/* ============================================================
   HealthKeeper - 메인 스타일시트
   반응형: 모바일(<768px) / 태블릿(768~1024px) / PC(1024px+)
   ============================================================ */

/* ── CSS 변수 ── */
:root {
  --color-primary:      #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light:#dbeafe;
  --color-success:      #10b981;
  --color-warning:      #f59e0b;
  --color-danger:       #ef4444;
  --color-orange:       #f97316;
  --color-gray-50:      #f9fafb;
  --color-gray-100:     #f3f4f6;
  --color-gray-200:     #e5e7eb;
  --color-gray-300:     #d1d5db;
  --color-gray-400:     #9ca3af;
  --color-gray-500:     #6b7280;
  --color-gray-600:     #4b5563;
  --color-gray-700:     #374151;
  --color-gray-800:     #1f2937;
  --color-gray-900:     #111827;
  --radius-sm:   4px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   24px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.12);
  --navbar-h: 64px;
  --transition: .18s ease;
  --page-loader-bg: rgba(15, 23, 42, 0.6);
  --page-loader-text: #ffffff;
}

.page-loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--page-loader-bg);
}

.page-loader-overlay.hidden { display: none; }

.page-loader-inner {
  background: rgba(17, 24, 39, 0.9);
  border-radius: 12px;
  padding: 20px 24px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 160px;
}

