@font-face {
  font-family: Onest;
  src: url("assets/Onest.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: Onest, system-ui, sans-serif;
  color: #1a3351;
  --ink: #1a3351;
  --paragraph: #121212;
  --amount: #1f4f85;
  --glass: rgb(255 255 255 / 56%);
  --shadow: 0 0 4px rgb(0 0 0 / 8%);
  --rim: inset 0 0 0 1px rgb(255 255 255 / 70%);
  --gutter: 16px;
  --gap: 12px;
  --radius: 24px;
  --compact-header-height: 113px;
  scroll-padding-top: var(--compact-header-height);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: #e7f0f7; }
h1, h2, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; }
button {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}
:focus-visible { outline: 2px solid #174e89; outline-offset: 3px; }
button:active { filter: brightness(.97); }
h2 { font-size: 16px; font-weight: 600; line-height: 20px; }

.home {
  position: relative;
  isolation: isolate;
  width: min(100%, 430px);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
}

.home-background {
  position: fixed;
  z-index: -1;
  inset-block: 0;
  inset-inline: var(--telegram-left, 0px) var(--telegram-right, 0px);
  max-width: 430px;
  margin-inline: auto;
  overflow: hidden;
  background: linear-gradient(#b4d1ff 22.596%, #93ced4);
  pointer-events: none;
}

.background {
  position: absolute;
  z-index: -1;
  left: calc(50% - .5px);
  transform: translateX(-50%);
  pointer-events: none;
}
.background--top { top: -444px; }
.background--middle { top: -444px; width: 827px; height: 827px; }

.header {
  position: sticky;
  z-index: 2;
  top: 0;
  height: var(--compact-header-height);
  margin-bottom: 73px;
  padding-inline: var(--gutter);
  pointer-events: none;
}
.header::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgb(255 255 255 / 24%), transparent);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 240ms ease;
  content: "";
}
:root[data-scrolled] .header::before { opacity: 1; }
.greeting, .profile h1, .brand p {
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}
:root[data-scrolled] :is(.greeting, .profile h1, .brand p) {
  visibility: hidden;
  opacity: 0;
  transform: translateY(-5px);
}
.status-bar {
  position: relative;
  display: flex;
  height: 58px;
  padding: 16px 20px 0;
  align-items: baseline;
  justify-content: space-between;
  color: var(--paragraph);
  font-size: 15px;
  font-weight: 700;
  line-height: 19px;
}
.status-bar span { transform: translate(1px, 2px); }
.status-bar img { width: 62.181px; height: 11.162px; align-self: flex-start; margin-top: 6px; }

.welcome {
  position: relative;
  display: flex;
  justify-content: space-between;
}
.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: rgb(255 255 255 / 10%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 80%), 1px 2px 4px rgb(0 0 0 / 10%);
}
.avatar__crop {
  position: relative;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
}
.avatar img {
  position: absolute;
  top: -24.88%;
  left: -25.29%;
  width: 149.76%;
  height: 149.76%;
}
.greeting {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 12px;
  color: var(--paragraph);
  font-size: 16px;
  line-height: 20px;
}
.profile h1 { font-size: 18px; font-weight: 600; line-height: 24px; }
.brand {
  display: grid;
  align-content: start;
  gap: 2px;
  margin-right: 1.578px;
  color: var(--amount);
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
}
.brand img { width: 150.422px; height: 43px; }

.dashboard { display: grid; gap: 16px; padding-inline: var(--gutter); }
.glass {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--rim), var(--shadow);
}
.overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.balance, .summary, .transactions, .exchange { padding: 12px; }
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.heading-button { width: 100%; border-radius: 5px; }
.chevron { flex: none; transform: rotate(180deg); }
.balance, .summary { min-height: 296px; }
.balance { display: grid; align-content: start; }
.balance__heading { height: 20px; }
.balance__heading h2 { margin-left: -2px; }

