:root {
  --bg: #f4f2eb;
  --surface: rgba(255, 255, 255, .82);
  --surface-solid: #fff;
  --surface-soft: #f7f7f2;
  --ink: #12201d;
  --muted: #70807b;
  --line: #e3e6de;
  --green: #163f35;
  --green-2: #2d7864;
  --green-3: #4f9c82;
  --lime: #c9f27b;
  --peach: #f5c2a4;
  --rose: #efaaa3;
  --shadow: 0 18px 55px rgba(24, 52, 45, .08);
  --shadow-soft: 0 8px 26px rgba(24, 52, 45, .06);
  --radius: 24px;
  color-scheme: light;
  font-family: Inter, "SF Pro Display", "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0d1413;
  --surface: rgba(25, 36, 33, .88);
  --surface-solid: #17221f;
  --surface-soft: #121c19;
  --ink: #edf4f0;
  --muted: #96a8a2;
  --line: #2a3a35;
  --green: #b9f0d8;
  --green-2: #7fd8b8;
  --green-3: #5ca98f;
  --lime: #bde969;
  --peach: #e7a783;
  --rose: #d98680;
  --shadow: 0 18px 55px rgba(0, 0, 0, .22);
  --shadow-soft: 0 8px 26px rgba(0, 0, 0, .18);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(95px);
  opacity: .25;
  pointer-events: none;
}

.ambient-one {
  width: 460px;
  height: 460px;
  right: 2%;
  top: -220px;
  background: #d8f49b;
}

.ambient-two {
  width: 380px;
  height: 380px;
  left: 5%;
  bottom: -230px;
  background: #f0bba6;
}

.app-shell {
  display: grid;
  grid-template-columns: 242px minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 34px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 820;
  letter-spacing: -.04em;
  font-size: 19px;
  padding: 0 8px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--green);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-style: italic;
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.brand-copy small {
  color: var(--green-2);
  font-size: 9px;
  letter-spacing: .08em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  padding: 12px 13px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  text-align: left;
}

.nav-item > span {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.side-card {
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 15px;
  background: var(--surface);
}

.quote-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.quote-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: color-mix(in srgb, var(--green-2) 13%, transparent);
  color: var(--green-2);
  font-weight: 800;
}

.quote-card > div:last-child { min-width: 0; }

.side-label,
.side-card small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}

.side-card strong {
  display: block;
  font-size: 19px;
  letter-spacing: -.04em;
  margin: 4px 0 5px;
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.file-label { cursor: pointer; }
.file-label input { display: none; }

main {
  padding: 36px clamp(24px, 4vw, 62px) 80px;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.title-stack { max-width: 600px; }

.eyebrow {
  font-size: 10px;
  font-weight: 820;
  letter-spacing: .14em;
  color: var(--green-2);
  margin: 0 0 8px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(30px, 3vw, 43px);
  line-height: 1;
  letter-spacing: -.055em;
}

.page-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.month-navigator {
  display: flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 4px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.month-arrow {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.month-arrow:hover {
  background: var(--surface-solid);
  color: var(--ink);
}

.month-picker {
  position: relative;
  min-width: 132px;
  text-align: center;
  padding: 7px 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.month-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.primary-button,
.ghost-button,
.secondary-button,
.save-button {
  border: 0;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 780;
  cursor: pointer;
}

.primary-button {
  padding: 13px 17px;
  background: var(--green);
  color: var(--bg);
  box-shadow: 0 10px 25px color-mix(in srgb, var(--green) 22%, transparent);
}

.primary-button span { font-size: 17px; }

.ghost-button {
  padding: 12px 14px;
  color: var(--green-2);
  background: color-mix(in srgb, var(--green-2) 9%, transparent);
}

.month-rail-wrap {
  margin-bottom: 16px;
  overflow: hidden;
}

.month-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 7px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.month-rail::-webkit-scrollbar { display: none; }

.month-chip {
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-solid) 72%, transparent);
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.month-chip span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}

.month-chip strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
  margin-top: 5px;
}

.month-chip:hover { transform: translateY(-1px); }

.month-chip.active {
  background: var(--green);
  border-color: var(--green);
  color: color-mix(in srgb, var(--bg) 75%, transparent);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--green) 18%, transparent);
}

