/* Statistics page: a compact, glanceable monthly report. */
body.stats-page-active {
  overflow: hidden;
  background: #f7f1e8;
}

/* Keep the illustration behind the entire report, including the browser safe area. */
body.stats-page-active.stats-detail-active {
  background-color: #fffaf0;
  background-image: var(--stats-overview-banner, url("assets/stats/overview-month-banner.png"));
  background-position: center top;
  background-repeat: no-repeat;
  background-size: 100% auto;
}

body.stats-page-active .app-shell {
  width: min(100%, 760px);
  height: 100svh;
  min-height: 100svh;
  max-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: max(14px, var(--safe-top)) 14px calc(92px + var(--safe-bottom));
  background: #fcf8f1;
}

body.stats-page-active #appShell > .topbar,
body.stats-page-active #appShell > .chat-overview-strip,
body.stats-page-active #appShell > .footer-note { display: none; }

body.stats-page-active #statsPage {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  padding: 2px 10px 14px;
  color: #30271d;
  background: #fcf8f1;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
body.stats-page-active #statsPage::-webkit-scrollbar { display: none; }

/* The statistics area has a lightweight landing screen and a separate report screen. */
body.stats-page-active #statsPage > .stats-home-view {
  display: flex;
  flex: 0 0 auto;
  min-height: 0;
  flex-direction: column;
  padding: 0 2px 18px;
}
body.stats-page-active:not(.stats-detail-active) #statsPage > .stats-report-view { display: none; }
body.stats-page-active.stats-detail-active #statsPage > .stats-home-view { display: none; }
body.stats-page-active.stats-detail-active #statsPage > .stats-report-view {
  display: flex;
  flex: 0 0 auto;
  min-height: 0;
  flex-direction: column;
}

