:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, .88);
  --text: #18181b;
  --muted: #72727a;
  --line: rgba(0, 0, 0, .08);
  --accent: #151518;
  --accentText: #fff;
  --soft: rgba(0, 0, 0, .045);
  --danger: #d92d20;
  --impulse: #b54708;
  --positive: #067647;
  --blue: #175cd3;
  --violet: #6941c6;
  --heroGlow: rgba(132, 173, 255, .34);
  --shadow: 0 12px 40px rgba(0, 0, 0, .06);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at 50% -12%, color-mix(in srgb, var(--blue) 9%, transparent), transparent 32rem),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
.file-btn {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button { transition: transform .16s ease, border-color .2s ease, background-color .2s ease, opacity .2s ease; }
button:active { transform: scale(.975); }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--text) 22%, transparent);
  outline-offset: 2px;
}

#app {
  width: 100%;
  max-width: 680px;
  min-height: 100dvh;
  margin: auto;
  padding: calc(env(safe-area-inset-top) + 20px) 18px calc(102px + env(safe-area-inset-bottom));
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -.04em;
}

h2 {
  margin: 0;
  font-size: 17px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
}

.view { display: none; }
.view.active { display: block; }

.view.entering > * {
  animation: view-rise .36s cubic-bezier(.2, .75, .2, 1) both;
}

.view.entering > *:nth-child(2) { animation-delay: 35ms; }
.view.entering > *:nth-child(3) { animation-delay: 70ms; }
.view.entering > *:nth-child(4) { animation-delay: 105ms; }
.view.entering > *:nth-child(n+5) { animation-delay: 125ms; }

.hero {
  position: relative;
  isolation: isolate;
  padding: 25px;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(145deg, #25252b 0%, #111116 52%, #050506 100%);
  color: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .18);
}

.hero::before,
.hero::after {
  position: absolute;
  z-index: -1;
  content: "";
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.hero::before {
  top: -90px;
  right: -55px;
  width: 210px;
  height: 210px;
  background: radial-gradient(circle, var(--heroGlow), transparent 68%);
  animation: hero-drift 8s ease-in-out infinite alternate;
}

.hero::after {
  bottom: -115px;
  left: -70px;
  width: 230px;
  height: 230px;
  background: radial-gradient(circle, rgba(126, 231, 135, .15), transparent 68%);
  animation: hero-drift 10s 1s ease-in-out infinite alternate-reverse;
}

.hero p {
  margin: 0;
  color: #aaa;
}

.hero > strong {
  display: block;
  margin: 10px 0 24px;
  font-size: clamp(40px, 12vw, 54px);
  letter-spacing: -.055em;
}

.hero-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  color: #aaa;
  font-size: 13px;
}

.hero-details b { color: #fff; }

.today-cashflow {
  display: flex;
  gap: 18px;
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  color: #aaa;
  font-size: 12px;
}

.today-cashflow b { color: #fff; }

.hero-budget {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}

.hero-budget > div:first-child {
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: #aaa;
  font-size: 12px;
}

.hero-budget b { color: #fff; }

.home-add {
  min-height: 58px;
  margin-top: 0;
  font-size: 17px;
}

.home-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 14px;
}

.home-actions button { min-height: 58px; }

.cloud-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: 138px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.cloud-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-plan {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  font-weight: 700;
}

.decision-card {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
}

.decision-card span,
.decision-card b,
.decision-card small { display: block; }

.decision-card span {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}

.decision-card b {
  font-size: 17px;
  line-height: 1.4;
}

.decision-card small {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.5;
}

.decision-card[data-tone="warning"] { border-color: color-mix(in srgb, var(--impulse) 35%, var(--line)); }
.decision-card[data-tone="ready"] { border-color: color-mix(in srgb, var(--positive) 35%, var(--line)); }

.decision-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.decision-metrics button {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--soft);
  text-align: left;
}

.decision-metrics span,
.decision-metrics b { display: block; }

.decision-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.decision-metrics b {
  margin-top: 5px;
  font-size: 18px;
}

.calendar-head { margin-top: 26px; }

.calendar-card {
  padding: 17px 8px 14px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--card) 93%, var(--blue) 7%), var(--card));
}

.calendar-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.calendar-kpis div {
  min-width: 0;
  padding: 0 10px;
  border-right: 1px solid var(--line);
}