.month-chip.active strong { color: var(--bg); }

.view { display: none; }

.active-view {
  display: block;
  animation: fadeUp .32s ease;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr;
  gap: 13px;
}

.hero-card,
.metric-card,
.panel,
.budget-card {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  border-radius: 28px;
  padding: 24px 27px;
  background:
    radial-gradient(circle at 92% 5%, color-mix(in srgb, var(--green-3) 34%, transparent), transparent 35%),
    linear-gradient(135deg, var(--green), color-mix(in srgb, var(--green) 82%, #173028));
  color: var(--bg);
  min-height: 224px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero-top,
.hero-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  opacity: .78;
}

.month-status {
  font-size: 9px;
  letter-spacing: .12em;
  border: 1px solid color-mix(in srgb, var(--bg) 25%, transparent);
  padding: 6px 8px;
  border-radius: 999px;
}

.hero-amount {
  font-size: clamp(40px, 5vw, 61px);
  font-weight: 780;
  letter-spacing: -.07em;
  margin-top: 17px;
  line-height: 1;
}

.hero-usd { margin-top: 8px; }
.hero-usd span { font-weight: 760; }
.hero-usd small { opacity: .62; }

.hero-signal {
  align-self: flex-start;
  margin-top: 12px;
  padding: 6px 9px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg) 10%, transparent);
  font-size: 10px;
  font-weight: 650;
}

.hero-signal[data-trend="down"] { color: var(--lime); }
.hero-signal[data-trend="up"] { color: #ffd0c5; }

.hero-footer {
  margin-top: auto;
  border-top: 1px solid color-mix(in srgb, var(--bg) 16%, transparent);
  padding-top: 12px;
}

.metric-card {
  border-radius: 24px;
  padding: 21px;
  display: flex;
  flex-direction: column;
  min-height: 224px;
}

.metric-card > span {
  font-size: 12px;
  color: var(--muted);
  margin-top: 22px;
}

.metric-card strong {
  font-size: 24px;
  letter-spacing: -.04em;
  margin-top: 7px;
}

.metric-card small {
  color: var(--muted);
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
}

.metric-icon {
  width: 41px;
  height: 41px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #23352f;
}

.metric-icon.peach { background: var(--peach); }
.metric-icon.mint { background: var(--lime); }

.budget-card {
  margin-top: 13px;
  border-radius: 20px;
  padding: 16px 20px;
  transition: border-color .2s ease;
}

.budget-card.over-budget { border-color: color-mix(in srgb, var(--rose) 72%, var(--line)); }

.budget-copy,
.budget-heading {
  display: flex;
  align-items: center;
}

.budget-copy { justify-content: space-between; gap: 20px; }
.budget-heading { gap: 12px; }

.budget-heading .eyebrow { margin-bottom: 4px; }
.budget-heading strong { font-size: 13px; }

.budget-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--green-2) 12%, transparent);
  color: var(--green-2);
  font-size: 18px;
}

.budget-track {
  height: 7px;
  background: var(--line);
  border-radius: 999px;
  margin-top: 14px;
  overflow: hidden;
}

.budget-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green-2), var(--lime));
  border-radius: inherit;
  transition: width .35s ease;
}

.over-budget .budget-track i { background: var(--rose); }

.budget-meta {
  color: var(--muted);
  font-size: 10px;
  margin-top: 8px;
}

.content-grid,
.lower-grid {
  display: grid;
  gap: 13px;
  margin-top: 13px;
}

.content-grid { grid-template-columns: 1.55fr 1fr; }
.lower-grid { grid-template-columns: 1.35fr 1fr; }

