:root {
  color-scheme: light;
  --cyan: #00cbd8;
  --cyan-dark: #007d87;
  --magenta: #dc20c5;
  --lime: #42d72c;
  --orange: #ff6b35;
  --yellow: #f1c900;
  --purple: #9d45e8;
  --red: #e24455;
  --ink: #17172c;
  --ink-soft: #4e506b;
  --muted: #74768f;
  --surface: #fff;
  --surface-soft: #f7f9fc;
  --line: #dfe6ee;
  --bg: #eef4f8;
  --shadow: 0 12px 35px rgba(27, 38, 61, 0.1);
  --shadow-small: 0 5px 18px rgba(27, 38, 61, 0.09);
  --radius: 22px;
  --font-display: "Arial Black", "Avenir Next", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Avenir Next", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 8%, rgba(0, 203, 216, 0.12), transparent 23rem),
    radial-gradient(circle at 92% 20%, rgba(220, 32, 197, 0.09), transparent 25rem),
    linear-gradient(135deg, #edf4f8, #f5f0f8 70%, #edf8f2);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button, label[for], select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 5000;
  padding: .75rem 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
}
.skip-link:focus { top: 1rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--cyan);
  background: rgba(255, 255, 255, .93);
  box-shadow: 0 6px 25px rgba(0, 203, 216, .14);
  backdrop-filter: blur(16px);
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: .9rem 0;
}
.logo {
  background: linear-gradient(90deg, var(--cyan-dark), var(--magenta));
  background-clip: text;
  color: transparent;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  font-weight: 900;
  letter-spacing: .035em;
}
.logo span { color: initial; }
.tagline { margin-top: .15rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: .75rem; }
.install-button {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 42px;
  padding: .5rem .75rem;
  border: 1px solid rgba(0, 203, 216, .35);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-small);
  color: var(--cyan-dark);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 900;
}
.install-button.ready { border-color: var(--lime); box-shadow: 0 0 0 4px rgba(66, 215, 44, .13); }
.balance-display {
  min-width: 172px;
  padding: .55rem 1.15rem;
  border: 2px solid var(--lime);
  border-radius: 999px;
  background: linear-gradient(140deg, #18182e, #30314c);
  box-shadow: 0 0 20px rgba(66, 215, 44, .18);
  text-align: right;
}
.balance-label { color: #b9bac7; font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.balance-amount { color: #65ea51; font-family: var(--font-display); font-size: 1.25rem; font-weight: 900; }
.balance-amount.negative { color: #ff7684; }
.status-pill {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .38rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: .74rem;
  font-weight: 800;
}
.status-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 8px currentColor; }
.status-pill.online .status-dot { background: var(--lime); }
.status-pill.offline .status-dot, .status-pill.error .status-dot { background: var(--red); }

.period-strip {
  display: grid;
  grid-template-columns: 46px minmax(220px, 380px) 46px;
  justify-content: center;
  align-items: center;
  gap: .6rem;
  margin: 1rem auto .3rem;
  padding: 0 1rem;
}
.icon-button, .period-button {
  border: 1px solid rgba(0, 203, 216, .25);
  background: rgba(255, 255, 255, .85);
  box-shadow: var(--shadow-small);
  cursor: pointer;
}
.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: var(--cyan-dark);
  font-size: 2rem;
  line-height: 1;
}
.period-button { padding: .5rem 1rem; border-radius: 16px; text-align: center; }
.period-button > span { display: block; }
.period-caption { color: var(--cyan-dark); font-size: .67rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.period-button strong { display: block; font-family: var(--font-display); font-size: 1rem; }
#cycleDates { color: var(--muted); font-size: .75rem; }
.icon-button:hover, .period-button:hover { border-color: var(--cyan); transform: translateY(-1px); }

.nav-tabs {
  display: flex;
  justify-content: center;
  gap: .55rem;
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: .8rem 0 1rem;
}
.nav-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 48px;
  padding: .6rem .9rem;
  border: 2px solid transparent;
  border-radius: 15px;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow-small);
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 900;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.nav-tab:hover { border-color: rgba(0, 203, 216, .45); transform: translateY(-2px); }
.nav-tab.active {
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 203, 216, .24);
}
.nav-primary { min-width: 94px; }