.balance-toggle {
  position: relative;
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
}
.balance-toggle__open { width: 16.5025px; height: 11.0017px; }
.balance-toggle__closed { display: none; }
.balance-toggle::before {
  position: absolute;
  inset: -7px;
  content: "";
}
.balance[data-hidden] .balance-toggle {
  padding-top: 2px;
  background: white;
  box-shadow: 0 0 2px rgb(0 0 0 / 8%);
}
.balance[data-hidden] .balance-toggle__open { display: none; }
.balance[data-hidden] .balance-toggle__closed { display: block; }

.khr { --series: #1d416f; --bar-height: 103px; }
.usd { --series: #f46666; --bar-height: 138px; }
.eur { --series: #318ae2; --bar-height: 78px; }
.balance-chart {
  position: relative;
  height: 150px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 12px;
}
.balance-chart__grid {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 0 10px,
    #efeff0 10px 11px, transparent 11px 30px,
    #efeff0 30px 31px, transparent 31px 48px,
    #efeff0 48px 49px, transparent 49px 67px,
    #efeff0 67px 68px, transparent 68px 86px,
    #efeff0 86px 87px, transparent 87px 106px,
    #efeff0 106px 107px, transparent 107px 124px,
    #efeff0 124px 125px, transparent 125px 143px,
    #efeff0 143px 144px, transparent 144px);
}
.balance-chart__bars {
  position: absolute;
  left: calc(50% - 7px);
  bottom: 7px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  width: min(100% - 14px, 123px);
  transform: translateX(-50%);
}
.balance-bar {
  width: 19px;
  height: var(--bar-height);
  border-radius: 4px 4px 0 0;
  background: var(--series);
  transform-origin: bottom;
}
.balance-list { display: grid; grid-template-rows: 18px 36px 18px; margin-top: 16px; }
.balance-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  font-size: 14.8px;
  font-weight: 700;
  line-height: 18.5px;
  white-space: nowrap;
}
.balance-mask {
  position: relative;
  display: none;
  flex: none;
  width: 74px;
  height: 18px;
  overflow: hidden;
  border-radius: 6px;
  background: rgb(255 255 255 / 10%);
}
.balance-mask::before {
  position: absolute;
  inset: 2px;
  background: url("assets/balance-mask.svg") left center / 14px 14px repeat-x;
  filter: blur(2px);
  content: "";
}
.balance[data-hidden] .balance-amount { display: none; }
.balance[data-hidden] .balance-mask { display: block; }
.balance-amount, .transaction__count strong { font-variant-numeric: tabular-nums; }
.balance-row::before {
  width: 3.704px;
  height: 18px;
  flex: none;
  box-shadow: inset 0 0 0 .463px white;
  border-radius: 5.556px;
  background: var(--series);
  content: "";
}
.balance-row:nth-child(2)::after {
  position: absolute;
  inset: 4px 0;
  border-block: 1px solid #efeff0;
  border-radius: 1px;
  pointer-events: none;
  content: "";
}

.summary .card-heading { justify-content: flex-start; gap: 4px; }
.summary-chart { margin-top: 14px; }
.summary-chart__body {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: 169px 12px;
  row-gap: 6px;
  font-size: 11px;
  line-height: 12px;
  color: #49545a;
}
.summary-chart__axis { display: flex; flex-direction: column; justify-content: space-between; padding-left: 1px; }
.summary-chart__plot { margin-top: 3px; clip-path: inset(0 -12px 0 0); }
.summary-chart__plot img { width: calc(100% + 55px); height: 161.867px; max-width: none; }
.summary-chart__months { grid-column: 2; display: flex; justify-content: space-between; gap: 2px; }
.summary-chart__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px;
  width: min(100%, 160px);
  margin: 25px auto 0;
  font-size: 12px;
  line-height: 14px;
}
.summary-chart__legend span { display: flex; align-items: center; gap: 4px; }
.summary-chart__legend span::before {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border-radius: 5px;
  background: var(--series);
  content: "";
}
.summary-chart__income { --series: #0094d8; }
.summary-chart__outcome { --series: #eb008a; }

@media (prefers-reduced-motion: no-preference) {
  .overview.animate-in .balance-bar {
    animation: balance-grow 740ms cubic-bezier(.22,.61,.36,1) both;
  }
  .overview.animate-in .balance-bar:nth-child(2) { animation-delay: 70ms; }
  .overview.animate-in .balance-bar:nth-child(3) { animation-delay: 140ms; }
  .overview.animate-in .summary-chart__plot img {
    animation: chart-reveal 860ms cubic-bezier(.22,.61,.36,1) both;
  }
}
@keyframes balance-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes chart-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
@media (prefers-reduced-motion: reduce) {
  .header::before, .greeting, .profile h1, .brand p { transition: none; }
  :root[data-scrolled] :is(.greeting, .profile h1, .brand p) { transform: none; }
}

.transactions { display: grid; gap: var(--gap); }
.transaction-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.transaction {
  display: grid;
  grid-template-rows: minmax(24px, 1fr) auto;
  gap: 8px;
  min-height: 82px;
  overflow: hidden;
  padding: 12px;
  border-radius: 16px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 65%);
}
.transaction__heading, .transaction__count { display: flex; align-items: center; gap: 8px; }
.transaction__heading { min-height: 24px; font-size: 16px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.transaction__heading img { flex: none; }
.transaction__count { color: #7f7f83; font-size: 14px; line-height: 18px; }
.transaction__count strong { color: var(--amount); font-size: 20px; font-weight: 700; line-height: 26px; }

.messages {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  height: 125px;
  display: block;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.messages::before {
  position: absolute;
  inset: 0;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  content: "";
}
.messages__tab, .messages__blur {
  position: absolute;
  inset: 0;
}
.messages__tab {
  clip-path: polygon(0 24px, 1% 12px, 3% 3px, 6% 0, 41.5% 0, 38% 4px, 35.5% 15px,
    34% 22px, 31% 33px, 28% 40px, 24.4% 43.1px, 3.5% 43.1px, 1% 47px, 0 54.5px);
  clip-path: shape(
    from 0 24px,
    curve to 6% 0 with 0 11px / 2.7% 0,
    line to 41.5% 0,
    curve to 34% 22px with 38.2% 0 / 35.7% 11px,
    curve to 24.4% 43.1px with 32% 34.6px / 28.4% 43.1px,
    line to 3.5% 43.1px,
    curve to 0 54.5px with 1.8% 43.1px / 0 47.8px,
    close
  );
}
.messages__tab::before, .messages__blur::before {
  position: absolute;
  inset: 0 auto auto 0;
  width: 45.48%;
  height: 69.608px;
  border-radius: 24px 0 135px 0;
  background: #5b9ad5;
  content: "";
}
.messages__blur { filter: blur(16px); }
.messages__heading {
  position: absolute;
  top: 10px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
}
.messages__panel { position: absolute; inset: 0; width: 100%; height: 125px; }
.messages__badge {
  position: absolute;
  top: 16.5px;
  right: 16.6px;
  display: grid;
  min-width: 30.769px;
  height: 25px;
  padding-inline: 7px;
  place-items: center;
  border-radius: 14px;
  background: #ff4343;
  color: white;
  font-size: 15.385px;
  font-weight: 500;
  line-height: 1;
}
.messages__description { position: absolute; top: 74px; left: 16px; font-size: 16px; line-height: 20px; }

.exchange { display: grid; gap: 10px; padding: 16px; }
.exchange .card-heading { align-items: start; min-height: 35px; }
.flags { display: flex; gap: 6px; }
.flag {
  position: relative;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border: 1px solid #f2f2f2;
  border-radius: 50%;
}
.flag img { position: absolute; object-fit: cover; }
.flag--us img { left: -7.8px; top: .2px; width: 56.667px; height: 29.937px; }
.flag--kh img { left: calc(50% - .16px); top: calc(50% + .1px); width: 47.187px; height: 30.2px; transform: translate(-50%, -50%); }
.exchange__rates { display: grid; gap: 8px; color: var(--paragraph); }
.exchange__rate { position: relative; display: flex; justify-content: space-between; gap: var(--gap); padding-inline: 5px; font-size: 16px; line-height: 20px; }
.exchange__rate dd { font-weight: 600; }
.exchange__rate dd span { font-size: 14px; font-weight: 400; }
.exchange__rate + .exchange__rate::before {
  position: absolute;
  top: -4.25px;
  right: 0;
  left: 0;
  height: .5px;
  background: url("assets/rate-divider.svg") left center no-repeat;
  content: "";
}

.promotions { min-width: 0; }
.promotions__heading {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 4px;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
}
.promotion-track {
  display: flex;
  gap: var(--gap);
  margin-top: 8px;
  margin-inline: calc(-1 * var(--gutter));
  padding-inline: var(--gutter);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-padding-inline: var(--gutter);
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.promotion-track::-webkit-scrollbar { display: none; }
.promotion-track:focus-visible { outline-offset: -2px; }
.promotion {
  display: flex;
  flex: 0 0 171px;
  flex-direction: column;
  gap: 8px;
  padding: 2px 2px 8px;
  color: var(--paragraph);
  scroll-snap-align: start;
}
.promotion img { border-radius: 22px 22px 0 0; object-fit: cover; }
.promotion span {
  display: -webkit-box;
  overflow: hidden;
  height: 40px;
  padding-inline: 12px;
  font-size: 16px;
  line-height: 20px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.promotion:focus-visible { outline-offset: -3px; }
.home-indicator { width: 139px; height: 5px; margin: 20px auto 8px; transform: translateX(-.5px); border-radius: 100px; background: #a1a1a1; }

.detail {
  width: min(calc(100% - 32px), 398px);
  max-height: min(760px, calc(100dvh - 32px));
  margin: auto;
  padding: 18px;
  overflow: auto;
  border: 1px solid rgb(255 255 255 / 85%);
  border-radius: 24px;
  background: #f2f8ff;
  box-shadow: 0 16px 48px rgb(17 41 72 / 24%);
  color: var(--ink);
}
.detail::backdrop { background: rgb(16 38 65 / 36%); }
.detail__heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.detail h2 { font-size: 18px; line-height: 24px; }
.detail__close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2edf9;
  font-size: 24px;
  line-height: 1;
}
.detail__content { display: grid; gap: 12px; font-size: 15px; line-height: 22px; }
.detail__content .summary-chart { width: min(100% - 24px, 169px); margin: 12px auto; }
.detail__chart-frame { overflow: auto; border-radius: 12px; background: #fff; }
.detail__art { width: 100%; height: auto; border-radius: 14px; }
.detail__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 12px; background: #fff; }
.detail__row img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; }
.detail__row--button { justify-content: start; }

@media (max-width: 420px) {
  .summary h2 { font-size: 14px; }
  .transaction__heading { gap: 6px; white-space: normal; }
}
@media (max-width: 380px) {
  :root { --gutter: 12px; }
  .overview, .transaction-grid { gap: 8px; }
  .balance, .summary, .transaction { padding-inline: 10px; }
  .balance h2, .summary h2, .transaction__heading { font-size: 14px; }
  .balance-row, .transaction__count { font-size: 12px; }
  .brand { margin-right: 0; }
}
@media (max-width: 325px) {
  .brand { font-size: 14px; }
  .brand img { width: 132px; height: auto; }
}

:root[data-telegram] {
  --compact-header-height: calc(71px + var(--telegram-top));
  --telegram-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --telegram-bottom: calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px));
  --telegram-left: calc(var(--tg-safe-area-inset-left, 0px) + var(--tg-content-safe-area-inset-left, 0px));
  --telegram-right: calc(var(--tg-safe-area-inset-right, 0px) + var(--tg-content-safe-area-inset-right, 0px));
}

:root[data-telegram] body {
  padding-inline: var(--telegram-left) var(--telegram-right);
}

:root[data-telegram] .home {
  padding-bottom: calc(24px + var(--telegram-bottom));
}

:root[data-telegram] .header {
  padding-top: calc(16px + var(--telegram-top));
}

:root[data-telegram] .status-bar,
:root[data-telegram] .home-indicator {
  display: none;
}

:root[data-telegram] .detail {
  inset: var(--telegram-top) var(--telegram-right) var(--telegram-bottom) var(--telegram-left);
  width: min(calc(100% - 32px - var(--telegram-left) - var(--telegram-right)), 398px);
  max-height: min(760px, calc(100dvh - 32px - var(--telegram-top) - var(--telegram-bottom)));
}
