*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  display: flex;
  min-height: 100vh;
  font-family: 'Segoe UI', sans-serif;
  background: #f0f2f5;
  color: #333;
}

/* Sidebar */
.sidebar {
  width: 220px;
  background: #1a1f36;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.nav-menu {
  list-style: none;
  padding: 12px 0;
}

.nav-link {
  display: block;
  padding: 12px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* 사이드바 하단 사용자 영역 */
.sidebar-user {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user-name {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.6);
}

.btn-logout {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  border-radius: 6px;
  padding: 7px 0;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-logout:hover {
  background: rgba(255,100,100,0.25);
  border-color: rgba(255,100,100,0.4);
  color: #fff;
}

/* Main content */
.content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

/* Card */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

/* Table */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid #e8eaed;
}

th {
  background: #f7f8fa;
  font-weight: 600;
  color: #555;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* Button */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary  { background: #4f6ef7; color: #fff; }
.btn-secondary{ background: #e8eaed; color: #333; }
.btn:hover    { opacity: 0.85; }

/* Loading / message */
.loading { color: #888; font-size: 0.875rem; padding: 20px 0; }
.error   { color: #e53e3e; font-size: 0.875rem; }

/* ── 햄버거 버튼 (데스크톱에서 숨김) ───────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  margin-left: auto;
  margin-right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 2px;
  transition: all 0.2s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── 모바일 반응형 ─────────────────────────────── */
@media (max-width: 768px) {
  body { flex-direction: column; }

  /* 사이드바 → 상단 고정 헤더 */
  .sidebar {
    width: 100%;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 200;
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    padding: 0 8px 0 16px;
    height: 52px;
    border-bottom: none;
    flex-shrink: 0;
  }

  .logo { font-size: 1rem; }

  .hamburger { display: flex; }

  /* 네비 메뉴 — 기본 숨김, 열리면 세로 드롭다운 */
  .nav-menu {
    display: none;
    flex-direction: column;
    padding: 4px 0 8px;
    background: #1a1f36;
    border-top: 1px solid rgba(255,255,255,0.08);
    width: 100%;
  }
  .nav-menu.open { display: flex; }
  .nav-menu li { flex-shrink: 0; }
  .nav-link {
    padding: 13px 20px;
    font-size: 0.92rem;
    white-space: nowrap;
    border-left: 3px solid transparent;
  }
  .nav-link.active { border-left-color: #4f6ef7; }

  .sidebar-user { display: none; }

  /* 컨텐츠 영역 */
  .content { padding: 14px 10px; }
  .page-header { margin-bottom: 14px; }
  .page-header h2 { font-size: 1.1rem; }
  .card { padding: 14px 10px; margin-bottom: 14px; }

  /* 테이블 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 0.78rem; }
  th, td { padding: 8px 8px; }

  /* 버튼 터치 영역 */
  .btn { padding: 10px 16px; font-size: 0.88rem; }

  /* 폼 요소 — 모바일에서 세로 스택 + 전체폭 */
  .filter-row,
  .search-row,
  .form-row {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .filter-row > *,
  .search-row > *,
  .form-row > * {
    width: 100% !important;
    min-width: 0 !important;
  }
  input[type="text"],
  input[type="date"],
  input[type="number"],
  input[type="password"],
  select,
  .form-input,
  .form-select,
  .search-input {
    width: 100%;
    font-size: 1rem;     /* iOS 자동확대 방지 */
    padding: 10px 12px;
  }

  /* 모달 — 전체화면 */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: 16px 16px 0 0 !important;
    overflow-y: auto;
  }

  /* 페이지 헤더 flex wrap */
  .page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
}
