:root {
  color-scheme: dark;
  --bg: #080706;
  --bg-soft: #11100e;
  --panel: #171411;
  --panel-raised: #201b16;
  --line: #34291f;
  --text: #f8f2ea;
  --muted: #aa9b8b;
  --muted-strong: #d6c3ae;
  --orange: #ff7a1a;
  --orange-strong: #ff9a3d;
  --orange-soft: rgba(255, 122, 26, 0.14);
  --green: #45d483;
  --yellow: #ffd166;
  --red: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  --sidebar-width: 288px;

  /* --- Podupu design tokens: one controlled scale for everything new --- */
  /* Spacing (4px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 72px;
  /* Type scale (1.25 ratio on 16px) */
  --t-xs: 0.694rem;
  --t-sm: 0.833rem;
  --t-base: 1rem;
  --t-md: 1.25rem;
  --t-lg: 1.563rem;
  --t-xl: 1.953rem;
  --t-2xl: 2.441rem;
  --t-3xl: 3.052rem;
  /* Radius scale */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  /* Elevation (3 levels only) */
  --e-1: 0 4px 14px rgba(0, 0, 0, 0.22);
  --e-2: 0 14px 38px rgba(0, 0, 0, 0.3);
  --e-3: 0 30px 70px rgba(0, 0, 0, 0.45);
  /* Motion language */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --dur-fast: 180ms;
  --dur-base: 300ms;
  --dur-slow: 620ms;
  /* Hairlines */
  --hairline: rgba(255, 255, 255, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.light-mode {
  --e-1: 0 4px 14px rgba(31, 20, 8, 0.1);
  --e-2: 0 14px 38px rgba(31, 20, 8, 0.13);
  --e-3: 0 30px 70px rgba(31, 20, 8, 0.2);
  --hairline: rgba(31, 20, 8, 0.1);
}

* {
  box-sizing: border-box;
}

/* Keep hidden form fields truly hidden even when generic label/input styles apply. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 122, 26, 0.12), transparent 30rem),
    linear-gradient(145deg, #050403 0%, #100c08 48%, #050403 100%);
  color: var(--text);
}

body.light-mode {
  color-scheme: light;
  --bg: #fffaf4;
  --bg-soft: #fff3e5;
  --panel: #ffffff;
  --panel-raised: #fff7ed;
  --line: #f0d9c0;
  --text: #1f160f;
  --muted: #7a6652;
  --muted-strong: #4b3624;
  /* Semantic colors must darken on light ground or eyebrows/legends/danger text wash out. */
  --orange: #e05f00;
  --orange-strong: #b3540a;
  --green: #177a45;
  --yellow: #9a6b00;
  --red: #c2372a;
  --orange-soft: rgba(255, 122, 26, 0.12);
  --shadow: 0 18px 50px rgba(107, 63, 22, 0.12);
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 122, 26, 0.18), transparent 30rem),
    linear-gradient(145deg, #fff8ef 0%, #fffdf9 48%, #ffe7ce 100%);
}

.currency-field {
  position: relative;
  display: grid;
}

.currency-prefix {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 2;
  color: var(--muted-strong);
  font-weight: 850;
  pointer-events: none;
  transform: translateY(-50%);
}

.currency-field input {
  padding-left: 36px;
}

.optional-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(8, 7, 6, 0.84);
  backdrop-filter: blur(18px);
}

.light-mode .sidebar {
  background: rgba(255, 250, 244, 0.88);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid rgba(255, 122, 26, 0.5);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.22), transparent), #130d09;
  color: var(--orange-strong);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-mark img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The Rising Stack, inline so each theme can recolor the bars for contrast. */
.brand-stack {
  flex: none;
  width: 46px;
  height: 46px;
}

.brand-stack .bar-low { fill: #7d766b; }
.brand-stack .bar-mid { fill: #cfc6b8; }
.brand-stack .bar-top { fill: var(--orange); }

.light-mode .brand-stack .bar-low { fill: #55503f; }
.light-mode .brand-stack .bar-mid { fill: #99927e; }

.auth-stack {
  width: 64px;
  height: 64px;
}

.brand-word {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
}

.logo-mark {
  position: relative;
  background: #130d09;
}

.logo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.brand-dot {
  color: var(--orange);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list a {
  position: relative;
  overflow: hidden;
  padding: 11px 12px 11px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted-strong);
}

.nav-list a::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 5px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
  content: "";
}

.nav-list a:hover,
.nav-list a.active {
  border-color: rgba(255, 122, 26, 0.28);
  background: var(--orange-soft);
  color: var(--text);
}

.nav-list a.active::before {
  background: var(--orange-strong);
  box-shadow: 0 0 14px rgba(255, 122, 26, 0.7);
}

.sync-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 122, 26, 0.2);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-raised), var(--panel));
  box-shadow: var(--shadow);
}

.sync-card h2 {
  margin: 6px 0;
  font-size: 1.45rem;
}

.sync-card p:last-of-type {
  color: var(--muted);
  line-height: 1.5;
}

.main-content {
  display: grid;
  align-content: start;
  gap: 22px;
  min-width: 0;
  padding: 26px;
}

.app-view {
  min-width: 0;
}

.app-view[hidden] {
  display: none;
}

.app-view.active {
  display: grid;
  gap: 22px;
  animation: viewEnter 280ms ease-out;
}

.focused-panel {
  min-height: calc(100vh - 260px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0 4px;
}

.topbar-copy {
  display: grid;
  gap: 8px;
}

.month-range {
  margin: 0;
  color: var(--muted-strong);
  font-size: 0.95rem;
  font-weight: 650;
}

.topbar h1 {
  max-width: 720px;
  margin: 4px 0 0;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.topbar-controls,
.topbar-actions,
.filter-group,
.month-switcher,
.chart-layout {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-controls {
  justify-content: flex-end;
}

.month-switcher {
  border: 1px solid rgba(255, 122, 26, 0.28);
  border-radius: var(--radius);
  padding: 7px;
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.14), rgba(255, 255, 255, 0.035)), var(--panel);
  box-shadow: var(--shadow);
}

.month-select-shell {
  display: grid;
  min-width: 190px;
  gap: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.month-select-shell select {
  min-height: 34px;
  border: 0;
  padding: 0 4px;
  background: transparent;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.profile-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid rgba(255, 122, 26, 0.42);
  border-radius: var(--radius);
  padding: 0 12px 0 8px;
  background: var(--orange-soft);
  color: var(--text);
  font-weight: 800;
}

.profile-button.signed-in {
  border-color: rgba(69, 212, 131, 0.44);
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-strong));
  color: #160901;
  font-size: 0.78rem;
}

.profile-button.signed-in .profile-avatar {
  background: linear-gradient(135deg, var(--green), #86efac);
}

.chart-select-shell {
  display: grid;
  min-width: 170px;
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chart-select-shell select {
  min-height: 38px;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.chart-export-button {
  align-self: flex-end;
  min-height: 38px;
}

.dashboard-visualization {
  overflow: hidden;
}

.chart-layout {
  align-items: stretch;
}

.chart-stage {
  flex: 1 1 520px;
  min-height: 300px;
  border: 1px solid rgba(255, 122, 26, 0.16);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.08), rgba(255, 255, 255, 0.025));
}

.chart-summary {
  display: grid;
  flex: 0 1 260px;
  gap: 10px;
}

.chart-stat {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--panel-raised);
}

.chart-stat span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.chart-stat strong {
  color: var(--text);
  font-size: 1.1rem;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 300px;
}

.chart-label {
  fill: var(--muted-strong);
  font-size: 13px;
  font-weight: 700;
}

.chart-value {
  fill: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.chart-bar {
  fill: var(--orange);
  opacity: 0.92;
}

.chart-bar-income {
  fill: var(--green);
}

.chart-bar-expense {
  fill: var(--orange);
}

.chart-stat-income {
  border-color: rgba(69, 212, 131, 0.32);
}

.chart-stat-expense {
  border-color: rgba(255, 122, 26, 0.32);
}

.chart-axis {
  stroke: var(--line);
  stroke-width: 2;
}

.chart-line {
  fill: none;
  stroke: var(--orange-strong);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.chart-line-income {
  stroke: var(--green);
}

.chart-line-expense {
  stroke: var(--orange-strong);
}

.chart-donut-hole {
  fill: var(--panel);
}

.bill-stars {
  color: var(--orange-strong);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.bill-adjustment {
  color: var(--orange-strong);
}

.bill-note {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 122, 26, 0.22);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--orange-soft);
}

.bill-note strong {
  color: var(--text);
}

.bill-note ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted-strong);
  font-size: 0.88rem;
}

.chart-empty {
  display: grid;
  min-height: 300px;
  place-items: center;
  padding: 20px;
  color: var(--muted-strong);
  text-align: center;
}

.month-arrow:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  transform: none;
}

.button,
.icon-button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel-raised);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button {
  padding: 0 16px;
  font-weight: 750;
}

.button:hover,
.icon-button:hover,
.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 122, 26, 0.55);
}

.button.primary {
  border-color: rgba(255, 122, 26, 0.72);
  background: linear-gradient(135deg, var(--orange), #d84f08);
  color: #160901;
}

.button.secondary {
  background: var(--panel);
}

.button.ghost {
  background: transparent;
}

.button.danger {
  border-color: rgba(255, 107, 107, 0.7);
  background: rgba(255, 107, 107, 0.13);
  color: var(--red);
}

.button.full {
  width: 100%;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.2rem;
}

.chip {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted-strong);
}

.chip.active {
  border-color: rgba(255, 122, 26, 0.48);
  background: var(--orange-soft);
  color: var(--text);
}

.eyebrow {
  margin: 0;
  color: var(--orange-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.4fr) repeat(3, minmax(180px, 1fr));
  gap: 16px;
}

.navigation-target {
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.summary-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent), var(--panel);
  box-shadow: var(--shadow);
}

.summary-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 178px;
  padding: 18px;
}

.summary-panel h2 {
  margin: 12px 0 8px;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  letter-spacing: 0;
}

.primary-summary {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.22), rgba(255, 122, 26, 0.02)), var(--panel);
}

.primary-summary::after {
  position: absolute;
  right: -36px;
  bottom: -56px;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(255, 122, 26, 0.18);
  border-radius: 50%;
  content: "";
}

.cashflow-meter {
  position: relative;
  z-index: 1;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.cashflow-meter span {
  display: block;
  width: 72%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--green));
}

.trend {
  margin: 0;
  font-weight: 700;
}

.trend.positive {
  color: var(--green);
}

.trend.warning {
  color: var(--yellow);
}

.trend.critical {
  color: var(--red);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel.attention-pulse,
.budget-item.attention-pulse,
.transaction-row.attention-pulse {
  animation: attentionPulse 1400ms ease;
  border-color: rgba(255, 122, 26, 0.85);
}

.panel.wide {
  min-height: 380px;
}

.nav-twinkle {
  animation: navTwinkle 620ms ease-in-out 2;
  border-color: rgba(255, 154, 61, 0.9);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes navTwinkle {
  0%,
  100% {
    border-color: var(--line);
    box-shadow: var(--shadow);
  }

  50% {
    border-color: rgba(255, 184, 102, 0.98);
    box-shadow: 0 0 0 4px rgba(255, 122, 26, 0.12), 0 0 28px rgba(255, 122, 26, 0.34), var(--shadow);
  }
}

@keyframes attentionPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 122, 26, 0.38), var(--shadow);
  }

  100% {
    box-shadow: 0 0 0 18px rgba(255, 122, 26, 0), var(--shadow);
  }
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 5px 0 0;
  font-size: 1.28rem;
  letter-spacing: 0;
}

.budget-list,
.goal-list,
.bill-list,
.insight-list {
  display: grid;
  gap: 12px;
}

.budget-item,
.goal-item,
.bill-item,
.insight-item {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  background: var(--panel-raised);
}

.budget-item,
.goal-item,
.bill-item,
.insight-item {
  padding: 13px;
}

.empty-state,
.empty-table-state {
  padding: 18px;
  border: 1px dashed rgba(255, 122, 26, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 122, 26, 0.06);
  color: var(--muted-strong);
}

.empty-state p {
  margin: 6px 0 0;
  line-height: 1.5;
}

.empty-table-state {
  text-align: center;
}

.budget-meta,
.goal-meta,
.bill-item,
.insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.goal-actions,
.bill-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.budget-title,
.goal-title,
.bill-title {
  display: grid;
  gap: 3px;
}

.budget-title small,
.goal-title small,
.bill-title small {
  color: var(--muted);
}

.progress {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--orange-strong));
}

.progress.good span {
  background: linear-gradient(90deg, var(--green), #8af2b4);
}

.progress.warning span {
  background: linear-gradient(90deg, var(--yellow), var(--orange));
}

.progress.danger span {
  background: linear-gradient(90deg, var(--red), var(--orange));
}

.bill-date,
.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 122, 26, 0.12);
  color: var(--orange-strong);
  font-size: 0.78rem;
  font-weight: 750;
}

.status-pill.ok,
.status-pill.good {
  background: rgba(69, 212, 131, 0.12);
  color: var(--green);
}

.status-pill.review,
.status-pill.warning {
  background: rgba(255, 209, 102, 0.13);
  color: var(--yellow);
}

.status-pill.danger {
  background: rgba(255, 91, 91, 0.13);
  color: var(--red);
}

button.status-pill {
  border: 0;
  cursor: pointer;
}

button.status-pill:hover {
  filter: brightness(1.08);
}

.transaction-wrap {
  overflow-x: auto;
}

.transaction-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.delete-warning {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 107, 107, 0.22);
  border-radius: var(--radius);
  padding: 13px;
  background: rgba(255, 107, 107, 0.08);
}

.delete-warning strong {
  color: var(--red);
}

.delete-warning span,
.delete-warning p {
  margin: 0;
  color: var(--muted-strong);
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(255, 122, 26, 0.06);
}

.amount-cell {
  text-align: right;
}

.amount-income {
  color: var(--green);
  font-weight: 800;
}

.amount-expense {
  color: var(--text);
  font-weight: 750;
}

.transaction-form {
  display: grid;
  gap: 13px;
}

.form-note {
  margin: -3px 0 1px;
  font-size: 0.84rem;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  outline: none;
  background: var(--bg-soft);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 122, 26, 0.78);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.16);
}

textarea {
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
}

.modal {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px;
  box-shadow: var(--shadow);
}

.modal .panel-header {
  margin-bottom: 14px;
}

.auth-note {
  margin: 0 0 14px;
  line-height: 1.5;
}

.cloud-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 122, 26, 0.24);
  border-radius: var(--radius);
  background: var(--panel-raised);
}

.cloud-status span,
.cloud-status strong {
  display: block;
}

.cloud-status span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cloud-status strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.cloud-status.signed-in {
  border-color: rgba(69, 212, 131, 0.32);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: 360px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 122, 26, 0.28);
  border-radius: var(--radius);
  background: var(--panel-raised);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sync-card {
    margin-top: 0;
  }

  .hero-grid,
  .layout-grid {
    grid-template-columns: 1fr 1fr;
  }

  .primary-summary,
  .panel.wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .focused-panel {
    min-height: 0;
  }

  .main-content,
  .sidebar {
    padding: 18px;
  }

  .sidebar {
    gap: 18px;
  }

  .topbar,
  .topbar-controls,
  .panel-header,
  .budget-meta,
  .goal-meta,
  .bill-item,
  .insight-item {
    flex-direction: column;
    align-items: stretch;
  }

  .goal-actions,
  .bill-actions,
  .topbar-controls,
  .month-switcher {
    justify-content: flex-start;
  }

  .month-select-shell {
    flex: 1 1 180px;
    min-width: 0;
  }

  .topbar h1 {
    font-size: 2.25rem;
  }

  .hero-grid,
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .chart-layout,
  .chart-controls {
    flex-direction: column;
  }

  .chart-export-button {
    width: 100%;
  }

  .chart-summary {
    grid-template-columns: 1fr 1fr;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

  .sync-card {
    display: none;
  }


  .topbar-actions,
  .filter-group {
    width: 100%;
  }

  .topbar-actions .button,
  .filter-group .chip {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-view.active {
    animation: none;
  }
}


.auth-checking .app-shell {
  visibility: hidden;
}

.auth-locked {
  display: grid;
  min-height: 100vh;
}

.auth-locked .app-shell {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 32px;
  align-items: center;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0;
}

.auth-screen[hidden] {
  display: none;
}

.auth-brand-panel,
.auth-card {
  border: 1px solid rgba(255, 122, 26, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-raised), var(--panel));
  box-shadow: var(--shadow);
}