.page-loader-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: var(--page-loader-text);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.page-loader-label {
  color: var(--page-loader-text);
  font-size: 0.9rem;
  font-weight: 600;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── 다크 모드 CSS 변수 재정의 ── */
html[data-theme="dark"] {
  --color-primary:       #60a5fa;
  --color-primary-dark:  #3b82f6;
  --color-primary-light: rgba(96,165,250,.15);
  --color-success:       #34d399;
  --color-warning:       #fbbf24;
  --color-danger:        #f87171;
  --color-orange:        #fb923c;
  --color-gray-50:       #0f172a;
  --color-gray-100:      #1e293b;
  --color-gray-200:      #334155;
  --color-gray-300:      #475569;
  --color-gray-400:      #64748b;
  --color-gray-500:      #94a3b8;
  --color-gray-600:      #cbd5e1;
  --color-gray-700:      #e2e8f0;
  --color-gray-800:      #f1f5f9;
  --color-gray-900:      #f8fafc;
  --shadow-sm:  0 1px 4px  rgba(0,0,0,.4);
  --shadow:     0 4px 14px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 28px rgba(0,0,0,.6);
}

/* ── 다크 모드 : 흰색 배경 표면 재정의 ── */
html[data-theme="dark"] body,
html[data-theme="dark"] .dashboard-page { background: #0f172a; color: #f1f5f9; }

html[data-theme="dark"] .navbar,
html[data-theme="dark"] .mobile-menu       { background: #1e293b; border-color: #334155; }

html[data-theme="dark"] .auth-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #1e40af 100%);
}
html[data-theme="dark"] .auth-card         { background: #1e293b; }
html[data-theme="dark"] .info-item         { background: rgba(0,0,0,.25); }

html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .profile-form-card { background: #1e293b; border-color: #334155; }

html[data-theme="dark"] .profile-form-card--danger { background: #1c1214; border-color: #7f1d1d; }
html[data-theme="dark"] .profile-stats              { border-color: #334155; }
html[data-theme="dark"] .profile-form-header,
html[data-theme="dark"] .profile-form-footer        { border-color: #334155; }
html[data-theme="dark"] .profile-form-icon--blue    { background: rgba(96,165,250,.15); color: #60a5fa; }
html[data-theme="dark"] .profile-form-icon--green   { background: rgba(52,211,153,.15); color: #34d399; }
html[data-theme="dark"] .profile-form-icon--red     { background: rgba(248,113,113,.15); color: #f87171; }
html[data-theme="dark"] .danger-desc                { color: #94a3b8; }

html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal--confirm            { background: #1e293b; }
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer              { border-color: #334155; }
html[data-theme="dark"] .modal-close               { color: #94a3b8; }
html[data-theme="dark"] .modal-close:hover         { background: #334155; }

html[data-theme="dark"] .chart-fullscreen-overlay,
html[data-theme="dark"] .chart-fullscreen-header   { background: #0f172a; border-color: #334155; }
html[data-theme="dark"] .chart-fullscreen-body     { background: #0f172a; }
html[data-theme="dark"] .chart-fullscreen-title-area h3 { color: #f1f5f9; }
html[data-theme="dark"] .chart-fullscreen-hint     { color: #64748b; }
html[data-theme="dark"] .btn-fullscreen-close      { border-color: #475569; color: #cbd5e1; }
html[data-theme="dark"] .btn-fullscreen-close:hover { background: #334155; }

html[data-theme="dark"] .data-table th   { background: #334155; color: #94a3b8; border-color: #475569; }
html[data-theme="dark"] .data-table td   { color: #e2e8f0; border-color: #334155; }
html[data-theme="dark"] .data-table tr:hover td { background: #27374d; }
html[data-theme="dark"] .empty-row       { color: #64748b; }

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0f172a; border-color: #475569; color: #f1f5f9;
}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus   { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96,165,250,.2); }
html[data-theme="dark"] input:disabled   { background: #334155; color: #64748b; border-color: #475569; }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #475569; }

html[data-theme="dark"] .reference-box   { background: #0f172a; border-color: #334155; }
html[data-theme="dark"] .summary-range   { color: #64748b; }
html[data-theme="dark"] .section-subtitle { color: #94a3b8; }
html[data-theme="dark"] .user-greeting   { color: #94a3b8; }
html[data-theme="dark"] .mobile-user     { border-color: #334155; color: #94a3b8; }

html[data-theme="dark"] .btn-ghost       { border-color: #475569; color: #cbd5e1; }
html[data-theme="dark"] .btn-ghost:hover { background: #334155; }
html[data-theme="dark"] .btn-outline     { border-color: #60a5fa; color: #93c5fd; }
html[data-theme="dark"] .btn-outline:hover { background: rgba(96,165,250,.15); }

html[data-theme="dark"] .nav-tab         { color: #94a3b8; }
html[data-theme="dark"] .nav-tab:hover   { background: #334155; color: #e2e8f0; }
html[data-theme="dark"] .nav-tab.active  { background: rgba(96,165,250,.15); color: #93c5fd; }
html[data-theme="dark"] .nav-tab-mobile  { color: #cbd5e1; }
html[data-theme="dark"] .nav-tab-mobile:hover  { background: #334155; }
html[data-theme="dark"] .nav-tab-mobile.active { background: rgba(96,165,250,.15); color: #93c5fd; }

html[data-theme="dark"] .range-btn       { border-color: #475569; color: #94a3b8; }
html[data-theme="dark"] .range-btn:hover { border-color: #60a5fa; color: #93c5fd; }
html[data-theme="dark"] .range-btn.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }

html[data-theme="dark"] .btn-icon        { border-color: #475569; color: #94a3b8; }
html[data-theme="dark"] .btn-icon:hover  { background: #334155; }
html[data-theme="dark"] .btn-icon.btn-icon-danger:hover { background: #1c0a0a; border-color: #7f1d1d; color: #f87171; }

html[data-theme="dark"] .btn-fullscreen  { border-color: #475569; color: #94a3b8; }
html[data-theme="dark"] .btn-fullscreen:hover { border-color: #60a5fa; color: #93c5fd; background: rgba(96,165,250,.1); }

html[data-theme="dark"] .badge-gray      { background: #334155; color: #94a3b8; }

html[data-theme="dark"] .combined-legend-row { border-color: #334155; }
html[data-theme="dark"] .combined-ref-grid   { border-color: #334155; }
html[data-theme="dark"] .ref-chip--normal    { background: rgba(52,211,153,.15); color: #34d399; }
html[data-theme="dark"] .ref-chip--warning   { background: rgba(251,191,36,.15); color: #fbbf24; }
html[data-theme="dark"] .ref-chip--danger    { background: rgba(248,113,113,.15); color: #f87171; }

html[data-theme="dark"] .confirm-modal-icon--logout { background: rgba(96,165,250,.15); }
html[data-theme="dark"] .confirm-modal-title        { color: #f1f5f9; }
html[data-theme="dark"] .confirm-modal-desc         { color: #94a3b8; }

html[data-theme="dark"] .alert-error   { background: #1c0a0a; border-color: #7f1d1d; color: #fca5a5; }
html[data-theme="dark"] .alert-success { background: #052e16; border-color: #166534; color: #86efac; }

html[data-theme="dark"] .toast           { background: #334155; color: #f1f5f9; }
html[data-theme="dark"] .toast-success   { background: #065f46; }
html[data-theme="dark"] .toast-error     { background: #991b1b; }
html[data-theme="dark"] .toast-warning   { background: #92400e; color: #fef3c7; }

html[data-theme="dark"] .strength-bar    { background: #334155; }

/* 다크모드 아이콘 스위칭 (CSS만으로 처리) */
.theme-toggle-btn .icon-sun  { display: none; }
.theme-toggle-btn .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle-btn .icon-sun  { display: block; }
html[data-theme="dark"] .theme-toggle-btn .icon-moon { display: none; }

/* ── 리셋 & 기본 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--color-gray-800);
  background: var(--color-gray-50);
  line-height: 1.6;
  font-size: 14px;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }

/* ── 테마 토글 버튼 ── */
.theme-toggle-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--color-gray-300);
  background: transparent;
  color: var(--color-gray-600);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle-btn:hover {
  background: var(--color-gray-100);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: rotate(20deg);
}
.theme-toggle-btn svg { pointer-events: none; }

/* 로그인/회원가입 페이지 우상단 고정 */
.theme-toggle-fixed {
  position: fixed; top: 16px; right: 16px; z-index: 10;
  border-color: rgba(255,255,255,.5);
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(4px);
}
.theme-toggle-fixed:hover {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.8);
  color: #fff;
  transform: rotate(20deg);
}
html[data-theme="dark"] .theme-toggle-fixed {
  border-color: rgba(255,255,255,.3);
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.08);
}

/* ── 유틸리티 ── */
.text-center { text-align: center; }
.text-muted  { color: var(--color-gray-500); font-size: .85rem; }

/* ============================================================
   버튼
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  font-size: .875rem; font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(.97); }

.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover  { background: var(--color-primary-dark); }

.btn-outline  { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover  { background: var(--color-primary-light); }

.btn-ghost    { background: transparent; color: var(--color-gray-600); border-color: var(--color-gray-300); }
.btn-ghost:hover    { background: var(--color-gray-100); }

.btn-danger   { background: var(--color-danger); color: #fff; }
.btn-danger:hover   { background: #dc2626; }

.btn-sm   { padding: 6px 12px; font-size: .8rem; }
.btn-full { width: 100%; }

.btn-icon {
  padding: 4px 8px;
  font-size: .75rem;
  background: transparent;
  color: var(--color-gray-600);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
}
.btn-icon:hover {
  background: var(--color-gray-100);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-icon.btn-icon-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: var(--color-danger);
}

.action-btns {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* 로그인 소셜 버튼 간격 조정 */
#kakao-login-btn,
#naver-login-btn {
  margin-top: 10px;
  justify-content: center;
  gap: 8px;
}

#kakao-login-btn img {
  width: 20px;
  height: auto;
}

/* ============================================================
   폼 공통
   ============================================================ */
.form-group {
  display: flex; flex-direction: column; gap: 5px;
  flex: 1;
}
.form-group label { font-size: .85rem; font-weight: 500; color: var(--color-gray-700); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--color-gray-300);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-gray-800);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--color-gray-400); }

.form-row { display: flex; gap: 12px; }
@media (max-width: 480px) {
  .form-row { flex-direction: column; }
}

.required { color: var(--color-danger); }

.input-password { position: relative; }
.input-password input { padding-right: 40px; width: 100%; }
.btn-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 4px;
  color: var(--color-gray-400); display: flex; align-items: center;
}
.icon-eye { width: 18px; height: 18px; }

/* ============================================================
   알림 메시지
   ============================================================ */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .875rem;
  border: 1px solid transparent;
  margin-bottom: 12px;
}
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }

/* ============================================================
   AUTH 페이지 (로그인 / 회원가입)
   ============================================================ */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}

.auth-container {
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; gap: 20px;
}
.auth-container--wide { max-width: 600px; }

.auth-brand {
  text-align: center; color: #fff;
}
.brand-icon { display: inline-block; margin-bottom: 10px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.brand-title { font-size: 2rem; font-weight: 700; letter-spacing: -.5px; }
.brand-subtitle { opacity: .85; margin-top: 2px; font-size: .95rem; }

.auth-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.auth-title {
  font-size: 1.35rem; font-weight: 700;
  color: var(--color-gray-900);
  margin-bottom: 20px;
  text-align: center;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-footer { margin-top: 16px; text-align: center; color: var(--color-gray-500); font-size: .875rem; }

.auth-info {
  display: flex; gap: 12px;
}
.info-item {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.15);
  border-radius: var(--radius-lg);
  padding: 12px 14px; color: #fff;
  backdrop-filter: blur(4px);
}
.info-icon { font-size: 1.5rem; }
.info-item strong { display: block; font-size: .85rem; }
.info-item span   { font-size: .75rem; opacity: .85; }
.glucose-color { color: #93c5fd; }
.pressure-color { color: #fca5a5; }

/* 비밀번호 강도 */
.password-strength { margin-top: -4px; }
.strength-label { font-size: .78rem; color: var(--color-gray-500); margin-bottom: 4px; }
.strength-bar { height: 4px; background: var(--color-gray-200); border-radius: 99px; overflow: hidden; }
.strength-fill {
  height: 100%; width: 0; border-radius: 99px;
  transition: width .3s ease, background .3s ease;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--color-gray-200);
  box-shadow: var(--shadow-sm);
}
.navbar-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 20px;
  height: var(--navbar-h);
  display: flex; align-items: center; gap: 24px;
}
.navbar-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.1rem; font-weight: 700;
  color: var(--color-gray-900);
  flex-shrink: 0;
  text-decoration: none;
}
.navbar-menu {
  display: flex; gap: 4px;
  flex: 1;
}
.nav-tab {
  padding: 7px 14px;
  border-radius: var(--radius);
  border: none; background: transparent;
  font-size: .875rem; font-weight: 500;
  color: var(--color-gray-600);
  transition: all var(--transition);
}
.nav-tab:hover { background: var(--color-gray-100); color: var(--color-gray-900); }
.nav-tab.active { background: var(--color-primary-light); color: var(--color-primary); }

.navbar-user {
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.user-greeting { font-size: .875rem; color: var(--color-gray-600); }

.navbar-toggle {
  display: none;
  background: none; border: none;
  color: var(--color-gray-600);
  margin-left: auto;
}

/* 모바일 메뉴 */
.mobile-menu {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  right: 0;
  z-index: 99;
  background: #fff;
  border-top: 1px solid var(--color-gray-200);
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 4px;
  max-height: calc(100vh - var(--navbar-h));
  overflow-y: auto;
}
.nav-tab-mobile {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: none; background: transparent;
  font-size: .9rem; font-weight: 500;
  color: var(--color-gray-700);
  text-align: left;
  transition: all var(--transition);
}
.nav-tab-mobile:hover { background: var(--color-gray-100); }
.nav-tab-mobile.active { background: var(--color-primary-light); color: var(--color-primary); }
.mobile-user {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  margin-top: 4px;
  border-top: 1px solid var(--color-gray-200);
  font-size: .85rem; color: var(--color-gray-600);
}

/* ============================================================
   메인 콘텐츠
   ============================================================ */
.dashboard-page { background: var(--color-gray-50); }
.main-content {
  max-width: 1280px; margin: 0 auto;
  padding: calc(var(--navbar-h) + 24px) 20px 40px;
}

/* 탭 섹션 */
.tab-section { display: none; }
.tab-section.active { display: block; }

.section-header {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  position: relative;
  z-index: 1;
}
@media (max-width: 768px) {
  .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
}
.section-header h2 { font-size: 1.4rem; font-weight: 700; color: var(--color-gray-900); }
.section-subtitle { color: var(--color-gray-500); font-size: .875rem; }

/* ============================================================
   요약 카드 (Summary)
   ============================================================ */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.summary-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-gray-200);
  border-top: 4px solid transparent;
}
.glucose-card  { border-top-color: var(--color-primary); }
.pressure-card { border-top-color: var(--color-danger); }

.summary-card-header {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 12px;
}
.summary-icon { font-size: 1.8rem; line-height: 1; }
.summary-card-header h3 { font-size: .9rem; font-weight: 600; color: var(--color-gray-700); }
.summary-card-header small { font-size: .75rem; color: var(--color-gray-400); }
.summary-status-group {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.summary-status-badge {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  color: #111827;
  background: #dbeafe;
  letter-spacing: .02em;
  white-space: nowrap;
}
.summary-status-badge.hidden { display: none; }
.summary-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .72rem; font-weight: 600;
  background: var(--color-gray-100); color: var(--color-gray-500);
}
.summary-badge.badge-normal  { background: #d1fae5; color: #065f46; }
.summary-badge.badge-warning { background: #fef3c7; color: #92400e; }
.summary-badge.badge-danger  { background: #fee2e2; color: #991b1b; }

.summary-value {
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 10px;
}
.value-number { font-size: 2.2rem; font-weight: 700; line-height: 1; color: var(--color-gray-900); }
.value-unit   { font-size: .85rem; color: var(--color-gray-500); }

.summary-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: .78rem; color: var(--color-gray-500);
  margin-bottom: 8px;
}
.summary-stats strong { color: var(--color-gray-700); }
.summary-range { font-size: .7rem; color: var(--color-gray-400); }

/* ============================================================
   차트 카드
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.chart-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-gray-200);
  margin-bottom: 20px;
}
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.chart-header h3 { font-size: 1rem; font-weight: 600; color: var(--color-gray-800); }
.chart-legend {
  display: flex; gap: 10px; align-items: center;
  font-size: .75rem; color: var(--color-gray-600);
}
.legend-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 3px;
}
.chart-wrapper { position: relative; height: 220px; }
.chart-wrapper--tall { height: 300px; }
.charts-dual .chart-wrapper { height: 300px; padding-bottom: 8px; }
.chart-sub-title { font-size: .85rem; font-weight: 600; color: var(--color-gray-600); }

/* 차트 서브 헤더 (타이틀 + 전체화면 버튼) */
.chart-sub-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}

/* 전체화면 버튼 */
.btn-fullscreen {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-gray-300);
  background: transparent;
  font-size: .75rem; font-weight: 500;
  color: var(--color-gray-500);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-fullscreen:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

/* ============================================================
   차트 전체화면 오버레이
   ============================================================ */
.chart-fullscreen-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: #fff;
  display: flex; flex-direction: column;
  animation: fsSlideIn .2s ease;
}
.chart-fullscreen-overlay.hidden { display: none; }

@keyframes fsSlideIn {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}

.chart-fullscreen-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-gray-200);
  background: #fff;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.chart-fullscreen-title-area {
  display: flex; align-items: center; gap: 10px;
}
.chart-fullscreen-title-area h3 {
  font-size: 1.1rem; font-weight: 700; color: var(--color-gray-900);
}
.chart-fullscreen-actions {
  display: flex; align-items: center; gap: 14px;
}
.chart-fullscreen-hint {
  font-size: .78rem; color: var(--color-gray-400);
}
.btn-fullscreen-close {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--color-gray-300);
  background: transparent;
  font-size: .85rem; font-weight: 500;
  color: var(--color-gray-700);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-fullscreen-close:hover {
  background: var(--color-gray-100);
  border-color: var(--color-gray-400);
}

.chart-fullscreen-body {
  flex: 1;
  padding: 28px 32px 24px;
  position: relative;
  overflow: hidden;
  background: var(--color-gray-50);
}
#chart-fullscreen-canvas {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 768px) {
  .chart-fullscreen-header { padding: 12px 16px; }
  .chart-fullscreen-hint   { display: none; }
  .chart-fullscreen-body   { padding: 16px 12px 12px; }
  .btn-fullscreen span     { display: none; }
}

.charts-dual {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

/* 범위 버튼 */
.range-tabs { display: flex; gap: 4px; }
.range-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-gray-300);
  background: transparent;
  font-size: .78rem; font-weight: 500;
  color: var(--color-gray-600);
  transition: all var(--transition);
}
.range-btn:hover  { border-color: var(--color-primary); color: var(--color-primary); }
.range-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* 참조선 설명 */
.chart-reference-lines {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--color-gray-100);
  font-size: .72rem;
}
.ref-line { display: flex; align-items: center; gap: 5px; }
.ref-line::before {
  content: ''; display: inline-block; width: 24px; height: 2px; border-radius: 1px;
}
.ref-normal::before  { background: var(--color-success); border-top: 2px dashed var(--color-success); height: 0; }
.ref-warning::before { background: var(--color-warning); border-top: 2px dashed var(--color-warning); height: 0; }
.ref-danger::before  { background: var(--color-danger);  border-top: 2px dashed var(--color-danger);  height: 0; }

/* ============================================================
   테이블 카드
   ============================================================ */
.table-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-gray-200);
}
.table-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.table-header h3 { font-size: 1rem; font-weight: 600; color: var(--color-gray-800); }
.table-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-filter input { padding: 6px 10px; font-size: .8rem; border: 1.5px solid var(--color-gray-300); border-radius: var(--radius); }
.table-filter-actions { display: flex; gap: 8px; flex-wrap: nowrap; }
.table-filter-actions .btn { min-width: 64px; }

@media (max-width: 768px) {
  .table-filter-actions { width: 100%; justify-content: flex-start; }
  .table-filter-actions .btn { flex: 1 1 auto; }
}

.table-responsive { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem;
}
.data-table th {
  text-align: left; padding: 10px 12px;
  border-bottom: 2px solid var(--color-gray-200);
  font-size: .8rem; font-weight: 600;
  color: var(--color-gray-600);
  white-space: nowrap;
  background: var(--color-gray-50);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-gray-100);
  vertical-align: middle;
  color: var(--color-gray-700);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--color-gray-50); }

@media print {
  .data-table tr:last-child td { border-bottom: 1px solid #cbd5e1 !important; }
}
.empty-row { text-align: center; color: var(--color-gray-400); padding: 32px !important; }

/* 상태 뱃지 */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 99px; font-size: .72rem; font-weight: 600;
  white-space: nowrap;
}
.badge-normal  { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: var(--color-gray-100); color: var(--color-gray-500); }

/* 액션 버튼 */
.action-btns { display: flex; gap: 6px; }
.btn-icon {
  padding: 5px 8px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-gray-300);
  background: transparent; font-size: .75rem;
  color: var(--color-gray-600);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--color-gray-100); }
.btn-icon.btn-icon-danger:hover { background: #fef2f2; border-color: #fca5a5; color: var(--color-danger); }

/* ============================================================
   Confirm 전용 모달 (로그아웃 등 간단한 확인창)
   ============================================================ */
.modal--confirm {
  text-align: center;
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  border-radius: var(--radius-xl);
  /* 헤더·푸터 구분선 없는 심플 레이아웃 */
}
.confirm-modal-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.confirm-modal-icon--logout {
  background: #eff6ff;
  color: var(--color-primary);
}
.confirm-modal-title {
  font-size: 1.15rem; font-weight: 700;
  color: var(--color-gray-900);
  margin-bottom: 8px;
}
.confirm-modal-desc {
  font-size: .925rem;
  color: var(--color-gray-500);
  line-height: 1.6;
  margin-bottom: 28px;
}
.confirm-modal-actions {
  display: flex; gap: 10px; width: 100%;
}
.confirm-modal-cancel {
  flex: 1;
  justify-content: center;
}
.confirm-modal-ok {
  flex: 1;
  justify-content: center;
}

/* ============================================================
   모달
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal--sm { max-width: 380px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-gray-200);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--color-gray-900); }
.modal-close {
  background: none; border: none;
  font-size: 1.1rem; color: var(--color-gray-500);
  padding: 4px 8px; border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--color-gray-100); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column; gap: 14px;
}

.modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--color-gray-200);
}

/* 참조 박스 */
.reference-box {
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.reference-box h4 { font-size: .8rem; font-weight: 600; color: var(--color-gray-700); margin-bottom: 8px; }
.ref-table { width: 100%; font-size: .78rem; }
.ref-table td { padding: 3px 6px; color: var(--color-gray-600); }
.ref-normal-text  { color: var(--color-success); font-weight: 600; }
.ref-warning-text { color: var(--color-warning); font-weight: 600; }
.ref-danger-text  { color: var(--color-danger);  font-weight: 600; }

/* ============================================================
   토스트 알림
   ============================================================ */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--color-gray-900); color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: .875rem;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideInRight .25s ease;
  min-width: 240px; max-width: 360px;
}
.toast-success { background: var(--color-success); }
.toast-error   { background: var(--color-danger); }
.toast-warning { background: var(--color-warning); color: var(--color-gray-900); }
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(10px); }
}

/* ============================================================
   내 정보 (프로필) 페이지
   ============================================================ */
.profile-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

/* 사이드 카드 */
.profile-side { position: sticky; top: calc(var(--navbar-h) + 24px); }
.profile-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-gray-200);
  text-align: center;
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #60a5fa);
  color: #fff;
  font-size: 2rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 4px 12px rgba(37,99,235,.25);
  user-select: none;
}
.profile-meta { margin-bottom: 20px; }
.profile-username {
  font-size: 1.05rem; font-weight: 700;
  color: var(--color-gray-900); margin-bottom: 4px;
}
.profile-joined { font-size: .78rem; color: var(--color-gray-400); }

.profile-stats {
  display: flex; gap: 12px;
  border-top: 1px solid var(--color-gray-100);
  padding-top: 16px;
}
.profile-stat {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.profile-stat-num {
  font-size: 1.4rem; font-weight: 700; color: var(--color-gray-900);
}
.profile-stat-label { font-size: .72rem; color: var(--color-gray-500); }

/* 편집 폼 영역 */
.profile-forms { display: flex; flex-direction: column; gap: 16px; }

.profile-form-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-gray-200);
}
.profile-form-card--danger {
  border-color: #fecaca;
  background: #fff8f8;
}

.profile-form-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-gray-100);
}
.profile-form-header h3 { font-size: 1rem; font-weight: 700; color: var(--color-gray-800); }

.profile-form-icon {
  width: 34px; height: 34px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-form-icon--blue  { background: #dbeafe; color: var(--color-primary); }
.profile-form-icon--green { background: #d1fae5; color: var(--color-success); }
.profile-form-icon--red   { background: #fee2e2; color: var(--color-danger); }

.profile-form-footer {
  display: flex; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--color-gray-100);
}

.danger-desc {
  font-size: .875rem; color: var(--color-gray-600);
  margin-bottom: 14px; line-height: 1.6;
}

/* 반응형 */
@media (max-width: 900px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-side   { position: static; }
  .profile-card   { display: flex; align-items: center; gap: 20px; text-align: left; padding: 20px; }
  .profile-avatar { width: 60px; height: 60px; font-size: 1.5rem; flex-shrink: 0; margin: 0; }
  .profile-meta   { margin-bottom: 0; flex: 1; }
  .profile-stats  { border-top: none; padding-top: 0; border-left: 1px solid var(--color-gray-100); padding-left: 16px; }
}
@media (max-width: 480px) {
  .profile-card   { flex-direction: column; text-align: center; }
  .profile-stats  { border-left: none; padding-left: 0; border-top: 1px solid var(--color-gray-100); padding-top: 14px; width: 100%; justify-content: center; }
  .profile-form-card { padding: 18px 16px; }
}

/* ============================================================
   통합 비교 차트 전용 스타일
   ============================================================ */
.combined-chart-title p { margin-top: 2px; }

.combined-chart-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.combined-legend-row {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 4px 14px;
  border-bottom: 1px solid var(--color-gray-100);
  margin-bottom: 16px;
}
.combined-legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; color: var(--color-gray-600);
}
.legend-swatch {
  display: inline-block; width: 28px; height: 3px;
  border-radius: 99px; flex-shrink: 0;
}

.chart-wrapper--combined { height: 460px; }

.combined-ref-grid {
  display: flex; gap: 24px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--color-gray-100);
}
.combined-ref-group {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ref-group-title { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.ref-chip {
  padding: 2px 9px; border-radius: 99px;
  font-size: .72rem; font-weight: 500;
  white-space: nowrap;
}
.ref-chip--normal  { background: #d1fae5; color: #065f46; }
.ref-chip--warning { background: #fef3c7; color: #92400e; }
.ref-chip--danger  { background: #fee2e2; color: #991b1b; }

.combined-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-gray-400);
  font-size: .9rem;
  line-height: 1.8;
}

/* ============================================================
   반응형 - 태블릿 (768px ~ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .charts-grid     { grid-template-columns: 1fr; }
  .charts-dual     { grid-template-columns: 1fr; }
  .summary-grid    { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   반응형 - 모바일 (~ 768px)
   ============================================================ */
@media (max-width: 768px) {
  .navbar-menu  { display: none; }
  .navbar-user  { display: none; }
  .navbar-toggle { display: flex; align-items: center; }

  .main-content { padding: calc(var(--navbar-h) + 16px) 14px 32px; }

  .summary-grid { grid-template-columns: 1fr; }
  .charts-grid  { grid-template-columns: 1fr; }
  .charts-dual  { grid-template-columns: 1fr; }

  .value-number { font-size: 1.7rem; }

  .auth-info { flex-direction: column; }
  .auth-card { padding: 24px 20px; }

  .section-header { flex-direction: row; justify-content: space-between; align-items: center; }

  .table-filter { flex-wrap: wrap; }
  .table-filter input { width: 140px; }

  .modal { max-height: 95vh; }
  .modal-body { padding: 16px 18px; }
  .modal-header, .modal-footer { padding: 14px 18px; }

  .chart-header { flex-direction: column; align-items: flex-start; }
  .range-tabs { flex-wrap: wrap; }
  .combined-legend-row { gap: 10px; }
  .charts-dual .chart-wrapper { height: 240px; padding-bottom: 6px; }
  .chart-wrapper--combined { height: 340px; }
  .combined-ref-grid { flex-direction: column; gap: 10px; }
}

@media (max-width: 480px) {
  .summary-stats { flex-direction: column; gap: 4px; }
  .auth-brand .brand-title { font-size: 1.6rem; }
  .navbar-inner { padding: 0 14px; }
  .table-header { flex-direction: column; align-items: flex-start; }
  .chart-reference-lines { flex-direction: column; gap: 6px; }
}