.calendar-kpis div:first-child { padding-left: 2px; }
.calendar-kpis div:last-child { padding-right: 2px; border-right: 0; }

.calendar-kpis span,
.calendar-kpis b { display: block; }

.calendar-kpis span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.calendar-kpis b {
  overflow: hidden;
  margin-top: 5px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.calendar-weekdays span { padding: 2px 0; }

.calendar-day {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 44px;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  animation: calendar-pop .3s cubic-bezier(.2, .8, .25, 1) both;
  animation-delay: calc(var(--calendar-index, 0) * 8ms);
}

.calendar-day::after {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: 0;
}

.calendar-day.level-1 { background: color-mix(in srgb, var(--blue) 12%, var(--card)); color: var(--blue); }
.calendar-day.level-2 { background: color-mix(in srgb, var(--blue) 24%, var(--card)); color: var(--blue); }
.calendar-day.level-3 { background: color-mix(in srgb, var(--blue) 42%, var(--card)); color: color-mix(in srgb, var(--blue) 86%, var(--text)); }
.calendar-day.level-4 { background: color-mix(in srgb, var(--blue) 72%, var(--card)); color: #fff; }
.calendar-day[class*="level-"]::after { opacity: .72; }

.calendar-day.refund-day {
  background: color-mix(in srgb, var(--positive) 15%, var(--card));
  color: var(--positive);
}

.calendar-day.today {
  border-color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card) 45%, transparent);
}

.calendar-day.future {
  opacity: .32;
  pointer-events: none;
}

.calendar-spacer {
  aspect-ratio: 1;
}

.calendar-caption {
  margin: 12px 3px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 28px 2px 12px;
}

.section-head.first-section { margin-top: 0; }

.section-head span,
.section-head button {
  padding: 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
}

.empty {
  padding: 30px 18px;
  color: var(--muted);
  text-align: center;
}

.record {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.record:last-child { border-bottom: 0; }

.record-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--bg);
  font-size: 19px;
  font-weight: 750;
}

.record-main {
  flex: 1;
  min-width: 0;
}

.record-main b,
.record-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-main small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.record-amount {
  flex: 0 0 auto;
  text-align: right;
}

.record-amount b { display: block; }

.record-amount button {
  min-width: 38px;
  min-height: 32px;
  padding: 5px 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
}

.impulse-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--impulse) 12%, transparent);
  color: var(--impulse);
  font-size: 10px;
  font-weight: 700;
  vertical-align: 2px;
}

.value-badge,
.refund-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: 2px;
}

.value-badge {
  background: color-mix(in srgb, var(--positive) 12%, transparent);
  color: var(--positive);
}

.value-regret {
  background: color-mix(in srgb, var(--danger) 11%, transparent);
  color: var(--danger);
}

.refund-badge {
  background: color-mix(in srgb, var(--blue) 11%, transparent);
  color: var(--blue);
}

.record-amount small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.category-stats {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
}

.stat-row {
  display: grid;
  grid-template-columns: minmax(62px, auto) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

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

.bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--text);
  transform-origin: left;
  animation: bar-grow .48s cubic-bezier(.2, .75, .2, 1) both;
}

.amount-wrap {
  padding: 8px 4px 18px;
  text-align: center;
}

.amount-wrap label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.amount-wrap > div {
  display: flex;
  align-items: center;
  justify-content: center;
}

.amount-wrap span { font-size: 28px; }

.amount-wrap input {
  width: min(270px, 80vw);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: clamp(48px, 14vw, 60px);
  font-weight: 750;
  letter-spacing: -.055em;
  text-align: center;
}

.error {
  display: block;
  min-height: 18px;
  color: var(--danger);
}

.candidates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 2px;
}

.candidates span {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 13px;
}

.candidates button,
.quick-chip {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
}

.quick-section {
  margin-bottom: 14px;
}

.quick-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 8px;
}

.quick-heading b { font-size: 14px; }

.quick-heading span {
  color: var(--muted);
  font-size: 12px;
}

.quick-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 1px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.quick-chips::-webkit-scrollbar { display: none; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: visible;
}

.category-grid .quick-chip {
  width: 100%;
  min-width: 0;
  padding-right: 6px;
  padding-left: 6px;
  white-space: normal;
}

.quick-chip {
  flex: 0 0 auto;
  background: var(--soft);
}