.auth-brand-panel {
  display: grid;
  align-content: center;
  min-height: 520px;
  padding: 40px;
}

.auth-logo-mark {
  width: 72px;
  height: 72px;
  margin-bottom: 28px;
}

.auth-brand-panel h1 {
  max-width: 620px;
  margin: 8px 0 14px;
  font-size: clamp(2.4rem, 5vw, 5.2rem);
  line-height: 0.98;
}

.auth-brand-panel p:last-child {
  max-width: 600px;
  color: var(--muted-strong);
  font-size: 1.05rem;
  line-height: 1.7;
}

.auth-card {
  padding: 26px;
}

.auth-card h2 {
  margin: 8px 0 8px;
  font-size: 2rem;
}

.auth-toggle {
  width: 100%;
  margin-top: 14px;
  border: 0;
  background: transparent;
  color: var(--orange-strong);
  font: inherit;
  font-weight: 800;
}

@media (max-width: 860px) {
  .auth-screen {
    grid-template-columns: 1fr;
    width: min(100% - 28px, 520px);
    padding: 24px 0;
  }

  .auth-brand-panel {
    min-height: auto;
    padding: 26px;
  }

  .auth-brand-panel h1 {
    font-size: 2.4rem;
  }
}

/* Premium fintech redesign layer. This section intentionally overrides the first UI pass without changing app logic. */
:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-soft: #0a0b0d;
  --panel: rgba(16, 18, 22, 0.82);
  --panel-raised: rgba(23, 26, 32, 0.9);
  --panel-solid: #111318;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #fbfaf7;
  --muted: #919aa8;
  --muted-strong: #d1d7e0;
  --orange: #ff7a1a;
  --orange-strong: #ffb36b;
  --orange-soft: rgba(255, 122, 26, 0.13);
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #fb7185;
  --shadow: 0 26px 72px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 16px 38px rgba(0, 0, 0, 0.3);
  --focus-ring: 0 0 0 4px rgba(255, 122, 26, 0.16);
  --glow-orange: 0 0 0 1px rgba(255, 122, 26, 0.18), 0 18px 48px rgba(255, 122, 26, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 304px;
}

::selection {
  background: rgba(255, 122, 26, 0.35);
  color: var(--text);
}

html {
  background: #050505;
}

body {
  position: relative;
  overflow-x: hidden;
  background:
    linear-gradient(115deg, rgba(255, 122, 26, 0.15), transparent 27rem),
    linear-gradient(235deg, rgba(74, 222, 128, 0.07), transparent 24rem),
    linear-gradient(135deg, #050505 0%, #0b0c0f 48%, #050505 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.035) 48%, transparent 49%);
  background-position: center top;
  background-size: 68px 68px, 68px 68px, 420px 420px;
  mask-image: linear-gradient(to bottom, black, black 44%, transparent 100%);
  content: "";
}

body.light-mode {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-soft: #eef3f7;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-raised: rgba(255, 255, 255, 0.96);
  --panel-solid: #ffffff;
  --line: rgba(15, 23, 42, 0.11);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #101828;
  --muted: #667085;
  --muted-strong: #344054;
  --orange-soft: rgba(255, 122, 26, 0.1);
  --shadow: 0 22px 58px rgba(15, 23, 42, 0.11);
  --shadow-soft: 0 14px 34px rgba(15, 23, 42, 0.08);
  background:
    linear-gradient(115deg, rgba(255, 122, 26, 0.14), transparent 26rem),
    linear-gradient(235deg, rgba(74, 222, 128, 0.12), transparent 22rem),
    linear-gradient(135deg, #f8fafc 0%, #fff7ed 55%, #f8fafc 100%);
}

body.light-mode::before {
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
}

.app-shell {
  isolation: isolate;
}

.sidebar {
  top: 12px;
  height: calc(100vh - 24px);
  margin: 12px 0 12px 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18, 20, 24, 0.9), rgba(8, 9, 11, 0.82));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(1.18);
}

.light-mode .sidebar {
  background: rgba(255, 255, 255, 0.78);
}

.brand {
  min-height: 64px;
  padding: 10px;
  border: 1px solid rgba(255, 122, 26, 0.2);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.15), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-color: rgba(255, 179, 107, 0.46);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.35), rgba(255, 179, 107, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 16px 34px rgba(255, 122, 26, 0.18);
}

.logo-mark img,
.auth-logo-mark img {
  transform: scale(1.06);
}

.brand strong {
  font-size: 1.04rem;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted-strong);
}

.nav-list {
  gap: 9px;
}

.nav-list a {
  min-height: 48px;
  border-radius: 12px;
  padding: 13px 14px 13px 18px;
  color: var(--muted-strong);
  font-weight: 820;
  letter-spacing: 0;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.nav-list a::before {
  top: 12px;
  bottom: 12px;
  left: 8px;
  width: 4px;
  border-radius: 999px;
}

.nav-list a:hover {
  transform: translateX(3px);
  border-color: rgba(255, 179, 107, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.nav-list a.active {
  border-color: rgba(255, 122, 26, 0.48);
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.24), rgba(255, 255, 255, 0.052));
  box-shadow: var(--glow-orange);
  color: var(--text);
}

.nav-list a.active::before {
  background: linear-gradient(180deg, var(--orange-strong), var(--orange));
  box-shadow: 0 0 18px rgba(255, 122, 26, 0.72);
}

.sync-card {
  border-radius: 14px;
  border-color: rgba(255, 179, 107, 0.25);
  background:
    linear-gradient(135deg, rgba(255, 122, 26, 0.16), transparent 55%),
    linear-gradient(160deg, rgba(31, 33, 39, 0.94), rgba(12, 13, 16, 0.86));
  box-shadow: var(--shadow-soft);
}

.light-mode .sync-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(255, 247, 237, 0.9));
}

.main-content {
  gap: 22px;
  padding: 28px 30px 34px 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 9;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, auto);
  align-items: start;
  margin: -10px -6px 0;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.9), rgba(5, 5, 5, 0.58));
  backdrop-filter: blur(22px) saturate(1.12);
}

.light-mode .topbar {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(248, 250, 252, 0.62));
}

.topbar-copy {
  gap: 9px;
}

.topbar h1 {
  max-width: 680px;
  font-size: clamp(2.15rem, 3vw, 3.85rem);
  letter-spacing: 0;
  line-height: 0.98;
}

.month-range {
  max-width: 640px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-proof-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-proof-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 780;
  backdrop-filter: blur(14px);
}


.eyebrow {
  color: var(--orange-strong);
  letter-spacing: 0.16em;
}

.topbar-controls {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.topbar-actions {
  justify-content: flex-end;
}

.month-switcher,
.profile-button,
.button,
.icon-button,
.chip,
.chart-select-shell select,
input,
select,
textarea {
  border-radius: 10px;
}

.month-switcher,
.profile-button {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
  backdrop-filter: blur(16px);
}

.month-switcher {
  padding: 6px;
}

.month-select-shell {
  min-width: 184px;
}

.profile-button {
  min-height: 44px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.profile-button:hover,
.month-switcher:hover {
  border-color: rgba(255, 122, 26, 0.42);
}

.profile-avatar {
  width: 30px;
  height: 30px;
  box-shadow: 0 12px 24px rgba(255, 122, 26, 0.24);
}

.button,
.icon-button,
.chip {
  border-color: rgba(255, 255, 255, 0.105);
  background: rgba(255, 255, 255, 0.052);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.button:hover,
.icon-button:hover,
.chip:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 179, 107, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 14px 30px rgba(0, 0, 0, 0.18);
}

.button:focus-visible,
.icon-button:focus-visible,
.chip:focus-visible,
.profile-button:focus-visible,
.nav-list a:focus-visible,
.auth-toggle:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring), var(--glow-orange);
}

.button.primary {
  border-color: rgba(255, 179, 107, 0.78);
  background: linear-gradient(135deg, #ffb36b 0%, #ff7a1a 44%, #ee5d0d 100%);
  box-shadow: 0 18px 34px rgba(255, 122, 26, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  color: #160901;
}

.button.secondary {
  color: var(--red);
}

body.light-mode .button.secondary {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(214, 69, 69, 0.4);
  color: #c03535;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.034);
}

.chip.active {
  border-color: rgba(255, 179, 107, 0.5);
  background: rgba(255, 122, 26, 0.18);
  box-shadow: var(--glow-orange);
}

.app-view.active {
  display: grid;
  gap: 20px;
  animation: premiumViewEnter 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-view.active > * {
  animation: surfaceEnter 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.app-view.active > *:nth-child(2) {
  animation-delay: 70ms;
}

body[data-view-direction="back"] .app-view.active {
  animation-name: premiumViewEnterBack;
}

.hero-grid {
  grid-template-columns: minmax(360px, 1.45fr) repeat(3, minmax(180px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.summary-panel,
.panel,
.auth-brand-panel,
.auth-card,
.modal {
  position: relative;
  overflow: hidden;
  border-color: var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), transparent 44%),
    var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px) saturate(1.1);
}

.summary-panel::before,
.panel::before,
.auth-brand-panel::before,
.auth-card::before,
.modal::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 28%, transparent 76%, rgba(255, 122, 26, 0.07));
  content: "";
}

.summary-panel > *,
.panel > *,
.auth-brand-panel > *,
.auth-card > *,
.modal > * {
  position: relative;
  z-index: 1;
}

.summary-panel {
  display: flex;
  min-height: 176px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.summary-panel:hover,
.panel:hover {
  border-color: rgba(255, 179, 107, 0.26);
}

.summary-panel:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow), var(--glow-orange);
}

.primary-summary {
  min-height: 260px;
  background:
    linear-gradient(145deg, rgba(255, 122, 26, 0.32), rgba(255, 255, 255, 0.052) 48%, rgba(74, 222, 128, 0.08)),
    var(--panel-solid);
}

.primary-summary::after {
  right: -70px;
  bottom: -88px;
  width: 250px;
  height: 250px;
  border-color: rgba(255, 179, 107, 0.28);
  box-shadow: inset 0 0 42px rgba(255, 122, 26, 0.1);
}

.summary-panel h2 {
  margin-top: 12px;
  font-size: clamp(1.95rem, 2.6vw, 3.15rem);
  letter-spacing: 0;
}

.primary-summary h2 {
  font-size: clamp(3rem, 4.3vw, 5.2rem);
  line-height: 0.9;
}

.summary-panel .muted,
.summary-panel .trend {
  line-height: 1.45;
}

.cashflow-meter {
  height: 14px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.24);
}

.cashflow-meter span {
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.28);
}

.panel {
  padding: 20px;
}

.panel.wide {
  min-height: 420px;
}

.focused-panel {
  width: min(100%, 1080px);
}

.layout-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 16px;
}

.panel-header {
  gap: 14px;
}

.panel-header h2 {
  font-size: 1.38rem;
  letter-spacing: 0;
}

.dashboard-visualization {
  min-height: 460px;
}

.chart-controls {
  align-items: end;
  gap: 10px;
}

.chart-select-shell {
  min-width: 180px;
}

.chart-select-shell select {
  min-height: 42px;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.28fr);
  align-items: stretch;
  gap: 16px;
}

.chart-stage {
  min-height: 354px;
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 122, 26, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
}

.chart-svg {
  height: 354px;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.16));
}

.chart-label {
  fill: var(--muted-strong);
  font-weight: 760;
}

.chart-value {
  fill: var(--text);
  font-weight: 850;
}

.chart-axis {
  stroke: rgba(255, 255, 255, 0.14);
}

.light-mode .chart-axis {
  stroke: rgba(15, 23, 42, 0.16);
}

.chart-line {
  stroke-width: 4;
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.18));
}

.chart-stat,
.budget-item,
.goal-item,
.bill-item,
.insight-item,
.empty-state,
.empty-table-state,
.bill-note,
.delete-warning {
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.085);
  background: rgba(255, 255, 255, 0.044);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.chart-stat {
  padding: 14px;
}

.chart-stat strong {
  margin-top: 6px;
}

.budget-item,
.goal-item,
.bill-item,
.insight-item {
  padding: 14px;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.budget-item:hover,
.goal-item:hover,
.bill-item:hover,
.insight-item:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 179, 107, 0.24);
  background: rgba(255, 255, 255, 0.065);
}

.goal-title,
.budget-title,
.bill-title {
  min-width: 0;
}

.goal-title strong,
.budget-title strong,
.bill-title strong,
.insight-item strong {
  letter-spacing: 0;
}

.progress {
  height: 12px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.24);
}

.light-mode .progress {
  background: rgba(15, 23, 42, 0.08);
}

.bill-date,
.status-pill {
  min-height: 32px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 122, 26, 0.14);
  font-weight: 840;
}

.status-pill.ok {
  background: rgba(74, 222, 128, 0.14);
  color: var(--green);
}

.status-pill.review {
  background: rgba(251, 191, 36, 0.14);
  color: var(--yellow);
}

.status-pill.danger,
.button.danger {
  background: rgba(251, 113, 133, 0.13);
  color: var(--red);
}

.transaction-wrap {
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

table {
  min-width: 1040px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom-color: rgba(255, 255, 255, 0.075);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.052);
  color: var(--muted-strong);
  backdrop-filter: blur(12px);
}

tbody tr {
  transition: background 160ms ease, transform 160ms ease;
}

tbody tr:hover {
  background: rgba(255, 122, 26, 0.08);
}

.amount-income {
  color: var(--green);
}

.amount-expense {
  color: var(--orange-strong);
}

input,
select,
textarea {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

body:not(.light-mode) select option {
  background: #101216;
  color: var(--text);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(255, 179, 107, 0.28);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 179, 107, 0.76);
  box-shadow: var(--focus-ring), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.075);
}

.currency-prefix {
  color: var(--orange-strong);
}

.modal-overlay {
  background: rgba(3, 4, 6, 0.68);
  backdrop-filter: blur(18px) saturate(1.08);
}