.panel {
  border-radius: var(--radius);
  padding: 23px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.panel-heading h2 {
  font-size: 19px;
  margin: 0;
  letter-spacing: -.035em;
}

.legend,
.panel-total {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 7px;
  height: 7px;
  background: var(--green-2);
  border-radius: 50%;
}

.panel-total { font-weight: 750; }

.canvas-wrap {
  height: 255px;
  position: relative;
  margin-top: 17px;
}

.canvas-wrap canvas {
  width: 100%;
  height: 100%;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.category-breakdown {
  margin-top: 21px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.category-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
}

.category-emoji,
.expense-icon {
  background: color-mix(in srgb, var(--green-2) 10%, transparent);
  display: grid;
  place-items: center;
}

.category-emoji {
  width: 35px;
  height: 35px;
  border-radius: 11px;
}

.category-info { min-width: 0; }

.category-info-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 6px;
}

.category-info-top span:first-child { font-weight: 720; }
.category-info-top span:last-child { color: var(--muted); }

.category-bar {
  height: 5px;
  background: var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.category-bar i {
  display: block;
  height: 100%;
  background: var(--green-2);
  border-radius: 5px;
}

.category-value {
  font-size: 11px;
  font-weight: 730;
  min-width: 76px;
  text-align: right;
}

.monthly-chart {
  height: 221px;
  display: grid;
  grid-template-columns: repeat(6, minmax(44px, 1fr));
  gap: 10px;
  align-items: stretch;
  margin-top: 19px;
}

.monthly-column {
  display: grid;
  grid-template-rows: 24px 1fr 20px;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  min-width: 0;
}

.monthly-value {
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monthly-bar-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}

.monthly-bar-wrap i {
  width: min(32px, 62%);
  border-radius: 8px 8px 3px 3px;
  background: color-mix(in srgb, var(--green-2) 35%, var(--line));
  transition: height .35s ease, background .2s ease;
}

.monthly-column.active .monthly-bar-wrap i { background: var(--green-2); }

.monthly-label {
  font-size: 10px;
  font-weight: 750;
  text-transform: capitalize;
}

.monthly-column.active .monthly-label,
.monthly-column:hover .monthly-label { color: var(--green-2); }

.insight-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 18px;
}

.insight-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px;
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
}

.insight-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-solid);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-soft);
}

.insight-row div { min-width: 0; }
.insight-row small,
.insight-row strong,
.insight-row div span { display: block; }
.insight-row small { color: var(--muted); font-size: 9px; }
.insight-row strong { font-size: 13px; margin-top: 3px; }
.insight-row div span { color: var(--muted); font-size: 9px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty-small {
  color: var(--muted);
  font-size: 12px;
  padding: 34px 0;
  text-align: center;
}

.recent-panel { margin-top: 13px; }

.text-button {
  border: 0;
  background: transparent;
  color: var(--green-2);
  font-size: 11px;
  font-weight: 760;
  cursor: pointer;
  padding: 5px;
}

.expense-list { margin-top: 15px; }

.expense-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  border-top: 1px solid var(--line);
}

.expense-row:first-child { border-top: 0; }

.expense-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 18px;
}

.expense-main { min-width: 0; }

.expense-main strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-main span,
.expense-amount span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}

.expense-amount { text-align: right; }
.expense-amount strong { display: block; font-size: 13px; }

.row-actions { display: flex; }

.row-actions button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.row-actions button:hover {
  background: var(--line);
  color: var(--ink);
}

.movements-panel { min-height: 70vh; }

.movement-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.secondary-button {
  background: color-mix(in srgb, var(--green-2) 12%, transparent);
  color: var(--green-2);
  padding: 10px 14px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) repeat(3, auto) auto;
  gap: 8px;
  margin: 22px 0 10px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  border-radius: 13px;
  padding: 0 13px;
}

.search-field input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 11px 0;
  color: var(--ink);
  outline: 0;
  font-size: 12px;
}

.filters select,
.filter-clear {
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--ink);
  border-radius: 13px;
  padding: 0 11px;
  font-size: 11px;
}

.filter-clear {
  color: var(--green-2);
  cursor: pointer;
  font-weight: 700;
}

.grouped-list { margin-top: 18px; }

.expense-month-group + .expense-month-group { margin-top: 25px; }

