:root {
  --bg: #080b11;
  --surface: #111621;
  --surface-raised: #171d29;
  --surface-soft: rgba(24, 30, 42, 0.78);
  --hairline: rgba(255, 255, 255, 0.09);
  --text: #f6f7fb;
  --muted: #9ca5b6;
  --muted-strong: #bcc3cf;
  --blue: #5b89ff;
  --blue-soft: rgba(91, 137, 255, 0.16);
  --coral: #ff6f6a;
  --mint: #53d6a2;
  --amber: #f1b654;
  --violet: #a68cff;
  --radius: 16px;
  --page-x: 20px;
  --safe-top: max(env(safe-area-inset-top), var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.icon-sprite,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

svg {
  display: block;
}

.material {
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
}

.app-shell {
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 12px) var(--page-x) calc(118px + var(--safe-bottom));
  opacity: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  margin-bottom: 28px;
}

.brand,
.context,
.label,
.subtle {
  margin: 0;
}

.brand {
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.context {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: transparent;
  cursor: pointer;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view {
  display: none;
  animation: view-in 240ms cubic-bezier(.2, .8, .2, 1);
}

.view.active {
  display: block;
}

@keyframes view-in {
  from {
    opacity: .55;
    transform: translateY(6px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.capital-block {
  margin-bottom: 22px;
}

.label,
label > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 530;
}

.capital-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-top: 5px;
}

.capital-value {
  min-width: 0;
  overflow: hidden;
  font-size: clamp(38px, 11vw, 52px);
  font-weight: 690;
  letter-spacing: -0.04em;
  line-height: 1.05;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.change-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.change-badge.positive {
  color: var(--mint);
  background: rgba(83, 214, 162, 0.11);
}

.change-badge.warning {
  color: var(--amber);
  background: rgba(241, 182, 84, 0.12);
}

.subtle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.capital-block .subtle {
  margin-top: 7px;
}

.period-control,
.kind-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border-radius: 13px;
}

.period-button,
.kind-button {
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 620;
  cursor: pointer;
}

.period-button.active,
.kind-button.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.flow-section {
  margin-top: 32px;
}

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

.section-heading.compact {
  align-items: center;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.025em;
}

h1 {
  font-size: 20px;
  font-weight: 660;
}

h2 {
  font-size: 18px;
  font-weight: 650;
}

.section-heading .subtle {
  margin-top: 4px;
}

.net-value {
  margin: 0;
  color: var(--muted-strong);
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.flow-chart {
  position: relative;
  width: 100%;
  height: 190px;
  margin-top: 16px;
  overflow: visible;
  touch-action: pan-y;
}

.flow-chart > svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-grid line {
  stroke: rgba(255, 255, 255, 0.065);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-area {
  fill: url(#net-fill);
}

.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 4px 7px rgba(91, 137, 255, 0.25));
}

.chart-end {
  fill: var(--bg);
  stroke: var(--blue);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.flow-bar {
  opacity: .52;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  top: 14px;
  min-width: 112px;
  padding: 9px 11px;
  border-radius: 11px;
  pointer-events: none;
  transform: translateX(-50%);
  font-size: 12px;
  line-height: 1.45;
}

.chart-tooltip strong {
  display: block;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.flow-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}

.flow-totals > div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 6px;
  row-gap: 5px;
  min-width: 0;
}

.flow-totals span:not(.signal) {
  color: var(--muted);
  font-size: 11px;
}

.flow-totals strong {
  grid-column: 1 / -1;
  overflow: hidden;
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 630;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.signal {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.signal.income {
  background: var(--mint);
}

.signal.expense {
  background: var(--coral);
}

.signal.saving {
  background: var(--violet);
}

.composition-section,
.category-section,
.recent-section {
  margin-top: 42px;
}

.text-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 610;
  cursor: pointer;
}

.compact-select {
  position: relative;
  min-width: 92px;
}

.compact-select select {
  width: 100%;
  min-height: 40px;
  padding: 0 28px 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  appearance: none;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 610;
  text-align: center;
}

.compact-select::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 11px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
}

.composition-layout {
  display: grid;
  grid-template-columns: 132px 1fr;
  align-items: center;
  gap: 18px;
  min-height: 144px;
}

.donut-wrap {
  position: relative;
  width: 132px;
  height: 132px;
}

.donut {
  width: 100%;
  height: 100%;
}

.donut-track,
.donut-segment {
  fill: none;
  stroke-width: 10;
}

.donut-track {
  stroke: rgba(255, 255, 255, 0.065);
}

.donut-segment {
  stroke-linecap: butt;
  transition: stroke-dasharray 360ms cubic-bezier(.2, .8, .2, 1);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

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

.donut-center strong {
  margin-top: 2px;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.direct-legend {
  display: grid;
  gap: 13px;
  min-width: 0;
}

.legend-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--progress-color);
}

.legend-row span {
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.legend-row strong {
  font-size: 13px;
  font-weight: 630;
  font-variant-numeric: tabular-nums;
}

.category-bars {
  display: grid;
  gap: 3px;
}

.category-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
  margin: -7px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.category-summary strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.category-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  gap: 7px 10px;
  align-items: center;
  min-height: 68px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.category-row .category-name,
.category-row strong {
  font-size: 13px;
}

.category-row .category-name {
  overflow: hidden;
  color: var(--muted-strong);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.category-row strong {
  font-variant-numeric: tabular-nums;
}

.category-chevron {
  grid-row: 1 / 3;
  grid-column: 3;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-progress {
  grid-column: 1 / 3;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.065);
}

.category-progress::-webkit-progress-bar,
.account-progress::-webkit-progress-bar {
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.065);
}

.category-progress::-webkit-progress-value,
.account-progress::-webkit-progress-value {
  border-radius: inherit;
  background: var(--progress-color);
}

.category-progress::-moz-progress-bar,
.account-progress::-moz-progress-bar {
  border-radius: inherit;
  background: var(--progress-color);
}

.tone-0 { --progress-color: #5b89ff; }
.tone-1 { --progress-color: #53d6a2; }
.tone-2 { --progress-color: #a68cff; }
.tone-3 { --progress-color: #ffb45d; }
.tone-4 { --progress-color: #ff6f6a; }
.tone-5 { --progress-color: #61c8ff; }
.tone-debt { --progress-color: #ff6f6a; }

.category-progress,
.account-progress {
  color: var(--progress-color);
  animation: progress-reveal 420ms cubic-bezier(.2, .8, .2, 1);
}

@keyframes progress-reveal {
  from { opacity: .35; }
  to { opacity: 1; }
}

.transaction-list {
  display: grid;
}

.transaction-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  border-bottom: 1px solid var(--hairline);
}

.transaction-symbol {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 16px;
  font-weight: 650;
}

.transaction-symbol.income {
  color: var(--mint);
  background: rgba(83, 214, 162, 0.1);
}

.transaction-symbol.expense {
  color: var(--coral);
  background: rgba(255, 111, 106, 0.1);
}

.transaction-symbol.transfer,
.transaction-symbol.saving {
  color: var(--violet);
  background: rgba(166, 140, 255, 0.11);
}

.transaction-copy {
  min-width: 0;
}

.transaction-copy strong,
.transaction-copy span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.transaction-copy strong {
  font-size: 14px;
  font-weight: 610;
}

.transaction-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.transaction-amount {
  text-align: right;
  font-size: 14px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.transaction-amount.expense {
  color: var(--text);
}

.page-heading {
  margin: 6px 0 28px;
}

.page-heading h1 {
  font-size: 30px;
  font-weight: 680;
  letter-spacing: -0.035em;
}

.page-heading .subtle {
  margin-top: 5px;
}

.search-field {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
}

.search-field svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

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

.search-field input::placeholder,
input::placeholder {
  color: #747e90;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin: 16px 0 10px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 13px;
  cursor: pointer;
}

.filter-chip.active {
  border-color: transparent;
  background: var(--blue-soft);
  color: #baceff;
}

.transaction-list.expanded .transaction-row {
  min-height: 72px;
}

.large-summary {
  margin: -8px 0 28px;
  font-size: 38px;
  font-weight: 680;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.accounts-list {
  display: grid;
  gap: 22px;
}

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

.account-name {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 15px;
  font-weight: 590;
}

.account-name i {
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 3px;
  background: var(--progress-color);
}

.account-name span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.account-row strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.account-meta {
  color: var(--muted);
  font-size: 12px;
}

.account-progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.065);
}

.goal-visual {
  min-height: 320px;
}

.goal-empty {
  display: grid;
  place-items: center;
  min-height: 300px;
  text-align: center;
}

.goal-empty-orbit {
  position: relative;
  width: 148px;
  height: 148px;
  margin-bottom: 24px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
}

.goal-empty-orbit::before,
.goal-empty-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.goal-empty-orbit::before {
  inset: 28px;
  background: var(--surface);
}

.goal-empty-orbit::after {
  top: 16px;
  right: 22px;
  width: 14px;
  height: 14px;
  background: var(--blue);
  box-shadow: 0 5px 14px rgba(91, 137, 255, .35);
}

.goal-empty p {
  max-width: 260px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.goal-empty .primary-button {
  margin-top: 16px;
}

.goal-main {
  display: grid;
  place-items: center;
}

.goal-ring-wrap {
  position: relative;
  width: min(270px, 76vw);
  height: min(270px, 76vw);
  margin: 12px auto 28px;
}

.goal-ring {
  width: 100%;
  height: 100%;
}

.goal-ring circle {
  fill: none;
  stroke-width: 7;
}

.goal-ring .track {
  stroke: rgba(255, 255, 255, .065);
}

.goal-ring .progress {
  stroke: var(--mint);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.goal-copy {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.goal-copy span {
  color: var(--muted);
  font-size: 13px;
}

.goal-copy strong {
  margin: 6px 0 3px;
  font-size: 34px;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.goal-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--hairline);
}

.goal-values div {
  padding: 17px;
  background: var(--surface);
}

.goal-values span,
.goal-values strong {
  display: block;
}

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

.goal-values strong {
  margin-top: 6px;
  font-size: 15px;
}

.goal-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 630;
  cursor: pointer;
}

.goal-insight {
  width: 100%;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

.goal-insight-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.goal-insight-line strong {
  color: var(--muted-strong);
  font-weight: 620;
}

.add-button {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: calc(39px + var(--safe-bottom));
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 12px 28px rgba(39, 83, 198, .42);
  transform: translateX(-50%);
  cursor: pointer;
}

.add-button:active {
  transform: translateX(-50%) scale(.95);
}

.add-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.bottom-nav {
  position: fixed;
  z-index: 7;
  right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  left: 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr) 58px repeat(2, 1fr);
  min-height: 72px;
  padding: 7px;
  border-radius: 22px;
}

.nav-button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 56px;
  padding: 0 4px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: #818a9b;
  cursor: pointer;
}

.nav-button.active {
  color: #dbe5ff;
  background: rgba(91, 137, 255, 0.1);
}

.nav-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-button[data-target="overview"] svg {
  fill: currentColor;
  stroke: none;
}

.nav-button span {
  overflow: hidden;
  font-size: 10px;
  font-weight: 560;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.loading-screen {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 24px;
  background: var(--bg);
  text-align: center;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-screen p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.loading-mark {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 42px;
}

.loading-mark span {
  width: 7px;
  border-radius: 7px;
  background: var(--blue);
  animation: loading-bars 900ms ease-in-out infinite alternate;
}

.loading-mark span:nth-child(1) {
  height: 18px;
}

.loading-mark span:nth-child(2) {
  height: 36px;
  animation-delay: 120ms;
}

.loading-mark span:nth-child(3) {
  height: 26px;
  animation-delay: 240ms;
}

@keyframes loading-bars {
  to {
    height: 12px;
    opacity: .45;
  }
}

.transaction-dialog {
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - var(--safe-top) - 8px);
  margin: auto auto 0;
  padding: 0;
  overflow: visible;
  border: 1px solid var(--hairline);
  border-radius: 24px 24px 0 0;
  background: #111620;
  color: var(--text);
  box-shadow: 0 -18px 60px rgba(0, 0, 0, .46);
}

.transaction-dialog::backdrop {
  background: rgba(0, 0, 0, .58);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.transaction-dialog[open] {
  animation: sheet-in 280ms cubic-bezier(.16, 1, .3, 1);
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: .55;
  }
}

.transaction-dialog form {
  max-height: calc(100dvh - var(--safe-top) - 8px);
  padding: 10px 20px calc(20px + var(--safe-bottom));
  overflow-y: auto;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  margin: 0 auto 17px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .22);
}

.sheet-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.sheet-heading .subtle {
  margin-top: 4px;
}

.kind-toggle {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 22px;
}

.amount-field {
  display: block;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}

.amount-field > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 5px;
}

.amount-field input {
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 48px;
  font-weight: 660;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.amount-field #entry-currency {
  color: var(--muted-strong);
  font-size: 18px;
  font-weight: 620;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.transaction-dialog label:not(.amount-field) {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.transaction-dialog select,
.transaction-dialog input:not(#amount-input) {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  outline: none;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 15px;
}

.goal-amount-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.goal-amount-input strong {
  color: var(--muted-strong);
  font-size: 14px;
}

.goal-dialog input[type="date"] {
  color-scheme: dark;
}

.form-error {
  margin: 15px 0 0;
  color: #ff9691;
  font-size: 13px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.primary-button:disabled {
  opacity: .5;
  cursor: default;
}

.primary-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.save-button {
  width: 100%;
  margin-top: 22px;
}

.toast {
  position: fixed;
  z-index: 40;
  top: calc(var(--safe-top) + 16px);
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 11px 15px;
  border-radius: 13px;
  color: var(--text);
  font-size: 13px;
  transform: translateX(-50%);
}

.state-screen {
  display: grid;
  place-items: center;
  min-height: 60vh;
  text-align: center;
}

.state-symbol {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: rgba(255, 111, 106, .11);
  color: var(--coral);
  font-size: 26px;
  font-weight: 650;
}

.state-screen p {
  max-width: 290px;
  margin: 10px 0 20px;
  color: var(--muted);
  line-height: 1.5;
}

.privacy-mode .money-value,
.privacy-mode .transaction-amount,
.privacy-mode .legend-row strong,
.privacy-mode .category-row strong,
.privacy-mode .account-row > strong {
  filter: blur(8px);
  user-select: none;
}

.empty-inline {
  padding: 26px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (min-width: 680px) {
  .app-shell {
    max-width: 620px;
    margin: 0 auto;
  }

  .bottom-nav {
    right: 50%;
    left: auto;
    width: min(596px, calc(100vw - 24px));
    transform: translateX(50%);
  }
}

@media (max-width: 370px) {
  :root {
    --page-x: 16px;
  }

  .composition-layout {
    grid-template-columns: 116px 1fr;
    gap: 12px;
  }

  .donut-wrap {
    width: 116px;
    height: 116px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

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