.modal {
  width: min(540px, 100%);
  padding: 22px;
  animation: modalEnter 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.toast {
  border-radius: 12px;
  border-color: rgba(255, 179, 107, 0.36);
  background: rgba(17, 19, 23, 0.92);
  backdrop-filter: blur(18px);
}

.light-mode .toast {
  background: rgba(255, 255, 255, 0.94);
}

.auth-screen {
  width: min(1120px, calc(100% - 44px));
  gap: 22px;
}

.auth-brand-panel {
  min-height: 590px;
  padding: 46px;
  background:
    linear-gradient(135deg, rgba(255, 122, 26, 0.22), transparent 45%),
    linear-gradient(220deg, rgba(74, 222, 128, 0.1), transparent 42%),
    linear-gradient(150deg, rgba(27, 29, 35, 0.96), rgba(7, 8, 10, 0.86));
}

.light-mode .auth-brand-panel {
  background:
    linear-gradient(135deg, rgba(255, 122, 26, 0.16), transparent 45%),
    linear-gradient(220deg, rgba(74, 222, 128, 0.12), transparent 42%),
    rgba(255, 255, 255, 0.88);
}

.auth-logo-mark {
  width: 78px;
  height: 78px;
  border-radius: 16px;
}

.auth-brand-panel h1 {
  max-width: 660px;
  font-size: clamp(3rem, 5.4vw, 6rem);
  letter-spacing: 0;
  line-height: 0.9;
}

.auth-brand-panel p:last-of-type {
  max-width: 560px;
  line-height: 1.65;
}

.auth-proof-strip {
  margin-top: 18px;
}

.auth-card {
  padding: 30px;
}

.auth-card h2 {
  font-size: 2.15rem;
  letter-spacing: 0;
}

.auth-toggle {
  min-height: 42px;
  border-radius: 10px;
  transition: background 160ms ease, color 160ms ease;
}

.auth-toggle:hover {
  background: rgba(255, 122, 26, 0.08);
}

.panel.attention-pulse,
.budget-item.attention-pulse,
.transaction-row.attention-pulse {
  animation: attentionPulse 1300ms ease;
  border-color: rgba(255, 179, 107, 0.9);
}

.nav-twinkle {
  animation: navTwinkle 620ms ease-in-out 2;
  border-color: rgba(255, 179, 107, 0.95);
}

/* Directional 3D view transitions: navigating forward swings the page in from the right,
   navigating back swings it in from the left — like turning panes in space. */
@supports (view-transition-name: root) {
  ::view-transition-old(root) {
    animation: premiumRootOut 280ms cubic-bezier(0.5, 0, 0.75, 0) both;
  }

  ::view-transition-new(root) {
    animation: premiumRootInForward 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  html[data-view-direction="back"]::view-transition-old(root) {
    animation-name: premiumRootOutBack;
  }

  html[data-view-direction="back"]::view-transition-new(root) {
    animation-name: premiumRootInBack;
  }
}

@keyframes premiumRootOut {
  from {
    opacity: 1;
    filter: blur(0);
    transform: perspective(1400px) rotateY(0deg) translateZ(0);
  }

  to {
    opacity: 0;
    filter: blur(8px);
    transform: perspective(1400px) rotateY(-5deg) translateX(-42px) translateZ(-90px);
  }
}

@keyframes premiumRootInForward {
  from {
    opacity: 0;
    filter: blur(12px);
    transform: perspective(1400px) rotateY(6deg) translateX(56px) translateZ(-110px);
  }

  60% {
    filter: blur(0);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: perspective(1400px) rotateY(0deg) translateX(0) translateZ(0);
  }
}

@keyframes premiumRootOutBack {
  from {
    opacity: 1;
    filter: blur(0);
    transform: perspective(1400px) rotateY(0deg) translateZ(0);
  }

  to {
    opacity: 0;
    filter: blur(8px);
    transform: perspective(1400px) rotateY(5deg) translateX(42px) translateZ(-90px);
  }
}

@keyframes premiumRootInBack {
  from {
    opacity: 0;
    filter: blur(12px);
    transform: perspective(1400px) rotateY(-6deg) translateX(-56px) translateZ(-110px);
  }

  60% {
    filter: blur(0);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: perspective(1400px) rotateY(0deg) translateX(0) translateZ(0);
  }
}

@keyframes premiumViewEnter {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(16px) scale(0.988);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

@keyframes premiumViewEnterBack {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(-10px) scale(0.988);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

@keyframes surfaceEnter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes navTwinkle {
  0%,
  100% {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-soft);
  }

  50% {
    border-color: rgba(255, 179, 107, 0.48);
    box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.055), 0 0 18px rgba(255, 122, 26, 0.16), var(--shadow-soft);
  }
}

@media (max-width: 1240px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-controls {
    justify-items: start;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .primary-summary {
    grid-column: 1 / -1;
  }

  .chart-layout,
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .chart-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .sidebar {
    position: static;
    height: auto;
    margin: 12px;
  }

  .main-content {
    padding: 18px 24px 28px;
  }

  .topbar {
    position: relative;
    margin: 0;
  }
}

@media (max-width: 760px) {
  :root {
    --radius: 10px;
  }

  .main-content,
  .sidebar {
    padding: 16px;
  }

  .sidebar {
    margin: 10px;
  }

  .topbar h1 {
    font-size: 2.3rem;
    line-height: 1;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .summary-panel,
  .panel,
  .auth-brand-panel,
  .auth-card,
  .modal {
    border-radius: 12px;
  }

  .primary-summary h2 {
    font-size: 3.05rem;
  }

  .topbar-actions,
  .chart-controls,
  .auth-proof-strip {
    width: 100%;
  }

  .topbar-actions .button,
  .topbar-actions .profile-button,
  .month-switcher,
  .chart-select-shell,
  .chart-export-button {
    width: 100%;
  }

  .month-switcher {
    justify-content: space-between;
  }

  .chart-summary {
    grid-template-columns: 1fr;
  }

  .auth-screen {
    width: min(100% - 28px, 540px);
  }

  .auth-brand-panel,
  .auth-card {
    padding: 24px;
  }

  .auth-brand-panel h1 {
    font-size: 2.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-view.active,
  .app-view.active > *,
  .modal,
  .nav-twinkle,
  .panel.attention-pulse,
  .budget-item.attention-pulse,
  .transaction-row.attention-pulse {
    animation: none;
  }

  .button,
  .icon-button,
  .chip,
  .summary-panel,
  .budget-item,
  .goal-item,
  .bill-item,
  .insight-item,
  .nav-list a {
    transition: none;
  }
}


/* Premium refinement pass: market-style charts, polished month controls, and quieter trust messaging. */
.month-switcher {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(190px, 1fr) 40px;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  border: 1px solid rgba(255, 179, 107, 0.22);
  border-radius: 16px;
  padding: 7px;
  background:
    linear-gradient(135deg, rgba(255, 122, 26, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 32px rgba(0, 0, 0, 0.18);
}

.month-switcher::before {
  position: absolute;
  inset: 8px auto 8px 53px;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
  content: "";
}

.month-switcher::after {
  position: absolute;
  inset: 8px 53px 8px auto;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
  content: "";
}

.month-arrow {
  width: 40px;
  min-width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 900;
}

.month-arrow:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  transform: none;
}

.month-select-shell {
  position: relative;
  min-width: 0;
  padding: 0 28px 0 4px;
}

.month-select-shell::after {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--orange-strong);
  border-bottom: 2px solid var(--orange-strong);
  pointer-events: none;
  transform: rotate(45deg);
  content: "";
}

.month-select-shell span {
  color: var(--orange-strong);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
}

.month-select-shell select {
  width: 100%;
  min-height: 30px;
  appearance: none;
  color: var(--text);
  font-size: 1.04rem;
  letter-spacing: 0;
}

.trust-ribbon {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 4px auto 0;
  padding: 4px;
  color: var(--muted);
}

.trust-ribbon span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.032);
  font-size: 0.72rem;
  font-weight: 760;
}

.trust-ribbon span:first-child {
  color: var(--orange-strong);
}

.chart-stage {
  position: relative;
  min-height: 378px;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 122, 26, 0.15), transparent 18rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018));
}

.chart-stage::before {
  position: absolute;
  inset: 14px;
  border-radius: 10px;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 92%);
  content: "";
}

.chart-svg-market {
  height: 378px;
}

.chart-market-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-dasharray: 3 8;
}

.chart-area {
  pointer-events: none;
}

.chart-line-market {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4.5;
}

.chart-endpoint {
  stroke-width: 3;
  fill: var(--panel-solid);
}

.chart-endpoint-income {
  fill: #4ade80;
  stroke: rgba(74, 222, 128, 0.34);
}

.chart-endpoint-expense {
  fill: #ff7a1a;
  stroke: rgba(255, 122, 26, 0.34);
}

.chart-market-badge rect,
.chart-legend-pill rect {
  fill: rgba(255, 255, 255, 0.07);
  stroke: rgba(255, 255, 255, 0.1);
}

.chart-market-badge text {
  fill: var(--text);
  font-size: 0.78rem;
  font-weight: 850;
}

.chart-badge-positive {
  fill: var(--green);
}

.chart-badge-negative {
  fill: var(--red);
}

.chart-legend-pill text {
  font-size: 0.72rem;
}

.nav-twinkle {
  animation: navTwinkle 620ms ease-in-out 2;
}

@keyframes navTwinkle {
  0%,
  100% {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-soft);
  }

  50% {
    border-color: rgba(255, 179, 107, 0.46);
    box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.055), 0 0 18px rgba(255, 122, 26, 0.14), var(--shadow-soft);
  }
}

body.light-mode .trust-ribbon span,
body.light-mode .chart-market-badge rect,
body.light-mode .chart-legend-pill rect {
  background: rgba(255, 255, 255, 0.72);
  fill: rgba(255, 255, 255, 0.72);
  stroke: rgba(15, 23, 42, 0.1);
}

@media (max-width: 760px) {
  .month-switcher {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .trust-ribbon {
    justify-content: flex-start;
  }
}

/* ============================================================= */
/* Premium polish layer v5 — refinement pass + new components.   */
/* Uses existing tokens only; base orange/black palette unchanged. */
/* ============================================================= */

/* Tabular figures make money read clean and aligned across rows. */
.summary-panel h2,
.amount-cell,
.chart-value,
.chart-stat strong,
.status-pill,
.budget-title small,
.goal-title small,
.bill-title small,
.deleted-meta small,
.month-select-shell select {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.primary-summary h2 {
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.3);
}

.light-mode .primary-summary h2 {
  text-shadow: 0 2px 16px rgba(255, 122, 26, 0.16);
}

/* Refined, quiet scrollbars that match the surface. */
.transaction-wrap,
.deleted-list,
.main-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 122, 26, 0.42) transparent;
}

.transaction-wrap::-webkit-scrollbar,
.deleted-list::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.transaction-wrap::-webkit-scrollbar-thumb,
.deleted-list::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(255, 122, 26, 0.4);
  background-clip: content-box;
}

.transaction-wrap::-webkit-scrollbar-thumb:hover,
.deleted-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 122, 26, 0.62);
  background-clip: content-box;
}

/* Tactile feedback on the small action pills (Edit / Delete / Add saved). */
button.status-pill {
  transition: transform 150ms ease, filter 150ms ease, background 150ms ease;
}

button.status-pill:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

button.status-pill:active {
  transform: translateY(0);
}

button.status-pill:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

/* Buttons mid-request read clearly as unavailable. */
.button:disabled,
.button[disabled] {
  cursor: progress;
  opacity: 0.62;
  transform: none;
  filter: saturate(0.85);
}

/* Budget cards gain the same action cluster as goals and bills. */
.budget-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Transactions header toolbar: recycle-bin entry point + filters. */
.transaction-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.button.small {
  min-height: 34px;
  padding: 0 13px;
  font-size: 0.82rem;
}

/* Quiet text link used for "Forgot password?". */
.auth-link {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 4px;
  border: 0;
  padding: 4px 2px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 0.86rem;
  font-weight: 720;
  transition: color 150ms ease;
}

.auth-link:hover {
  color: var(--orange-strong);
}

.auth-link:focus-visible {
  outline: 0;
  border-radius: 6px;
  box-shadow: var(--focus-ring);
}

.auth-link[hidden] {
  display: none;
}

/* Compact confirm / reset dialogs. */
.modal-compact {
  width: min(430px, 100%);
}

.modal-message {
  margin: 0 0 18px;
  color: var(--muted-strong);
  line-height: 1.55;
}

/* Recycle-bin list. */
.deleted-list {
  display: grid;
  gap: 10px;
  max-height: min(60vh, 460px);
  overflow-y: auto;
  padding-right: 4px;
}

.deleted-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.044);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.light-mode .deleted-item {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.deleted-item:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 179, 107, 0.24);
  background: rgba(255, 255, 255, 0.065);
}

.light-mode .deleted-item:hover {
  background: rgba(255, 255, 255, 0.9);
}

.deleted-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.deleted-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deleted-meta small {
  color: var(--muted);
}

.deleted-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Slightly warmer empty states so blank views still feel designed. */
.empty-state strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 1.02rem;
}

/* ============================================================= */
/* Premium polish layer v6 — display typography + chart refinement. */
/* ============================================================= */

:root {
  --font-display: "Sora", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  font-family: var(--font-body);
}

h1,
h2,
h3,
.brand strong,
.topbar h1,
.summary-panel h2,
.panel-header h2,
.sync-card h2,
.auth-card h2,
.auth-brand-panel h1,
.modal h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.018em;
}

.topbar h1,
.auth-brand-panel h1,
.primary-summary h2 {
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Cash-flow chart legend: each series shows its own aligned total. */
.chart-legend-name {
  fill: var(--muted-strong);
  font-size: 13px;
  font-weight: 700;
}

.chart-legend-amount {
  font-size: 14.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.chart-income-text {
  fill: var(--green);
}

.chart-expense-text {
  fill: var(--orange-strong);
}

.chart-callout-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chart-net-positive,
.chart-net-negative {
  font-size: 15px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.chart-net-positive {
  fill: var(--green);
}

.chart-net-negative {
  fill: var(--red);
}

/* Non-actionable insight status — a clear indicator, not a fake button. */
.insight-flag {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
  border-radius: 999px;
  padding: 6px 12px 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 760;
  cursor: default;
}

.light-mode .insight-flag {
  background: rgba(15, 23, 42, 0.05);
}

.insight-flag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.insight-flag.ok {
  color: var(--green);
}

.insight-flag.review {
  color: var(--yellow);
}

/* Spendable today — daily allowance chip inside the safe-to-spend card */
.daily-allowance {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 16px;
  padding: 11px 15px;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.14), rgba(255, 122, 26, 0.04));
  border: 1px solid rgba(255, 122, 26, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.daily-allowance[hidden] {
  display: none;
}

.daily-allowance-tag {
  width: 100%;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange-strong);
}

.daily-allowance-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.daily-allowance-meta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted-strong);
}

.daily-allowance.is-critical {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.16), rgba(255, 107, 107, 0.05));
  border-color: rgba(255, 107, 107, 0.32);
}

.daily-allowance.is-critical .daily-allowance-tag {
  color: var(--red);
}

/* ============================================================
   Ultra-premium motion system
   ============================================================ */

/* --- Scroll reveal: cards float up out of depth as they enter the viewport.
   Kept deliberately cheap: no will-change or per-card perspective, so dozens of
   cards never overwhelm the compositor on low-end machines. --- */
.reveal-card {
  opacity: 0;
  transform: translateY(26px) scale(0.985);
  transition:
    opacity 640ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 640ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-card.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Stagger the four hero cards so the dashboard opens like a sequence, not a dump. */
.hero-grid .reveal-card:nth-child(1) { transition-delay: 0ms; }
.hero-grid .reveal-card:nth-child(2) { transition-delay: 80ms; }
.hero-grid .reveal-card:nth-child(3) { transition-delay: 160ms; }
.hero-grid .reveal-card:nth-child(4) { transition-delay: 240ms; }

/* --- 3D hover: summary cards tilt toward the light with a sheen sweep --- */
.hero-grid {
  perspective: 1600px;
}

.summary-panel {
  position: relative;
  overflow: hidden;
  transition:
    transform 320ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 320ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 320ms ease;
}

.summary-panel:hover {
  transform: translateY(-7px) rotateX(1.6deg) scale(1.015);
  border-color: rgba(255, 122, 26, 0.4);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 122, 26, 0.12),
    0 0 44px rgba(255, 122, 26, 0.1);
}

.summary-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.07) 48%, transparent 62%);
  transform: translateX(-130%);
  transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.summary-panel:hover::after {
  transform: translateX(130%);
}

