@font-face {
  font-family: "Geist";
  src: url("./fonts/geist-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #f3f0e8;
  --paper-deep: #e9e4d9;
  --card: #fffdf8;
  --ink: #18201d;
  --muted: #727973;
  --line: #dedbd1;
  --forest: #173f35;
  --forest-light: #245b4d;
  --mint: #b8e3ca;
  --lime: #d4ed88;
  --coral: #ef765f;
  --coral-soft: #fde5df;
  --blue-soft: #dce9f7;
  --shadow: 0 28px 70px -42px rgb(23 63 53 / 46%);
  color-scheme: light;
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(circle at 3% 0%, rgb(212 237 136 / 22%), transparent 31rem),
    radial-gradient(circle at 98% 12%, rgb(184 227 202 / 24%), transparent 30rem),
    var(--paper);
  color: var(--ink);
  letter-spacing: -0.015em;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
[hidden] { display: none !important; }
svg { display: block; width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.045em; }

.app-shell { min-height: 100svh; padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.auth-view { width: min(100%, 980px); min-height: calc(100svh - 40px); margin: auto; display: grid; align-content: center; gap: 26px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 14px; }
.brand-mark, .wordmark span {
  display: grid; place-items: center; background: var(--forest); color: var(--lime); font-family: "Geist", sans-serif; font-weight: 750;
}
.brand-mark { width: 68px; height: 68px; border-radius: 22px 22px 22px 7px; font-size: 2.25rem; box-shadow: 0 20px 35px -19px rgb(23 63 53 / 70%); }
.brand-name { margin: 0; font-family: "Geist", sans-serif; font-size: 2.1rem; font-weight: 750; letter-spacing: -.055em; }
.brand-tagline { margin: 2px 0 0; color: var(--muted); font-size: .9rem; font-weight: 600; }
.auth-card { width: min(100%, 440px); margin: 0 auto; padding: clamp(22px, 5vw, 38px); border: 1px solid rgb(255 255 255 / 72%); border-radius: 28px; background: rgb(255 253 248 / 88%); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.auth-heading { margin-bottom: 24px; }
.auth-heading h1 { margin-bottom: 9px; font-family: "Geist", sans-serif; font-size: clamp(2rem, 6vw, 2.7rem); font-weight: 650; }
.auth-heading > p:last-child { margin: 0; color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--forest-light); font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.light { color: rgb(255 255 255 / 66%); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 22px; padding: 5px; border-radius: 14px; background: var(--paper); }
.auth-tab { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 750; }
.auth-tab.is-active { background: var(--card); color: var(--forest); box-shadow: 0 6px 16px -12px rgb(24 32 29 / 65%); }
.auth-form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: #515a54; font-size: .84rem; font-weight: 700; }
input { width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: #fff; color: var(--ink); }
input:focus-visible { border-color: var(--forest-light); box-shadow: 0 0 0 4px rgb(36 91 77 / 13%); }
button:focus-visible { outline: 3px solid rgb(36 91 77 / 22%); outline-offset: 2px; }
.primary-button { min-height: 50px; border: 0; border-radius: 13px; padding: 0 20px; background: var(--forest); color: #fff; font-weight: 800; box-shadow: 0 17px 28px -19px rgb(23 63 53 / 80%); transition: transform .15s ease, background .15s ease; }
.primary-button:hover { transform: translateY(-1px); background: var(--forest-light); }
.form-message { min-height: 20px; margin: 14px 0 0; color: #b43e2e; font-size: .86rem; font-weight: 700; }

.budget-view { width: min(100%, 1160px); margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 18px; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-family: "Geist", sans-serif; font-size: 1.55rem; font-weight: 750; text-decoration: none; }
.wordmark span { width: 36px; height: 36px; border-radius: 12px 12px 12px 4px; font-size: 1.25rem; }
.icon-button { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--line); border-radius: 13px; background: rgb(255 253 248 / 74%); color: var(--forest); font-size: 1.8rem; line-height: 1; transition: transform .15s ease, border-color .15s ease; }
.icon-button:hover { transform: rotate(5deg); border-color: #b9b8ae; }

.balance-card { position: relative; overflow: hidden; padding: clamp(22px, 5vw, 38px); border-radius: 27px; background: var(--forest); color: #fff; box-shadow: 0 30px 60px -36px rgb(23 63 53 / 78%); }
.balance-card::after { content: ""; position: absolute; width: 260px; height: 260px; top: -150px; right: -70px; border: 54px solid rgb(212 237 136 / 8%); border-radius: 50%; }
.balance-head { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.balance-amount { margin: 5px 0 25px; font-family: "Geist", sans-serif; font-size: clamp(2.65rem, 9vw, 4.6rem); font-weight: 520; font-variant-numeric: tabular-nums; line-height: .95; letter-spacing: -.065em; }
.status-pill { flex: 0 0 auto; padding: 8px 12px; border: 1px solid rgb(255 255 255 / 11%); border-radius: 99px; background: var(--lime); color: #27350e; font-size: .75rem; font-weight: 850; }
.status-pill.over { background: var(--coral-soft); color: #8f2e22; }
.progress-track { position: relative; z-index: 1; height: 6px; overflow: hidden; border-radius: 99px; background: rgb(255 255 255 / 13%); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--lime); transition: width .45s ease; }
.progress-track span.over { background: var(--coral); }
.balance-meta { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 22px; }
.balance-meta p { display: grid; gap: 5px; margin: 0; padding: 0 18px; border-left: 1px solid rgb(255 255 255 / 12%); }
.balance-meta p:first-child { padding-left: 0; border-left: 0; }
.balance-meta span { color: rgb(255 255 255 / 58%); font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.balance-meta strong { font-size: .98rem; }

.content-grid { display: grid; min-width: 0; gap: 18px; margin-top: 18px; }
.activity-panel, .entry-panel { min-width: 0; border: 1px solid var(--line); border-radius: 24px; background: rgb(255 253 248 / 82%); box-shadow: var(--shadow); }
.activity-panel { padding: clamp(19px, 4vw, 28px); }
.entry-panel { padding: clamp(19px, 4vw, 25px); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.section-heading h2, .entry-heading h2, .sheet-header h2 { margin: 0; font-family: "Geist", sans-serif; font-size: 1.55rem; font-weight: 650; }
.sync-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .73rem; font-weight: 750; }
.sync-label i { width: 7px; height: 7px; border-radius: 50%; background: #48a672; box-shadow: 0 0 0 4px rgb(72 166 114 / 11%); }
.sync-label.is-syncing i { background: #d8a63d; }
.sync-label.is-error i { background: var(--coral); }
.transaction-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.transaction-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 67px; padding: 8px 0; border-bottom: 1px solid #e8e4db; }
.transaction-item:last-child { border-bottom: 0; }
.category-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 14px; background: var(--paper-deep); font-size: 1.06rem; }
.transaction-copy { min-width: 0; }
.transaction-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; text-transform: capitalize; }
.transaction-copy time { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.transaction-amount { font-size: .91rem; font-weight: 850; white-space: nowrap; }
.transaction-amount.receive { color: #267855; }
.delete-transaction { display: grid; width: 33px; height: 33px; place-items: center; border: 0; border-radius: 10px; background: transparent; color: #9a9d98; font-size: 1.2rem; }
.delete-transaction:hover { background: var(--coral-soft); color: #af3c2c; }
.empty-state { padding: 28px 10px 20px; text-align: center; color: var(--muted); }
.empty-state > span { display: grid; width: 52px; height: 52px; margin: 0 auto 13px; place-items: center; border-radius: 17px; background: var(--paper-deep); color: var(--forest); font-size: 1.5rem; }
.empty-state h3 { margin-bottom: 5px; color: var(--ink); font-family: "Geist", sans-serif; font-size: 1.15rem; font-weight: 650; }
.empty-state p { margin: 0; font-size: .82rem; }

.entry-heading { margin-bottom: 8px; }
.amount-display { display: flex; align-items: baseline; justify-content: center; gap: 7px; padding: 17px 0 13px; }
.amount-display span { color: var(--muted); font-size: .93rem; font-weight: 800; }
.amount-display strong { max-width: 88%; overflow: hidden; font-family: "Geist", sans-serif; font-size: clamp(2.6rem, 11vw, 3.8rem); font-weight: 520; font-variant-numeric: tabular-nums; letter-spacing: -.06em; text-overflow: ellipsis; }
.category-list { display: flex; gap: 7px; margin: 0 -3px 16px; padding: 3px; overflow-x: auto; scrollbar-width: none; }
.category-list::-webkit-scrollbar { display: none; }
.category-chip { min-height: 35px; flex: 0 0 auto; padding: 0 13px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--muted); font-size: .73rem; font-weight: 750; }
.category-chip.is-active { border-color: var(--forest); background: var(--forest); color: #fff; }
.number-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.number-pad button { min-height: 52px; border: 1px solid #e2ded5; border-radius: 14px; background: #faf7f0; color: var(--ink); font-size: 1.14rem; font-weight: 750; transition: transform .08s ease, background .12s ease; touch-action: manipulation; }
.number-pad button:hover { background: var(--paper-deep); }
.number-pad button:active { transform: scale(.96); }
.number-pad .backspace { color: var(--muted); font-size: 1.3rem; }
.entry-message { min-height: 18px; margin: 7px 0 0; color: #b43e2e; font-size: .76rem; font-weight: 700; text-align: center; }
.movement-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 4px; }
.movement-button { display: flex; min-height: 58px; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 16px; font-weight: 850; transition: transform .12s ease, filter .12s ease; touch-action: manipulation; }
.movement-button:hover { transform: translateY(-1px); filter: brightness(1.03); }
.movement-button b { font-size: 1.55rem; font-weight: 500; line-height: 1; }
.movement-button.spend { background: var(--coral-soft); color: #a53729; }
.movement-button.receive { background: var(--mint); color: #174b39; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 19; background: rgb(20 27 24 / 35%); backdrop-filter: blur(3px); }
.settings-sheet { position: fixed; z-index: 20; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); width: min(430px, calc(100% - 28px)); margin-left: auto; padding: 12px 22px 22px; border: 1px solid rgb(255 255 255 / 75%); border-radius: 25px; background: var(--card); box-shadow: 0 35px 90px -20px rgb(18 30 25 / 48%); }
.sheet-handle { width: 42px; height: 4px; margin: 0 auto 14px; border-radius: 99px; background: var(--line); }
.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.profile-row { display: flex; align-items: center; gap: 12px; margin: 18px 0; padding: 13px; border-radius: 15px; background: var(--paper); }
.profile-row > span { display: grid; width: 43px; height: 43px; flex: 0 0 auto; place-items: center; border-radius: 14px; background: var(--forest); color: var(--lime); font-family: "Geist", sans-serif; font-size: 1.25rem; font-weight: 750; }
.profile-row strong { display: block; font-size: .9rem; }
.profile-row p { margin: 3px 0 0; color: var(--muted); font-size: .76rem; }
.budget-form { display: grid; gap: 10px; }
.currency-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.currency-input:focus-within { border-color: var(--forest-light); box-shadow: 0 0 0 4px rgb(36 91 77 / 13%); }
.currency-input span { padding-left: 14px; color: var(--muted); font-weight: 800; }
.currency-input input { border: 0; box-shadow: none; font-weight: 750; }
.currency-input input:focus-visible { box-shadow: none; }
.budget-form > p { margin: 0 0 5px; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.logout-button { width: 100%; min-height: 46px; margin-top: 10px; border: 1px solid #edc6be; border-radius: 13px; background: transparent; color: #a43a2b; font-weight: 800; }

@media (min-width: 760px) {
  .auth-view { grid-template-columns: 1fr 1fr; align-items: center; }
  .auth-brand { justify-content: flex-start; padding-left: 9%; }
  .content-grid { grid-template-columns: minmax(0, 1.5fr) minmax(330px, .85fr); align-items: start; }
  .entry-panel { position: sticky; top: 18px; }
}

@media (max-width: 500px) {
  .app-shell { padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar { margin-bottom: 12px; }
  .balance-card { border-radius: 23px; }
  .balance-head { display: block; }
  .status-pill { position: absolute; top: 0; right: 0; }
  .balance-meta p { padding: 0 10px; }
  .balance-meta strong { font-size: .86rem; }
  .activity-panel, .entry-panel { border-radius: 21px; }
  .transaction-item { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; }
  .category-icon { width: 38px; height: 38px; }
  .delete-transaction { width: 30px; height: 30px; }
  .settings-sheet { padding-right: 18px; padding-left: 18px; }
}

@media (max-width: 340px) {
  .balance-card { padding-right: 20px; padding-left: 20px; }
  .balance-head .eyebrow { max-width: 150px; }
  .status-pill { padding: 6px 9px; font-size: .67rem; }
  .balance-meta p { padding: 0 5px; }
  .balance-meta span { font-size: .63rem; }
  .balance-meta strong { font-size: .76rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