.quick-chip.selected {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  max-width: 220px;
  margin: 0 auto 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--soft);
}

.type-switch button {
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.type-switch button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

.income-value { color: var(--positive) !important; }

.form-grid label {
  min-width: 0;
  padding: 14px;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
}

.form-grid .wide { grid-column: 1 / -1; }

.form-grid input:not([type="checkbox"]),
.form-grid select,
.filters input,
.filters select {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 5px;
  padding: 2px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}

.impulse-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  color: var(--text) !important;
}

.impulse-row input {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--text);
}

.impulse-row span,
.impulse-row small { display: block; }

.impulse-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.primary,
.secondary {
  width: 100%;
  min-height: 56px;
  margin-top: 16px;
  border: 0;
  border-radius: 18px;
  font-weight: 750;
}

.primary {
  background: var(--accent);
  color: var(--accentText);
}

.secondary {
  border: 1px solid var(--line);
  background: transparent;
}

.save-button {
  position: sticky;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--line);
}

.filters > * {
  min-width: 0;
  min-height: 50px;
  margin: 0 !important;
  padding: 13px !important;
  background: var(--card) !important;
}

.filters #search { grid-column: 1 / -1; }

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}

.metrics-grid > div {
  min-width: 0;
  padding: 15px;
  background: var(--card);
}

.metrics-grid span,
.metrics-grid b { display: block; }

.metrics-grid span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.metrics-grid b {
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wide-metric { grid-column: 1 / -1; }

.compact-list .record { padding: 13px; }

.review-hero {
  padding: 24px;
  border-radius: 26px;
  background: linear-gradient(145deg, #12352b, #071c17);
  color: #fff;
  box-shadow: var(--shadow);
}

.review-hero p {
  margin: 0;
  color: #a6c7bc;
  font-size: 13px;
}

.review-hero > strong {
  display: block;
  margin: 9px 0 22px;
  font-size: 42px;
  letter-spacing: -.05em;
}

.review-hero > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  color: #a6c7bc;
  font-size: 12px;
}

.review-hero b { color: #fff; }

.action-list,
.stack-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
}

.action-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.action-item:last-child { border-bottom: 0; }

.action-item i {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.action-item div { min-width: 0; }
.action-item b { line-height: 1.4; }
.action-item p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.plan-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-bottom: 12px;
  background: var(--line);
}

.plan-form label,
.plan-form-actions {
  min-width: 0;
  padding: 14px;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
}

.plan-form .wide { grid-column: 1 / -1; }

.plan-form input,
.plan-form select,
.inline-field input,
.simulator-card select,
.modal-field input {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  padding: 10px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}

.plan-form-actions {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
}

.plan-form-actions button,
.inline-field button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: transparent;
}

.decision-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.decision-item:last-child { border-bottom: 0; }
.decision-item.is-ready { background: color-mix(in srgb, var(--positive) 5%, var(--card)); }
.decision-item-main { min-width: 0; }
.decision-item-main span,
.decision-item-main b,
.decision-item-main small { display: block; }
.decision-item-main span { color: var(--muted); font-size: 11px; }
.decision-item-main b { margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.decision-item-main small { margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45; text-overflow: ellipsis; }
.decision-item > strong { align-self: center; font-size: 15px; white-space: nowrap; }

.decision-item-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.decision-item-actions button {
  min-width: 0;
  min-height: 42px;
  padding: 8px 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  font-size: 12px;
}

.single-action { grid-template-columns: 1fr 1fr; }
.subscription-actions { grid-template-columns: 1fr 1fr; }

.inline-field {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
}

.inline-field input {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg);
}

.budget-track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(128, 128, 128, .2);
}

.budget-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #58c99d;
  transition: width .25s ease;
}

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

.simulator-card select {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg);
}

.range-label {
  display: block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.range-label input { width: 100%; margin-top: 12px; accent-color: var(--text); }

.sim-result {
  display: grid;
  gap: 5px;
  margin-top: 15px;
  padding: 15px;
  border-radius: 14px;
  background: var(--soft);
  color: var(--muted);
}

.sim-result b { color: var(--text); font-size: 17px; }
.sim-result span { font-size: 12px; }

.health-note {
  padding: 12px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--positive) 8%, transparent);
  color: var(--positive) !important;
  font-size: 13px;
}

