:root {
  /* palette */
  --ink: #12121a;
  --ink-soft: #2b2b39;
  --muted: #6a6b82;
  --paper: #fdfaf2;
  --paper-2: #f4eedc;
  --cream: #faf4e3;
  --line: #e6dfc7;

  --money: #1f8a58;
  --money-bg: #e4f5e9;
  --loss: #c0392b;
  --loss-bg: #fde4e1;
  --gold: #c6a14a;

  --you-color: #e66a4a; /* warm terracotta */
  --you-color-bg: #fde6dd;
  --ai-color: #4f79e0; /* dusty cobalt */
  --ai-color-bg: #e2eafa;

  /* category accents (pastel) */
  --c-career: #8fb6ff;
  --c-finance: #77d9ae;
  --c-health: #f7a6b7;
  --c-car: #f7c27a;
  --c-home: #caa7f0;
  --c-family: #f5b2d1;
  --c-pet: #ffb781;
  --c-education: #a9a7f2;
  --c-food: #d8e87a;
  --c-entertainment: #f1a0d9;
  --c-travel: #8edcdc;
  --c-legal: #b6bac8;
  --c-disaster: #f07a74;
  --c-luck: #f3d774;
  --c-nature: #9bd9a3;
  --c-shopping: #8fdad0;
  --c-default: #dcd4be;

  /* typography */
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", "Georgia", serif;

  /* radii / shadows */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;
  --shadow-sm: 0 2px 6px rgba(20, 20, 40, 0.06);
  --shadow-md: 0 10px 24px -8px rgba(20, 20, 40, 0.18);
  --shadow-lg: 0 30px 60px -20px rgba(20, 20, 40, 0.35);

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

kbd {
  font-family: "SFMono-Regular", ui-monospace, monospace;
  font-size: 0.82em;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--cream);
}

a {
  color: var(--ink-soft);
  text-underline-offset: 3px;
}

/* mood backdrop: a hue-shifting gradient that changes as the month progresses */
.mood-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1100px 800px at 20% -10%, #fce9c7 0%, transparent 55%),
    radial-gradient(900px 700px at 110% 20%, #cee4fb 0%, transparent 55%),
    radial-gradient(900px 900px at 50% 120%, #ffe1d0 0%, transparent 60%),
    var(--paper);
  transition: filter 800ms var(--ease-out);
  --mood-hue: 0deg;
  filter: hue-rotate(var(--mood-hue));
  pointer-events: none;
}

/* app layout */
.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 32px) 60px;
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
}

/* top bar */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.topbar__day {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  background: var(--cream);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.topbar__day-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 600;
}
.topbar__day-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
}
.topbar__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand__mark {
  font-size: 30px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
.brand__text h1 {
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
}
.brand__text p {
  margin: 2px 0 0;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* buttons */
.primary-btn,
.ghost-btn,
.icon-btn {
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  transition: transform 180ms var(--ease-out),
    background 180ms var(--ease-out), border-color 180ms var(--ease-out),
    box-shadow 180ms var(--ease-out);
  background: transparent;
}
.primary-btn {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-sm);
}
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.ghost-btn {
  background: var(--cream);
  border-color: var(--line);
}
.ghost-btn:hover {
  transform: translateY(-1px);
  background: #fff;
}
.icon-btn {
  padding: 8px 12px;
  background: var(--cream);
  border-color: var(--line);
  font-size: 16px;
  line-height: 1;
}
.icon-btn:hover {
  background: #fff;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* attribution */
.attribution {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-align: center;
}
.attribution p {
  margin: 0;
}
.attribution__credit {
  font-weight: 600;
  color: var(--ink-soft);
}
.attribution__credit a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}
.attribution__credit a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.attribution__meta a {
  color: var(--muted);
}

/* End-of-month pacing banner */
.mg-banner {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 45;
  opacity: 0;
  transition: opacity 220ms var(--ease-out);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(40px, 6vw, 72px);
  color: #fff;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  letter-spacing: 0.02em;
  background: radial-gradient(ellipse at center, rgba(20, 20, 40, 0.4), transparent 65%);
}
.mg-banner.is-visible {
  opacity: 1;
  animation: banner-pulse 900ms var(--ease-out);
}
@keyframes banner-pulse {
  0%   { transform: scale(0.92); letter-spacing: 0.12em; }
  40%  { transform: scale(1.02); letter-spacing: 0.02em; }
  100% { transform: scale(1); }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* small screens */
@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand actions" "brand day";
    row-gap: 6px;
  }
  .topbar .brand { grid-area: brand; }
  .topbar .topbar__day { grid-area: day; justify-self: end; }
  .topbar .topbar__actions { grid-area: actions; }
}
