/* ===================================================
   HEALTH GUARDIAN — Global Design System
   Colors: #004680 (Deep Blue), #DDCA4B (Gold), #FFFFFF
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@300;400;500;600;700;800&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #004680;
  --primary-light: #005fa8;
  --primary-dark: #003360;
  --gold: #DDCA4B;
  --gold-light: #f0e27a;
  --gold-dark: #b8a530;
  --white: #FFFFFF;
  --bg: #f0f4f8;
  --surface: #FFFFFF;
  --surface-2: #f7f9fc;
  --border: #e0e8f0;
  --text: #1a2a3a;
  --text-secondary: #5a7a9a;
  --text-muted: #8faabf;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-sm: 0 2px 8px rgba(0,70,128,0.08);
  --shadow-md: 0 4px 20px rgba(0,70,128,0.12);
  --shadow-lg: 0 8px 40px rgba(0,70,128,0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --nav-height: 68px;
  --sidebar-width: 240px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Pretendard', 'Outfit', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== TYPOGRAPHY ===== */
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-gold { color: var(--gold-dark); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--nav-height);
}

.page-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ===== TOP NAV ===== */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 5000;
  box-shadow: 0 2px 16px rgba(0,0,0,0.18);
  overflow: visible;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
}

.nav-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--gold);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nav-brand-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--white);
  letter-spacing: -0.03em;
  white-space: nowrap;
}

/* ===== ADMIN FILTER BAR ===== */
.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-select {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.filter-select:hover {
  border-color: var(--primary);
}

.nav-brand-name span {
  color: var(--gold);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,0.12);
  color: var(--white);
}

.nav-links a.active {
  background: var(--gold);
  color: var(--primary-dark);
  font-weight: 700;
}

.nav-links a .nav-icon {
  font-size: 1rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
}

.nav-avatar {
  width: 36px;
  height: 36px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary-dark);
  flex-shrink: 0;
}

.nav-username {
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── 프로필 드롭다운 ── */
.nav-profile {
  position: relative;
}

.nav-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 100px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  color: var(--white);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.nav-profile-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.nav-profile-btn .profile-caret {
  font-size: 0.55rem;
  opacity: 0.7;
  transition: transform 0.2s;
  margin-left: 2px;
}

.nav-profile.open .profile-caret {
  transform: rotate(180deg);
}

/* 드롭다운 패널 */
.nav-profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.nav-profile.open .nav-profile-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 드롭다운 헤더 (유저 정보) */
.dropdown-user-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.dropdown-user-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
}

.dropdown-user-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 드롭다운 아이템 */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.14s;
}

.dropdown-item:hover {
  background: var(--surface-2);
}

.dropdown-item .di-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.dropdown-item.admin-item {
  color: var(--gold-dark);
}
.dropdown-item.admin-item .di-icon {
  background: rgba(221, 202, 75, 0.15);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.dropdown-item.logout-item {
  color: var(--text-secondary);
}
.dropdown-item.logout-item .di-icon {
  background: var(--surface-2);
}

.dropdown-item.danger-item {
  color: #dc2626;
}
.dropdown-item.danger-item .di-icon {
  background: rgba(239, 68, 68, 0.1);
}

.dropdown-item.danger-item:hover {
  background: rgba(239, 68, 68, 0.06);
}

/* btn-logout — 관리자 페이지 전용 유지 */
.btn-logout {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--white);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}

.btn-logout:hover {
  background: rgba(255,255,255,0.22);
}


/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.22s cubic-bezier(0.4,0,0.2,1), color 0.22s cubic-bezier(0.4,0,0.2,1), border-color 0.22s cubic-bezier(0.4,0,0.2,1), transform 0.22s cubic-bezier(0.4,0,0.2,1), box-shadow 0.22s cubic-bezier(0.4,0,0.2,1);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(0,70,128,0.25);
}

.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: 0 6px 20px rgba(0,70,128,0.35);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-gold {
  background: var(--gold);
  color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(221,202,75,0.3);
}

.btn-gold:hover {
  background: var(--gold-light);
  box-shadow: 0 6px 20px rgba(221,202,75,0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 15px 36px;
  font-size: 1.05rem;
}

.btn-block { width: 100%; }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 20px 24px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.card-icon-blue { background: rgba(0,70,128,0.1); color: var(--primary); }
.card-icon-gold { background: rgba(221,202,75,0.2); color: var(--gold-dark); }
.card-icon-green { background: rgba(34,197,94,0.1); color: var(--success); }
.card-icon-red { background: rgba(239,68,68,0.1); color: var(--danger); }

/* ===== STAT CARDS ===== */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow 0.25s, transform 0.25s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--primary);
}

.stat-card.gold::before { background: var(--gold); }
.stat-card.green::before { background: var(--success); }
.stat-card.red::before { background: var(--danger); }

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-unit {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 4px;
}