.stats-home-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 2px 2px 0;
}
.stats-home-profile { display: flex; align-items: center; min-width: 0; gap: 13px; }
.stats-home-avatar {
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  overflow: hidden;
  background: #fff4d8;
  border: 1px solid #f2dfb8;
  border-radius: 50%;
}
.stats-home-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.stats-home-profile-copy { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.stats-home-profile-copy strong { color: #30271d; font-size: 20px; font-weight: 800; letter-spacing: -.05em; }
.stats-home-profile-copy span { color: #938d85; font-size: 12px; font-variant-numeric: tabular-nums; }
.stats-home-settings {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #39342e;
  background: transparent;
  border: 0;
  border-radius: 50%;
}
.stats-home-settings span { font-size: 25px; line-height: 1; }
.stats-home-settings:focus-visible { outline: 3px solid rgba(239, 158, 24, .3); outline-offset: 2px; }
.stats-home-banner {
  display: block;
  width: 100%;
  margin: 14px 0 16px;
  padding: 0;
  overflow: hidden;
  background: #fff4d8;
  border: 0;
  border-radius: 23px;
  box-shadow: 0 10px 24px rgba(117, 78, 24, .08);
}
.stats-home-banner img { display: block; width: 100%; height: auto; aspect-ratio: 1929 / 815; object-fit: cover; }
.stats-home-banner:focus-visible { outline: 3px solid rgba(239, 158, 24, .32); outline-offset: 3px; }
.stats-home-actions {
  display: flex;
  flex-direction: column;
  padding: 7px 16px;
  background: rgba(255, 253, 250, .94);
  border: 1px solid #f0e7db;
  border-radius: 23px;
  box-shadow: 0 10px 24px rgba(92, 66, 38, .045);
}
.stats-home-action {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 58px;
  gap: 13px;
  padding: 6px 0;
  color: #30271d;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
}
.stats-home-action + .stats-home-action { border-top: 1px solid #f3ece3; }
.stats-home-action > img:first-child { display: block; width: 31px; height: 31px; flex: 0 0 31px; object-fit: contain; }
.stats-home-action > span { flex: 1 1 auto; min-width: 0; }
.stats-home-action .stats-home-chevron { width: 18px; height: 18px; flex: 0 0 18px; opacity: .58; transform: rotate(-90deg); }
.stats-home-action:active { background: #fcf4e7; }
.stats-home-action:focus-visible { outline: 3px solid rgba(239, 158, 24, .24); outline-offset: -2px; }

.stats-detail-back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: 2px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
}
.stats-detail-back img { display: block; width: 25px; height: 25px; }
.stats-detail-back:focus-visible { outline: 3px solid rgba(239, 158, 24, .3); outline-offset: 1px; }

body.stats-page-active .stats-heading {
  position: relative;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 8px;
  padding: 0 2px;
}
body.stats-page-active .stats-heading > div { position: absolute; left: 50%; transform: translateX(-50%); }
body.stats-page-active .stats-heading h2 {
  margin: 0;
  color: #191713;
  font-size: clamp(27px, 7vw, 38px);
  font-weight: 800;
  letter-spacing: -.07em;
}
body.stats-page-active .stats-current-button { color: #8c857c; background: transparent; border-color: #eee5d8; }

body.stats-page-active .stats-month-switcher {
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) 38px 38px;
  gap: 4px;
  margin: 0 0 10px;
  padding: 0;
  background: transparent;
  border: 0;
}
body.stats-page-active .stats-month-picker {
  grid-column: 1;
  display: flex;
  align-items: center;
  min-height: 44px;
  width: fit-content;
  padding: 0 19px;
  text-align: left;
  background: #fffdfa;
  border: 1px solid #f0e5d6;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(103, 74, 39, .04);
}
body.stats-page-active .stats-month-picker span {
  color: #241f1a;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.04em;
}
body.stats-page-active .stats-month-picker::after {
  width: 9px;
  height: 9px;
  margin: 0 0 5px 17px;
  content: "";
  border-right: 3px solid #27231e;
  border-bottom: 3px solid #27231e;
  transform: rotate(45deg);
}
body.stats-page-active .stats-month-arrow {
  grid-row: 1;
  width: 38px;
  height: 44px;
  color: #97999a;
  font-size: 34px;
  font-weight: 300;
}
body.stats-page-active #statsPrevMonth { grid-column: 2; }
body.stats-page-active #statsNextMonth { grid-column: 3; }

.stats-view-tabs {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 11px;
  padding: 4px;
  background: #f6eee3;
  border-radius: 999px;
}
.stats-view-button {
  min-height: 40px;
  padding: 0 8px;
  color: #7d7a76;
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.04em;
}
.stats-view-button.is-active {
  color: #30271d;
  background: #fff;
  box-shadow: 0 5px 14px rgba(99, 73, 47, .09);
}

.stats-summary-card,
body.stats-page-active .trend-card,
body.stats-page-active .category-card {
  flex: 0 0 auto;
  background: #fffdfa;
  border: 1px solid #f0e7db;
  border-radius: 27px;
  box-shadow: 0 9px 24px rgba(92, 66, 38, .045);
}
.stats-summary-card {
  display: grid;
  grid-template-columns: minmax(150px, .95fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 13px;
  min-height: 180px;
  margin-bottom: 11px;
  padding: 12px 13px;
}
.stats-donut-wrap {
  position: relative;
  width: min(100%, 150px);
  aspect-ratio: 1;
  margin: 0 auto;
}
.stats-donut { width: 100%; height: 100%; }
.stats-donut svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.stats-donut circle { fill: none; }
.stats-donut-track { stroke: #f0e8de; stroke-width: 22; }
.stats-donut-segment { stroke-width: 22; stroke-linecap: butt; }
.stats-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.stats-donut-center span,
.stats-donut-center small { color: #85827e; font-size: 12px; }
.stats-donut-center strong {
  margin-top: 5px;
  color: #211c17;
  font-size: clamp(21px, 6vw, 27px);
  line-height: 1;
  letter-spacing: -.06em;
  font-variant-numeric: tabular-nums;
}
.stats-donut-center small { margin-top: 5px; }
.stats-category-legend { min-width: 0; }
.stats-legend-row {
  display: grid;
  grid-template-columns: 9px 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 47px;
  padding: 3px 0;
  color: #30271d;
  text-align: left;
  background: transparent;
  border: 0;
}
.stats-legend-row + .stats-legend-row { border-top: 1px solid #f3ece3; }
.stats-legend-mark { width: 9px; height: 9px; background: var(--legend-color); border-radius: 50%; }
.stats-legend-row .bill-art { display: grid; place-items: center; width: 32px; height: 32px; overflow: hidden; background: #faf4e8; border-radius: 10px; }
.stats-legend-row .bill-art img { display: block; width: 121%; height: 121%; object-fit: contain; }
.stats-legend-name { min-width: 0; overflow: hidden; font-size: 16px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.stats-legend-percent { color: #8e8a83; font-size: 14px; font-variant-numeric: tabular-nums; }
.stats-legend-row strong { color: #2a241f; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats-empty-inline { display: flex; flex-direction: column; gap: 7px; padding: 18px 5px; color: #85817b; }
.stats-empty-inline strong { color: #332b23; font-size: 15px; }
.stats-empty-inline span { font-size: 12px; line-height: 1.45; }
body.stats-page-active .stats-summary-card.is-empty { grid-template-columns: minmax(145px, .95fr) minmax(0, 1.05fr); }
body.stats-page-active .stats-summary-card.is-empty .stats-empty-inline { gap: 5px; padding: 8px 2px; }
body.stats-page-active .stats-summary-card.is-empty .stats-empty-inline strong { font-size: 16px; }
body.stats-page-active .stats-summary-card.is-empty .stats-empty-inline span { font-size: 12px; }

body.stats-page-active .trend-card,
body.stats-page-active .category-card { margin-bottom: 10px; padding: 12px 15px; }
body.stats-page-active .trend-card { margin-bottom: 11px; padding: 14px 15px; }
body.stats-page-active .trend-card-title { align-items: center; }
body.stats-page-active .trend-card .card-title-row h3,
body.stats-page-active .category-card .card-title-row h3 {
  color: #2b241d;
  font-size: 20px;
  letter-spacing: -.055em;
}
body.stats-page-active .trend-card .card-title-row p,
body.stats-page-active .category-card .card-title-row p { margin-top: 5px; color: #a19a92; font-size: 12px; }
body.stats-page-active .trend-legend { font-size: 11px; }
body.stats-page-active .trend-legend span::before { width: 9px; height: 9px; }
body.stats-page-active .stats-trend-chart { height: 110px; min-height: 110px; margin-top: 11px; }
body.stats-page-active .stats-trend-chart svg { height: 110px; min-height: 0; }
body.stats-page-active .stats-trend-chart > .stats-empty-state,
body.stats-page-active .category-bars > .stats-empty-state {
  min-height: 94px;
  height: 94px;
  padding: 8px 12px;
  background: #faf7f1;
  border: 1px solid #f3eadf;
  border-radius: 16px;
}
body.stats-page-active .stats-trend-chart > .stats-empty-state > span,
body.stats-page-active .category-bars > .stats-empty-state > span { width: 30px; height: 30px; margin-bottom: 6px; font-size: 15px; }
body.stats-page-active .stats-trend-chart > .stats-empty-state strong,
body.stats-page-active .category-bars > .stats-empty-state strong { font-size: 14px; }
body.stats-page-active .stats-trend-chart > .stats-empty-state p,
body.stats-page-active .category-bars > .stats-empty-state p { margin-top: 4px; font-size: 11px; }
body.stats-page-active .trend-grid line { stroke: #efe9e1; stroke-dasharray: 3 4; }
body.stats-page-active .trend-line { stroke-width: 3.2; }
body.stats-page-active .trend-line.expense { stroke: #7eb68f; }
body.stats-page-active .trend-line.income { stroke: #8d83ed; }
body.stats-page-active .trend-axis-labels { fill: #99938c; font-size: 9px; }

.stats-more-button {
  padding: 5px 0 5px 8px;
  color: #8a877f;
  background: transparent;
  border: 0;
  font-size: 14px;
}
.stats-more-button span { margin-left: 3px; font-size: 22px; vertical-align: -1px; }
body.stats-page-active .category-bars { margin-top: 14px; }
body.stats-page-active .category-row {
  grid-template-columns: minmax(125px, 1fr) minmax(64px, 1.2fr) 76px;
  gap: 11px;
  min-height: 50px;
  padding: 4px 0;
  border-bottom-color: #f2ebe3;
}
body.stats-page-active .category-name { gap: 9px; }
body.stats-page-active .category-name > .bill-art { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; overflow: hidden; background: #faf4e8; border-radius: 12px; }
body.stats-page-active .category-name > .bill-art img { display: block; width: 122%; height: 122%; object-fit: contain; }
body.stats-page-active .category-name b { color: #30271d; font-size: 17px; }
body.stats-page-active .category-name small { margin-top: 4px; color: #a19a92; font-size: 12px; }
body.stats-page-active .bar-track { height: 8px; background: #f3eee7; }
body.stats-page-active .bar-fill { background: #7eb68f; }
body.stats-page-active .category-value { color: #2b241d; font-size: 16px; }
body.stats-page-active .category-empty { min-height: 94px; }

body.stats-page-active #statsPage .stats-overview-card,
body.stats-page-active #statsPage .budget-card,
body.stats-page-active #statsPage .reminder-card,
body.stats-page-active #statsPage .stats-kpi-grid,
body.stats-page-active #statsPage .category-budget-card,
body.stats-page-active #statsPage .tip-card { display: none !important; }

/* Share the statistics navigation across home and its secondary pages. */
#appShell[data-page="home"] { padding-bottom: calc(92px + var(--safe-bottom)); }
#appShell:is([data-page="home"], [data-page="stats"], [data-page="budget"], [data-page="reminders"]) > .nav-dock {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(10px, var(--safe-bottom));
  width: min(calc(100% - 28px), 732px);
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: translateX(-50%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
#appShell:is([data-page="home"], [data-page="stats"], [data-page="budget"], [data-page="reminders"]) > .nav-dock .tabbar {
  min-height: 62px;
  padding: 4px 15px;
  background: #fffdfa;
  border: 1px solid #f0e6d8;
  border-radius: 29px;
  box-shadow: 0 10px 27px rgba(96, 69, 38, .09);
}
#appShell:is([data-page="home"], [data-page="stats"], [data-page="budget"], [data-page="reminders"]) > .nav-dock .tab-button {
  min-height: 51px;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
  color: #8c8c8a;
  font-size: 15px;
  font-weight: 720;
}
#appShell:is([data-page="home"], [data-page="stats"], [data-page="budget"], [data-page="reminders"]) > .nav-dock .tab-button.is-active { color: #ef9e18; font-weight: 820; }
#appShell:is([data-page="home"], [data-page="stats"], [data-page="budget"], [data-page="reminders"]) > .nav-dock .tab-button::after { display: none; }
#appShell:is([data-page="home"], [data-page="stats"], [data-page="budget"], [data-page="reminders"]) > .nav-dock .tab-entry-button { color: #3f372f; }
#appShell:is([data-page="home"], [data-page="stats"], [data-page="budget"], [data-page="reminders"]) > .nav-dock .tab-entry-button .tab-icon { display: none; }
#appShell:is([data-page="home"], [data-page="stats"], [data-page="budget"], [data-page="reminders"]) > .nav-dock .tab-entry-button::before { display: none; }

@media (max-width: 410px) {
  body.stats-page-active .app-shell { padding-inline: 10px; }
  body.stats-page-active #statsPage { padding-inline: 6px; }
  body.stats-page-active #statsPage > .stats-home-view { padding-inline: 1px; }
  .stats-home-account { min-height: 70px; }
  .stats-home-avatar { width: 58px; height: 58px; flex-basis: 58px; }
  .stats-home-profile-copy strong { font-size: 19px; }
  .stats-home-banner { margin-top: 12px; border-radius: 21px; }
  .stats-home-actions { padding-inline: 14px; border-radius: 21px; }
  .stats-home-action { min-height: 56px; font-size: 15px; }
  .stats-summary-card { grid-template-columns: minmax(126px, .88fr) minmax(0, 1.2fr); gap: 7px; padding-inline: 10px; }
  .stats-donut-wrap { width: 145px; }
  .stats-legend-row { grid-template-columns: 8px 30px minmax(0, 1fr) auto; gap: 5px; }
  .stats-legend-row .bill-art { width: 30px; height: 30px; }
  .stats-legend-name { font-size: 14px; }
  .stats-legend-percent { font-size: 12px; }
  .stats-legend-row strong { font-size: 13px; }
  .stats-legend-row { grid-template-columns: 8px 30px minmax(0, 1fr) auto auto; }
  body.stats-page-active .category-row { grid-template-columns: minmax(110px, 1fr) minmax(45px, 1.2fr) 67px; gap: 7px; }
  body.stats-page-active .category-name b { font-size: 15px; }
  body.stats-page-active .category-value { font-size: 14px; }
}

/* Budget and reminder management use full secondary pages; forms remain lightweight sheets. */
body.budget-page-active,
body.reminders-page-active {
  overflow: hidden;
  background: #f7f1e8;
}

body.budget-page-active .app-shell,
body.reminders-page-active .app-shell {
  width: min(100%, 760px);
  height: 100svh;
  min-height: 100svh;
  max-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: max(14px, var(--safe-top)) 14px calc(92px + var(--safe-bottom));
  background: #fcf8f1;
}

body.budget-page-active #appShell > .topbar,
body.budget-page-active #appShell > .chat-overview-strip,
body.budget-page-active #appShell > .footer-note,
body.reminders-page-active #appShell > .topbar,
body.reminders-page-active #appShell > .chat-overview-strip,
body.reminders-page-active #appShell > .footer-note { display: none; }

body.budget-page-active #budgetPage,
body.reminders-page-active #remindersPage {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  padding: 2px 8px 14px;
  color: #30271d;
  background: #fcf8f1;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.secondary-page-header {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  flex: 0 0 auto;
  min-height: 64px;
  gap: 8px;
}
.secondary-page-back {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
}
.secondary-page-back img { display: block; width: 25px; height: 25px; opacity: .82; }
.secondary-page-back:focus-visible { outline: 3px solid rgba(239, 158, 24, .3); outline-offset: 1px; }
.secondary-page-title { min-width: 0; }
.secondary-page-title .section-kicker { font-size: 9px; }
.secondary-page-title h2 { margin: 4px 0 0; color: #211c17; font-size: clamp(25px, 6vw, 32px); line-height: 1; letter-spacing: -.07em; }
.secondary-page-action,
.secondary-inline-action {
  min-height: 38px;
  padding: 0 12px;
  color: #9a681d;
  background: #fff4dc;
  border: 1px solid #f1ddbb;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.secondary-page-action:active,
.secondary-inline-action:active { background: #ffebc0; }

.secondary-page-scroll {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 11px;
  padding: 0 2px 8px;
  overflow-y: auto;
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.secondary-page-scroll::-webkit-scrollbar { display: none; }
.secondary-month-switcher {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.secondary-month-arrow {
  display: grid;
  place-items: center;
  width: 38px;
  height: 42px;
  padding: 0;
  color: #97999a;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}
.secondary-month-arrow:disabled { opacity: .32; }
.secondary-month-picker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  width: fit-content;
  min-width: 142px;
  padding: 0 18px;
  background: #fffdfa;
  border: 1px solid #f0e5d6;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(103, 74, 39, .04);
}
.secondary-month-picker span { color: #241f1a; font-size: 16px; font-weight: 700; letter-spacing: -.04em; }
.secondary-month-picker::after { width: 8px; height: 8px; margin: 0 0 5px 12px; content: ""; border-right: 2px solid #6d6861; border-bottom: 2px solid #6d6861; transform: rotate(45deg); }
.secondary-month-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.secondary-summary-card,
.secondary-list-card,
.reminder-secondary-summary {
  flex: 0 0 auto;
  background: #fffdfa;
  border: 1px solid #f0e7db;
  border-radius: 24px;
  box-shadow: 0 9px 24px rgba(92, 66, 38, .045);
}
.secondary-summary-card { padding: 18px 17px 15px; }
.secondary-summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.secondary-card-label,
.secondary-summary-status span,
.secondary-summary-meta { color: #969087; font-size: 12px; }
.secondary-summary-head strong { display: block; margin-top: 5px; color: #2a2118; font-size: 28px; line-height: 1; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.secondary-summary-status { text-align: right; }
.secondary-summary-status strong { color: #8d6b3f; font-size: 22px; }
.secondary-progress { height: 9px; margin-top: 17px; overflow: hidden; background: #f2ede5; border-radius: 999px; }
.secondary-progress > span { display: block; width: 0; height: 100%; background: #e5a33a; border-radius: inherit; transition: width 180ms ease; }
.budget-secondary-summary.is-warning .secondary-progress > span { background: #df8b45; }
.budget-secondary-summary.is-over .secondary-progress > span { background: #d87462; }
.secondary-summary-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; }
.secondary-summary-meta strong { color: #474038; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.budget-secondary-summary.is-over .secondary-summary-meta span:last-child strong { color: #c66757; }

.secondary-list-card { padding: 17px 15px 13px; }
.secondary-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.secondary-card-heading h3 { margin: 0; color: #2b241d; font-size: 20px; letter-spacing: -.055em; }
.secondary-card-heading p { margin: 5px 0 0; color: #a19a92; font-size: 12px; line-height: 1.45; }
.secondary-category-list { margin-top: 13px; }
.secondary-category-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 10px; padding: 13px 0; border-top: 1px solid #f3ece3; }
.secondary-category-item:first-child { border-top: 0; }
.secondary-category-item-main { display: flex; align-items: center; min-width: 0; gap: 10px; }
.secondary-category-item-main .bill-art { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; overflow: hidden; background: #faf4e8; border-radius: 13px; }
.secondary-category-item-main .bill-art img { display: block; width: 123%; height: 123%; object-fit: contain; }
.secondary-category-item-main > div { min-width: 0; }
.secondary-category-item-main strong,
.secondary-category-item-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secondary-category-item-main strong { color: #30271d; font-size: 15px; }
.secondary-category-item-main span { margin-top: 4px; color: #9a948c; font-size: 11px; }
.secondary-category-item-side { display: flex; align-items: baseline; gap: 3px; color: #9a948c; white-space: nowrap; }
.secondary-category-item-side strong { color: #3b332b; font-size: 15px; font-variant-numeric: tabular-nums; }
.secondary-category-item-side span { font-size: 11px; }
.secondary-category-track { grid-column: 1 / -1; height: 7px; overflow: hidden; background: #f3eee7; border-radius: 999px; }
.secondary-category-track > span { display: block; width: 0; height: 100%; background: #7eb68f; border-radius: inherit; }
.secondary-category-item.is-warning .secondary-category-track > span { background: #e3a245; }
.secondary-category-item.is-over .secondary-category-track > span { background: #d87462; }
.secondary-category-item-foot { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; gap: 8px; color: #9a948c; font-size: 11px; }
.secondary-category-item-foot > span:last-child { display: flex; align-items: center; gap: 5px; }
.secondary-category-item-foot button { min-height: 32px; padding: 0 7px; color: #9a681d; background: #fff8ec; border: 1px solid #f2e3cd; border-radius: 9px; font-size: 11px; }
.secondary-category-item-foot button:last-child { color: #b86b5b; background: #fff6f3; border-color: #f3ded8; }

.secondary-empty-state { display: flex; flex-direction: column; align-items: center; padding: 27px 12px 22px; color: #9a948c; text-align: center; }
.secondary-empty-state > span { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 10px; color: #d1932c; background: #fff4dc; border-radius: 14px; font-size: 22px; }
.secondary-empty-state strong { color: #3b332b; font-size: 15px; }
.secondary-empty-state p { margin: 6px 0 14px; font-size: 12px; line-height: 1.5; }
.secondary-empty-state button { min-height: 38px; padding: 0 14px; color: #9a681d; background: #fff4dc; border: 1px solid #f1ddbb; border-radius: 11px; font-size: 12px; font-weight: 750; }

.reminder-secondary-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 17px 18px; }
.reminder-secondary-summary > div + div { padding-left: 16px; border-left: 1px solid #f3ece3; }
.reminder-secondary-summary span,
.reminder-secondary-summary strong { display: block; }
.reminder-secondary-summary span { color: #969087; font-size: 12px; }
.reminder-secondary-summary strong { margin-top: 6px; color: #2a2118; font-size: 22px; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.reminder-page-list { margin-top: 13px; }
.reminder-page-list .reminder-item { min-height: 72px; padding: 11px 9px; background: #faf7f1; border-color: #f2ebe2; border-radius: 15px; }
.reminder-page-list .reminder-item + .reminder-item { margin-top: 8px; }
.reminder-page-list .reminder-item-icon { width: 38px; height: 38px; border-radius: 12px; font-size: 16px; }
.reminder-page-list .reminder-item-copy strong { font-size: 14px; }
.reminder-page-list .reminder-item-copy span,
.reminder-page-list .reminder-item-copy .reminder-due { font-size: 11px; }
.reminder-page-list .reminder-item-side > b { font-size: 15px; }
.reminder-page-list .reminder-pay-button,
.reminder-page-list .reminder-more-button { min-height: 32px; font-size: 11px; }
.reminder-secondary-list-card .reminder-empty { padding: 17px 9px; }
.reminder-secondary-list-card .reminder-empty strong { font-size: 13px; }
.reminder-secondary-list-card .reminder-empty p { font-size: 11px; }

/* Monthly/yearly overview screens. The app shell owns the art so the safe area is painted by the same banner background. */
body.stats-page-active.stats-detail-active .app-shell {
  background: transparent !important;
}
body.stats-page-active.stats-detail-active #statsPage { background: transparent !important; padding-top: 0; }
body.stats-page-active.stats-detail-active .stats-report-view > :not(.stats-overview-shell) { display: none !important; }
.stats-overview-shell { min-height: 100%; padding: 12px 8px 30px; color: #2f251b; background: transparent; }
.stats-overview-heading { position: relative; display: flex; align-items: center; justify-content: center; min-height: 48px; }
.stats-overview-heading .stats-detail-back { position: absolute; left: -5px; top: 4px; }
.stats-overview-heading h2 { margin: 0; color: #1d1712; font-size: clamp(27px, 7vw, 38px); font-weight: 800; letter-spacing: -.08em; }
.stats-overview-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: min(100%, 196px); margin: 13px 0 9px; }
.stats-overview-tab { position: relative; min-height: 35px; padding: 0; color: #929497; background: transparent; border: 0; font-size: 19px; font-weight: 750; letter-spacing: -.07em; }
.stats-overview-tab.is-active { color: #201912; }
.stats-overview-tab.is-active::after { position: absolute; left: 50%; bottom: -2px; width: 48px; height: 4px; content: ""; background: #f2a344; border-radius: 99px; transform: translateX(-50%); }
.stats-overview-period { display: grid; grid-template-columns: 29px minmax(0, 1fr) 29px; align-items: center; width: min(100%, 172px); min-height: 42px; margin-top: 11px; background: rgba(255, 255, 255, .8); border-radius: 999px; box-shadow: 0 6px 18px rgba(117, 78, 24, .035); }
.stats-overview-period > button { display: grid; place-items: center; width: 29px; height: 36px; padding: 0; color: #969ba0; background: transparent; border: 0; font-size: 29px; font-weight: 300; line-height: 1; }
.stats-overview-period > button:last-child { color: #8d9295; }
.stats-overview-period label { position: relative; display: flex; align-items: center; justify-content: center; min-height: 36px; }
.stats-overview-period label span { color: #191511; font-size: 17px; font-weight: 700; letter-spacing: -.05em; }
.stats-overview-period label::after { width: 8px; height: 8px; margin: -4px 0 0 11px; content: ""; border-right: 2px solid #2b251f; border-bottom: 2px solid #2b251f; transform: rotate(45deg); }
.stats-overview-period input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.stats-overview-sticky-controls {
  position: sticky;
  z-index: 12;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 -4px;
  padding: 0 4px 9px;
  background: rgba(255, 250, 240, .9);
  -webkit-backdrop-filter: blur(14px) saturate(112%);
  backdrop-filter: blur(14px) saturate(112%);
}
.stats-overview-sticky-controls .stats-overview-tabs { margin-top: 13px; }
.stats-overview-sticky-controls .stats-overview-period { margin-top: 0; }
.stats-overview-month, .stats-overview-year { display: flex; flex-direction: column; gap: 12px; margin-top: 17px; }
.overview-card { flex: 0 0 auto; padding: 17px 16px 16px; background: rgba(255, 255, 255, .93); border: 0; border-radius: 24px; box-shadow: 0 10px 28px rgba(102, 72, 35, .055); }
.overview-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.overview-card-heading h3 { margin: 0; color: #251c15; font-size: 18px; font-weight: 400; letter-spacing: -.055em; }
.overview-card-heading p { margin: 4px 0 0; color: #9a948d; font-size: 12px; }
.overview-card-heading > span { color: #858b91; font-size: 12px; white-space: nowrap; }
.overview-card-heading button { padding: 1px 0 0; color: #858b91; background: transparent; border: 0; font-size: 13px; white-space: nowrap; }
.overview-card-heading button span { margin-left: 5px; font-size: 26px; line-height: .5; vertical-align: -2px; }
.overview-summary-grid { display: grid; grid-template-columns: minmax(145px, .84fr) minmax(0, 1.16fr); align-items: center; gap: 10px; margin-top: 11px; }
.overview-donut-wrap { position: relative; width: min(100%, 190px); aspect-ratio: 1; margin: 0 auto; }
.overview-donut, .overview-donut svg { display: block; width: 100%; height: 100%; }
.overview-donut svg { transform: rotate(-90deg); }
.overview-donut circle { fill: none; }
.overview-donut-track { stroke: #f2eadf; stroke-width: 22; }
.overview-donut-segment { stroke-width: 22; stroke-linecap: butt; }
.overview-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.overview-donut-center span { color: #96989a; font-size: 13px; }
.overview-donut-center strong { margin-top: 5px; color: #211a15; font-size: clamp(17px, 4.6vw, 22px); font-weight: 400; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.overview-category-list { min-width: 0; }
.overview-category-row { display: grid; grid-template-columns: 9px 34px minmax(0, 1fr) auto auto; align-items: center; gap: 6px; width: 100%; min-height: 44px; padding: 3px 0; color: #2b211a; text-align: left; background: transparent; border: 0; border-top: 1px solid #f2ece4; }
.overview-category-row:first-child { border-top: 0; }
.overview-category-dot { width: 9px; height: 9px; background: var(--overview-color); border-radius: 50%; }
.overview-category-row .bill-art { display: grid; place-items: center; width: 32px; height: 32px; overflow: hidden; background: #fff7e3; border-radius: 10px; }
.overview-category-row .bill-art img { display: block; width: 122%; height: 122%; object-fit: contain; }
.overview-category-row strong { min-width: 0; overflow: hidden; font-size: 14px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.overview-category-percent { color: #95999e; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.overview-category-row b { color: #28211b; font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.overview-legend { display: flex; align-items: center; gap: 16px; color: #858b8d; font-size: 14px; white-space: nowrap; }
.overview-legend span::before { display: inline-block; width: 11px; height: 11px; margin-right: 7px; content: ""; border-radius: 50%; vertical-align: -1px; }
.overview-legend .income::before { background: #57bd91; }
.overview-legend .expense::before { background: #ff825f; }
.overview-chart { min-height: 152px; margin-top: 7px; }
.overview-chart svg { display: block; width: 100%; height: 152px; overflow: visible; }
.overview-chart-grid line { stroke: #eeeae4; stroke-dasharray: 4 5; }
.overview-chart-grid text, .overview-chart-axis text { fill: #8f959c; font-size: 11px; }
.overview-chart-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.overview-chart-line.income { stroke: #55bd91; }
.overview-chart-line.expense { stroke: #ff825f; }
.overview-chart-point { fill: #fff; stroke-width: 3; }
.overview-chart-point.income { stroke: #55bd91; }
.overview-chart-point.expense { stroke: #ff825f; }
.overview-ranking-list { margin-top: 8px; }
.overview-ranking-row { display: grid; grid-template-columns: 40px minmax(70px, 1fr) minmax(80px, 1.8fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 56px; padding: 6px 0; color: #2b211a; text-align: left; background: transparent; border: 0; border-top: 1px solid #f3ece4; }
.overview-ranking-row:first-child { border-top: 0; }
.overview-ranking-row .bill-art { display: grid; place-items: center; width: 36px; height: 36px; overflow: hidden; background: #fff7e3; border-radius: 11px; }
.overview-ranking-row .bill-art img { display: block; width: 122%; height: 122%; object-fit: contain; }
.overview-ranking-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.overview-ranking-copy strong { overflow: hidden; font-size: 14px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.overview-ranking-copy small { color: #95999e; font-size: 12px; }
.overview-ranking-track { height: 9px; overflow: hidden; background: #f2eee8; border-radius: 999px; }
.overview-ranking-track i { display: block; height: 100%; border-radius: inherit; }
.overview-ranking-row > b { color: #29221c; font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.overview-empty { padding: 28px 10px 20px; color: #99938b; font-size: 13px; text-align: center; }
.overview-year-totals { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.overview-year-totals > div { min-width: 0; padding: 0 12px; border-left: 1px solid #eee7df; }
.overview-year-totals > div:first-child { padding-left: 0; border-left: 0; }
.overview-year-totals > div:last-child { padding-right: 0; }
.overview-year-totals span, .overview-year-totals strong, .overview-year-totals small { display: block; }
.overview-year-totals span { color: #858b91; font-size: 12px; }
.overview-year-totals strong { margin-top: 6px; color: #26201a; font-size: clamp(14px, 3.8vw, 18px); font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.overview-year-totals strong.income { color: #20a66d; }
.overview-year-totals strong.expense { color: #fa5e53; }
.overview-year-totals small { margin-top: 6px; color: #35ae79; font-size: 10px; white-space: nowrap; }
.overview-year-totals > div:nth-child(2) small { color: #fb6a5b; }
.overview-month-table { margin-top: 10px; }
.overview-month-row { display: grid; grid-template-columns: 1fr 1.15fr 1.15fr 1.15fr 16px; align-items: center; gap: 6px; width: 100%; min-height: 45px; padding: 0; color: #29211b; text-align: left; background: transparent; border: 0; border-top: 1px solid #f1eae2; font-size: 14px; font-variant-numeric: tabular-nums; }
.overview-month-row:first-child { border-top: 0; }
.overview-month-row strong { font-size: 15px; font-weight: 400; }
.overview-month-row span:nth-child(2), .overview-month-row span:nth-child(3), .overview-month-row b { text-align: right; white-space: nowrap; }
.overview-month-row span:nth-child(2) { color: #29211b; }
.overview-month-row span:nth-child(3), .overview-month-row b.expense { color: #fa5e53; }
.overview-month-row b.income { color: #20a66d; }
.overview-month-row > span:last-child { color: #999b9f; font-size: 24px; text-align: right; }
body.stats-page-active.stats-detail-active .stats-overview-shell[data-overview-mode="year"] ~ * { display: none; }

@media (max-width: 520px) {
  .stats-overview-shell { padding-inline: 4px; }
  .stats-overview-tabs { gap: 4px; }
  .overview-card { padding-inline: 14px; }
  .overview-summary-grid { grid-template-columns: minmax(124px, .8fr) minmax(0, 1.2fr); gap: 6px; }
  .overview-category-row { grid-template-columns: 7px 31px minmax(0, 1fr) auto; gap: 5px; }
  .overview-category-row .bill-art { width: 31px; height: 31px; }
  .overview-category-row b { grid-column: 3 / -1; grid-row: 2; justify-self: end; margin-top: -11px; font-size: 13px; }
  .overview-category-row strong { font-size: 13px; }
  .overview-category-percent { font-size: 12px; }
  .overview-ranking-row { grid-template-columns: 39px minmax(64px, .8fr) minmax(75px, 1.6fr) auto; gap: 6px; }
  .overview-ranking-row .bill-art { width: 36px; height: 36px; }
  .overview-ranking-copy strong { font-size: 13px; }
  .overview-ranking-row > b { font-size: 12px; }
  .overview-year-totals > div { padding-inline: 7px; }
  .overview-year-totals strong { font-size: 15px; }
  .overview-year-totals small { overflow: hidden; font-size: 10px; text-overflow: ellipsis; }
}

@media (max-width: 410px) {
  body.budget-page-active .app-shell,
  body.reminders-page-active .app-shell { padding-inline: 10px; }
  body.budget-page-active #budgetPage,
  body.reminders-page-active #remindersPage { padding-inline: 6px; }
  .secondary-page-action { padding-inline: 9px; font-size: 11px; }
  .secondary-category-item-side strong { font-size: 14px; }
  .reminder-page-list .reminder-item { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 8px; }
}
