/* ===========================================================
   NH Groupware 공통 스타일
   - PC(768px 이상): 좌측 고정 사이드바 + 상단바
   - 모바일(768px 미만): 상단바 + 하단 고정 탭바(사이드바 숨김)
   =========================================================== */

:root {
  --primary: #0056b3;
  --primary-dark: #003d82;
  --accent: #28a745;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --border: #e5e8ec;
  --text: #222;
  --text-muted: #888;
  --danger: #c0392b;
  --sidebar-w: 210px;
  --topbar-h: 56px;
  --bottomnav-h: 60px;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

/* ---------- 레이아웃 뼈대 ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* 좌측 사이드바 */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  bottom: 0;
  z-index: 1001;
  overflow-y: auto; /* 🔥 핵심: 화면이 작을 때 사이드바 전체가 스크롤 되도록 허용 */
}
.sidebar .brand {
  padding: 18px 16px;
  font-weight: 800;
  font-size: 17px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar .brand small { display: block; font-weight: 400; font-size: 11px; opacity: .7; margin-top: 2px; }
.sidebar nav { 
  padding: 8px 0; 
  /* 기존에 있던 flex: 1; 과 overflow-y: auto; 를 지워서 텅 빈 공백을 없앱니다 */
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  border-left: 3px solid transparent;
}
.sidebar .nav-item .ic { font-size: 17px; width: 20px; text-align: center; }
.sidebar .nav-item.active,
.sidebar .nav-item:hover {
  background: rgba(255,255,255,0.08);
  border-left-color: var(--accent);
  color: #fff;
}
.sidebar .user-box {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 12px;
  color: rgba(255,255,255,0.75);
}
.sidebar .user-box .logout-link { display: inline-block; margin-top: 6px; color: #ffb3b3; font-weight: 600; }

/* 본문 영역 */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 상단바 (모바일에서만 보임 / PC에선 페이지 타이틀바로 사용 가능) */
.topbar {
  height: var(--topbar-h);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 700; }
.topbar .topbar-right a { color: #fff; font-size: 13px; font-weight: 600; }
.topbar .hamburger { display: none; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; }

/* 컨텐츠 컨테이너 */
.container {
  max-width: 1600px; /* 🔥 기존 980px에서 약 160%인 1600px로 대폭 확대 */
  width: 100%;
  margin: 20px auto;
  padding: 0 16px 90px 16px; 
  flex: 1;
}

/* 카드 */
.card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  margin-bottom: 18px;
  border: 1px solid var(--border);
}
.card h3 {
  margin: 0 0 14px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #eee;
  color: #333;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* 폼 요소 */
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=file], input[type=number], textarea, select {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
}
label { font-size: 13px; color: #555; font-weight: 600; display: block; margin-bottom: 4px; }

button, .btn {
  display: inline-block;
  padding: 11px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
button.btn-block { width: 100%; }
button.btn-blue, .btn-blue { background: var(--primary); }
button.btn-danger, .btn-danger { background: var(--danger); }
button.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
button.btn-sm, .btn-sm { padding: 6px 10px; font-size: 12px; }

/* 테이블 - 모바일에서 가로 스크롤 */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13.5px; }
th, td { border: 1px solid var(--border); padding: 9px 10px; text-align: left; white-space: nowrap; }
th { background: #f8f9fa; }
td.wrap { white-space: normal; }

/* 알림 */
.alert { color: #155724; background: #d4edda; padding: 10px 14px; border-radius: 8px; margin-bottom: 15px; font-size: 14px; }
.error { color: #721c24; background: #f8d7da; padding: 10px 14px; border-radius: 8px; margin-bottom: 15px; font-size: 14px; }

/* 홈 대시보드 메뉴 그리드 */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.menu-card {
  background: var(--card-bg);
  padding: 20px 10px;
  border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  text-align: center;
  border: 1px solid var(--border);
}
.menu-card .menu-icon { font-size: 30px; margin-bottom: 8px; }
.menu-card .menu-title { font-weight: 700; font-size: 13.5px; }

/* ---------- 하단 탭바 (모바일 전용) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--bottomnav-h);
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 200;
}
.bottom-nav .bn-inner {
  display: flex;
  height: 100%;
  overflow-x: auto;
}
.bottom-nav .bn-item {
  flex: 1 0 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  color: #777;
}
.bottom-nav .bn-item .ic { font-size: 19px; }
.bottom-nav .bn-item.active { color: var(--primary); font-weight: 700; }

/* ===========================================================
   반응형 분기점
   =========================================================== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-area { margin-left: 0; }
  .topbar .hamburger { display: inline-block; }
  .bottom-nav { display: block; }
  .container { padding-bottom: calc(var(--bottomnav-h) + 20px); }
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
  table { font-size: 12px; }
  th, td { padding: 6px 7px; }
}

/* 사이드바를 모바일에서 슬라이드로 열 때 사용 (선택 기능) */
.sidebar.mobile-open {
  display: flex;
  width: 78vw;
  max-width: 280px;
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000;
}
.sidebar-backdrop.show { display: block; }

/* ===========================================================
   접속중 표시 점 (이모지 대체)
   =========================================================== */
.dot-online {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 0 2px rgba(46,204,113,0.25);
  flex-shrink: 0;
}

/* ===========================================================
   페이지 전환 스켈레톤 로더
   =========================================================== */
.skeleton-overlay {
  display: none;
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 999;
  overflow: hidden;
}
.skeleton-overlay.show { display: block; }
.skeleton-page {
  max-width: 980px;
  margin: 20px auto;
  padding: 0 16px 90px 16px;
}
.skeleton-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.skeleton-block {
  border-radius: 6px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #eceff2 25%, #f6f7f9 37%, #eceff2 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