.health-note.needs-attention {
  background: color-mix(in srgb, var(--impulse) 10%, transparent);
  color: var(--impulse) !important;
}

.data-card {
  margin: 18px 0;
  padding: 20px;
}

.data-card p {
  color: var(--muted);
  line-height: 1.6;
}

.data-card button,
.file-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 8px 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  text-align: center;
}

.data-card .primary-inline {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accentText);
  font-weight: 700;
}

.cloud-heading,
.cloud-heading > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.cloud-heading {
  justify-content: space-between;
  margin-bottom: 8px;
}

.data-card .cloud-heading button {
  width: auto;
  min-height: 40px;
  margin: 0;
  padding: 8px 12px;
}

#cloudStatusDot,
#cloudStatusDotData {
  display: inline-block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--muted) 12%, transparent);
}

#cloudStatusDot[data-state="synced"],
#cloudStatusDot[data-state="ready"],
#cloudStatusDotData[data-state="synced"],
#cloudStatusDotData[data-state="ready"] { background: var(--positive); }

#cloudStatusDot[data-state="syncing"],
#cloudStatusDotData[data-state="syncing"] {
  background: var(--blue);
  animation: cloud-pulse 1.2s ease-in-out infinite;
}

#cloudStatusDot[data-state="error"],
#cloudStatusDotData[data-state="error"] { background: #f97066; }

#cloudStatusDot[data-state="offline"],
#cloudStatusDotData[data-state="offline"] { background: var(--impulse); }

.cloud-card details {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cloud-card summary {
  min-height: 44px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.stack-field {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.stack-field input,
.inline-input input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin-top: 6px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--soft);
  color: var(--text);
  font-size: 16px;
}

.inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.data-card .inline-actions button {
  width: auto;
  margin: 0;
}

.migration-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 15px;
  background: var(--soft);
}

.migration-box p { margin-bottom: 8px; font-size: 13px; }

.inline-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.inline-input input { margin: 0; }
.data-card .inline-input button { width: auto; margin: 0; }

.action-link {
  text-decoration: none;
  color: var(--text);
}

.compact-chips { margin-top: 12px; }
.compact-chips button { width: auto; min-height: 40px; margin: 0; }
.muted-text { color: var(--muted); font-size: 13px; }

.file-btn input { display: none; }

.privacy { font-size: 13px; }

.range-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 14px 0 12px;
}

.data-card .range-presets button {
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 9px 5px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
}

.data-card .range-presets button.active {
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
  background: color-mix(in srgb, var(--blue) 10%, var(--card));
  color: var(--blue);
  font-weight: 750;
}

.range-fields,
.range-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.range-fields label {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.range-fields input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg);
  font-size: 16px;
}

.range-hint {
  margin: 10px 2px 12px;
  font-size: 12px;
}

.range-actions button { min-width: 0; }

.import-preview {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.danger-outline {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line)) !important;
  color: var(--danger) !important;
}

.hidden { display: none !important; }

nav {
  position: fixed;
  z-index: 10;
  bottom: 0;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(680px, 100%);
  transform: translateX(-50%);
  padding: 10px 12px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

nav button {
  min-height: 48px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
}

nav i {
  display: block;
  margin-bottom: 3px;
  font-size: 21px;
  font-style: normal;
}

nav button.active {
  color: var(--text);
  font-weight: 750;
}

nav button:not(.add-nav).active i { animation: nav-bounce .32s cubic-bezier(.2, .8, .3, 1.25); }

.add-nav i {
  display: grid;
  width: 50px;
  height: 50px;
  margin: -27px auto 4px;
  place-items: center;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}

#toast {
  position: fixed;
  z-index: 30;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 50%;
  max-width: calc(100% - 36px);
  overflow: hidden;
  transform: translate(-50%, 20px);
  opacity: 0;
  padding: 12px 16px;
  border-radius: 99px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: .2s;
}

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

#toast button {
  margin-left: 12px;
  padding: 4px;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 800;
}

.modal {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .45);
}

.modal-card {
  width: min(500px, 100%);
  max-height: min(620px, 88dvh);
  overflow-y: auto;
  padding: 22px;
  border-radius: 24px;
  background: var(--bg);
}

.modal-card p {
  color: var(--muted);
  line-height: 1.5;
}