.main-content { width: min(1220px, calc(100% - 2rem)); margin: 0 auto; padding: .7rem 0 4rem; }
.page { display: none; animation: enter .25s ease-out; }
.page.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: .5rem 0 1rem; }
.page-heading h1 { margin: .05rem 0 0; font-family: var(--font-display); font-size: clamp(1.55rem, 4vw, 2.25rem); line-height: 1.1; }
.eyebrow { margin: 0; color: var(--magenta); font-size: .76rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
h2 { margin: 0 0 1rem; font-family: var(--font-display); font-size: clamp(1.05rem, 2vw, 1.3rem); }
p { margin-top: 0; }
.muted { color: var(--muted); }

.card, .projection-card {
  margin-bottom: 1.15rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { background: rgba(255, 255, 255, .94); }
.card-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-heading h2 { margin-bottom: .25rem; }
.card-heading p { margin: 0; }
.projection-card { background: linear-gradient(145deg, #19192f, #343551); color: #fff; }
.projection-card h2 { color: #fff; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 125px;
  padding: 1.2rem;
  border: 1px solid #fff;
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}
.stat-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: currentColor; }
.stat-card.income { color: #1eac28; }
.stat-card.expenses { color: var(--orange); }
.stat-card.remaining { color: var(--cyan-dark); }
.stat-card.savings { color: var(--purple); }
.stat-label { display: block; margin-bottom: .65rem; color: var(--ink-soft); font-size: .74rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.stat-value { display: block; overflow-wrap: anywhere; font-family: var(--font-display); font-size: clamp(1.3rem, 3vw, 2rem); }
.stat-value.negative { color: var(--red); }

.achievements { display: flex; gap: .55rem; overflow-x: auto; padding: .15rem 0 1rem; scrollbar-width: thin; }
.badge { flex: none; padding: .45rem .8rem; border: 1px solid rgba(0, 0, 0, .08); border-radius: 999px; background: #fff; box-shadow: var(--shadow-small); font-size: .78rem; font-weight: 900; }
.badge.gold { background: linear-gradient(135deg, #fff4a6, #ffd03b); }
.badge.silver { background: linear-gradient(135deg, #f8fbff, #d9e0e8); }
.badge.bronze { background: linear-gradient(135deg, #ffd1aa, #c9844d); color: #442512; }
.badge.locked { color: #9898a8; background: #eceff3; }

.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; }
.category-tile {
  --category: var(--cyan);
  min-width: 0;
  padding: 1rem;
  border: 2px solid transparent;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #f7f8fc);
  box-shadow: var(--shadow-small);
}
.category-tile.over { border-color: var(--red); }
.category-top { display: flex; align-items: start; justify-content: space-between; gap: .5rem; }
.category-name { min-width: 0; color: var(--ink-soft); font-size: .84rem; font-weight: 900; }
.category-icon { font-size: 1.65rem; }
.category-amount { margin-top: .35rem; color: var(--category); font-family: var(--font-display); font-size: 1.25rem; overflow-wrap: anywhere; }
.category-budget { margin: .15rem 0 .65rem; color: var(--muted); font-size: .74rem; }
.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: #e8ecf1; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: var(--category); transition: width .3s ease; }
.category-tile.warning .progress-fill { background: var(--yellow); }
.category-tile.over .progress-fill { background: var(--red); }

.two-column { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(0, 1.4fr); gap: 1.15rem; }
.projection-list { margin: 0; }
.projection-list > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.projection-list > div:last-child { border-bottom: 0; }
.projection-list dt { color: #ccd0dc; }
.projection-list dd { margin: 0; color: #65ea51; font-family: var(--font-display); text-align: right; }
.projection-list dd.negative { color: #ff8793; }
.projection-list dd.neutral { color: #73e7ef; }

.transaction-list { display: grid; gap: .65rem; }
.transaction-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .8rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-left: 5px solid var(--cyan);
  border-radius: 15px;
  background: #fff;
}
.transaction-item.has-receipt { border-left-color: var(--magenta); }
.transaction-main { min-width: 0; }
.transaction-title { overflow: hidden; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.transaction-meta { display: flex; flex-wrap: wrap; gap: .3rem .7rem; margin-top: .22rem; color: var(--muted); font-size: .77rem; }
.transaction-amount { color: var(--orange); font-family: var(--font-display); white-space: nowrap; }
.transaction-actions { display: flex; gap: .35rem; }
.mini-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  cursor: pointer;
}
.mini-button:hover { border-color: var(--cyan); background: #fff; }
.compact-list .transaction-item { padding: .7rem .8rem; }
.empty-state { padding: 2rem 1rem; border: 2px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }

.form-card > h2 { margin-bottom: 1.1rem; }
.form-grid { display: grid; gap: 1rem; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label > span { display: block; margin-bottom: .4rem; color: var(--ink-soft); font-size: .8rem; font-weight: 900; letter-spacing: .035em; }
label em { color: var(--muted); font-size: .72rem; font-style: normal; font-weight: 600; }
input, select {
  width: 100%;
  min-height: 48px;
  padding: .72rem .82rem;
  border: 2px solid var(--line);
  border-radius: 13px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(0, 203, 216, .12); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); }
.money-input { position: relative; }
.money-input input { padding-left: 3rem; font-family: var(--font-display); font-size: 1.05rem; }
.currency-prefix { position: absolute; left: .8rem; top: 50%; z-index: 1; transform: translateY(-50%); color: var(--cyan-dark); font-weight: 900; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .65rem; margin-top: 1.2rem; }
.form-actions.centered { justify-content: center; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .72rem 1.2rem;
  border: 0;
  border-radius: 13px;
  box-shadow: var(--shadow-small);
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
  transition: filter .15s ease, transform .15s ease;
}
.button:hover:not(:disabled) { filter: saturate(1.12) brightness(1.02); transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button.compact { min-height: 42px; padding: .55rem .85rem; }
.button-cyan { background: linear-gradient(135deg, var(--cyan), #04aeb8); color: #062f33; }
.button-lime { background: linear-gradient(135deg, #65ec50, #26bd27); color: #103111; }
.button-magenta { background: linear-gradient(135deg, #f05bdb, var(--magenta)); color: #fff; }
.button-orange { background: linear-gradient(135deg, #ff9a55, var(--orange)); color: #3e1a0e; }
.button-danger { background: linear-gradient(135deg, #ff7180, var(--red)); color: #fff; }
.button-quiet { border: 1px solid var(--line); background: #fff; color: var(--ink-soft); }
.text-button { padding: .2rem; border: 0; background: none; color: var(--cyan-dark); cursor: pointer; font-weight: 900; }
.text-button:hover { text-decoration: underline; }
.callout { margin: 1rem 0 0; padding: .8rem 1rem; border-left: 4px solid var(--cyan); border-radius: 10px; background: #edfafd; color: var(--ink-soft); }

.budget-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; }
.budget-input-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, .6fr); align-items: center; gap: 1rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 14px; }
.budget-label { display: flex; align-items: center; gap: .55rem; min-width: 0; font-weight: 900; }
.budget-label span:first-child { font-size: 1.35rem; }

.receipt-hero {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(300px, 1.2fr);
  gap: 1.5rem;
  align-items: center;
  border: 2px solid rgba(220, 32, 197, .2);
}
.receipt-copy h2 { margin: .5rem 0 .7rem; font-size: clamp(1.35rem, 3vw, 2rem); }
.receipt-copy p { color: var(--ink-soft); }
.feature-badge { display: inline-flex; padding: .32rem .62rem; border-radius: 999px; background: rgba(220, 32, 197, .1); color: var(--magenta); font-size: .7rem; font-weight: 900; letter-spacing: .13em; }
.camera-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  overflow: hidden;
  padding: 1.5rem;
  border: 3px dashed var(--cyan);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(0, 203, 216, .06), rgba(220, 32, 197, .05));
  cursor: pointer;
  text-align: center;
}
.camera-zone:hover { border-color: var(--magenta); }
.camera-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.camera-icon { font-size: 3rem; }
.camera-zone strong, .camera-zone small { display: block; }
.camera-zone strong { margin-top: .4rem; color: var(--ink); }
.camera-zone small { color: var(--muted); }
.camera-zone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #141421; }
.camera-zone.has-image .camera-icon, .camera-zone.has-image strong, .camera-zone.has-image small { visibility: hidden; }
.receipt-hero > .form-actions { grid-column: 1 / -1; margin-top: -.3rem; }

.quick-add-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.quick-add-button { display: grid; place-items: center; min-height: 105px; padding: .8rem; border: 2px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; font-weight: 900; text-align: center; }
.quick-add-button:hover { border-color: var(--cyan); transform: translateY(-2px); box-shadow: var(--shadow-small); }
.quick-add-button span:first-child { font-size: 1.8rem; }
.scan-confidence { margin-top: 1rem; padding: .75rem 1rem; border-radius: 12px; background: #effcf0; color: #22652a; font-weight: 800; }
.warning-box { margin-top: 1rem; padding: .8rem 1rem; border: 1px solid #f3cf6e; border-radius: 12px; background: #fff8dd; color: #604b13; }
.warning-box ul { margin: .3rem 0 0; padding-left: 1.2rem; }

.history-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, .3fr); gap: .8rem; margin-bottom: 1rem; }
.search-field input { padding-left: 1rem; }

.insight-lead { min-height: 180px; }
#personalizedTips { display: grid; gap: .65rem; }
.insight-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .7rem; align-items: start; padding: .7rem 0; border-bottom: 1px solid rgba(255, 255, 255, .13); }
.insight-row:last-child { border-bottom: 0; }
.insight-icon { font-size: 1.3rem; }
.tips-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.tip-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); }
.tip-icon { font-size: 1.7rem; }
.tip-card h3 { margin: 0 0 .25rem; font-size: 1rem; }
.tip-card p { margin: 0; color: var(--muted); font-size: .86rem; }

.button-grid { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; }
.file-button { position: relative; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.about-card dl { margin: 1rem 0 0; }
.about-card dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.about-card dt { color: var(--muted); }
.about-card dd { margin: 0; font-weight: 900; text-align: right; overflow-wrap: anywhere; }
.connection-details { margin: .8rem 0 0; }
.connection-details > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.connection-details dt { color: var(--muted); }
.connection-details dd { margin: 0; font-weight: 800; overflow-wrap: anywhere; text-align: right; }
.setup-modal { width: min(620px, 100%); }
.setup-modal .callout { margin-top: 1rem; }

.modal-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 1rem; background: rgba(15, 15, 30, .68); backdrop-filter: blur(5px); }
.modal { width: min(540px, 100%); max-height: min(88vh, 800px); overflow: auto; padding: 1.25rem; border-radius: 20px; background: #fff; box-shadow: 0 25px 70px rgba(0, 0, 0, .3); }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.modal-header h2 { margin: 0; }
.modal-close { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #eef1f5; cursor: pointer; font-size: 1.8rem; line-height: 1; }
.receipt-modal { width: min(720px, 100%); }
.receipt-modal img { display: block; width: 100%; max-height: 72vh; object-fit: contain; border-radius: 13px; background: #151526; }

.loading-overlay { position: fixed; inset: 0; z-index: 2000; display: grid; place-content: center; gap: 1rem; padding: 2rem; background: rgba(248, 251, 253, .9); color: var(--ink); text-align: center; backdrop-filter: blur(7px); }
.loader { width: 54px; height: 54px; margin: auto; border: 5px solid rgba(0, 203, 216, .2); border-top-color: var(--magenta); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-region { position: fixed; right: 1rem; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 2500; display: grid; gap: .6rem; width: min(380px, calc(100% - 2rem)); pointer-events: none; }
.toast { padding: .85rem 1rem; border-left: 5px solid var(--cyan); border-radius: 13px; background: #fff; box-shadow: 0 12px 38px rgba(0, 0, 0, .2); color: var(--ink); font-weight: 800; animation: toast-in .2s ease-out; }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.noscript { margin: 1rem; padding: 1rem; background: #ffe6e9; color: #6d1721; font-weight: 900; }

@media (max-width: 980px) {
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-add-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .budget-inputs { grid-template-columns: 1fr; }
  .nav-tab { flex: 1; padding-inline: .55rem; }
}

@media (max-width: 760px) {
  body { padding-bottom: 80px; }
  .app-header { position: relative; }
  .header-content { align-items: start; }
  .tagline, .status-pill, .install-button span:last-child { display: none; }
  .install-button { min-width: 42px; padding: .5rem; justify-content: center; }
  .balance-display { min-width: 140px; padding: .5rem .8rem; }
  .balance-amount { font-size: 1rem; }
  .nav-tabs {
    position: fixed;
    inset: auto 0 0;
    z-index: 150;
    justify-content: space-around;
    width: 100%;
    padding: .45rem max(.4rem, env(safe-area-inset-left)) max(.45rem, env(safe-area-inset-bottom)) max(.4rem, env(safe-area-inset-right));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -8px 24px rgba(20, 28, 45, .1);
    backdrop-filter: blur(14px);
  }
  .nav-tab { display: grid; flex: 1; gap: .1rem; min-width: 0; min-height: 54px; padding: .3rem .2rem; border: 0; border-radius: 12px; background: transparent; box-shadow: none; font-size: .66rem; }
  .nav-tab span:first-child { font-size: 1.15rem; }
  .nav-tab.active { box-shadow: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 105px; }
  .two-column, .receipt-hero { grid-template-columns: 1fr; }
  .receipt-hero > .form-actions { grid-column: auto; }
  .form-grid.two, .tips-grid { grid-template-columns: 1fr; }
  .quick-add-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-toolbar { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .header-content, .main-content { width: min(100% - 1rem, 1220px); }
  .logo { font-size: 1.02rem; }
  .balance-display { min-width: 124px; }
  .period-strip { grid-template-columns: 42px minmax(0, 1fr) 42px; padding-inline: .5rem; }
  .icon-button { width: 42px; height: 42px; }
  .page-heading { align-items: start; }
  .page-heading .button { display: none; }
  .stats-grid { gap: .6rem; }
  .stat-card { padding: .9rem; }
  .category-grid { grid-template-columns: 1fr; }
  .transaction-item { grid-template-columns: minmax(0, 1fr) auto; }
  .transaction-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .budget-input-row { grid-template-columns: 1fr; gap: .5rem; }
  .camera-zone { min-height: 230px; }
  .form-actions .button { flex: 1; }
  .button-grid { display: grid; }
}

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