.stat-card-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.stat-card-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  opacity: 0.1;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.03em;
}

.form-label .required {
  color: var(--danger);
  margin-left: 3px;
}

.form-label .unit {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,70,128,0.08);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .form-control {
  padding-left: 42px;
}

.input-icon-wrap .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

/* ===== STAR RATING ===== */
.star-rating {
  display: flex;
  gap: 6px;
  align-items: center;
}

.star-rating input[type="radio"] {
  display: none;
}

.star-rating label {
  font-size: 1.8rem;
  cursor: pointer;
  color: #dde4ec;
  transition: color 0.15s, transform 0.15s;
  line-height: 1;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
  color: var(--gold);
}

.star-rating input:checked + label,
.star-rating label:hover {
  transform: scale(1.2);
}

/* Star rating reverse trick */
.star-rating {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.star-rating label:hover,
.star-rating label:hover ~ label {
  color: var(--gold);
}

.star-rating input:checked ~ label {
  color: var(--gold);
}

/* ===== PROGRESS BAR ===== */
.progress-wrap {
  background: var(--border);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.progress-bar.gold {
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
}

.progress-bar.green {
  background: linear-gradient(90deg, #16a34a, var(--success));
}

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-blue { background: rgba(0,70,128,0.1); color: var(--primary); }
.badge-gold { background: rgba(221,202,75,0.25); color: var(--gold-dark); }
.badge-green { background: rgba(34,197,94,0.1); color: #16a34a; }
.badge-red { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge-gray { background: var(--border); color: var(--text-muted); }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header h1 .page-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--white);
  box-shadow: 0 4px 12px rgba(0,70,128,0.25);
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
  margin-left: 52px;
}

/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 8px;
}

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ===== ALERT ===== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  color: #15803d;
}

.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #b91c1c;
}

.alert-info {
  background: rgba(0,70,128,0.07);
  border: 1px solid rgba(0,70,128,0.15);
  color: var(--primary);
}

/* ===== STREAK BADGE ===== */
.streak-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  padding: 10px 18px;
  border-radius: var(--radius-md);
}

.streak-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold);
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--text);
  color: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 240px;
  animation: slideInToast 0.3s cubic-bezier(0.4,0,0.2,1);
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }

@keyframes slideInToast {
  from { transform: translateX(110%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOutToast {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(110%); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c0cfd8; border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #9ab0c0; }

/* ===== UTILITY ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.relative { position: relative; }
.cursor-pointer { cursor: pointer; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.4,0,0.2,1) both;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse { animation: pulse 2s ease-in-out infinite; }

/* ===================================================================
   RESPONSIVE SYSTEM
   Breakpoints: 480px (small mobile), 600px (mobile), 900px (tablet)
   =================================================================== */

/* ── 태블릿 (900px 이하) ── */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 22px 18px; }
  .top-nav { padding: 0 20px; }
}

/* ── 모바일 (600px 이하) ── */
@media (max-width: 600px) {
  /* 레이아웃 */
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  /* 상단 네비 간소화 */
  .nav-links { display: none; }
  .nav-right .btn-logout { display: none; }
  .nav-right .btn-gold { display: none; } /* 개인 대시보드 버튼 숨김 (드로어에서 접근) */
  .admin-badge { display: none; }         /* 관리자 배지 숨김 */
  .nav-username { display: none; }
  .top-nav { padding: 0 14px; }

  /* 콘텐츠 영역 — 하단 탭바(62px) + 여유(8px) 확보 */
  .page-content {
    padding: 16px 14px;
    padding-bottom: 78px;
  }

  /* 타이포그래피 */
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
  h3 { font-size: 1rem; }

  /* 페이지 헤더 */
  .page-header { margin-bottom: 18px; }
  .page-header h1 { font-size: 1.3rem; }
  .page-header .subtitle { margin-left: 0; font-size: 0.82rem; margin-top: 6px; }

  /* 스탯 카드 */
  .stat-card { padding: 16px; }
  .stat-card-value { font-size: 1.5rem; }

  /* 카드 */
  .card-body { padding: 16px; }
  .card-header { padding: 16px 16px 0; }

  /* 테이블 */
  table { min-width: 520px; }
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 버튼 터치 타겟 */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; padding: 8px 14px; }
  button, input, select, textarea { min-height: 44px; }

  /* 모달 — 하단 슬라이드업 */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 88dvh;
    max-height: 88vh;
    padding: 24px 18px;
    width: 100%;
    max-width: 100%;
    animation: slideUpModal 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }
  @keyframes slideUpModal {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* 토스트 — 상단 배치 */
  .toast-container {
    bottom: auto;
    top: calc(var(--nav-height) + 8px);
    left: 12px;
    right: 12px;
    align-items: stretch;
  }
  .toast {
    min-width: 0;
    width: 100%;
    font-size: 0.85rem;
  }

  /* 섹션 제목 */
  .section-title { font-size: 0.95rem; }

  /* 차트 기본 높이 */
  .chart-wrap { height: 180px; }
}

/* ── 소형 모바일 (480px 이하) ── */
@media (max-width: 480px) {
  .page-content { padding: 14px 12px; padding-bottom: 78px; }
  .stat-card-value { font-size: 1.35rem; }
  .nav-brand-name { font-size: 1rem; }
}

/* ======================================================
   MOBILE HAMBURGER MENU DRAWER
   모바일에서 상단 우측 ☰ 버튼 → 오른쪽 슬라이드 드로어
   ====================================================== */

/* 햄버거 버튼 — 모바일에서만 표시 */
.nav-hamburger {
  display: none;
}

@media (max-width: 600px) {
  /* 상단 네비 콘텐츠 하단 패딩 불필요 (탭바 없음) */
  .page-content {
    padding-bottom: 24px;
  }

  /* 앱 레이아웃 — 하단 여백 불필요 */
  .app-layout {
    padding-bottom: 0;
  }

  /* 햄버거 버튼 */
  .nav-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    cursor: pointer;
    color: var(--white);
    font-size: 1.3rem;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
    flex-shrink: 0;
  }

  .nav-hamburger:active {
    background: rgba(255, 255, 255, 0.28);
  }
}