#modalText { color: var(--muted); line-height: 1.5; }
#modalText p { margin: 12px 0; }

.modal-field {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.modal-field input {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
}

.privacy-mode .money-value,
.privacy-mode #todayTotal,
.privacy-mode #monthTotal,
.privacy-mode #homeAvoided,
.privacy-mode #homeRegret,
.privacy-mode #avoidedTotal,
.privacy-mode #regretTotal,
.privacy-mode [id^="stats"],
.privacy-mode #homeBudgetText,
.privacy-mode #budgetStatus,
.privacy-mode #simResult,
.privacy-mode #categoryStats b,
.privacy-mode #homeDecisionTitle,
.privacy-mode #homeDecisionDetail,
.privacy-mode #actionList,
.privacy-mode .calendar-kpis b,
.privacy-mode #spendingCalendar,
.privacy-mode #analysisRangeHint,
.privacy-mode .refund-badge,
.privacy-mode .record-money small,
.privacy-mode #modalText {
  filter: blur(9px);
  user-select: none;
}

.modal-card button {
  width: 100%;
  min-height: 50px;
  margin-top: 8px;
  padding: 13px;
  border: 0;
  border-radius: 14px;
  background: var(--soft);
}

.modal-card .primary-action {
  background: var(--accent);
  color: var(--accentText);
  font-weight: 750;
}

.modal-card .quiet-action {
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.danger {
  background: var(--danger) !important;
  color: #fff !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --card: rgba(28, 28, 31, .9);
    --text: #f4f4f5;
    --muted: #98989f;
    --line: rgba(255, 255, 255, .09);
    --accent: #f4f4f5;
    --accentText: #101012;
    --soft: rgba(255, 255, 255, .06);
    --impulse: #fdb022;
    --positive: #75e0a7;
    --blue: #84adff;
    --violet: #b692f6;
    --heroGlow: rgba(132, 173, 255, .28);
    --shadow: none;
  }
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, .88);
  --text: #18181b;
  --muted: #72727a;
  --line: rgba(0, 0, 0, .08);
  --accent: #151518;
  --accentText: #fff;
  --soft: rgba(0, 0, 0, .045);
  --impulse: #b54708;
  --shadow: 0 12px 40px rgba(0, 0, 0, .06);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0d;
  --card: rgba(28, 28, 31, .9);
  --text: #f4f4f5;
  --muted: #98989f;
  --line: rgba(255, 255, 255, .09);
  --accent: #f4f4f5;
  --accentText: #101012;
  --soft: rgba(255, 255, 255, .06);
  --impulse: #fdb022;
  --positive: #75e0a7;
  --blue: #84adff;
  --violet: #b692f6;
  --heroGlow: rgba(132, 173, 255, .28);
  --shadow: none;
}

@keyframes view-rise {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hero-drift {
  from { transform: translate3d(-6px, -2px, 0) scale(.96); opacity: .72; }
  to { transform: translate3d(12px, 10px, 0) scale(1.08); opacity: 1; }
}

@keyframes calendar-pop {
  from { opacity: 0; transform: scale(.88); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bar-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes nav-bounce {
  0% { transform: translateY(2px) scale(.9); }
  70% { transform: translateY(-1px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes cloud-pulse {
  0%, 100% { opacity: .45; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.12); }
}

@media (max-width: 380px) {
  #app {
    padding-right: 12px;
    padding-left: 12px;
  }

  .hero { padding: 22px; }
  .record { padding: 13px 10px; }
  .record-icon { flex-basis: 38px; width: 38px; height: 38px; }
  .record-main small { font-size: 11px; }
  .record-amount button { min-width: 34px; }
  nav { padding-right: 6px; padding-left: 6px; }
  nav button { font-size: 10px; }
  nav i { font-size: 19px; }
  .decision-item { padding: 14px 11px; }
  .calendar-card { padding-right: 11px; padding-left: 11px; }
  .calendar-weekdays,
  .spending-calendar { gap: 4px; }
  .calendar-day { border-radius: 10px; }
  .cloud-pill { max-width: 116px; padding: 0 10px; }
  .inline-actions { grid-template-columns: 1fr; }
}

@media (min-width: 560px) {
  .quick-chips { flex-wrap: wrap; overflow-x: visible; }
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .wide-metric { grid-column: span 2; }
}

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