body.light-mode .summary-panel:hover {
  box-shadow:
    0 22px 48px rgba(31, 20, 8, 0.16),
    0 0 0 1px rgba(255, 122, 26, 0.18);
}

/* --- Chart motion & premium chart pieces --- */
.chart-bar-track {
  fill: rgba(148, 128, 110, 0.14);
}

.chart-bar {
  animation: barGrow 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes barGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.chart-bar-cap {
  opacity: 0;
  animation: chartFadeIn 320ms ease-out forwards;
}

.chart-share {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.chart-pie-slice {
  stroke: var(--panel);
  stroke-width: 2.5;
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), filter 260ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.chart-pie-slice:hover {
  transform: scale(1.045);
  filter: brightness(1.12);
}

.chart-pie-group {
  animation: pieReveal 820ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pieReveal {
  from {
    opacity: 0;
    transform: rotate(-42deg) scale(0.82);
  }

  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

.chart-donut-total {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  fill: var(--text);
  letter-spacing: -0.01em;
}

/* Opacity-only: CSS transform animations would override the SVG translate()
   positioning attribute on these groups and collapse every row onto the origin. */
.chart-legend-row {
  opacity: 0;
  animation: legendFadeIn 460ms ease-out forwards;
}

@keyframes legendFadeIn {
  to {
    opacity: 1;
  }
}

.chart-legend-value {
  font-weight: 700;
}

.chart-line-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: lineDraw 1100ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes lineDraw {
  to { stroke-dashoffset: 0; }
}

.chart-area {
  opacity: 0;
  animation: chartFadeIn 700ms ease-out 420ms forwards;
}

@keyframes chartFadeIn {
  to { opacity: 1; }
}

/* --- Neutral trend state for months without data --- */
.trend.muted-trend {
  color: var(--muted);
}

/* ============================================================
   Settings hub modal
   ============================================================ */
.settings-modal {
  width: min(560px, calc(100vw - 48px));
}

.settings-group {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.settings-group legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange-strong);
}

.settings-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.settings-choice {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), border-color 200ms ease, box-shadow 200ms ease;
}

.settings-choice:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 122, 26, 0.45);
}

.settings-choice.selected {
  border-color: var(--orange);
  background: linear-gradient(135deg, rgba(255, 122, 26, 0.16), rgba(255, 122, 26, 0.04));
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.35), 0 8px 26px rgba(255, 122, 26, 0.12);
}

.settings-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-choice-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.settings-choice-caption {
  font-size: 0.78rem;
  color: var(--muted);
}

.settings-note {
  margin: 4px 0 14px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ============================================================
   Liquid-glass surface system
   Ambient light lives behind the UI; every major surface is a
   frosted pane with a catch-light top edge. Falls back to the
   solid panels automatically where backdrop-filter is missing.
   ============================================================ */

/* Ambient drifting light behind the glass */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 55vw;
  height: 55vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  pointer-events: none;
}

body::before {
  top: -18vw;
  left: -12vw;
  background: radial-gradient(circle, rgba(255, 122, 26, 0.22), transparent 65%);
  animation: orbDriftA 46s ease-in-out infinite alternate;
}

body::after {
  right: -16vw;
  bottom: -20vw;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.1), rgba(255, 122, 26, 0.06) 55%, transparent 70%);
  animation: orbDriftB 58s ease-in-out infinite alternate;
}

@keyframes orbDriftA {
  to { transform: translate(9vw, 7vh) scale(1.12); }
}

@keyframes orbDriftB {
  to { transform: translate(-8vw, -9vh) scale(1.08); }
}

body.light-mode::before {
  background: radial-gradient(circle, rgba(255, 122, 26, 0.14), transparent 65%);
}

body.light-mode::after {
  background: radial-gradient(circle, rgba(74, 222, 128, 0.1), transparent 70%);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel,
  .summary-panel,
  .sync-card,
  .topbar,
  .modal {
    background:
      linear-gradient(165deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015) 45%, rgba(255, 122, 26, 0.035));
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    backdrop-filter: blur(22px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-top-color: rgba(255, 255, 255, 0.17);
    box-shadow:
      0 24px 64px rgba(0, 0, 0, 0.38),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  .settings-choice {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  body.light-mode .panel,
  body.light-mode .summary-panel,
  body.light-mode .sync-card,
  body.light-mode .topbar,
  body.light-mode .modal {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.5));
    border: 1px solid rgba(31, 20, 8, 0.1);
    border-top-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 20px 48px rgba(31, 20, 8, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  }

  body.light-mode .settings-choice {
    background: rgba(255, 255, 255, 0.55);
  }
}

/* ============================================================
   Money calendar
   ============================================================ */
.calendar-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted-strong);
}

.calendar-legend-item::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.calendar-legend-item.income::before { background: var(--green); color: var(--green); }
.calendar-legend-item.bill::before { background: var(--orange); color: var(--orange); }
.calendar-legend-item.goal::before { background: var(--yellow); color: var(--yellow); }

.calendar-note {
  margin: 2px 0 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.money-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekday {
  padding: 4px 2px 8px;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.calendar-day {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 76px;
  padding: 7px 7px 6px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), border-color 220ms ease, background 220ms ease;
}

.calendar-day.empty {
  border-color: transparent;
  background: transparent;
}

.calendar-day.weekend:not(.empty) {
  background: rgba(255, 255, 255, 0.005);
  border-style: dashed;
}

.calendar-day.has-events:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 122, 26, 0.45);
  background: rgba(255, 122, 26, 0.06);
}

.calendar-day.today {
  border-color: var(--orange);
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.55), 0 0 24px rgba(255, 122, 26, 0.18);
}

.calendar-day-number {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted-strong);
}

.calendar-day.today .calendar-day-number {
  color: var(--orange-strong);
}

.calendar-event {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 6px;
  border-radius: 7px;
  font-size: 0.62rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.calendar-event.income { background: rgba(69, 212, 131, 0.16); color: var(--green); }
.calendar-event.bill { background: rgba(255, 122, 26, 0.16); color: var(--orange-strong); }
.calendar-event.goal { background: rgba(255, 209, 102, 0.16); color: var(--yellow); }
.calendar-event.more { background: rgba(255, 255, 255, 0.08); color: var(--muted-strong); }

body.light-mode .calendar-day {
  border-color: rgba(31, 20, 8, 0.08);
  background: rgba(255, 255, 255, 0.4);
}

body.light-mode .calendar-day.empty {
  border-color: transparent;
  background: transparent;
}

@media (max-width: 760px) {
  .calendar-day { min-height: 58px; padding: 5px; }
  .calendar-event { font-size: 0.56rem; padding: 1px 4px; }
}

/* --- Calm mode: every premium animation steps aside for reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .reveal-card,
  .summary-panel,
  .summary-panel::after,
  .settings-choice {
    transition: none !important;
  }

  .reveal-card {
    opacity: 1;
    transform: none;
  }

  .chart-bar,
  .chart-bar-cap,
  .chart-pie-group,
  .chart-legend-row,
  .chart-line-draw,
  .chart-area {
    animation: none !important;
    opacity: 1;
    stroke-dashoffset: 0;
  }

  body::before,
  body::after,
  .calendar-day {
    animation: none !important;
    transition: none !important;
  }
}


/* ============================================================
   Decluttered topbar: showcase headline + jewel month selector
   ============================================================ */

#page-title {
  font-size: clamp(2.2rem, 3.6vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 16ch;
  background: linear-gradient(115deg, var(--text) 58%, var(--orange-strong) 96%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-copy .month-range::before {
  content: "";
  display: inline-block;
  width: 26px;
  height: 3px;
  margin-right: 10px;
  border-radius: 2px;
  vertical-align: middle;
  background: linear-gradient(90deg, var(--orange), var(--orange-strong));
}

/* --- Month selector: glass jewel pill --- */
.month-switcher {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 40px 10px 18px;
  position: relative;
  border-radius: 16px;
  cursor: pointer;
  border: 1px solid rgba(255, 122, 26, 0.35);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015)),
    rgba(20, 16, 12, 0.55);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 30px rgba(0, 0, 0, 0.25);
  color: var(--text);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), border-color 220ms ease, box-shadow 220ms ease;
}

.month-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 122, 26, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 14px 36px rgba(0, 0, 0, 0.3), 0 0 24px rgba(255, 122, 26, 0.16);
}

.light-mode .month-pill {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(255, 250, 243, 0.65));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 26px rgba(31, 20, 8, 0.1);
}

.month-pill-eyebrow {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange-strong);
}

.month-pill-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.month-pill-chevron {
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--orange);
  border-bottom: 2px solid var(--orange);
  transform: rotate(45deg);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.month-pill[aria-expanded="true"] .month-pill-chevron {
  transform: rotate(-135deg);
  margin-top: -2px;
}

/* --- Month popover: floating glass month grid --- */
.month-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 80;
  width: 312px;
  max-height: 336px;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-content: start;
  border-radius: 18px;
  border: 1px solid rgba(255, 122, 26, 0.28);
  background: linear-gradient(165deg, rgba(34, 27, 20, 0.94), rgba(15, 11, 8, 0.96));
  backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: monthPopIn 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.light-mode .month-popover {
  background: linear-gradient(165deg, rgba(255, 253, 249, 0.97), rgba(250, 244, 235, 0.97));
  box-shadow: 0 30px 70px rgba(31, 20, 8, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

@keyframes monthPopIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
}

.month-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-strong);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.month-option:hover {
  background: rgba(255, 122, 26, 0.13);
  border-color: rgba(255, 122, 26, 0.25);
  color: var(--text);
}

.month-option.selected {
  background: linear-gradient(135deg, #ff7a1a, #ff9a3d);
  color: #1c0f03;
  font-weight: 800;
}

.month-now-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* --- Settings: data management row --- */
.settings-data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button.danger-ghost {
  background: transparent;
  border: 1px solid rgba(255, 107, 107, 0.5);
  color: var(--red);
}

.button.danger-ghost:hover {
  background: rgba(255, 107, 107, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .month-popover {
    animation: none;
  }

  .month-pill,
  .month-pill-chevron {
    transition: none;
  }
}

/* Keep the open month popover above every other topbar control. */
.month-switcher {
  z-index: 120;
}

/* ============================================================
   Shell refresh: professional nav icons, calmer sidebar, bottom nav
   ============================================================ */
.nav-list a {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.nav-icon {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--muted);
  transition: color var(--dur-fast) ease, transform var(--dur-base) var(--ease-out);
}

.nav-list a:hover .nav-icon {
  color: var(--orange-strong);
  transform: translateY(-1px);
}

.nav-list a.active .nav-icon {
  color: var(--orange);
}

/* Bottom navigation (mobile) */
.bottom-nav {
  display: none;
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    padding-bottom: 96px;
  }

  .bottom-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 140;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: var(--s-3) var(--s-2);
    border-radius: var(--r-lg);
    border: 1px solid var(--hairline);
    background: rgba(14, 11, 8, 0.82);
    backdrop-filter: blur(22px) saturate(1.3);
    box-shadow: var(--e-3);
  }

  .light-mode .bottom-nav {
    background: rgba(255, 251, 245, 0.88);
  }

  .bottom-nav a {
    display: grid;
    place-items: center;
    width: 46px;
    height: 42px;
    border-radius: var(--r-md);
    color: var(--muted);
    transition: color var(--dur-fast) ease, background var(--dur-fast) ease;
  }

  .bottom-nav a .nav-icon {
    width: 24px;
    height: 24px;
    color: inherit;
  }

  .bottom-nav a.active {
    color: var(--orange);
    background: var(--orange-soft);
  }
}

/* ============================================================
   Landing page — the Podupu front door (deliberately dark)
   ============================================================ */
.auth-screen {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: var(--s-6);
  align-items: center;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: var(--s-7) 0;
}

@media (max-width: 860px) {
  .auth-gate {
    grid-template-columns: 1fr;
  }
}

.auth-back {
  margin-top: var(--s-4);
  background: none;
  border: none;
  color: var(--muted);
  font-size: var(--t-sm);
  cursor: pointer;
  padding: var(--s-2) 0;
}

.auth-back:hover {
  color: var(--orange-strong);
}

.landing {
  --l-ink: #f8f2ea;
  --l-muted: #b3a494;
  color: var(--l-ink);
  background:
    radial-gradient(60rem 34rem at 85% -6%, rgba(255, 122, 26, 0.14), transparent 60%),
    radial-gradient(46rem 30rem at -10% 38%, rgba(69, 212, 131, 0.05), transparent 55%),
    #080706;
  min-height: 100vh;
  overflow-x: hidden;
}

.landing-header {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-4) clamp(20px, 5vw, 64px);
  background: rgba(8, 7, 6, 0.72);
  backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid var(--hairline);
}

.landing-lockup {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.landing-lockup .brand-stack {
  width: 40px;
  height: 40px;
}

.landing-lockup.small .brand-stack {
  width: 30px;
  height: 30px;
}

.landing-header-actions {
  display: flex;
  gap: var(--s-3);
}

.button.large {
  padding: 14px 26px;
  font-size: var(--t-base);
}

/* --- Hero --- */
.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(48px, 9vh, 110px) 0 clamp(40px, 7vh, 90px);
  --px: 0;
  --py: 0;
}

@media (max-width: 920px) {
  .landing-hero {
    grid-template-columns: 1fr;
  }
}

.landing-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: var(--s-4) 0;
  text-wrap: balance;
}

.hero-accent {
  background: linear-gradient(115deg, var(--orange), var(--orange-strong));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-sub {
  font-size: var(--t-md);
  line-height: 1.6;
  color: var(--l-muted);
  max-width: 54ch;
  margin: 0 0 var(--s-5);
}

.landing-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}

.landing-cta-row.center {
  justify-content: center;
}

/* --- Hero stage: floating 3D snippet cluster --- */
.hero-stage {
  position: relative;
  min-height: 430px;
  perspective: 1400px;
  transform-style: preserve-3d;
}

.hero-snippet {
  position: absolute;
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)), rgba(18, 14, 11, 0.82);
  backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: var(--e-3), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  padding: var(--s-5);
  animation: heroFloat 7s ease-in-out infinite;
}

.hero-snippet[data-depth="3"] {
  top: 8%;
  left: 0;
  width: min(320px, 82%);
  z-index: 3;
  transform: translate3d(calc(var(--px) * -14px), calc(var(--py) * -10px), 40px);
}

.hero-snippet[data-depth="6"] {
  top: 46%;
  right: 4%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  animation-delay: 1.2s;
  transform: translate3d(calc(var(--px) * -30px), calc(var(--py) * -22px), 90px);
}

.hero-snippet[data-depth="6"] svg {
  width: 84px;
  height: 84px;
}

.hero-snippet[data-depth="9"] {
  bottom: 0;
  left: 10%;
  z-index: 1;
  animation-delay: 2.4s;
  transform: translate3d(calc(var(--px) * -48px), calc(var(--py) * -34px), 140px);
}

@keyframes heroFloat {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -12px; }
}

.snippet-eyebrow {
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange-strong);
  margin: 0 0 var(--s-2);
}

.snippet-big {
  font-family: var(--font-display);
  font-size: var(--t-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-2);
}

.snippet-big small {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--l-muted);
}

.snippet-mid {
  font-family: var(--font-display);
  font-size: var(--t-lg);
  font-weight: 800;
  margin: 0;
}

.snippet-muted {
  font-size: var(--t-sm);
  color: var(--l-muted);
  margin: 0;
}

.snippet-allowance {
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 122, 26, 0.28);
  background: rgba(255, 122, 26, 0.1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.snippet-tag {
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange-strong);
}