/* 드로어 오버레이 (배경 어두워짐) */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 4000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: overlayFadeIn 0.22s ease;
}

.drawer-overlay.open {
  display: block;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* 드로어 본체 */
.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 76vw;
  max-width: 300px;
  background: var(--white);
  z-index: 4001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  will-change: transform;
  backface-visibility: hidden;
}

.nav-drawer.open {
  transform: translateX(0);
}

/* 드로어 헤더 — 유저 정보 */
.drawer-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 20px 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.drawer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-dark);
  flex-shrink: 0;
}

.drawer-user-info {
  flex: 1;
  min-width: 0;
}

.drawer-user-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-user-sub {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

.drawer-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--white);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* 드로어 스크롤 영역 */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* 드로어 섹션 레이블 */
.drawer-section-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 20px 6px;
}

/* 드로어 메뉴 아이템 */
.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.drawer-nav-item:active,
.drawer-nav-item:hover {
  background: var(--surface-2);
}

.drawer-nav-item.active {
  color: var(--primary);
  background: rgba(0, 70, 128, 0.06);
}

.drawer-nav-item.active .drawer-item-icon {
  background: rgba(0, 70, 128, 0.12);
}

.drawer-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: background 0.15s;
}

.drawer-item-label {
  flex: 1;
}

.drawer-item-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--gold);
  color: var(--primary-dark);
  padding: 2px 7px;
  border-radius: 100px;
}

/* 구분선 */
.drawer-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 20px;
}

/* 위험 영역 (탈퇴/로그아웃) */
.drawer-nav-item.danger {
  color: #dc2626;
}

.drawer-nav-item.danger .drawer-item-icon {
  background: rgba(239, 68, 68, 0.1);
}

.drawer-nav-item.danger:active {
  background: rgba(239, 68, 68, 0.06);
}

.drawer-nav-item.logout-item {
  color: var(--text-secondary);
}

/* 드로어 푸터 */
.drawer-footer {
  padding: 12px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}


/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #006bb5 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(221,202,75,0.12) 0%, transparent 70%);
  border-radius: 50%;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -150px;
  left: -100px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(221,202,75,0.07) 0%, transparent 70%);
  border-radius: 50%;
}

.login-card {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 48px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.3);
  z-index: 1;
  animation: fadeIn 0.5s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(0,70,128,0.3);
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.login-logo h1 span {
  color: var(--gold-dark);
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.87rem;
  margin-top: 4px;
}

.login-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}

.login-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.login-tab.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ===== CHART WRAPPER ===== */
.chart-wrap {
  position: relative;
  height: 220px;
}

/* ===== HISTORY CARDS ===== */
.record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.record-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(0,70,128,0.2);
  transform: translateY(-1px);
}

.record-card .record-date {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.record-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
}

.metric-chip .chip-icon { font-size: 0.9rem; }

.metric-chip.highlight {
  background: rgba(0,70,128,0.06);
  border-color: rgba(0,70,128,0.15);
  color: var(--primary);
}

.record-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
}

/* ===== CONDITION STARS ===== */
.condition-display {
  display: flex;
  gap: 2px;
  color: var(--gold);
  font-size: 0.9rem;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s;
}

.modal-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 100px rgba(0,0,0,0.25);
  animation: scaleIn 0.25s cubic-bezier(0.4,0,0.2,1);
  will-change: transform, opacity;
  backface-visibility: hidden;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
  background: var(--danger);
  color: var(--white);
}