.expense-group-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 4px;
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.expense-group-heading div strong,
.expense-group-heading div span { display: block; }
.expense-group-heading div strong { font-size: 14px; }
.expense-group-heading div span { color: var(--muted); font-size: 9px; margin-top: 3px; }
.expense-group-heading > strong { font-size: 13px; }

.mobile-nav { display: none; }

dialog {
  border: 0;
  padding: 0;
  border-radius: 28px;
  background: var(--surface-solid);
  color: var(--ink);
  width: min(570px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .3);
}

dialog::backdrop {
  background: rgba(7, 17, 14, .64);
  backdrop-filter: blur(8px);
}

dialog[open] { animation: dialogIn .24s ease; }

#expenseForm,
#budgetForm {
  padding: 27px;
  overflow: auto;
  max-height: calc(100vh - 24px);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -.04em;
}

.icon-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
}

.amount-field {
  display: flex;
  align-items: center;
  margin: 25px 0 7px;
  border-bottom: 2px solid var(--line);
}

.amount-field span {
  font-size: 30px;
  color: var(--muted);
}

.amount-field input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 50px;
  font-weight: 770;
  line-height: 1.2;
  letter-spacing: -.06em;
  padding: 5px 8px;
  outline: 0;
}

.amount-field.compact input { font-size: 42px; }

.conversion-preview {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 25px;
}

.conversion-preview button {
  border: 0;
  background: transparent;
  color: var(--green-2);
  font-size: 10px;
  font-weight: 730;
  cursor: pointer;
}

.manual-rate { margin: -13px 0 20px; }
.manual-rate.hidden { display: none; }
.manual-rate label { font-size: 10px; color: var(--muted); }

.manual-rate input {
  margin-left: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 8px;
  width: 110px;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 22px;
}

legend,
.form-field > span {
  font-size: 11px;
  font-weight: 730;
  margin-bottom: 10px;
}

.form-field > span { display: block; }
.form-field small { font-weight: 500; color: var(--muted); }

.category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.category-option input { position: absolute; opacity: 0; }

.category-option span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: 9px;
  cursor: pointer;
}

.category-option b { font-size: 18px; }

.category-option input:checked + span {
  border-color: var(--green-2);
  background: color-mix(in srgb, var(--green-2) 10%, transparent);
  color: var(--green-2);
  font-weight: 720;
}

.form-field input,
.form-field select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px;
  outline: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.save-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: 21px;
  padding: 15px 18px;
  background: var(--green);
  color: var(--bg);
}

.save-button:disabled { opacity: .62; cursor: wait; }

.form-note {
  text-align: center;
  color: var(--muted);
  font-size: 9px;
  margin: 10px 0 0;
}

.small-dialog { width: min(460px, calc(100vw - 24px)); }

.dialog-description {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 18px 0 0;
}

.budget-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 22px;
}

.danger-text {
  border: 0;
  background: transparent;
  color: #c86d65;
  font-size: 11px;
  font-weight: 720;
  cursor: pointer;
}

.inline-save {
  width: auto;
  min-width: 150px;
  margin: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 13px;
  font-size: 11px;
  font-weight: 680;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 100;
  box-shadow: var(--shadow);
}

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

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
}

@media (max-width: 1180px) {
  .topbar { align-items: flex-start; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 480px; }
  .filters { grid-template-columns: minmax(220px, 1fr) repeat(2, auto); }
  .filter-clear { min-height: 40px; }
}

