:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f1ef;
  --surface-3: #ececea;
  --text: #111112;
  --muted: #747478;
  --muted-2: #a4a4a8;
  --line: rgba(17, 17, 18, 0.08);
  --line-strong: rgba(17, 17, 18, 0.14);
  --press: rgba(17, 17, 18, 0.055);
  --income-day: rgba(17, 17, 18, 0.04);
  --selected: #111112;
  --selected-text: #ffffff;
  --backdrop: rgba(0, 0, 0, 0.26);
  --shadow: 0 -14px 40px rgba(0, 0, 0, 0.10);
  --ease: cubic-bezier(.22, .78, .26, 1);
  --danger: #2b2b2d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0c;
    --surface: #141416;
    --surface-2: #1b1b1e;
    --surface-3: #202024;
    --text: #f5f5f4;
    --muted: #9a9aa0;
    --muted-2: #6f6f76;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --press: rgba(255, 255, 255, 0.07);
    --income-day: rgba(255, 255, 255, 0.045);
    --selected: #f5f5f4;
    --selected-text: #111112;
    --backdrop: rgba(0, 0, 0, 0.56);
    --shadow: 0 -14px 48px rgba(0, 0, 0, 0.34);
    --danger: #d7d7d9;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "SF Pro Text",
    system-ui,
    sans-serif;
  overscroll-behavior: none;
}

body {
  min-height: 100svh;
  display: flex;
  justify-content: center;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app {
  width: 100%;
  max-width: 440px;
  min-height: 100svh;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding:
    max(18px, env(safe-area-inset-top))
    18px
    max(18px, env(safe-area-inset-bottom));
}

.app::-webkit-scrollbar {
  display: none;
}


.topbar {
  min-height: 44px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  flex: 0 0 auto;
}

.month-heading {
  min-width: 0;
}

.month-name {
  margin: 0;
  font-size: 28px;
  line-height: 1.03;
  font-weight: 680;
  letter-spacing: -0.04em;
}

.year {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 520;
  letter-spacing: -0.01em;
}

.today-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 0 7px 14px;
  margin-top: 1px;
  font-size: 12px;
  line-height: 1;
  font-weight: 620;
  letter-spacing: -0.01em;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition:
    opacity 150ms ease,
    transform 150ms ease,
    color 120ms ease;
}

.today-button.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.today-button:active {
  color: var(--text);
}

.summary {
  margin: 8px 0 22px;
  flex: 0 0 auto;
}

.summary-with-trend {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(138px, 42%);
  align-items: end;
  gap: 18px;
}

.summary-copy {
  min-width: 0;
}

.summary-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 540;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.summary-value {
  font-variant-numeric: tabular-nums;
  font-size: clamp(36px, 10vw, 46px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.055em;
  white-space: nowrap;
  transition:
    opacity 140ms ease,
    transform 180ms var(--ease);
}

.summary-value.updating {
  opacity: .42;
  transform: translateY(2px);
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: max(24px, calc(14px + env(safe-area-inset-bottom)));
  transform: translate(-50%, 12px);
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 620;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 150ms ease,
    transform 180ms var(--ease);
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 370px) {
  .summary-with-trend {
    grid-template-columns: minmax(0, 1fr) minmax(118px, 39%);
    gap: 12px;
  }

  .summary-value {
    font-size: 36px;
  }
}

@media (min-width: 700px) {
  body {
    padding: 20px 0;
  }

  .app {
    min-height: min(900px, calc(100svh - 40px));
    border: 1px solid var(--line);
    border-radius: 28px;
  }
}

@media (max-width: 360px) {
  .app {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
