/* GTC 종합관리시스템 스타일 */

/*
  ── 라이트 모드 컬러 철학 ──
  배경:  #f0f4f8  (쿨 슬레이트 + 약간의 따뜻함)
  카드:  #ffffff  with border + shadow
  사이드바: #1e293b (항상 다크)
  텍스트 주: #1e293b
  텍스트 부: #64748b
  강조:  #3b82f6
  테두리: #e2e8f0
*/

/* ── hidden 유틸리티 (Tailwind CDN 보완) ── */
.hidden { display: none !important; }

/* ── Y25 vs Y26 비교 카드 (다크/라이트 대응) ── */
.year-compare-card { transition: background 0.3s, border-color 0.3s; }
.year-compare-card.y25-card {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}
.year-compare-card.y26-card {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.dark .year-compare-card.y25-card {
  background: #1e293b;
  border: 1px solid #334155;
}
.dark .year-compare-card.y26-card {
  background: #172554;
  border: 1px solid #1e40af;
}
/* 비교카드 내부 텍스트 */
.compare-label { color: #64748b; }
.compare-value { color: #1e293b; }
.dark .compare-label { color: #64748b; }
.dark .compare-value { color: #e2e8f0; }

/* ══════════════════════════════════════════════
   사이드바: 라이트/다크 모드 ALL 상황에서
   항상 다크 배경(#1e293b) → 텍스트는 밝은 색
   ══════════════════════════════════════════════ */

/* nav-item 기본 상태: 밝은 회색, 가독성 확보 */
.nav-item {
  color: #94a3b8;
  text-decoration: none;
  display: flex;
  align-items: center;
}
.nav-item span { color: inherit; }
.nav-item i { color: inherit; }

/* nav-item 호버 */
.nav-item:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
}

/* nav-item 활성화 */
.nav-item.active {
  color: #ffffff !important;
  background: rgba(59,130,246,0.18) !important;
}
.nav-item.active i { color: #60a5fa !important; }

/* 섹션 구분 라벨 - 사이드바는 항상 어두운 배경이므로 더 밝은 색으로 */
.sidebar-section-label { color: #94a3b8; letter-spacing: 0.08em; }

/* ══════════════════════════════════════════════
   CSS 변수: 테마별 텍스트/배경/테두리 색상
   ══════════════════════════════════════════════ */
:root {
  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-muted:     #475569;
  --border-color:   #f1f5f9;
  --bg-subtle:      #f8fafc;
}
html.dark {
  --text-primary:   #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted:     #94a3b8;
  --border-color:   #334155;
  --bg-subtle:      #253047;
}

/* 테이블 기본 텍스트 */
.data-table td { color: #1e293b; }
.data-table th { color: #475569; }
.dark .data-table td { color: #cbd5e1; }
.dark .data-table th { color: #94a3b8; }

/* KPI 카드 */
.kpi-card p { color: inherit; }

/* ── 라이트/다크 전역 ── */
body {
  background-color: #f0f4f8;
  color: #1e293b;
  transition: background-color 0.3s, color 0.3s;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
html.dark body {
  background-color: #0f172a;
  color: #e2e8f0;
  color-scheme: dark;
}
html.dark { color-scheme: dark; }

/* ── 로그인 화면 ── */
.login-screen-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 45%, #0d1f3c 100%);
  position: relative;
  overflow: hidden;
}
.login-screen-wrap.hidden { display: none !important; }

/* 로그인 배경 그라디언트 레이어 */
.login-screen-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(59,130,246,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 80%, rgba(99,102,241,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(14,165,233,0.05) 0%, transparent 60%);
  pointer-events: none;
}
/* 그리드 패턴 */
.login-screen-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* 플로팅 오브 - GPU 가속 최적화 */
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.12;
  pointer-events: none;
  will-change: transform;
  animation: orbFloat 10s ease-in-out infinite;
  transform: translateZ(0); /* GPU 레이어 강제 */
}
.login-orb-1 { width:260px;height:260px;background:radial-gradient(circle,#3b82f6,transparent);top:-60px;left:-60px;animation-delay:0s; }
.login-orb-2 { width:220px;height:220px;background:radial-gradient(circle,#6366f1,transparent);bottom:-50px;right:-50px;animation-delay:-5s; }
.login-orb-3 { width:160px;height:160px;background:radial-gradient(circle,#0ea5e9,transparent);top:50%;right:15%;animation-delay:-2.5s;opacity:0.07; }
@keyframes orbFloat {
  0%,100% { transform:translateY(0) translateZ(0); }
  50%      { transform:translateY(-16px) translateZ(0); }
}

/* 별 파티클 - 최소화 */
.login-star {
  position:absolute;width:2px;height:2px;background:white;border-radius:50%;
  opacity:0;pointer-events:none;will-change:opacity;
  animation:starTwinkle 4s ease-in-out infinite;
}
@keyframes starTwinkle {
  0%,100% { opacity:0; }
  50%      { opacity:0.4; }
}

/* 로그인 글래스 카드 */
.login-card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  will-change: auto; /* backdrop-filter 성능 보조 */
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06);
  position: relative;
  z-index: 1;
}

/* 로그인 입력 */
.login-input {
  width:100%;padding:0.75rem 1rem;border-radius:0.75rem;
  border:1px solid rgba(255,255,255,0.10);background:rgba(255,255,255,0.055);
  color:#f1f5f9;font-size:0.875rem;transition:all 0.2s;outline:none;
}
.login-input::placeholder { color:#4b5563; }
.login-input:focus {
  border-color:rgba(59,130,246,0.55);
  background:rgba(255,255,255,0.08);
  box-shadow:0 0 0 3px rgba(59,130,246,0.12);
}

/* 공지사항 아이템 (로그인) */
.login-notice-item {
  background:rgba(255,255,255,0.045);border:1px solid rgba(255,255,255,0.07);
  border-radius:0.75rem;padding:0.875rem 1rem;transition:background 0.2s;
}
.login-notice-item:hover { background:rgba(255,255,255,0.075); }

/* 아이콘 그룹 (로그인) */
.login-feature {
  background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);
  border-radius:0.75rem;padding:0.875rem;text-align:center;transition:all 0.2s;
}
.login-feature:hover { background:rgba(255,255,255,0.08);transform:translateY(-2px); }

/* 로그인 버튼 */
.login-btn-primary {
  width:100%;padding:0.875rem;
  background:linear-gradient(135deg,#3b82f6,#2563eb);
  color:white;font-weight:600;font-size:0.95rem;
  border-radius:0.75rem;border:none;cursor:pointer;
  transition:all 0.2s;box-shadow:0 4px 15px rgba(59,130,246,0.3);
}
.login-btn-primary:hover {
  background:linear-gradient(135deg,#2563eb,#1d4ed8);
  box-shadow:0 6px 20px rgba(59,130,246,0.4);transform:translateY(-1px);
}
.login-btn-primary:active { transform:translateY(0); }

/* 로그인 토글 버튼 */
.login-toggle-btn {
  display:inline-flex;align-items:center;gap:8px;
  padding:7px 14px;border-radius:8px;
  border:1px solid rgba(255,255,255,0.12);background:rgba(255,255,255,0.05);
  color:#94a3b8;font-size:12px;font-weight:500;cursor:pointer;transition:all 0.2s;
}
.login-toggle-btn:hover { background:rgba(255,255,255,0.09);color:#cbd5e1; }

/* ── 헤더 ── */
header {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #e8edf2;
  color: #1e293b;
  transition: background 0.3s, color 0.3s;
}
html.dark header {
  background: rgba(15,23,42,0.95) !important;
  border-bottom-color: #1e293b;
  color: #e2e8f0;
}

/* ── 메인 콘텐츠 ── */
#page-content { color: #1e293b; }
html.dark #page-content { color: #e2e8f0; }

/* ── 모달 ── */
#modal-content { background:#ffffff; color:#1e293b; }
html.dark #modal-content { background:#1e293b; color:#e2e8f0; }

/* ── 차트 컨테이너 ── */
.chart-container { background:transparent; position:relative; }
.chart-container canvas { max-height:300px; }

/* ── 스크롤바 ── */
.scrollbar-thin::-webkit-scrollbar { width:4px; }
.scrollbar-thin::-webkit-scrollbar-track { background:transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius:2px; }
.dark .scrollbar-thin::-webkit-scrollbar-thumb { background:#475569; }

/* ── 네비 활성 ── */
.nav-item.active { background:rgba(59,130,246,0.15); color:#60a5fa !important; }
.nav-item.active i { color:#60a5fa !important; }

/* ── 카드 ──
   라이트: 흰 배경 + 연한 테두리 + 아주 가벼운 그림자
   다크:   #1e293b 배경 + slate 테두리
*/
.card {
  background: #ffffff;
  border-radius: 1rem;
  border: 1px solid #e8edf2;
  box-shadow: 0 1px 3px rgba(30,41,59,0.04), 0 1px 2px rgba(30,41,59,0.03);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.dark .card { background:#1e293b; border-color:#334155; }
.card:hover { box-shadow:0 4px 12px rgba(30,41,59,0.07); border-color:#dde3ea; }
.dark .card:hover { box-shadow:0 4px 12px rgba(0,0,0,0.2); border-color:#3d5068; }

/* ── KPI 카드 ── */
.kpi-card {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.25rem;
  border: 1px solid #e8edf2;
  box-shadow: 0 1px 3px rgba(30,41,59,0.04);
  transition: box-shadow 0.2s;
}
.dark .kpi-card { background:#1e293b; border-color:#334155; }

/* ── 테이블 ── */
.data-table { width:100%; border-collapse:collapse; }
.data-table th {
  padding:0.7rem 1rem;
  text-align:left;font-size:0.72rem;font-weight:600;
  color:#64748b;text-transform:uppercase;letter-spacing:0.06em;
  background:#f8fafc;border-bottom:1px solid #e8edf2;
}
.dark .data-table th { background:#253348; color:#94a3b8; border-color:#334155; }
.data-table td {
  padding:0.75rem 1rem;font-size:0.875rem;
  color:#334155;border-bottom:1px solid #f1f5f9;
}
.dark .data-table td { color:#cbd5e1; border-color:#334155; }
.data-table tr:hover td { background:#f8fafc; }
.dark .data-table tr:hover td { background:rgba(51,65,85,0.35); }

/* ── 배지 ── */
.badge {
  display:inline-flex;align-items:center;
  padding:0.2rem 0.6rem;border-radius:9999px;
  font-size:0.72rem;font-weight:600;
}
.badge-blue   { background:#dbeafe; color:#1d4ed8; }
.badge-green  { background:#dcfce7; color:#15803d; }
.badge-yellow { background:#fef9c3; color:#a16207; }
.badge-red    { background:#fee2e2; color:#b91c1c; }
.badge-purple { background:#f3e8ff; color:#7e22ce; }
.badge-gray   { background:#f1f5f9; color:#475569; }
.badge-indigo { background:#e0e7ff; color:#3730a3; }
.badge-orange { background:#fff7ed; color:#c2410c; }
.dark .badge-blue   { background:#1e3a5f; color:#93c5fd; }
.dark .badge-green  { background:#14532d; color:#86efac; }
.dark .badge-yellow { background:#713f12; color:#fde047; }
.dark .badge-red    { background:#7f1d1d; color:#fca5a5; }
.dark .badge-purple { background:#4c1d95; color:#d8b4fe; }
.dark .badge-gray   { background:#334155; color:#94a3b8; }
.dark .badge-indigo { background:#312e81; color:#a5b4fc; }
.dark .badge-orange { background:#431407; color:#fdba74; }

/* ── 버튼 ── */
.btn {
  display:inline-flex;align-items:center;gap:0.375rem;
  padding:0.5rem 1rem;border-radius:0.625rem;
  font-size:0.875rem;font-weight:500;
  transition:all 0.15s;cursor:pointer;border:none;
}
.btn-primary   { background:#3b82f6; color:white; }
.btn-primary:hover   { background:#2563eb; box-shadow:0 3px 8px rgba(59,130,246,0.3); }
.btn-success   { background:#22c55e; color:white; }
.btn-success:hover   { background:#16a34a; }
.btn-danger    { background:#ef4444; color:white; }
.btn-danger:hover    { background:#dc2626; }
.btn-warning   { background:#f59e0b; color:white; }
.btn-warning:hover   { background:#d97706; }
.btn-secondary { background:#f1f5f9; color:#475569; border:1px solid #e2e8f0; }
.btn-secondary:hover { background:#e8edf2; }
.dark .btn-secondary { background:#334155; color:#cbd5e1; border-color:#475569; }
.dark .btn-secondary:hover { background:#475569; }
.btn-outline   { background:transparent; color:#3b82f6; border:1.5px solid #3b82f6; }
.btn-outline:hover   { background:#eff6ff; }
.dark .btn-outline   { color:#60a5fa; border-color:#60a5fa; }
.dark .btn-outline:hover { background:#1e3a5f; }
.btn-sm  { padding:0.35rem 0.75rem; font-size:0.8rem; border-radius:0.5rem; }
.btn-xs  { padding:0.2rem 0.5rem;  font-size:0.72rem; border-radius:0.375rem; }

/* ── 입력 필드 ── */
.form-input {
  width:100%;padding:0.625rem 0.875rem;
  border-radius:0.625rem;border:1.5px solid #e2e8f0;
  background:#ffffff;color:#1e293b;font-size:0.875rem;
  transition:all 0.15s;outline:none;
}
.dark .form-input { background:#253348; border-color:#334155; color:#f1f5f9; }
.form-input:focus { border-color:#3b82f6; box-shadow:0 0 0 3px rgba(59,130,246,0.1); }
.form-label { display:block;font-size:0.78rem;font-weight:500;color:#475569;margin-bottom:0.35rem; }
.dark .form-label { color:#94a3b8; }
.form-select {
  appearance:none;
  background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position:right 0.5rem center;background-repeat:no-repeat;
  background-size:1.5em 1.5em;padding-right:2.5rem;
}

/* ── 탭 ── */
.tab-btn {
  padding:0.5rem 1.25rem;font-size:0.875rem;font-weight:600;
  color:#334155;border-bottom:2px solid transparent;
  transition:all 0.15s;white-space:nowrap;cursor:pointer;background:none;
}
.tab-btn:hover { color:#0f172a; }
.tab-btn.active { color:#3b82f6; border-bottom-color:#3b82f6; font-weight:700; }
/* 라이트모드 – 탭 컨테이너(흰 배경)에서 텍스트 진하게 */
.bg-white .tab-btn, [style*="background:#fff"] .tab-btn { color:#1e293b; }
.dark .tab-btn { color:#94a3b8; }
.dark .tab-btn:hover { color:#e2e8f0; }
.dark .tab-btn.active { color:#60a5fa; border-bottom-color:#60a5fa; }

/* ── 빈 상태 ── */
.empty-state { text-align:center; padding:3rem 1rem; color:#94a3b8; }
.empty-state i { font-size:3rem; margin-bottom:1rem; opacity:0.35; }
.empty-state p { font-size:0.875rem; }

/* ── Toast ── */
.toast {
  padding:0.875rem 1.25rem;border-radius:0.75rem;
  box-shadow:0 4px 16px rgba(15,23,42,0.18);
  font-size:0.875rem;display:flex;align-items:center;gap:0.5rem;
  animation:slideIn 0.3s ease;max-width:360px;
}
@keyframes slideIn { from{transform:translateX(100%);opacity:0;} to{transform:translateX(0);opacity:1;} }
.toast-success { background:#22c55e; color:white; }
.toast-error   { background:#ef4444; color:white; }
.toast-info    { background:#3b82f6; color:white; }
.toast-warning { background:#f59e0b; color:white; }

/* ── 모바일 사이드바 ── */
/* ══════════════════════════════════════════════════
   반응형 레이아웃 (모바일 우선)
   ══════════════════════════════════════════════════ */

/* 태블릿 이하: 사이드바 슬라이드 */
@media (max-width:1023px) {
  #sidebar { transform:translateX(-100%); transition:transform 0.28s ease; }
  #sidebar.open { transform:translateX(0); box-shadow:4px 0 24px rgba(0,0,0,0.35); }
  #main-content-wrapper { margin-left:0 !important; }
  #hamburger-btn { display:inline-flex !important; }
  #sidebar-overlay.open { display:block !important; }
}

/* 데스크탑: 사이드바 항상 표시 */
@media (min-width:1024px) {
  #main-content-wrapper { margin-left:256px !important; }
  #hamburger-btn { display:none !important; }
  #sidebar-overlay { display:none !important; }
}

/* 모바일 (640px 이하) 핵심 레이아웃 */
@media (max-width:640px) {
  /* 헤더 높이/패딩 */
  #main-header { height:52px !important; padding:0 0.75rem !important; }
  /* 페이지 콘텐츠 패딩 축소 */
  #page-content { padding:0.75rem !important; }
  /* 페이지 제목 */
  #page-title { font-size:1rem !important; }

  /* KPI 그리드: 모바일 2열 */
  .kpi-grid { grid-template-columns:repeat(2,1fr) !important; gap:0.5rem !important; }
  .kpi-card  { padding:0.875rem !important; }
  .kpi-value { font-size:1.35rem !important; }
  .kpi-label { font-size:0.7rem !important; }

  /* 차트 그리드: 1열 */
  .chart-grid { grid-template-columns:1fr !important; }

  /* 일반 카드 패딩 */
  .card { padding:0.875rem !important; border-radius:0.875rem !important; }

  /* 섹션 타이틀 */
  .section-title { font-size:0.9rem !important; }

  /* 테이블: 가로 스크롤 보장 */
  .table-container { border-radius:0.625rem; }
  .data-table th, .data-table td { font-size:0.75rem !important; padding:0.5rem 0.625rem !important; white-space:nowrap; }

  /* 탭 버튼 */
  .tab-btn { font-size:0.75rem !important; padding:0.5rem 0.75rem !important; }

  /* 폼 인풋 */
  .form-input  { font-size:0.875rem !important; padding:0.5rem 0.75rem !important; }
  .form-label  { font-size:0.8rem !important; }

  /* 버튼 */
  .btn        { font-size:0.8rem !important; padding:0.45rem 0.875rem !important; }
  .btn-xs     { font-size:0.7rem !important; padding:0.3rem 0.5rem !important; }

  /* 모달 */
  #modal-content  { border-radius:1rem !important; max-height:92vh !important; }
  .modal-header   { padding:1rem 1rem 0.75rem !important; }
  .modal-body     { padding:0.875rem 1rem !important; }
  .modal-footer   { padding:0.75rem 1rem !important; }

  /* 탭바 */
  #repair-tab-bar, #cost-tab-bar, #board-tab-bar {
    overflow-x:auto; white-space:nowrap;
    scrollbar-width:none; -ms-overflow-style:none;
    padding:0.375rem !important;
    gap:0.25rem !important;
    flex-wrap:nowrap !important;
  }
  #repair-tab-bar::-webkit-scrollbar,
  #cost-tab-bar::-webkit-scrollbar,
  #board-tab-bar::-webkit-scrollbar { display:none; }

  /* 그리드 유틸리티 */
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns:1fr !important; }

  /* 헤더 사용자명 숨기기 (작은 화면) */
  #header-user-info span { display:none; }

  /* 달력 셀 최소높이 축소 */
  .calendar-day { min-height:52px !important; font-size:0.75rem; }

  /* 조직도 노드 */
  .org-node { min-width:120px !important; }

  /* 배지 */
  .badge { font-size:0.65rem !important; padding:2px 6px !important; }
}

/* 반응형 그리드 (1024px 이하) */
@media (max-width:1024px) {
  .grid-4,.grid-5 { grid-template-columns:repeat(2,1fr); }
  .grid-3         { grid-template-columns:repeat(2,1fr); }
  .kpi-grid       { grid-template-columns:repeat(3,1fr); }
}

/* ── 로딩 스피너 ── */
.spinner {
  width:2rem;height:2rem;
  border:3px solid #e2e8f0;border-top-color:#3b82f6;
  border-radius:50%;animation:spin 0.8s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg);} }
.page-loading { display:flex;align-items:center;justify-content:center;min-height:300px; }

/* ── 통계 바 ── */
.stat-bar { height:6px;background:#e8edf2;border-radius:3px;overflow:hidden; }
.dark .stat-bar { background:#334155; }
.stat-bar-fill { height:100%;border-radius:3px;transition:width 0.5s ease; }

/* ── 캘린더 ── */
.calendar-grid { display:grid;grid-template-columns:repeat(7,1fr);gap:2px; }
.calendar-day { min-height:80px;border-radius:8px;padding:6px;background:#ffffff;border:1px solid #e8edf2; }
.dark .calendar-day { background:#1e293b;border-color:#334155; }
.calendar-day.today { border-color:#3b82f6;background:#eff6ff; }
.dark .calendar-day.today { background:#1e3a5f;border-color:#3b82f6; }
.calendar-day.other-month { opacity:0.4; }

/* ── 모달 ── */
.modal-header { padding:1.5rem 1.5rem 0;display:flex;align-items:center;justify-content:space-between; }
.modal-body   { padding:1.5rem; }
.modal-footer {
  padding:1rem 1.5rem;border-top:1px solid #e8edf2;
  display:flex;justify-content:flex-end;gap:0.75rem;
}
.dark .modal-footer { border-top-color:#334155; }

/* ── 테마 토글 ── */
.theme-toggle-btn {
  display:inline-flex;align-items:center;gap:0.5rem;
  cursor:pointer;user-select:none;transition:opacity 0.15s;
}
.theme-toggle-btn:active { opacity:0.8; }
.toggle-track {
  width:2.25rem;height:1.25rem;border-radius:9999px;background:#cbd5e1;
  position:relative;transition:background-color 0.2s;flex-shrink:0;
}
html.dark .toggle-track { background:#6366f1; }
.toggle-thumb {
  position:absolute;top:0.125rem;left:0.125rem;
  width:1rem;height:1rem;background:white;border-radius:50%;
  box-shadow:0 1px 3px rgba(0,0,0,0.25);transition:transform 0.2s;
}
html.dark .toggle-thumb { transform:translateX(1rem); }

/* ── 조직도 ── */
.org-node {
  display:inline-flex;flex-direction:column;align-items:center;gap:0.5rem;
  padding:1rem;background:#ffffff;border-radius:1rem;
  box-shadow:0 2px 8px rgba(30,41,59,0.08);min-width:120px;text-align:center;
  border:2px solid #e8edf2;transition:all 0.25s cubic-bezier(0.34,1.56,0.64,1);
  cursor:pointer;
}
.dark .org-node { background:#1e293b;border-color:#334155; }
.org-node:hover {
  border-color:#3b82f6;
  transform:translateY(-4px) scale(1.05);
  box-shadow:0 12px 28px rgba(59,130,246,0.22);
  z-index:10;position:relative;
}
.org-node.leader { border-color:#3b82f6;background:#eff6ff; }
.dark .org-node.leader { background:#1e3a5f;border-color:#3b82f6; }

/* 조직도 프로필 이미지 hover 확대 */
.org-node .w-14, .org-node [class*="w-14"] {
  transition:transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s ease;
}
.org-node:hover .w-14, .org-node:hover [class*="w-14"] {
  transform:scale(1.18);
  box-shadow:0 6px 18px rgba(59,130,246,0.35);
}
/* 아바타(이니셜) 확대 */
.org-node > div:first-child {
  transition:transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.org-node:hover > div:first-child {
  transform:scale(1.15);
}

/* ── 유틸리티 ── */
.number-format { font-variant-numeric:tabular-nums; }
.filter-bar { display:flex;flex-wrap:wrap;gap:0.75rem;align-items:center; }

/* ── 드라이브 배지 ── */
.drive-badge { padding:0.2rem 0.6rem;border-radius:9999px;font-size:0.7rem;font-weight:600; }
.drive-badge.구동     { background:#fee2e2;color:#991b1b; }
.drive-badge.비구동   { background:#dbeafe;color:#1e40af; }
.drive-badge.일반업무 { background:#d1fae5;color:#065f46; }
.dark .drive-badge.구동     { background:#7f1d1d;color:#fca5a5; }
.dark .drive-badge.비구동   { background:#1e3a5f;color:#93c5fd; }
.dark .drive-badge.일반업무 { background:#064e3b;color:#6ee7b7; }

/* ── 섹션 헤더 ── */
.section-header { display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem; }
.section-title { font-size:1rem;font-weight:600;color:#1e293b;display:flex;align-items:center;gap:0.5rem; }
.dark .section-title { color:#f1f5f9; }

/* ── 그리드 ── */
.grid-2 { display:grid;grid-template-columns:repeat(2,1fr);gap:1rem; }
.grid-3 { display:grid;grid-template-columns:repeat(3,1fr);gap:1rem; }
.grid-4 { display:grid;grid-template-columns:repeat(4,1fr);gap:1rem; }
.grid-5 { display:grid;grid-template-columns:repeat(5,1fr);gap:1rem; }
/* grid 반응형: 상단 @media 블록에서 처리 */

/* ── 테이블 컨테이너 ── */
.table-container { overflow-x:auto;border-radius:0.75rem;border:1px solid #e8edf2; }
.dark .table-container { border-color:#334155; }

/* ── 상태 ── */
.status-dot { width:8px;height:8px;border-radius:50%;display:inline-block; }
.status-dot.active   { background:#22c55e; }
.status-dot.inactive { background:#ef4444; }

/* ── 스켈레톤 ── */
.skeleton {
  animation:skeletonPulse 1.5s ease-in-out infinite;
  background:linear-gradient(90deg,#f1f5f9 0%,#e8edf2 50%,#f1f5f9 100%);
  background-size:200%;border-radius:4px;
}
.dark .skeleton {
  background:linear-gradient(90deg,#253348 0%,#334155 50%,#253348 100%);
  background-size:200%;
}
@keyframes skeletonPulse { 0%{background-position:0%;} 100%{background-position:200%;} }

/* ── KPI 값 ── */
.kpi-value { font-size:1.75rem;font-weight:800;line-height:1; }
.kpi-label { font-size:0.75rem;color:#64748b;margin-top:0.25rem; }
.dark .kpi-label { color:#94a3b8; }

/* ── 게시판 ── */
.post-item { padding:1rem;border-bottom:1px solid #f1f5f9;transition:background 0.15s;cursor:pointer; }
.dark .post-item { border-color:#334155; }
.post-item:hover { background:#f8fafc; }
.dark .post-item:hover { background:rgba(51,65,85,0.35); }
.post-item:last-child { border-bottom:none; }

/* ── 섹션 구분선 ── */
.section-divider { border:none;border-top:1px solid #e8edf2;margin:1.5rem 0; }
.dark .section-divider { border-top-color:#334155; }

/* ── 인포 박스 ── */
.info-box {
  background:#eff6ff;border:1px solid #bfdbfe;border-radius:0.75rem;
  padding:0.875rem 1rem;color:#1e40af;font-size:0.875rem;
}
.dark .info-box { background:#1e3a5f;border-color:#1e40af;color:#93c5fd; }
.warning-box {
  background:#fffbeb;border:1px solid #fde68a;border-radius:0.75rem;
  padding:0.875rem 1rem;color:#92400e;font-size:0.875rem;
}
.dark .warning-box { background:#451a03;border-color:#92400e;color:#fde68a; }

/* ── 로그인 화면 추가 애니메이션 ── */
@keyframes statusPulse {
  0%,100% { box-shadow:0 0 0 0 rgba(34,197,94,0.4); }
  50%      { box-shadow:0 0 0 4px rgba(34,197,94,0); }
}

/* 모바일 로그인 */
@media (max-width:640px) {
  .login-card { border-radius:1rem; }
}

/* ══════════════════════════════════════════════
   라이트모드 텍스트 가독성 강화
   핵심 원칙:
     1) #page-content / #modal-content 안에서만 텍스트를 진하게
     2) #sidebar, .modal-dark-bg, [어두운 배경] 안에서는 절대 어두운 색 적용 X
        → 어두운 배경 영역은 CSS .nav-item 등 별도 규칙으로 처리
   ══════════════════════════════════════════════ */

/* ── 라이트모드: 페이지 콘텐츠 / 모달 안 gray 텍스트만 진하게 ── */
html:not(.dark) #page-content .text-gray-400 { color: #64748b !important; }
html:not(.dark) #page-content .text-gray-500 { color: #475569 !important; }
html:not(.dark) #page-content .text-gray-600 { color: #334155 !important; }
html:not(.dark) #page-content .text-gray-700 { color: #1e293b !important; }
html:not(.dark) #modal-content .text-gray-400 { color: #64748b !important; }
html:not(.dark) #modal-content .text-gray-500 { color: #475569 !important; }
html:not(.dark) #modal-content .text-gray-600 { color: #334155 !important; }
html:not(.dark) #modal-content .text-gray-700 { color: #1e293b !important; }

/* 테이블 (페이지 내부만) */
html:not(.dark) #page-content .data-table td { color: #0f172a; }
html:not(.dark) #page-content .data-table th { color: #334155; }
html:not(.dark) #modal-content .data-table td { color: #0f172a; }
html:not(.dark) #modal-content .data-table th { color: #334155; }

/* 카드 내 텍스트: 페이지/모달 내부만 */
html:not(.dark) #page-content .card   { color: #0f172a; }
html:not(.dark) #page-content .kpi-card { color: #0f172a; }
html:not(.dark) #modal-content .card  { color: #0f172a; }

/* 섹션 제목: 페이지/모달 내부만 */
html:not(.dark) #page-content .section-title { color: #0f172a; }
html:not(.dark) #modal-content .section-title { color: #0f172a; }

/* form label: 페이지/모달 내부만 */
html:not(.dark) #page-content .form-label  { color: #334155; }
html:not(.dark) #modal-content .form-label { color: #334155; }

/* font-weight 기반 텍스트: 페이지/모달 내부만 */
html:not(.dark) #page-content .font-medium   { color: #0f172a; }
html:not(.dark) #page-content .font-semibold  { color: #0f172a; }
html:not(.dark) #page-content .font-bold      { color: #0f172a; }
html:not(.dark) #modal-content .font-medium   { color: #0f172a; }
html:not(.dark) #modal-content .font-semibold { color: #0f172a; }
html:not(.dark) #modal-content .font-bold     { color: #0f172a; }

/* text-sm / text-xs: 페이지/모달 내부만 */
html:not(.dark) #page-content .text-sm  { color: #1e293b; }
html:not(.dark) #modal-content .text-sm { color: #1e293b; }
html:not(.dark) #page-content p.text-xs,
html:not(.dark) #page-content span.text-xs   { color: #475569; }
html:not(.dark) #modal-content p.text-xs,
html:not(.dark) #modal-content span.text-xs  { color: #475569; }
/* 어두운 배경(bg-blue-600, bg-green-600 등) 위의 text-sm은 흰색으로 덮어쓰기 */
html:not(.dark) #page-content .bg-blue-600 .text-sm,
html:not(.dark) #page-content .bg-blue-700 .text-sm,
html:not(.dark) #page-content .bg-green-600 .text-sm,
html:not(.dark) #page-content .bg-red-600 .text-sm,
html:not(.dark) #modal-content .bg-blue-600 .text-sm,
html:not(.dark) #modal-content .bg-green-600 .text-sm { color: #ffffff !important; }

/* ── 예외: 컬러 유틸리티·뱃지는 그대로 ── */
html:not(.dark) .text-blue-500,
html:not(.dark) .text-blue-600,
html:not(.dark) .text-green-600,
html:not(.dark) .text-green-500,
html:not(.dark) .text-red-500,
html:not(.dark) .text-red-600,
html:not(.dark) .text-orange-500,
html:not(.dark) .text-purple-500,
html:not(.dark) .text-indigo-500,
html:not(.dark) .text-yellow-500,
html:not(.dark) .text-yellow-600 { color: inherit !important; }

html:not(.dark) .badge       { color: inherit !important; }
html:not(.dark) .drive-badge { color: inherit !important; }

/* ══════════════════════════════════════════════
   다크모드: Tailwind CDN dark: 클래스 미동작 보완
   CDN Tailwind은 dark: prefix를 처리하지 못하므로
   html.dark 하위에서 모든 gray/text 클래스를 명시적으로 재정의
   ══════════════════════════════════════════════ */

/* 텍스트 그레이 클래스: 다크모드에서 밝게 */
html.dark .text-gray-900 { color: #f1f5f9 !important; }
html.dark .text-gray-800 { color: #f1f5f9 !important; }
html.dark .text-gray-700 { color: #e2e8f0 !important; }
html.dark .text-gray-600 { color: #cbd5e1 !important; }
html.dark .text-gray-500 { color: #94a3b8 !important; }
html.dark .text-gray-400 { color: #94a3b8 !important; }
html.dark .text-gray-300 { color: #94a3b8 !important; }

/* 다크 배경 안 텍스트 */
html.dark .bg-gray-700 { color: #e2e8f0; }
html.dark .bg-gray-800 { color: #e2e8f0; }
html.dark .bg-gray-900 { color: #e2e8f0; }

/* bg-white는 다크모드에서 카드 배경으로 쓰이지만 JS가 제어하므로 OK */

/* 다크모드: 인라인 스타일 없는 일반 텍스트도 밝게 */
html.dark .font-medium    { color: inherit; }
html.dark .font-semibold  { color: inherit; }
html.dark .font-bold      { color: inherit; }

/* ══════════════════════════════════════════════
   라이트모드: 어두운 배경 위 텍스트 항상 밝은색
   사이드바(#1e293b), 어두운 버튼 배경(bg-blue-600, bg-slate-700 등)
   ══════════════════════════════════════════════ */

/* 사이드바 내 모든 텍스트는 항상 밝은 색 (라이트/다크 모두) */
#sidebar { color: #94a3b8; }
#sidebar .sidebar-section-label { color: #94a3b8; }
#sidebar p, #sidebar span, #sidebar a { color: inherit; }

/* bg-blue-600 어두운 버튼 위 텍스트 강제 흰색 */
html:not(.dark) .bg-blue-600 { color: #ffffff !important; }
html:not(.dark) .bg-blue-600 * { color: #ffffff !important; }
html:not(.dark) .bg-blue-700 { color: #ffffff !important; }
html:not(.dark) .bg-indigo-600 { color: #ffffff !important; }
html:not(.dark) .bg-red-600 { color: #ffffff !important; }
html:not(.dark) .bg-green-600 { color: #ffffff !important; }
html:not(.dark) .bg-slate-700 { color: #ffffff !important; }
html:not(.dark) .bg-slate-800 { color: #e2e8f0 !important; }
html:not(.dark) .bg-gray-800 { color: #e2e8f0 !important; }
html:not(.dark) .bg-gray-900 { color: #e2e8f0 !important; }

/* text-white는 항상 흰색 */
.text-white { color: #ffffff !important; }

/* ══════════════════════════════════════════════════
   라이트모드 텍스트 가시성 보완
   (Tailwind CDN은 dark: prefix 미지원 → 명시적 규칙으로 대체)
   ══════════════════════════════════════════════════ */

/* 게시판 - 제목·본문·메타 텍스트 */
html:not(.dark) #board-content .post-item p.font-medium { color: #0f172a !important; }
html:not(.dark) #board-content .text-gray-900 { color: #0f172a !important; }
html:not(.dark) #board-content .text-gray-700 { color: #334155 !important; }
html:not(.dark) #board-content .text-gray-300 { color: #475569 !important; }
html:not(.dark) #board-content .text-gray-200 { color: #334155 !important; }
html:not(.dark) #board-content .border-gray-700 { border-color: #e2e8f0 !important; }
html:not(.dark) #board-content .border-gray-100 { border-color: #f1f5f9 !important; }
html:not(.dark) #board-content .card { background: #ffffff !important; color: #0f172a !important; }
html:not(.dark) #board-content .font-semibold { color: #1e293b !important; }

/* 게시판 모달 */
html:not(.dark) #modal-content .text-gray-900 { color: #0f172a !important; }
html:not(.dark) #modal-content .text-gray-800 { color: #1e293b !important; }
html:not(.dark) #modal-content .text-gray-700 { color: #334155 !important; }
html:not(.dark) #modal-content .text-gray-200 { color: #334155 !important; }
html:not(.dark) #modal-content .border-gray-700 { border-color: #e2e8f0 !important; }
html:not(.dark) #modal-content .bg-gray-700 { background: #f1f5f9 !important; color: #1e293b !important; }
html:not(.dark) #modal-content .bg-gray-800 { background: #f8fafc !important; color: #0f172a !important; }

/* 비용정리 - 텍스트 */
html:not(.dark) #page-content .text-gray-900 { color: #0f172a !important; }
html:not(.dark) #page-content .text-gray-800 { color: #1e293b !important; }
html:not(.dark) #page-content .text-gray-700 { color: #334155 !important; }
html:not(.dark) #page-content .text-gray-300 { color: #475569 !important; }
html:not(.dark) #page-content .text-gray-200 { color: #334155 !important; }
html:not(.dark) #page-content .border-gray-700 { border-color: #e2e8f0 !important; }
html:not(.dark) #page-content .border-gray-600 { border-color: #e2e8f0 !important; }

/* 조직도 - 멤버명·직급·전화번호 텍스트 */
html:not(.dark) .org-node p { color: #1e293b !important; }
html:not(.dark) .org-node .text-gray-500 { color: #64748b !important; }

/* 주간업무 / 수리이력 기타 텍스트 */
html:not(.dark) #page-content .text-gray-200 { color: #334155 !important; }

/* ══════════════════════════════════════════════════
   메인 앱 배경 레이어 - 로그인 전용이므로 메인앱에서 숨김
   ══════════════════════════════════════════════════ */
#main-bg-layer { display: none !important; }