/* Mini calendar chips */
.snippet-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: var(--s-3) 0;
}

.snippet-cal-grid span {
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--l-muted);
}

.snippet-cal-grid .bill { background: rgba(255, 122, 26, 0.22); color: #ffb36b; }
.snippet-cal-grid .pay { background: rgba(69, 212, 131, 0.2); color: #7fe3ab; }
.snippet-cal-grid .goal { background: rgba(255, 209, 102, 0.2); color: #ffd166; }
.snippet-cal-grid .today { background: #ff7a1a; color: #1c0f03; box-shadow: 0 0 14px rgba(255, 122, 26, 0.55); }

/* --- Feature sections --- */
.landing-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: center;
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(36px, 7vh, 84px) 0;
}

.landing-feature.flip .landing-feature-copy {
  order: 2;
}

@media (max-width: 860px) {
  .landing-feature {
    grid-template-columns: 1fr;
  }

  .landing-feature.flip .landing-feature-copy {
    order: 0;
  }
}

.landing-feature h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: var(--s-3) 0;
  text-wrap: balance;
}

.landing-feature-copy p:not(.eyebrow) {
  color: var(--l-muted);
  font-size: var(--t-base);
  line-height: 1.65;
  max-width: 50ch;
}

.mini-card {
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)), rgba(18, 14, 11, 0.8);
  backdrop-filter: blur(18px);
  box-shadow: var(--e-2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: var(--s-5);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}

.mini-card:hover {
  transform: translateY(-6px) rotateX(1.4deg);
  box-shadow: var(--e-3), 0 0 40px rgba(255, 122, 26, 0.1);
}

.mini-meter {
  height: 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: var(--s-3);
}

.mini-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--orange-strong));
}

.mini-row-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.mini-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.mini-row div {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mini-row strong {
  font-size: var(--t-sm);
}

.mini-row small {
  color: var(--l-muted);
  font-size: var(--t-xs);
}

.mini-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: var(--t-sm);
  color: var(--orange-strong);
  background: rgba(255, 122, 26, 0.14);
  border: 1px solid rgba(255, 122, 26, 0.25);
}

.mini-pill {
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

.mini-pill.review { background: rgba(255, 209, 102, 0.16); color: #ffd166; }
.mini-pill.ok { background: rgba(69, 212, 131, 0.15); color: #7fe3ab; }

.mini-privacy {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.mini-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.mini-chip-row span {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.045);
  font-size: var(--t-sm);
  font-weight: 600;
}

/* --- Gains + final CTA + footer --- */
.landing-gain {
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(36px, 7vh, 84px) 0;
  text-align: center;
}

.landing-gain h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  letter-spacing: -0.025em;
  margin-bottom: var(--s-6);
}

.landing-gain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-4);
  text-align: left;
}

.gain-card {
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)), rgba(18, 14, 11, 0.7);
  padding: var(--s-5);
}

.gain-card .gain-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-md);
  margin: 0 0 var(--s-2);
}

.gain-card p:not(.gain-title) {
  color: var(--l-muted);
  margin: 0;
  line-height: 1.6;
}

.landing-final {
  text-align: center;
  width: min(760px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(40px, 8vh, 100px) 0;
}

.landing-final h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 3.2rem);
  letter-spacing: -0.03em;
  margin-bottom: var(--s-3);
}

.landing-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-6) clamp(20px, 5vw, 64px);
  border-top: 1px solid var(--hairline);
}

.landing-footnote {
  color: var(--l-muted);
  font-size: var(--t-sm);
}

@media (prefers-reduced-motion: reduce) {
  .hero-snippet {
    animation: none;
    transform: none !important;
  }

  .mini-card,
  .nav-icon {
    transition: none;
  }
}

/* ============================================================
   Money Pulse — signature dashboard visualization
   ============================================================ */
.money-pulse-panel { display: flex; flex-direction: column; gap: var(--s-5); }
.money-pulse-header { align-items: flex-start; }

.pulse-status {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-pill);
  border: 1px solid var(--hairline); font-size: var(--t-sm);
  font-weight: 700; white-space: nowrap;
}
.pulse-status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.pulse-status.ahead   { color: var(--green); background: rgba(69,212,131,0.1); border-color: rgba(69,212,131,0.34); }
.pulse-status.onpace  { color: var(--orange-strong); background: rgba(255,122,26,0.1); border-color: rgba(255,122,26,0.34); }
.pulse-status.risk    { color: var(--red); background: rgba(255,107,107,0.12); border-color: rgba(255,107,107,0.36); }
.pulse-status.planned { color: var(--muted-strong); }
.pulse-status.ahead .pulse-status-dot  { background: var(--green); animation: pulseDot 2s var(--ease-out) infinite; }
.pulse-status.onpace .pulse-status-dot { background: var(--orange); animation: pulseDot 2s var(--ease-out) infinite; }
.pulse-status.risk .pulse-status-dot   { background: var(--red); animation: pulseDot 1.4s var(--ease-out) infinite; }

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  70% { box-shadow: 0 0 0 7px transparent; opacity: 0.85; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

.pulse-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-3); }
.pulse-metric {
  display: flex; flex-direction: column; gap: var(--s-1);
  padding: var(--s-4); border-radius: var(--r-md);
  background: rgba(255,255,255,0.03); border: 1px solid var(--hairline);
}
.pulse-metric-label { font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pulse-metric-value { font-family: var(--font-display); font-size: var(--t-md); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.pulse-metric-value.positive { color: var(--green); }
.pulse-metric-value.negative { color: var(--red); }

.pulse-chart-wrap { position: relative; width: 100%; }
.pulse-chart { width: 100%; aspect-ratio: 76 / 30; min-height: 240px; }
.pulse-svg { width: 100%; height: 100%; display: block; overflow: visible; touch-action: none; }

.pulse-grid { stroke: var(--hairline); stroke-width: 1; }
.pulse-axis { stroke: var(--hairline); stroke-width: 1.4; }
.pulse-ideal { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 3 6; stroke-linecap: round; opacity: 0.7; }
.pulse-prev { fill: none; stroke: var(--muted-strong); stroke-width: 1.6; opacity: 0.28; stroke-linejoin: round; }
.pulse-fill { fill: url(#pulseArea); opacity: 0; animation: pulseFillIn 700ms var(--ease-out) 420ms forwards; }
.pulse-actual {
  fill: none; stroke: var(--orange); stroke-width: 3;
  stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 4px 12px rgba(255,122,26,0.4));
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: pulseDraw 1050ms var(--ease-out) forwards;
}
@keyframes pulseDraw { to { stroke-dashoffset: 0; } }
@keyframes pulseFillIn { to { opacity: 1; } }

.pulse-marker { stroke: var(--panel); stroke-width: 1.5; }
.pulse-marker.income { fill: var(--green); }
.pulse-marker.bill { fill: var(--orange-strong); }
.pulse-today { fill: var(--orange); stroke: var(--panel); stroke-width: 2.5; color: var(--orange); animation: pulseDot 2s var(--ease-out) infinite; }

.pulse-crosshair { stroke: var(--orange-strong); stroke-width: 1; stroke-dasharray: 2 3; transition: opacity 120ms ease; }
.pulse-hover-dot { fill: var(--orange); stroke: var(--text); stroke-width: 2; transition: opacity 120ms ease; }

.pulse-tooltip {
  position: absolute; top: 8px; transform: translateX(-50%);
  min-width: 152px; max-width: 220px; padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md); background: var(--panel-raised);
  border: 1px solid var(--hairline); box-shadow: var(--e-2);
  display: flex; flex-direction: column; gap: 3px;
  font-size: var(--t-sm); pointer-events: none; z-index: 5;
}
.pulse-tooltip strong { color: var(--text); }
.pulse-tooltip .tip-row { display: flex; justify-content: space-between; gap: var(--s-4); color: var(--muted); }
.pulse-tooltip .tip-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.pulse-tooltip .tip-delta { margin-top: 2px; font-weight: 700; }
.pulse-tooltip .tip-delta.good { color: var(--green); }
.pulse-tooltip .tip-delta.bad { color: var(--red); }
.pulse-tooltip .tip-event { margin-top: 2px; font-weight: 600; }
.pulse-tooltip .tip-event.income { color: var(--green); }
.pulse-tooltip .tip-event.bill { color: var(--orange-strong); }

.pulse-legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: var(--t-sm); color: var(--muted); }
.pulse-key { display: inline-flex; align-items: center; gap: var(--s-2); }
.pulse-key i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.pulse-key.actual i { background: var(--orange); }
.pulse-key.ideal i { height: 0; border-top: 2px dashed var(--muted); }
.pulse-key.prev i { background: var(--muted-strong); opacity: 0.42; }
.pulse-key.income i { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.pulse-key.bill i { width: 9px; height: 9px; border-radius: 50%; background: var(--orange-strong); }

@media (max-width: 720px) { .pulse-metrics { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) {
  .pulse-actual { animation: none; stroke-dashoffset: 0; }
  .pulse-fill { animation: none; opacity: 1; }
  .pulse-today, .pulse-status-dot { animation: none !important; }
}

/* ============================================================
   Calendar quick entry + account danger zone
   ============================================================ */
.calendar-day.clickable { cursor: pointer; position: relative; transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out); }
.calendar-day.clickable:hover,
.calendar-day.clickable:focus-visible {
  border-color: rgba(255, 122, 26, 0.55);
  background: rgba(255, 122, 26, 0.07);
  transform: translateY(-2px);
  outline: none;
}
/* A soft "+" appears in the free corner on hover — the quick-entry invitation. */
.calendar-day.clickable::after {
  content: "+";
  position: absolute;
  top: 6px;
  right: 9px;
  font-size: var(--t-sm);
  font-weight: 800;
  color: var(--orange);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
  pointer-events: none;
}
.calendar-day.clickable:hover::after,
.calendar-day.clickable:focus-visible::after { opacity: 1; transform: scale(1); }
.calendar-day.future-locked { opacity: 0.55; cursor: default; }

.add-tx-modal { width: min(500px, calc(100vw - 40px)); }
.add-tx-modal .transaction-form { display: flex; flex-direction: column; gap: var(--s-3); }
.add-tx-modal .checkbox-row { flex-direction: row; align-items: center; gap: var(--s-2); }

.danger-zone { border-top: 1px solid var(--hairline); padding-top: var(--s-4); margin-top: var(--s-2); }
.danger-legend, .danger-eyebrow { color: var(--red) !important; }
.settings-danger-copy { font-size: var(--t-sm); color: var(--muted); margin: 0 0 var(--s-3); max-width: 46ch; }

.button.danger-outline {
  background: none;
  border: 1px solid rgba(255, 107, 107, 0.5);
  color: var(--red);
}
.button.danger-outline:hover { background: rgba(255, 107, 107, 0.1); border-color: var(--red); }
.button.danger {
  background: linear-gradient(135deg, #ff8080, #e5484d);
  border: 1px solid rgba(255, 107, 107, 0.6);
  color: #fff;
}
.button.danger:disabled { opacity: 0.45; cursor: not-allowed; }

.delete-account-modal .delete-list { margin: var(--s-2) 0 var(--s-3); padding-left: 20px; display: flex; flex-direction: column; gap: 5px; color: var(--muted-strong); font-size: var(--t-sm); }
.delete-account-modal .modal-message.strong { font-weight: 800; color: var(--red); }
.delete-confirm-label { display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--t-sm); color: var(--muted-strong); margin-bottom: var(--s-4); }
.delete-confirm-label b { color: var(--red); letter-spacing: 0.08em; }
.delete-confirm-label input {
  padding: 10px 14px; border-radius: var(--r-sm);
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.05); color: var(--text);
  font-size: var(--t-base); letter-spacing: 0.12em; font-weight: 700;
}
.delete-confirm-label input:focus { outline: 2px solid rgba(255, 107, 107, 0.5); outline-offset: 1px; }

/* ============================================================
   Landing v2 — committed dark cinematic surface
   ============================================================ */
/* The landing is ALWAYS dark, no matter what theme the app saved.
   Pinning tokens here stops light-mode ink from vanishing on black. */
.auth-screen {
  --text: #f8f2ea;
  --muted: #aa9b8b;
  --muted-strong: #d6c3ae;
  --panel: #171411;
  --panel-raised: #201b16;
  --line: #34291f;
  --orange-soft: rgba(255, 122, 26, 0.14);
  --hairline: rgba(255, 255, 255, 0.09);
  color: var(--text);
  color-scheme: dark;
}

/* Wordmark + logo bars keep their dark-ground colors even in light-mode. */
.auth-screen .brand-word { color: #f4ede3; }
.auth-screen .brand-stack .bar-low { fill: #8a8277; }
.auth-screen .brand-stack .bar-mid { fill: #c9c0b2; }
.auth-screen .brand-stack .bar-top { fill: #ff7a1a; }

/* Ghost buttons finally own a visible voice on black. */
.auth-screen .button.ghost {
  color: #f4ede3;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.auth-screen .button.ghost:hover {
  border-color: rgba(255, 122, 26, 0.6);
  background: rgba(255, 122, 26, 0.1);
  color: #ffd9b8;
  transform: translateY(-1px);
}

/* Proof chips: quiet glass, clearly legible. */
.auth-screen .auth-proof-strip span {
  color: #d6c3ae;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.045);
}

/* Sticky glass header with a hairline base. */
.landing-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px) saturate(1.3);
  background: rgba(8, 7, 6, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

/* --- Typography: editorial signature --- */
.landing-hero h1 {
  font-size: clamp(3rem, 7.2vw, 5.4rem);
  letter-spacing: -0.04em;
  line-height: 0.99;
}

/* The accent word becomes a serif italic with a living gradient. */
.hero-accent {
  font-family: "Fraunces", "Iowan Old Style", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.01em;
  background: linear-gradient(105deg, #ffb36b 0%, #ff7a1a 38%, #ffd166 70%, #ff9a3d 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: heroShimmer 6s ease-in-out infinite;
}

@keyframes heroShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.landing-sub { font-size: clamp(1.05rem, 1.6vw, 1.25rem); }

/* --- Motion: float via `translate` so pointer-parallax `transform` composes --- */
@keyframes heroFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}

.hero-snippet {
  transition: transform 260ms var(--ease-out);
  will-change: transform;
}

/* --- CTA presence --- */
.landing-cta-row .button.primary.large {
  box-shadow: 0 10px 34px rgba(255, 122, 26, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  animation: ctaBreathe 4s ease-in-out infinite;
}
.landing-cta-row .button.primary.large:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 44px rgba(255, 122, 26, 0.5);
}

@keyframes ctaBreathe {
  0%, 100% { box-shadow: 0 10px 34px rgba(255, 122, 26, 0.3); }
  50% { box-shadow: 0 12px 44px rgba(255, 122, 26, 0.5); }
}

/* --- Feature visuals: 3D tilt on approach --- */
.landing-feature-visual .mini-card {
  transition: transform 340ms var(--ease-out), box-shadow 340ms ease, border-color 340ms ease;
}
.landing-feature-visual:hover .mini-card {
  transform: perspective(900px) rotateX(3.5deg) rotateY(-4deg) translateY(-8px);
  border-color: rgba(255, 122, 26, 0.4);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.5), 0 0 44px rgba(255, 122, 26, 0.12);
}
.landing-feature.flip .landing-feature-visual:hover .mini-card {
  transform: perspective(900px) rotateX(3.5deg) rotateY(4deg) translateY(-8px);
}

/* Gain cards lift softly. */
.gain-card { transition: transform 280ms var(--ease-out), border-color 280ms ease; }
.gain-card:hover { transform: translateY(-5px); border-color: rgba(255, 122, 26, 0.4); }

@media (prefers-reduced-motion: reduce) {
  .hero-accent { animation: none; }
  .hero-snippet { animation: none !important; transition: none; }
  .landing-cta-row .button.primary.large { animation: none; }
}

/* ==========================================================================
   Auth gate — the sign-in / sign-up stage.
   Deliberately single-theme: the pre-login world is always the dark brand
   surface, immune to the in-app light/dark preference. Every colour below is
   hard-coded on purpose; do not swap them for theme variables.
   ========================================================================== */

.auth-gate {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 620px) minmax(360px, 470px);
  justify-content: center;
  align-items: center;
  column-gap: var(--s-6);
  padding: var(--s-7) max(24px, calc((100vw - 1150px) / 2));
  background:
    radial-gradient(46rem 30rem at 8% -6%, rgba(255, 122, 26, 0.16), transparent 60%),
    radial-gradient(40rem 28rem at 100% 108%, rgba(74, 222, 128, 0.08), transparent 62%),
    linear-gradient(160deg, #0a0806 0%, #0d0a07 52%, #070605 100%);
}

/* Floating ambient orbs give the glass something to refract. */
.auth-gate::before,
.auth-gate::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}

.auth-gate::before {
  width: 380px;
  height: 380px;
  left: -120px;
  top: -100px;
  background: radial-gradient(circle, rgba(255, 122, 26, 0.28), transparent 70%);
  animation: gateOrbDrift 16s ease-in-out infinite alternate;
}

.auth-gate::after {
  width: 320px;
  height: 320px;
  right: -100px;
  bottom: -110px;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.16), transparent 70%);
  animation: gateOrbDrift 19s ease-in-out infinite alternate-reverse;
}

@keyframes gateOrbDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(46px, 34px, 0) scale(1.12); }
}