@media (max-width: 1050px) {
  .hero-grid { grid-template-columns: 1.5fr 1fr; }
  .hero-card { grid-row: span 2; }
  .metric-card { min-height: 132px; }
  .metric-card > span { margin-top: 14px; }
  .content-grid,
  .lower-grid { grid-template-columns: 1fr; }
  .category-breakdown { display: grid; grid-template-columns: 1fr 1fr; }
  .monthly-chart { height: 190px; }
  .insight-list { display: grid; grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 208px minmax(0, 1fr); }
  .sidebar { padding-inline: 14px; }
  main { padding-inline: 24px; }
  .topbar { flex-direction: column; }
  .top-actions { width: 100%; justify-content: flex-start; max-width: none; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  main { padding: 23px 15px 108px; }
  .topbar { gap: 18px; margin-bottom: 15px; }
  .topbar h1 { font-size: 30px; }
  .page-subtitle { font-size: 11px; }
  .top-actions { flex-wrap: nowrap; }
  .month-navigator { flex: 1; min-width: 0; }
  .month-picker { flex: 1; min-width: 100px; }
  .ghost-button { white-space: nowrap; padding-inline: 12px; }
  .primary-button { display: none; }
  .month-rail-wrap { margin-inline: -15px; }
  .month-rail { padding-inline: 15px; }
  .month-chip { min-width: 122px; }
  .hero-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hero-card { grid-column: 1 / -1; grid-row: auto; min-height: 211px; padding: 21px; }
  .hero-amount { font-size: clamp(39px, 13vw, 54px); }
  .metric-card { min-height: 143px; padding: 16px; }
  .metric-card > span { margin-top: 11px; }
  .metric-card strong { font-size: 19px; }
  .metric-card small { font-size: 9px; }
  .metric-icon { width: 38px; height: 38px; }
  .budget-card { padding: 15px; }
  .budget-copy { align-items: flex-start; }
  .budget-heading strong { font-size: 11px; }
  .content-grid,
  .lower-grid { gap: 10px; margin-top: 10px; }
  .panel { padding: 18px; border-radius: 20px; }
  .recent-panel { margin-top: 10px; }
  .canvas-wrap { height: 220px; }
  .category-breakdown { display: flex; }
  .insight-list { display: flex; }
  .monthly-chart { height: 180px; gap: 5px; }
  .monthly-value { font-size: 8px; }
  .expense-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
  .row-actions { grid-column: 2 / -1; justify-content: flex-end; margin-top: -8px; }
  .expense-amount strong { font-size: 12px; }
  .expense-amount span { max-width: 105px; }
  .filters { display: flex; overflow-x: auto; padding-bottom: 5px; }
  .search-field { min-width: min(290px, 82vw); }
  .filters select { min-height: 42px; flex: 0 0 auto; }
  .filter-clear { min-height: 42px; flex: 0 0 auto; padding-inline: 14px; }
  .movement-heading { align-items: center; }
  .movement-heading .secondary-button { white-space: nowrap; }
  .expense-group-heading { top: -1px; }
  .mobile-nav {
    position: fixed;
    z-index: 20;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 1fr 62px 1fr;
    align-items: center;
    background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
    border: 1px solid var(--line);
    box-shadow: 0 14px 50px rgba(0, 0, 0, .16);
    border-radius: 22px;
    padding: 7px;
    backdrop-filter: blur(20px);
  }
  .mobile-tab {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px;
  }
  .mobile-tab span { font-size: 18px; }
  .mobile-tab.active { color: var(--green-2); }
  .mobile-add {
    width: 54px;
    height: 54px;
    border: 0;
    border-radius: 18px;
    background: var(--green);
    color: var(--bg);
    font-size: 27px;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--green) 24%, transparent);
    transform: translateY(-14px);
  }
  .form-row { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .category-option span { padding: 9px 1px; font-size: 8px; }
  .category-option b { font-size: 17px; }
  #expenseForm,
  #budgetForm { padding: 23px 18px; }
  .amount-field input { font-size: 45px; }
  .toast { bottom: 98px; white-space: nowrap; max-width: calc(100vw - 30px); }
  .panel-heading { gap: 10px; }
}

@media (max-width: 410px) {
  .topbar h1 { font-size: 27px; }
  .ghost-button { font-size: 11px; }
  .month-arrow { width: 31px; }
  .month-picker { font-size: 11px; padding-inline: 3px; }
  .hero-card { min-height: 202px; }
  .hero-signal { font-size: 9px; }
  .metric-card strong { font-size: 17px; }
  .category-grid { grid-template-columns: repeat(4, 1fr); }
  .category-value { min-width: 65px; }
  .monthly-chart { gap: 2px; }
  .monthly-bar-wrap i { width: 54%; }
  .movement-heading { align-items: flex-start; }
  .movement-heading .secondary-button { font-size: 10px; padding-inline: 10px; }
}

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