:root {
  /* ---- 배경 / 표면 ---- */
  --bg: #f2f4fc;
  --surface: #ffffff;
  --surface-alt: #f8f9fe;
  --border: #ecebf7;

  /* ---- 텍스트 ---- */
  --text: #2e2a47;
  --text-muted: #9896ad;
  --text-faint: #c2c0d6;

  /* ---- 브랜드 / 포인트 ---- */
  --primary: #6c8cff;
  --primary-soft: #dde5ff;

  /* ---- 카테고리 파스텔 팔레트 ---- */
  --pink: #ffe1e7;
  --pink-strong: #ff8fa8;
  --mint: #d8f7e8;
  --mint-strong: #3fce9c;
  --yellow: #fff3c4;
  --yellow-strong: #ffc93c;
  --purple: #e8e2fb;
  --purple-strong: #9c88f5;

  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 8px 24px rgba(108, 108, 158, 0.08);
  --shadow-fab: 0 10px 24px rgba(255, 143, 168, 0.45);

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---- 앱 셸 ---- */
.app-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

.screen {
  padding: 20px 20px 108px;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

/* ---- 하단 탭바 ---- */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -6px 18px rgba(108, 108, 158, 0.06);
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 14px;
  transition: color 0.15s ease, background 0.15s ease;
}

.bottom-nav__item.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

.bottom-nav__item svg {
  display: block;
}

/* ---- 서브페이지 헤더 ---- */
.page-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 18px;
}

.page-header__back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  flex-shrink: 0;
}

.page-header__title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.page-header__title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.page-header__badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--pink-strong);
  background: var(--pink);
  padding: 4px 10px;
  border-radius: 999px;
}

.page-header__right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- FAB ---- */
.fab {
  position: fixed;
  right: max(20px, calc(50vw - 195px));
  bottom: 92px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9fb3, #ff8fa8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  z-index: 30;
  transition: transform 0.12s ease;
}

.fab:active {
  transform: scale(0.94);
}

/* ---- 도넛 차트 (conic-gradient, 라이브러리 불필요) ---- */
.donut {
  position: relative;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut::after {
  content: '';
  position: absolute;
  inset: 22%;
  background: var(--surface);
  border-radius: 50%;
}

.donut__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  text-align: center;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.legend__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend__name {
  flex: 1;
}

/* =======================================================
   대시보드
   ======================================================= */
.dashboard__greeting {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dashboard__hello {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 4px;
}

.dashboard__bell {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dashboard__total {
  background: linear-gradient(150deg, #ffeef1 0%, #eef1ff 100%);
  margin-bottom: 16px;
}

.dashboard__total-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dashboard__cloud {
  font-size: 22px;
}

.dashboard__total-amount {
  font-size: 28px;
  font-weight: 800;
  display: block;
  margin-bottom: 14px;
}

.dashboard__progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard__progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.dashboard__progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8fa6ff, var(--primary));
}

.dashboard__progress-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.dashboard__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.dashboard__cat-card {
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dashboard__cat-label {
  font-size: 13px;
  font-weight: 700;
}

.dashboard__cat-amount {
  font-size: 17px;
  font-weight: 800;
}

.dashboard__cat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.dashboard__recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard__more {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.dashboard__recent-list {
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.list-item__icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.list-item__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.list-item__amount-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 14px;
}

.list-item__amount--negative {
  color: var(--pink-strong);
}

/* =======================================================
   생활비
   ======================================================= */
.living__summary {
  background: linear-gradient(150deg, #fff0f3, #ffffff);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.living__amount {
  font-size: 24px;
  font-weight: 800;
}

.living__ratio {
  font-size: 12px;
  color: var(--pink-strong);
  font-weight: 700;
}

.living__ratio-card {
  margin-bottom: 18px;
}

.living__chart-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.living__list {
  margin: 4px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.add-btn {
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
}

.add-btn--pink {
  background: var(--pink);
  color: var(--pink-strong);
}

.add-btn--mint {
  background: var(--mint);
  color: var(--mint-strong);
}

.add-btn--purple {
  background: var(--purple);
  color: var(--purple-strong);
}

/* =======================================================
   고정비
   ======================================================= */
.fixed-page__summary {
  background: linear-gradient(150deg, #f0fdf6, #ffffff);
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fixed-page__amount {
  font-size: 24px;
  font-weight: 800;
}

.fixed-page__ratio-label {
  font-size: 12px;
  color: var(--mint-strong);
  font-weight: 700;
  margin-bottom: 8px;
}

.fixed-page__progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.fixed-page__progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8ee9c0, var(--mint-strong));
}

.fixed-page__section {
  margin-bottom: 18px;
}

.fixed-page__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.fixed-page__more {
  font-size: 12px;
  color: var(--text-muted);
}

.fixed-page__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fixed-page__dday {
  color: var(--mint-strong);
  font-weight: 700;
}

/* =======================================================
   할부
   ======================================================= */
.tab-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab-group button {
  flex: 1;
  padding: 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-card);
}

.tab-group button.is-active {
  color: #fff;
}

.tab-group--purple button.is-active {
  background: var(--purple-strong);
}

.tab-group--yellow button.is-active {
  background: var(--yellow-strong);
}

.installment__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.installment__card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.installment__head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.installment__icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.installment__progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.installment__progress-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.installment__progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b7a6ff, var(--purple-strong));
}

.installment__progress-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--purple-strong);
}

.installment__count {
  font-size: 12px;
  margin-top: -4px;
}

.installment__footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  font-size: 13px;
}

.installment__footer > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* =======================================================
   경조사
   ======================================================= */
.event-page__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.event-page__card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-page__head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.event-page__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.event-page__title-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.event-page__net {
  color: var(--pink-strong);
  font-size: 15px;
}

.event-page__row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding-left: 54px;
}

/* =======================================================
   달력
   ======================================================= */
.calendar-page__card {
  margin-bottom: 18px;
}

.calendar-page__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 15px;
}

.calendar-page__nav button {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-alt);
}

.calendar-page__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.calendar-page__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-page__cell {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text);
}

.calendar-page__cell.is-muted {
  color: var(--text-faint);
}

.calendar-page__cell.is-today {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.calendar-page__cell.is-selected {
  background: var(--purple-strong);
  color: #fff;
  font-weight: 700;
}

.calendar-page__dot {
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--pink-strong);
}

.calendar-page__event-list {
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-page__event-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
}

.calendar-page__event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-page__event-label {
  flex: 1;
}

/* =======================================================
   통계
   ======================================================= */
.stats-page__card {
  margin-bottom: 16px;
}

.stats-page__chart-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stats-page__bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-page__bar-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.stats-page__bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.stats-page__bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8fc7ff, var(--primary));
}

.stats-page__bar-amount {
  font-weight: 700;
  white-space: nowrap;
}

/* =======================================================
   설정
   ======================================================= */
.settings-page__header h1 {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 16px;
}

.settings-page__profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  background: linear-gradient(150deg, #fff0f3, #eef1ff);
}

.settings-page__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.settings-page__group {
  margin-bottom: 18px;
}

.settings-page__list {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.settings-page__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.settings-page__list li:last-child .settings-page__item {
  border-bottom: none;
}

.settings-page__item span {
  flex: 1;
  text-align: left;
}

.settings-page__chevron {
  color: var(--text-faint);
}