/* --- Brand panel: the story side --- */
.auth-gate .auth-brand-panel,
.light-mode .auth-gate .auth-brand-panel {
  display: grid;
  align-content: center;
  gap: var(--s-4);
  min-height: 560px;
  padding: var(--s-7);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top-color: rgba(255, 255, 255, 0.16);
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, rgba(255, 122, 26, 0.13), transparent 46%),
    linear-gradient(215deg, rgba(74, 222, 128, 0.07), transparent 44%),
    linear-gradient(160deg, rgba(24, 19, 14, 0.94), rgba(9, 7, 5, 0.9));
  box-shadow: var(--e-3);
  backdrop-filter: blur(26px) saturate(1.2);
  animation: gateRiseLeft 700ms var(--ease-out) both;
}

.gate-lockup {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}

.gate-lockup .auth-stack {
  width: 46px;
  height: 46px;
}

.gate-word {
  font-family: var(--font-display);
  font-size: var(--t-md);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f8f2ea;
}

.auth-gate .auth-brand-panel .eyebrow,
.light-mode .auth-gate .auth-brand-panel .eyebrow {
  color: #ff9a3d;
}

.auth-gate .auth-brand-panel h1,
.light-mode .auth-gate .auth-brand-panel h1 {
  margin: 0;
  font-size: clamp(2.1rem, 3.6vw, 2.9rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  color: #f8f2ea;
  text-wrap: balance;
}

.gate-accent {
  font-family: Fraunces, "Iowan Old Style", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  background: linear-gradient(120deg, #ffb36b, #ff7a1a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-gate .gate-copy,
.light-mode .auth-gate .gate-copy {
  max-width: 44ch;
  margin: 0;
  font-size: var(--t-base);
  line-height: 1.6;
  color: #b9a893;
}

.auth-gate .auth-proof-strip,
.light-mode .auth-gate .auth-proof-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.auth-gate .auth-proof-strip span,
.light-mode .auth-gate .auth-proof-strip span {
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.045);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #cfc2b2;
}

/* --- Auth card: the doorway --- */
.auth-gate .auth-card,
.light-mode .auth-gate .auth-card {
  padding: var(--s-6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.18);
  border-radius: var(--r-lg);
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.05), transparent 38%),
    linear-gradient(160deg, rgba(28, 22, 16, 0.96), rgba(12, 9, 7, 0.94));
  box-shadow: var(--e-3), 0 0 60px rgba(255, 122, 26, 0.07);
  backdrop-filter: blur(26px) saturate(1.2);
  animation: gateRiseRight 700ms var(--ease-out) 90ms both;
}

.auth-gate .auth-card .eyebrow { color: #ff9a3d; }

.auth-gate .auth-card h2,
.light-mode .auth-gate .auth-card h2 {
  margin: 6px 0 8px;
  font-size: var(--t-lg);
  letter-spacing: -0.02em;
  color: #f8f2ea;
}

.auth-gate .auth-card .muted,
.light-mode .auth-gate .auth-card .muted {
  color: #a99b8a;
}

.auth-gate .auth-card label,
.light-mode .auth-gate .auth-card label {
  color: #d6c9b8;
  font-weight: 600;
}

.auth-gate .auth-card input,
.light-mode .auth-gate .auth-card input {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.05);
  color: #f8f2ea;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background var(--dur-fast) ease;
}

.auth-gate .auth-card input::placeholder { color: #7d7264; }

.auth-gate .auth-card input:focus,
.light-mode .auth-gate .auth-card input:focus {
  outline: none;
  border-color: rgba(255, 122, 26, 0.75);
  background: rgba(255, 122, 26, 0.05);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.18);
}

.auth-gate .auth-link,
.auth-gate .auth-toggle,
.auth-gate .auth-back,
.light-mode .auth-gate .auth-link,
.light-mode .auth-gate .auth-toggle,
.light-mode .auth-gate .auth-back {
  color: #cfc2b2;
}

.auth-gate .auth-toggle,
.light-mode .auth-gate .auth-toggle {
  color: #ff9a3d;
  font-weight: 700;
}

.auth-gate .auth-link:hover,
.auth-gate .auth-toggle:hover,
.auth-gate .auth-back:hover {
  color: #ffb36b;
}

/* Entrance: the two panels swing up out of depth toward the visitor. */
@keyframes gateRiseLeft {
  from {
    opacity: 0;
    transform: perspective(1300px) translateY(34px) rotateY(5deg) scale(0.97);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: perspective(1300px) translateY(0) rotateY(0deg) scale(1);
    filter: blur(0);
  }
}

@keyframes gateRiseRight {
  from {
    opacity: 0;
    transform: perspective(1300px) translateY(34px) rotateY(-5deg) scale(0.97);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: perspective(1300px) translateY(0) rotateY(0deg) scale(1);
    filter: blur(0);
  }
}

@media (max-width: 900px) {
  .auth-gate {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--s-5);
    padding: var(--s-6) 20px;
  }

  .auth-gate .auth-brand-panel {
    min-height: 0;
    padding: var(--s-6);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-gate::before,
  .auth-gate::after,
  .auth-gate .auth-brand-panel,
  .auth-gate .auth-card {
    animation: none !important;
  }
}

/* --- Signup profile fields --- */
.auth-name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}

@media (max-width: 480px) {
  .auth-name-row { grid-template-columns: 1fr; }
}

.optional-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7d7264;
}

/* --- Inline auth error: guidance, not a dead end --- */
.auth-error {
  margin: var(--s-3) 0 0;
  padding: var(--s-3) var(--s-4);
  border: 1px solid rgba(224, 122, 95, 0.45);
  border-radius: var(--r-md);
  background: rgba(224, 122, 95, 0.1);
  color: #ffb4a1;
  font-size: var(--t-sm);
  line-height: 1.55;
}

.auth-error-cta {
  padding: 0;
  border: none;
  background: none;
  color: #ff9a3d;
  font-weight: 700;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-error-cta:hover { color: #ffb36b; }

/* ==========================================================================
   Light-mode modal legibility.
   Translucent white glass over the dark overlay reads as muddy grey, so in
   light mode dialogs become near-opaque warm paper with ink-dark text.
   ========================================================================== */

body.light-mode .modal {
  background: linear-gradient(180deg, #fffdf9 0%, #fbf3e8 100%);
  border: 1px solid rgba(31, 20, 8, 0.13);
  border-top-color: #ffffff;
  box-shadow: 0 34px 90px rgba(31, 20, 8, 0.3);
  backdrop-filter: none;
}

body.light-mode .modal::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), transparent 30%, transparent 78%, rgba(224, 95, 0, 0.05));
}

body.light-mode .settings-choice {
  background: #ffffff;
  border-color: rgba(31, 20, 8, 0.14);
}

body.light-mode .settings-choice.selected {
  background: linear-gradient(135deg, rgba(224, 95, 0, 0.1), rgba(224, 95, 0, 0.02));
  border-color: var(--orange);
}

/* Danger zone reads as danger in both themes. */
.settings-group.danger-zone legend {
  color: var(--red);
}

.settings-group.danger-zone {
  border-top: 1px solid var(--hairline);
  padding-top: var(--s-4);
}

/* ==========================================================================
   Workspace upgrades: search, avatars, pace, timelines, milestones,
   explain-this-number, and the scenario studio.
   ========================================================================== */

/* --- Explain buttons: every headline number can show its math --- */
.eyebrow-row {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.explain-btn {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.explain-btn:hover,
.explain-btn:focus-visible {
  color: var(--orange);
  transform: scale(1.15);
  outline: none;
}

.explain-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

.explain-link:hover {
  color: var(--orange);
}

.explain-rows {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin: var(--s-4) 0;
  font-variant-numeric: tabular-nums;
}

.explain-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: var(--s-2);
  align-items: baseline;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--orange-soft);
}

.explain-row .explain-op {
  font-weight: 800;
  color: var(--orange-strong);
  text-align: center;
}

.explain-row .explain-label {
  color: var(--muted-strong);
  font-size: var(--t-sm);
}

.explain-row .explain-value {
  font-weight: 700;
  color: var(--text);
}

.explain-row.total {
  border: 1px solid var(--orange);
  background: none;
}

.explain-row.total .explain-value {
  font-family: var(--font-display);
  font-size: var(--t-md);
}

/* --- Transactions: search field + merchant avatars --- */
.tx-search {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--panel);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.tx-search:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-soft);
}

.tx-search svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
  flex: none;
}

.tx-search input {
  width: 190px;
  border: none;
  background: none;
  color: var(--text);
  font-size: var(--t-sm);
  outline: none;
}

.tx-search input::placeholder {
  color: var(--muted);
}

.merchant-cell {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.merchant-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: hsl(var(--mh) 65% 50% / 0.18);
  border: 1px solid hsl(var(--mh) 65% 55% / 0.4);
  color: hsl(var(--mh) 70% 62%);
  font-size: 0.72rem;
  font-weight: 800;
}

body.light-mode .merchant-avatar {
  background: hsl(var(--mh) 60% 45% / 0.12);
  border-color: hsl(var(--mh) 60% 40% / 0.4);
  color: hsl(var(--mh) 70% 30%);
}

/* --- Budgets: spending pace --- */
.progress {
  position: relative;
}

.budget-pace.over {
  color: var(--red);
  font-weight: 600;
}

.budget-pace.under {
  color: var(--green);
}

.pace-tick {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  border-radius: 1px;
  background: var(--muted-strong);
  opacity: 0.75;
}

/* --- Bills: recurring-payment timeline --- */
.bill-timeline {
  display: flex;
  flex-direction: column;
}

.bill-tl-group {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: var(--s-3);
}

.bill-tl-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.bill-tl-rail::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: -4px;
  width: 2px;
  background: var(--hairline);
}

.bill-tl-group:last-child .bill-tl-rail::before {
  bottom: auto;
  height: 22px;
}

.bill-tl-dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft);
}

.bill-tl-group.past .bill-tl-dot {
  background: var(--green);
  box-shadow: none;
}

.bill-tl-content {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding-bottom: var(--s-5);
}

.bill-tl-date {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
}

.bill-tl-date strong {
  font-family: var(--font-display);
  font-size: var(--t-base);
}

.bill-tl-total {
  color: var(--muted);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

.bill-item.paid {
  opacity: 0.66;
}

.status-pill.upcoming {
  color: var(--orange-strong);
  border-color: currentColor;
}

/* --- Goals: milestones + projection --- */
.goal-milestone {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--hairline);
}

.goal-milestone.reached {
  background: rgba(255, 255, 255, 0.55);
}

body.light-mode .goal-milestone.reached {
  background: rgba(31, 20, 8, 0.4);
}

.goal-projection {
  color: var(--muted);
}

.goal-projection b {
  color: var(--orange-strong);
  font-weight: 700;
}

.goal-projection.done {
  color: var(--green);
  font-weight: 600;
}

.goal-contribs {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --- Scenario studio --- */
.scenario-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--t-sm);
  font-style: italic;
}

.scenario-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: var(--s-5);
  align-items: center;
}

@media (max-width: 860px) {
  .scenario-grid {
    grid-template-columns: 1fr;
  }
}

.scenario-inputs {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.scenario-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-sm);
  color: var(--muted-strong);
}

.scenario-field .currency-field {
  width: 130px;
}

.scenario-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s-3);
}

.scenario-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
}

.scenario-label {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.scenario-value {
  font-family: var(--font-display);
  font-size: var(--t-md);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.scenario-value.good { color: var(--text); }
.scenario-value.bad { color: var(--red); }

.scenario-base {
  font-size: var(--t-xs);
  color: var(--muted);
}

.scenario-status {
  font-weight: 800;
  font-size: var(--t-base);
}

.scenario-status.ahead { color: var(--green); }
.scenario-status.onpace { color: var(--text); }
.scenario-status.risk { color: var(--red); }
.scenario-status.planned { color: var(--muted); }

/* ============================================================
   Explain-this-number triggers & dialog
   ============================================================ */
.eyebrow-row {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.explain-btn {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: pointer;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.explain-btn:hover,
.explain-btn:focus-visible {
  color: var(--orange-strong);
  border-color: var(--orange-strong);
  transform: scale(1.12);
  outline: none;
}

.explain-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

.explain-link:hover { color: var(--orange-strong); }

.explain-modal { width: min(480px, calc(100vw - 48px)); }

/* ============================================================
   Transactions search shell
   ============================================================ */
.tx-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 210px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--orange-soft);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.tx-search:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.16);
}

.tx-search svg { flex: none; color: var(--muted); }

.tx-search input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: var(--t-sm);
  outline: none;
}

.tx-search input::placeholder { color: var(--muted); }

/* ============================================================
   Delete-account dialog states
   ============================================================ */
.delete-csv-button {
  width: 100%;
  margin: var(--s-3) 0 var(--s-2);
}

.delete-error {
  margin: var(--s-3) 0 0;
  padding: var(--s-3) var(--s-4);
  border: 1px solid rgba(210, 60, 45, 0.4);
  border-radius: var(--r-md);
  background: rgba(210, 60, 45, 0.1);
  color: var(--red);
  font-size: var(--t-sm);
  line-height: 1.5;
}

.delete-success {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-5) 0 var(--s-3);
  text-align: center;
}

.delete-success h2 {
  margin: 0;
  font-size: var(--t-lg);
  color: var(--text);
}

/* ==========================================================================
   Clarity release: metric sparks, filtered totals, statuses, story, planner
   ========================================================================== */

/* --- Metric card sparklines + deltas --- */
.metric-spark {
  width: 100px;
  height: 28px;
  margin: 4px 0 2px;
  color: var(--orange-strong);
  opacity: 0.85;
}

.metric-spark.empty { display: none; }

.primary-summary .metric-spark { color: var(--orange); }

