/* 공통 스타일 — 기존 budget_manager.html 다크 테마 기반 */
:root {
  --bg: #0d0f1a;
  --surface: #151824;
  --surface2: #1c2134;
  --border: #252a3d;
  --accent: #6c63ff;
  --accent2: #ff6b9d;
  --green: #00e5a0;
  --red: #ff4d6d;
  --yellow: #ffd166;
  --blue: #4cc9f0;
  --text: #e8eaf6;
  --text2: #8892b0;
  --text3: #4a5270;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: 'Pretendard', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── 헤더 ─── */
.header {
  background: linear-gradient(135deg, #1a0a3d 0%, #0d0f1a 50%, #0a1a1a 100%);
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.header h1 {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(90deg, #6c63ff, #ff6b9d, #4cc9f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-nav { display: flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.2s;
}
.nav-link:hover { border-color: var(--accent); color: var(--accent); }
.nav-link.active { background: var(--accent); border-color: var(--accent); color: white; }
.nav-logout {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid rgba(255,77,109,0.3);
  background: rgba(255,77,109,0.08);
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s;
}
.nav-logout:hover { background: rgba(255,77,109,0.2); }

/* ─── 메인 컨텐츠 ─── */
.main { padding: 30px 40px; display: flex; flex-direction: column; gap: 24px; }

/* ─── 요약 카드 ─── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.summary-card:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.summary-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
}
.card-income::before { background: linear-gradient(90deg, var(--blue), var(--green)); }
.card-expense::before { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.card-balance::before { background: linear-gradient(90deg, var(--yellow), var(--green)); }
.card-balance.negative::before { background: linear-gradient(90deg, var(--red), var(--accent2)); }
.card-card::before { background: linear-gradient(90deg, #a78bfa, #c084fc); }
.card-label { font-size: 12px; color: var(--text2); font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 10px; }
.card-icon { font-size: 22px; margin-bottom: 8px; }
.card-amount { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.card-amount.income-color { color: var(--blue); }
.card-amount.expense-color { color: var(--accent2); }
.card-amount.positive { color: var(--green); }
.card-amount.negative { color: var(--red); }
.card-amount.card-color { color: #c084fc; }
.card-sub { font-size: 12px; color: var(--text2); margin-top: 6px; }

/* ─── 상태 배너 ─── */
.status-banner {
  border-radius: 14px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
  font-size: 15px;
}
.status-banner.surplus { background: rgba(0,229,160,0.08); border: 1px solid rgba(0,229,160,0.25); color: var(--green); }
.status-banner.deficit { background: rgba(255,77,109,0.08); border: 1px solid rgba(255,77,109,0.25); color: var(--red); }
.status-icon { font-size: 24px; }
.status-text-sub { font-size: 13px; font-weight: 400; color: var(--text2); margin-top: 2px; }

/* ─── 프로그레스 바 ─── */
.expense-ratio { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; }
.ratio-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.ratio-title { font-size: 14px; font-weight: 600; color: var(--text2); }
.ratio-pct { font-size: 22px; font-weight: 800; }
.progress-bar { background: var(--bg); border-radius: 8px; height: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 8px; transition: width 0.8s cubic-bezier(0.16,1,0.3,1); }

/* ─── 섹션 공통 ─── */
.section-box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content:''; display:block; width:4px; height:16px; border-radius:2px; background:var(--accent); }

/* ─── 거래 내역 ─── */
.transactions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .transactions-grid { grid-template-columns: 1fr; } }
.txn-section { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.txn-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.bank-badge { padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }
.badge-kakao { background: rgba(255,210,0,0.15); color: #ffd200; }
.badge-kb { background: rgba(255,130,0,0.15); color: #ff8200; }
.badge-etc { background: rgba(108,99,255,0.15); color: #a78bfa; }
.txn-title { font-size: 14px; font-weight: 700; }
.txn-total { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--text2); }
.txn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 22px;
  border-bottom: 1px solid rgba(37,42,61,0.5);
  transition: background 0.15s;
  gap: 8px;
}
.txn-row:hover { background: rgba(255,255,255,0.03); }
.txn-row:last-child { border-bottom: none; }
.txn-name { font-size: 14px; font-weight: 500; flex: 1; }
.txn-bar-wrap { width: 70px; background: var(--bg); border-radius: 4px; height: 4px; }
.txn-bar { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.txn-amount { font-size: 14px; font-weight: 700; color: var(--accent2); font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }
.txn-actions { display: flex; gap: 4px; }
.btn-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.btn-icon:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.btn-icon.delete:hover { background: rgba(255,77,109,0.15); color: var(--red); }
.status-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
  border: none; cursor: pointer; font-family: inherit;
  white-space: nowrap; transition: opacity 0.15s; flex-shrink: 0;
}
.status-badge:hover { opacity: 0.75; }
.no-data { padding: 24px; text-align: center; color: var(--text3); font-size: 13px; }

/* ─── 카테고리 차트 ─── */
.cat-item { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cat-name { font-size: 13px; color: var(--text2); width: 120px; }
.cat-bar-wrap { flex: 1; background: var(--bg); border-radius: 4px; height: 6px; }
.cat-bar { height: 6px; border-radius: 4px; transition: width 0.8s cubic-bezier(0.16,1,0.3,1); }
.cat-amount { font-size: 13px; font-weight: 600; text-align: right; min-width: 90px; font-variant-numeric: tabular-nums; }

/* ─── 추이 차트 ─── */
.chart-wrap { position: relative; height: 200px; margin-top: 16px; overflow: hidden; }
.chart-svg { width: 100%; height: 100%; }
.chart-tooltip {
  position: absolute;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  display: none;
  z-index: 10;
}

/* ─── 입력 폼 ─── */
.input-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.input-group label { display: block; font-size: 12px; color: var(--text2); font-weight: 600; margin-bottom: 6px; letter-spacing: 0.5px; }
.input-group input, .input-group select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus, .input-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}
.input-group select option { background: var(--surface2); }

/* ─── 버튼 ─── */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  padding: 11px 22px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #5a54e8; box-shadow: 0 4px 20px rgba(108,99,255,0.4); }
.btn-success { background: rgba(0,229,160,0.15); color: var(--green); border: 1.5px solid rgba(0,229,160,0.3); }
.btn-success:hover { background: rgba(0,229,160,0.25); }
.btn-danger { background: rgba(255,77,109,0.12); color: var(--red); border: 1.5px solid rgba(255,77,109,0.3); }
.btn-danger:hover { background: rgba(255,77,109,0.25); }
.btn-secondary { background: var(--surface2); color: var(--text2); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ─── 모달 ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* ─── 월별 탭 ─── */
.month-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 20px 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.month-tab {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: 30px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}
.month-tab:hover { border-color: var(--accent); color: var(--accent); }
.month-tab.active { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 0 20px rgba(108,99,255,0.4); }
.month-tab.deficit { border-color: rgba(255,77,109,0.4); color: rgba(255,77,109,0.8); }
.month-tab.deficit.active { background: var(--red); border-color: var(--red); color: white; box-shadow: 0 0 20px rgba(255,77,109,0.4); }

/* ─── 예산 페이지 ─── */
.budget-item {
  background: var(--surface2);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.budget-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.budget-category { font-size: 14px; font-weight: 700; }
.budget-amounts { font-size: 13px; color: var(--text2); }
.budget-progress { background: var(--bg); border-radius: 6px; height: 8px; overflow: hidden; }
.budget-fill { height: 8px; border-radius: 6px; transition: width 0.6s; }

/* ─── 설정/사용자 관리 ─── */
.user-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.user-row:last-child { border-bottom: none; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white;
  flex-shrink: 0;
}
.user-info { flex: 1; }
.user-name { font-size: 14px; font-weight: 700; }
.user-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.badge-admin { background: rgba(108,99,255,0.2); color: var(--accent); }
.badge-inactive { background: rgba(255,77,109,0.15); color: var(--red); }

/* ─── 로그인 ─── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 26px; font-weight: 800; }
.login-logo p { color: var(--text2); font-size: 14px; margin-top: 6px; }
.login-error {
  background: rgba(255,77,109,0.1);
  border: 1px solid rgba(255,77,109,0.25);
  color: var(--red);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ─── 토스트 알림 ─── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  min-width: 200px;
  animation: slideIn 0.2s ease;
}
.toast.success { border-color: rgba(0,229,160,0.3); color: var(--green); }
.toast.error { border-color: rgba(255,77,109,0.3); color: var(--red); }
@keyframes slideIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

/* ─── 추가 태그 ─── */
.added-tag { display:inline-flex; align-items:center; gap:6px; background:rgba(0,229,160,0.1); border:1px solid rgba(0,229,160,0.25); color:var(--green); border-radius:6px; padding:2px 8px; font-size:11px; font-weight:700; margin-left:8px; }

/* ─── 반응형 ─── */
@media (max-width: 768px) {
  .header { padding: 16px 20px; }
  .month-tabs { padding: 14px 20px; }
  .main { padding: 20px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .card-amount { font-size: 20px; }
}