.metric-delta {
  margin: 0 0 4px;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.metric-delta.delta-good { color: var(--green); }
.metric-delta.delta-bad { color: var(--red); }
.metric-delta.flat { color: var(--muted); font-weight: 600; }

/* --- Pulse additions --- */
.pulse-marker.goal { fill: var(--yellow); }
.pulse-key.goal i { background: var(--yellow); }
.tip-event.goal { color: var(--yellow); }

.pulse-text-summary {
  margin: 6px 0 0;
  font-size: var(--t-xs);
  line-height: 1.55;
  color: var(--muted);
  max-width: 72ch;
}

.pulse-refresh {
  animation: pulseRefresh 420ms var(--ease-out);
}

@keyframes pulseRefresh {
  from { opacity: 0.25; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Transactions: totals bar, sticky header, category filter --- */
.transaction-totals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(255, 122, 26, 0.05);
  font-size: var(--t-sm);
}

.transaction-totals[hidden] { display: none; }

.tx-total-count {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tx-total { color: var(--muted-strong); }
.tx-total b { font-weight: 800; color: var(--text); }
.tx-total.income b { color: var(--green); }
.tx-total.expense b { color: var(--red); }

.transaction-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  box-shadow: 0 1px 0 var(--hairline);
}

.tx-category-filter {
  max-width: 170px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--panel);
  color: var(--text);
  font-size: var(--t-sm);
}

/* --- Toast with action --- */
.toast-action {
  margin-left: 12px;
  padding: 4px 12px;
  border: 1px solid rgba(255, 122, 26, 0.6);
  border-radius: var(--r-pill);
  background: rgba(255, 122, 26, 0.14);
  color: var(--orange-strong);
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
}

.toast-action:hover { background: rgba(255, 122, 26, 0.26); }

/* --- Budgets: daily recommendation --- */
.budget-daily {
  color: var(--green);
  font-weight: 600;
}

.budget-header-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
}

/* --- Bills: commitments bar + overdue state --- */
.bill-commitments {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(255, 122, 26, 0.06);
  font-size: var(--t-sm);
}

.bill-commitments b { font-weight: 800; }

.bill-commitments-detail { color: var(--muted); font-size: var(--t-xs); }

.status-pill.danger { border-color: rgba(255, 107, 107, 0.5); color: var(--red); }

/* --- Monthly money story --- */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--s-3);
}

.story-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.025);
}

.light-mode .story-cell { background: rgba(255, 255, 255, 0.55); }

.story-label {
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-strong);
}

.story-value {
  font-family: var(--font-display);
  font-size: var(--t-md);
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.story-sub { font-size: var(--t-xs); color: var(--muted); }

.story-cell.story-action {
  grid-column: 1 / -1;
  background: rgba(255, 122, 26, 0.07);
  border-color: rgba(255, 122, 26, 0.25);
}

.story-action .action-text {
  font-size: var(--t-sm);
  color: var(--text);
  font-weight: 600;
}

.story-empty { color: var(--muted); margin: 0; font-size: var(--t-sm); }

/* --- Scenario studio extra fields --- */
.scenario-inputs { align-content: start; }

.scenario-field select {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--text);
  font-size: var(--t-sm);
  max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .pulse-refresh { animation: none; }
}

/* ==========================================================================
   Month navigator refresh — grouped single-column picker (2026-07-19)
   Overrides the earlier 2-column grid; later cascade wins, no risky edits.
   ========================================================================== */
.month-popover {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 264px;
  padding: 8px;
  max-height: 400px;
}

.month-year-label {
  padding: 10px 12px 4px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.month-year-label:first-child { padding-top: 2px; }

.month-popover .month-option {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  padding: 11px 13px;
  font-size: 0.95rem;
  border-radius: 11px;
}

.month-option-name { flex: 1; }

.month-now-badge {
  flex: none;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: rgba(74, 222, 128, 0.16);
  color: var(--green);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.month-option.selected .month-now-badge {
  background: rgba(28, 15, 3, 0.2);
  color: #1c0f03;
}

.month-check {
  flex: none;
  font-weight: 900;
  color: #1c0f03;
}

.month-popover-note {
  margin: 8px 4px 2px;
  padding-top: 9px;
  border-top: 1px solid var(--hairline);
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}

/* Pill: a touch more refined/modern */
.month-pill { padding: 8px 40px 9px 16px; border-radius: 14px; }
.month-pill-eyebrow { font-size: 0.56rem; letter-spacing: 0.16em; opacity: 0.9; }
.month-pill-label { font-size: 1rem; }

/* ==========================================================================
   Accounts (payment sources)
   ========================================================================== */
.accounts-setup-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  padding: var(--s-5);
  border-color: rgba(255, 122, 26, 0.32);
  background:
    linear-gradient(135deg, rgba(255, 122, 26, 0.12), transparent 55%),
    var(--panel);
}

.accounts-setup-copy { flex: 1 1 320px; }
.accounts-setup-card h2 { margin: 6px 0 8px; font-size: var(--t-md); letter-spacing: -0.01em; }
.accounts-setup-card p { margin: 0; max-width: 68ch; font-size: var(--t-sm); line-height: 1.6; color: var(--muted-strong); }
.accounts-setup-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.accounts-modal { width: min(620px, calc(100vw - 40px)); }

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-height: 46vh;
  overflow-y: auto;
  margin: var(--s-3) 0 var(--s-4);
}

.account-group-label {
  margin: var(--s-3) 0 2px;
  font-size: var(--t-xs);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange-strong);
}

.account-group-label:first-child { margin-top: 0; }

.account-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel-raised);
}

.account-row-main { display: flex; align-items: center; gap: var(--s-3); flex: 1; min-width: 0; }
.account-row-main strong { display: block; font-size: 0.95rem; }
.account-row-main small { color: var(--muted); font-size: var(--t-xs); }

.account-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-weight: 800;
  font-size: 0.95rem;
}

.account-avatar.bank { background: rgba(74, 222, 128, 0.16); color: var(--green); }
.account-avatar.credit { background: rgba(255, 122, 26, 0.16); color: var(--orange-strong); }

.account-row-balance { text-align: right; flex: none; }
.account-row-balance strong { display: block; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.account-row-balance small { font-size: var(--t-xs); color: var(--muted); }
.account-row-balance.owed strong { color: var(--orange-strong); }

.account-row-actions { display: flex; gap: 6px; flex: none; }

.account-debt-total {
  margin: var(--s-2) 0 0;
  padding-top: var(--s-3);
  border-top: 1px solid var(--hairline);
  font-size: var(--t-sm);
  color: var(--muted-strong);
  text-align: right;
}

.account-debt-total strong { color: var(--orange-strong); font-variant-numeric: tabular-nums; }

.settings-note-tight { margin-top: 0; margin-bottom: var(--s-3); }

@media (max-width: 560px) {
  .account-row { flex-wrap: wrap; }
  .account-row-balance { text-align: left; }
  .account-row-actions { width: 100%; }
}

/* --- Accounts in the ledger --- */
.merchant-text { display: inline-flex; flex-direction: column; gap: 1px; min-width: 0; }

.merchant-account {
  font-size: var(--t-xs);
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* A transfer is neither a gain nor a loss — never colour it like spending. */
.amount-cell.amount-transfer { color: var(--muted-strong); }
.transaction-row.is-transfer .merchant-account { color: var(--orange-strong); }

.accounts-modal-actions { flex-wrap: wrap; }

/* --- Phase 5: accounts overview on the dashboard --- */
.accounts-overview { margin-bottom: var(--s-4); }
.accounts-overview-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--s-3);
  margin: var(--s-3) 0 var(--s-4);
}
.acct-stat {
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel-raised);
  display: flex; flex-direction: column; gap: 3px;
}
.acct-stat-label { font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.acct-stat-value { font-family: var(--font-display); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.acct-stat.owed .acct-stat-value { color: var(--orange-strong); }
.accounts-overview-list { display: flex; flex-direction: column; gap: var(--s-2); }
.in-bank-line { margin: 2px 0 0; font-size: var(--t-sm); color: var(--muted-strong); }
.in-bank-line strong { color: var(--text); font-variant-numeric: tabular-nums; }
.in-bank-line strong.owed { color: var(--orange-strong); }

/* ==========================================================================
   Landing enhancements — feature grid, accounts mock, scroll-3D, hero aurora
   ========================================================================== */
.landing-feature-visual,
.feature-tile { transform-style: preserve-3d; will-change: transform; }

.landing-grid-section { text-align: center; padding: var(--s-7) 0; }
.center-eyebrow { color: #ff9a3d; }
.landing-grid-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -0.02em;
  margin: 0 auto var(--s-6);
  max-width: 22ch;
  color: #f8f2ea;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: var(--s-4);
  text-align: left;
  perspective: 1300px;
}

.feature-tile {
  padding: var(--s-5);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top-color: rgba(255, 255, 255, 0.16);
  border-radius: var(--r-lg);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)), rgba(18, 14, 11, 0.7);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--e-2);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.feature-tile:hover {
  border-color: rgba(255, 122, 26, 0.45);
  box-shadow: var(--e-3), 0 0 42px rgba(255, 122, 26, 0.12);
}

.feature-ico {
  display: inline-flex;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  margin-bottom: var(--s-3);
  border-radius: 13px;
  background: linear-gradient(135deg, #ff7a1a, #ff9a3d);
  color: #1c0f03;
}
.feature-ico svg { width: 23px; height: 23px; }
.feature-tile h3 { margin: 0 0 6px; font-size: 1.1rem; color: #f8f2ea; }
.feature-tile p { margin: 0; font-size: 0.9rem; line-height: 1.55; color: #b9a893; }

/* Accounts mock visual */
.accounts-mock { display: flex; flex-direction: column; gap: 10px; }
.mock-row { display: flex; align-items: center; gap: 12px; }
.mock-name { flex: 1; min-width: 0; }
.mock-name strong { display: block; font-size: 0.92rem; color: #f8f2ea; }
.mock-name small { font-size: 0.72rem; color: #a2917d; }
.mock-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-weight: 800; font-size: 0.9rem; }
.mock-avatar.bank { background: rgba(74, 222, 128, 0.18); color: #59d98d; }
.mock-avatar.card { background: rgba(255, 122, 26, 0.18); color: #ff9a3d; }
.mock-bal { font-weight: 800; font-variant-numeric: tabular-nums; color: #f8f2ea; font-size: 0.9rem; }
.mock-bal.owed { color: #ff9a3d; }
.mock-bal.clear { color: #a2917d; font-weight: 600; }
.mock-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.mock-foot span { font-size: 0.78rem; color: #a2917d; }
.mock-foot strong { font-family: var(--font-display); font-size: 1.2rem; color: #f8f2ea; }

/* Hero aurora glow */
.landing-hero { position: relative; }
.landing-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -12% -20% auto -20%;
  height: 62%;
  background:
    radial-gradient(50% 60% at 20% 30%, rgba(255, 122, 26, 0.18), transparent 70%),
    radial-gradient(45% 55% at 85% 20%, rgba(74, 222, 128, 0.1), transparent 70%);
  filter: blur(34px);
  pointer-events: none;
  animation: auroraDrift 15s ease-in-out infinite alternate;
}
@keyframes auroraDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(32px, 22px, 0) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .landing-feature-visual,
  .feature-tile { transform: none !important; }
  .landing-hero::before { animation: none; }
}

/* ==========================================================================
   Landing hero — 3D product shot, ambient mesh, premium buttons (v30)
   ========================================================================== */
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; margin-bottom: var(--s-3);
  border: 1px solid rgba(255, 122, 26, 0.35);
  border-radius: var(--r-pill);
  background: rgba(255, 122, 26, 0.1);
  color: #ff9a3d; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.01em;
}

/* Ambient mesh behind the whole landing */
.landing { position: relative; isolation: isolate; }
.landing::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(38rem 30rem at 14% -6%, rgba(255, 122, 26, 0.16), transparent 60%),
    radial-gradient(34rem 30rem at 92% 6%, rgba(74, 222, 128, 0.09), transparent 60%),
    radial-gradient(42rem 34rem at 62% 104%, rgba(157, 124, 255, 0.08), transparent 62%),
    linear-gradient(180deg, #0a0806, #0b0907 60%, #080605);
  animation: meshDrift 24s ease-in-out infinite alternate;
}
@keyframes meshDrift { from { transform: translate3d(0,0,0); } to { transform: translate3d(0,-26px,0) scale(1.04); } }

/* Tilted device */
.hero-stage { perspective: 1700px; }
.hero-glow {
  position: absolute; inset: 4% 2% 4% 4%; z-index: 0;
  background: radial-gradient(closest-side, rgba(255, 122, 26, 0.3), transparent 72%);
  filter: blur(52px); animation: glowPulse 8s ease-in-out infinite;
}
@keyframes glowPulse { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }

.hero-device {
  position: relative; z-index: 2;
  transform: rotateY(-16deg) rotateX(7deg)
    translate3d(calc(var(--px) * -16px), calc(var(--py) * -12px), 0);
  transform-style: preserve-3d;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.2);
  background: linear-gradient(165deg, rgba(28, 22, 16, 0.97), rgba(12, 9, 7, 0.96));
  box-shadow: 0 52px 92px rgba(0,0,0,0.6), 0 0 72px rgba(255,122,26,0.1), inset 0 1px 0 rgba(255,255,255,0.08);
  overflow: hidden;
  animation: deviceFloat 9s ease-in-out infinite;
  transition: transform 0.4s var(--ease-out);
}
@keyframes deviceFloat { 0%,100% { margin-top: 0; } 50% { margin-top: -14px; } }

.hd-chrome { display: flex; align-items: center; gap: 6px; padding: 11px 15px; border-bottom: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); }
.hd-dot { width: 9px; height: 9px; border-radius: 50%; }
.hd-dot:nth-child(1){ background: #ff6b6b; } .hd-dot:nth-child(2){ background: #ffd166; } .hd-dot:nth-child(3){ background: #45d483; }
.hd-addr { margin-left: 10px; font-size: 0.72rem; color: #8a7a68; font-family: ui-monospace, Menlo, monospace; }
.hd-screen { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.hd-eyebrow { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: #ff9a3d; }
.hd-safe { display: flex; flex-direction: column; gap: 4px; }
.hd-big { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; letter-spacing: -0.02em; color: #f8f2ea; line-height: 1; margin-top: 2px; }
.hd-sub { font-size: 0.78rem; color: #a2917d; }
.hd-chip { align-self: flex-start; margin-top: 8px; padding: 6px 12px; border-radius: var(--r-pill); background: linear-gradient(135deg, rgba(255,122,26,0.16), rgba(255,122,26,0.05)); border: 1px solid rgba(255,122,26,0.24); color: #ffb36b; font-size: 0.74rem; font-weight: 700; }
.hd-pulse { border: 1px solid rgba(255,255,255,0.07); border-radius: 14px; padding: 12px 14px; background: rgba(255,255,255,0.02); }
.hd-pulse-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.hd-status { font-size: 0.66rem; font-weight: 800; color: #45d483; }
.hd-pulse svg { width: 100%; height: 60px; display: block; }
.hd-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hd-tile { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); }
.hd-tile small { display: block; font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: #8a7a68; margin-bottom: 3px; }
.hd-tile strong { font-size: 1rem; color: #f8f2ea; font-variant-numeric: tabular-nums; }
.hd-tile strong.up { color: #59d98d; }

.hero-float-card {
  position: absolute; z-index: 4; left: -7%; bottom: -6%;
  display: flex; flex-direction: column; gap: 3px;
  padding: 14px 17px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  border-top-color: rgba(255,255,255,0.22);
  background: linear-gradient(165deg, rgba(32,25,18,0.98), rgba(15,11,8,0.97));
  box-shadow: 0 30px 58px rgba(0,0,0,0.55);
  animation: deviceFloat 7s ease-in-out infinite 1s;
  transform: translate3d(calc(var(--px) * -38px), calc(var(--py) * -26px), 0);
}
.hf-bal { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; color: #f8f2ea; }
.hf-bal.owed { color: #ff9a3d; }
.hf-note { font-size: 0.72rem; color: #8a7a68; }

/* Premium landing buttons */
.button.primary.large {
  background: linear-gradient(135deg, #ff9a3d, #ff7a1a);
  box-shadow: 0 12px 30px rgba(255,122,26,0.32);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease;
}
.button.primary.large:hover { transform: translateY(-2px); box-shadow: 0 16px 42px rgba(255,122,26,0.44); }
.button.ghost.large { border: 1px solid rgba(255,255,255,0.16); transition: border-color 0.2s ease, background 0.2s ease; }
.button.ghost.large:hover { border-color: rgba(255,122,26,0.5); background: rgba(255,122,26,0.06); }

@media (max-width: 920px) {
  .hero-device { transform: none; }
  .hero-float-card { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-device, .hero-glow, .hero-float-card, .landing::before { animation: none; }
}

/* ==========================================================================
   Landing sections — richer, more premium to match the hero (v31)
   ========================================================================== */
.landing-feature { padding: clamp(46px, 8vh, 92px) 0; gap: clamp(32px, 6vw, 78px); align-items: center; }
.landing-feature-copy .eyebrow { color: #ff9a3d; margin-bottom: 10px; }
.landing-feature-copy h2 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  letter-spacing: -0.025em; line-height: 1.08; margin: 4px 0 16px; color: #f8f2ea;
  text-wrap: balance;
}
.landing-feature-copy p { font-size: 1.06rem; line-height: 1.66; color: #b9a893; max-width: 46ch; }

.landing-feature-visual { perspective: 1500px; }
.landing-feature-visual .mini-card,
.landing-feature-visual .accounts-mock {
  padding: var(--s-6);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(165deg, rgba(30, 24, 17, 0.95), rgba(13, 10, 8, 0.95));
  box-shadow: 0 44px 82px rgba(0, 0, 0, 0.52), 0 0 60px rgba(255, 122, 26, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(20px) saturate(1.2);
}
.landing-feature-visual .mini-card .snippet-big { font-family: var(--font-display); }

/* Section eyebrow + heading for the grid & gain blocks */
.landing-grid-section, .landing-gain { padding: clamp(48px, 8vh, 96px) 0; }
.landing-gain h2, .landing-grid-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  letter-spacing: -0.02em;
}

.gain-card {
  padding: var(--s-5);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(165deg, rgba(28, 22, 16, 0.7), rgba(14, 10, 8, 0.7));
  box-shadow: var(--e-2);
  transition: transform 0.28s var(--ease-out), border-color 0.28s ease;
}
.gain-card:hover { transform: translateY(-4px); border-color: rgba(255, 122, 26, 0.4); }
.gain-title { font-family: var(--font-display); font-size: 1.15rem; color: #f8f2ea; margin: 0 0 6px; }

/* Final CTA — make it a real closer */
.landing-final { padding: clamp(60px, 10vh, 120px) 0; text-align: center; }
.landing-final h2 { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -0.03em; margin-bottom: 12px; }


/* ============================================================
   MOBILE LAYER — phone-native behaviour (appended last so it
   wins over the earlier desktop-first rules of equal specificity).
   Breakpoint contract:
     <= 900px  tablet   : single column, sidebar still visible
     <= 720px  phone    : bottom nav, sheets, card lists
     <= 380px  small    : tightened spacing / type
   ============================================================ */

/* ---- 1. Foundations ---------------------------------------- */
@media (max-width: 900px) {
  /* The classic flex/grid overflow trap: a min-width:auto ancestor
     refuses to shrink, so an inner overflow-x:auto never engages and
     the whole PAGE scrolls sideways instead. Neutralise the chain. */
  .app-shell,
  .main-content,
  .app-view,
  .hero-grid,
  .layout-grid,
  .transactions-view-wrap,
  .panel,
  .panel.wide,
  .panel-header,
  .summary-panel {
    min-width: 0;
  }

  /* Nothing may push the document sideways. */
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }
}

@media (max-width: 720px) {
  /* Respect the notch and the home indicator. */
  .main-content {
    padding:
      calc(14px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
      calc(104px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    gap: 14px;
  }

  /* iOS zooms the page when a focused control is under 16px. Never allow it. */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* Comfortable thumb targets everywhere. */
  .button,
  .icon-button,
  .chip,
  .status-pill,
  .profile-button {
    min-height: 44px;
  }

  .status-pill {
    min-height: 36px;
  }
}

/* ---- 2. Topbar: was eating half the first screen ------------ */
@media (max-width: 720px) {
  .topbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: -4px 0 0;
    padding: 12px;
    border-radius: 14px;
  }

  .topbar-copy {
    gap: 4px;
  }

  /* #page-title is an ID selector, so it must be named explicitly —
     .topbar h1 alone loses on specificity no matter the source order. */
  .topbar h1,
  #page-title {
    max-width: none;
    font-size: clamp(1.5rem, 7vw, 1.95rem);
    line-height: 1.12;
  }

  .topbar .eyebrow {
    font-size: 0.62rem;
    letter-spacing: 0.14em;
  }

  .month-range {
    max-width: none;
    font-size: 0.82rem;
  }

  .topbar-controls {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 10px;
  }

  /* Month switcher: compact bar, arrows kept as real 44px targets. */
  .month-switcher {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    min-height: 0;
    padding: 4px;
    gap: 4px;
  }

  .month-switcher .icon-button {
    min-height: 40px;
    width: 100%;
  }

  .month-select-shell,
  .month-pill {
    min-width: 0;
    width: 100%;
  }

  .month-pill {
    min-height: 40px;
    /* The chevron is absolutely positioned, so the right padding is what
       reserves its lane — trimming it made the label run underneath. */
    padding: 4px 30px 4px 12px;
  }

  .month-pill-chevron {
    right: 11px;
  }

  /* Three visible children: profile, settings gear, Add transaction.
     Profile + gear share the first row; the primary action gets its
     own full-width row so its label never clips. */
  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .topbar-actions .profile-button {
    grid-column: 1;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .topbar-actions .icon-button {
    grid-column: 2;
    width: 44px;
    padding: 0;
  }

  .topbar-actions .button.primary {
    grid-column: 1 / -1;
    width: 100%;
  }

  /* Long names must ellipsis, never push the row wide. */
  .topbar-actions .profile-button > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
}

/* ---- 3. Bottom nav: safe-area aware ------------------------ */
@media (max-width: 720px) {
  .bottom-nav {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    padding: 6px 4px;
    gap: 2px;
  }

  .bottom-nav a {
    width: auto;
    flex: 1;
    height: 48px;
    min-height: 48px;
  }
}

/* ---- 4. Panels & dashboard --------------------------------- */
@media (max-width: 720px) {
  .panel,
  .summary-panel,
  #money-pulse-panel {
    padding: 16px 14px;
    border-radius: 14px;
  }

  .panel-header {
    gap: 10px;
  }

  .panel-header h2 {
    font-size: 1.15rem;
  }

  /* Money calendar: let the 7 columns share the width instead of
     sitting on fixed 40px cells that crowd on a 360px screen. */
  .money-calendar {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    font-size: 0.72rem;
  }

  .money-calendar .calendar-day {
    min-width: 0;
    aspect-ratio: 1;
  }

  /* Charts must never dictate page width. */
  .chart-shell,
  .chart-layout,
  .pulse-chart,
  #money-pulse-chart {
    min-width: 0;
    max-width: 100%;
  }

  .chart-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 380px) {
  .pulse-metrics {
    grid-template-columns: 1fr;
  }
}

/* ---- 5. Transactions: table -> card list -------------------- */
@media (max-width: 720px) {
  .transactions-view-wrap,
  .transaction-wrap {
    min-width: 0;
    max-width: 100%;
    overflow-x: visible;
  }

  .transaction-wrap table {
    min-width: 0;
    width: 100%;
    display: block;
    border-collapse: separate;
  }

  .transaction-wrap thead {
    display: none;
  }

  .transaction-wrap tbody {
    display: grid;
    gap: 10px;
  }

  /* Each row becomes a self-contained card. */
  .transaction-wrap tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    row-gap: 6px;
    column-gap: 10px;
    padding: 12px 13px;
    border: 1px solid var(--hairline);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.032);
  }

  .light-mode .transaction-wrap tbody tr {
    background: rgba(0, 0, 0, 0.025);
  }

  .transaction-wrap tbody td {
    display: block;
    border: 0;
    padding: 0;
    white-space: normal;
    min-width: 0;
  }

  /* Explicit placement — deterministic regardless of source order.
     td order is: 1 date, 2 merchant, 3 category, 4 status,
                  5 comments, 6 amount, 7 actions. */
  .transaction-wrap tbody tr td:nth-child(2) { grid-area: 1 / 1 / 2 / 2; }
  .transaction-wrap tbody tr td:nth-child(6) { grid-area: 1 / 2 / 2 / 3; justify-self: end; font-size: 1.02rem; }
  .transaction-wrap tbody tr td:nth-child(1) { grid-area: 2 / 1 / 3 / 2; font-size: 0.8rem; color: var(--muted); }
  .transaction-wrap tbody tr td:nth-child(3) { grid-area: 2 / 2 / 3 / 3; justify-self: end; font-size: 0.8rem; color: var(--muted); }
  .transaction-wrap tbody tr td:nth-child(5) { grid-area: 3 / 1 / 4 / 3; font-size: 0.82rem; color: var(--muted); }
  .transaction-wrap tbody tr td:nth-child(4) { grid-area: 4 / 1 / 5 / 2; }
  .transaction-wrap tbody tr td:nth-child(7) { grid-area: 4 / 2 / 5 / 3; justify-self: end; }

  /* Empty comments must not reserve a row. */
  .transaction-wrap tbody tr td:nth-child(5):empty { display: none; }

  /* The "no results" row spans the whole card. */
  .transaction-wrap tbody tr td[colspan] {
    grid-area: auto / 1 / auto / -1;
  }

  .merchant-cell {
    gap: 8px;
  }

  .merchant-text {
    font-weight: 700;
  }

  .transaction-actions {
    display: flex;
    gap: 6px;
  }

  /* The four controls total ~870px of intrinsic width; as a flex row they
     wrapped into ragged, half-cut rows. Give each an explicit slot. */
  .transaction-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .transaction-toolbar > .tx-search,
  .transaction-toolbar > .filter-group {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .transaction-toolbar > .tx-category-filter,
  .transaction-toolbar > .button {
    grid-column: span 1;
    width: 100%;
    min-width: 0;
  }

  .tx-search input,
  .tx-category-filter select {
    width: 100%;
    min-width: 0;
  }

  .filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .filter-group .chip {
    flex: 1 1 auto;
  }

  .transaction-totals {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ---- 6. Modals become bottom sheets ------------------------- */
@media (max-width: 720px) {
  .modal-overlay {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    /* dvh tracks the collapsing mobile browser chrome; the settings
       modal used to render 1060px tall with overflow hidden, so its
       top AND bottom were unreachable. */
    max-height: 92dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 20px 20px 0 0;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  }

  /* NOTE: no grab handle here on purpose. `.modal::before` is already
     the glass sheen overlay (position:absolute; inset:0), and we do not
     implement drag-to-dismiss — a handle would both break the sheen and
     promise a gesture that does not exist. */

  /* Slide up from the bottom edge like a real sheet. The shared
     modalEnter keyframe drops in with translateY(16px), which on a
     bottom-anchored sheet pushes it past the fold mid-flight. */
  .modal {
    animation: modalSheetEnter 240ms var(--ease-out) both;
  }

  @keyframes modalSheetEnter {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .modal > .panel-header {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 -16px 10px;
    padding: 10px 16px;
    background: var(--panel-solid, #14100c);
    border-bottom: 1px solid var(--hairline);
  }

  .light-mode .modal > .panel-header {
    background: #fffdf9;
  }

  .modal .form-grid,
  .modal form .field-row {
    grid-template-columns: 1fr;
  }

  .modal .modal-actions,
  .modal .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .modal .modal-actions .button,
  .modal .form-actions .button {
    width: 100%;
  }
}

/* ---- 7. Month popover as a sheet on phones ------------------ */
@media (max-width: 720px) {
  /* NOTE: position:fixed is useless here. `.month-switcher` sets
     backdrop-filter, which makes it a containing block for positioned
     descendants — a fixed popover resolves against the switcher, not the
     viewport, and lands off-screen. Anchor it under the pill instead. */
  #month-popover {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    bottom: auto;
    width: auto;
    min-width: 0;
    max-height: 52dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* ---- 8. Reduced motion for the mobile layer ----------------- */
@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  .modal {
    animation: none;
  }
}

/* ---- 9. Mobile control sizing (specificity corrections) ------
   These three lost to more specific desktop selectors, so they are
   restated here with matching or higher weight. ------------------ */
@media (max-width: 720px) {
  /* iOS zooms the whole page when a focused field is under 16px.
     `.tx-search input` etc. are class-scoped and outrank a bare
     `input` selector, and new scoped inputs would silently
     reintroduce the bug — so this one is deliberately forced. */
  input,
  select,
  textarea,
  .tx-search input,
  .tx-category-filter select {
    font-size: 16px !important;
  }

  /* .button.small (0,2,0) beat the plain .button min-height. */
  .button.small,
  .chip.small,
  .icon-button.small {
    min-height: 44px;
  }

  /* The "i" explain buttons stay visually small but get a finger-sized
     hit area via an invisible overlay. */
  .explain-btn {
    position: relative;
    height: 22px;
    width: 22px;
    font-size: 0.72rem;
  }

  .explain-btn::after {
    content: "";
    position: absolute;
    inset: -11px;
  }
}

/* ---- 10. Landing page on phones ---------------------------- */
@media (max-width: 720px) {
  /* Every other landing section is width:min(1120px, 100% - 48px);
     the feature-grid section was missed and ran nearly edge to edge. */
  .landing-grid-section {
    width: min(1120px, calc(100% - 48px));
    margin-left: auto;
    margin-right: auto;
  }

  .feature-grid {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Hero type: impactful but not shouty on a 360px screen. */
  .landing-hero h1 {
    font-size: clamp(2.35rem, 11vw, 3rem);
    line-height: 1.04;
  }

  .landing-sub {
    font-size: 1rem;
    line-height: 1.55;
  }

  /* Stack the two CTAs full width — they were sharing a cramped row. */
  .landing-cta-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
  }

  .landing-cta-row .button {
    width: 100%;
    justify-content: center;
  }

  .landing-header {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .landing-header .button {
    padding: 0 12px;
  }

  /* Feature sections read top-to-bottom: copy first, then the visual. */
  .landing-feature,
  .landing-feature.flip {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .landing-feature .landing-feature-copy,
  .landing-feature .landing-feature-visual {
    grid-column: 1;
  }

  .landing-feature h2,
  .landing-gain h2,
  .landing-grid-title,
  .landing-final h2 {
    font-size: clamp(1.7rem, 7.5vw, 2.2rem);
  }

  .landing-footer {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  /* Auth gate (login / signup) — the one screen everyone must pass. */
  .auth-gate {
    grid-template-columns: 1fr;
    width: min(520px, calc(100% - 32px));
    padding: 24px 0 calc(32px + env(safe-area-inset-bottom));
    gap: 20px;
  }
}

/* ---- 11. Planned (future) months in the month picker --------
   A month past today only appears once something is scheduled into
   it, so it is badged to explain its presence. Orange = forward-
   looking, matching the "Planning ahead" header state. */
.month-planned-badge {
  flex: none;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 122, 26, 0.16);
  color: var(--orange-strong);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.month-option.selected .month-planned-badge {
  background: rgba(28, 15, 3, 0.2);
  color: #1c0f03;
}
