:root {
  --bg:            #0A0A0B;
  --surface:       #111113;
  --line:          #18181A;
  --line-2:        #1B1B1D;
  --line-3:        #212123;

  --text:          #F4F4F5;
  --text-strong:   #FCFCFD;
  --text-soft:     #EDEDED;
  --text-dim:      #C9C9C4;
  --muted:         #6D6D72;
  --muted-2:       #7C7C81;
  --muted-3:       #5F5F64;

  /* голубой акцент */
  --accent:        #4D9BFF;
  --accent-soft:   #8FBEFF;
  --accent-from:   #58A6FF;
  --accent-to:     #1D6FE8;
  --accent-ink:    #FFFFFF;
  --avatar-from:   #4D9BFF;
  --avatar-to:     #1B5FD0;
  --avatar-ink:    #F2F7FF;

  /* верхний mesh-градиент */
  --sky-base:      #0069E1;   /* hsl(209, 100%, 44%) */
  --sky-teal:      #10E7DA;   /* hsl(177, 87%, 48%) */

  --green:         #5DCAA5;
  --red:           #E26A6A;

  --font:          'Inter', -apple-system, system-ui, sans-serif;
  --font-display:  'Inter Tight', 'Inter', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* фоновая сцена: градиент + размытые блобы */
.stage {
  position: fixed;
  inset: 0 0 auto 0;
  height: 48vh;
  min-height: 340px;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(168deg, #6C8AE0, #7E9BE6 40%, #4E6DD2);
  -webkit-mask-image: radial-gradient(150% 100% at 50% 0%, #000 42%, transparent 92%);
  mask-image: radial-gradient(150% 100% at 50% 0%, #000 42%, transparent 92%);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
}
.blob-1 { width: 56%;  height: 40%; left: 8%;   top: 30%; background: #ECF0FC; opacity: .9;  transform: rotate(34deg); }
.blob-2 { width: 64%;  height: 34%; left: 44%;  top: 14%; background: #C4D6F6; opacity: .75; transform: rotate(-8deg); }
.blob-3 { width: 86%;  height: 56%; left: -24%; top: 4%;  background: #8AA3E8; opacity: .8;  transform: rotate(-28deg); }
.blob-4 { width: 150%; height: 60%; left: -30%; top: 62%; background: #3450C8; opacity: .9;  transform: rotate(-12deg); }

html {
  background: var(--bg);
}

body {
  margin: 0;
  /* прозрачный, чтобы mesh-градиент из body::before был виден на фоне */
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior-y: none;
}

button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(12px + var(--tg-safe-top, 0px)) 18px 12px;
}
.topbar__greeting {
  color: rgba(233, 241, 255, .72);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .2px;
  margin-bottom: 2px;
}
.topbar__title {
  color: #FFFFFF;
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -.3px;
}
.topbar__actions { display: flex; gap: 9px; align-items: center; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .14);
  color: #EAF2FF;
  font-size: 17px;
  border: .5px solid rgba(255, 255, 255, .18);
  transition: background .15s ease;
}
.icon-btn:active { background: rgba(255, 255, 255, .24); }

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--avatar-from), var(--avatar-to));
  color: var(--avatar-ink);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- screens ---------- */
.screens { flex: 1; display: flex; flex-direction: column; }
.screen { display: none; flex: 1; flex-direction: column; }
.screen.is-active { display: flex; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 14px 20px 54px; position: relative; }
.hero__label {
  font-size: 12px;
  color: rgba(233, 241, 255, .72);
  font-weight: 500;
  letter-spacing: .3px;
  margin-bottom: 12px;
}
.hero__value {
  font-size: 48px;
  color: #FFFFFF;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -1.6px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero__delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  background: rgba(255, 255, 255, .16);
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
}
.hero__delta .ti { font-size: 14px; color: #6DF78C; }
.hero__delta-pct { font-size: 13px; color: #6DF78C; font-weight: 600; }
.hero__delta-abs { font-size: 13px; color: rgba(255, 255, 255, .7); font-weight: 500; }

.hero__delta.is-down { background: rgba(255, 255, 255, .16); }
.hero__delta.is-down .ti,
.hero__delta.is-down .hero__delta-pct { color: #FFD3D3; }

.hero__value, .hero__delta { transition: opacity .18s ease; }
.hero.is-loading .hero__value,
.hero.is-loading .hero__delta { opacity: .35; }

/* ---------- переключатель периода ---------- */
.period { position: relative; display: inline-block; }

.period__btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #FFFFFF;
  font: inherit;
  font-weight: 600;
  letter-spacing: inherit;
  padding: 2px 0;
  user-select: none;
}
.period__btn .ti { font-size: 13px; transition: transform .2s ease; }
.period.is-open .period__btn .ti { transform: rotate(180deg); }

.period__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 10;
  min-width: 150px;
  padding: 6px;
  background: #17171B;
  border: .5px solid #2C2C31;
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, .6);
  display: flex;
  flex-direction: column;
  transform: translate(-50%, -6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.period.is-open .period__menu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.period__opt {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}
.period__opt.is-active { color: var(--accent-soft); background: #101014; }

/* ---------- квадрат с действиями ---------- */
.panel {
  margin: 0 18px 20px;
  padding: 4px 12px 0;
  background: none;
  border: 0;
  box-shadow: none;
}

.actions {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}
.action { flex: 1; text-align: center; }
.action__tile {
  width: 52px; height: 52px;
  margin: 0 auto 9px;
  border-radius: 50%;
  background: hsl(200 0% 100% / 0.140);
  border: 0.5px solid hsl(200 0% 100% / 0.300);
  -webkit-backdrop-filter: blur(10px) saturate(135%) brightness(104%);
  backdrop-filter: blur(10px) saturate(135%) brightness(104%);
  color: #FFFFFF;
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.28),
    inset 0 -1px 1px rgba(255, 255, 255, 0.12),
    inset 0 0 22px rgba(255, 255, 255, 0.06),
    0 12px 26px -14px rgba(8, 14, 28, 0.45);
  transition: transform .12s ease, background .15s ease;
}
.action:active .action__tile { background: hsl(200 0% 100% / 0.220); }
/* без backdrop-filter — чуть плотнее, чтобы иконка читалась */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .action__tile { background: rgba(255, 255, 255, .22); }
}
.action:active .action__tile { transform: scale(.94); }
.action__label {
  font-size: 11px;
  color: rgba(255, 255, 255, .92);
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}

/* ---------- баннеры ---------- */
.banners { margin: 6px 0 20px; }
.banners[hidden] { display: none; }

.banners__track {
  display: flex;
  gap: 12px;
  padding: 0 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.banners__track::-webkit-scrollbar { display: none; }

.banner {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px 14px 12px 18px;
  border-radius: 16px;
  overflow: hidden;
  text-align: left;
  background: linear-gradient(135deg, #17325C 0%, #101E38 100%);
  border: .5px solid rgba(255, 255, 255, .06);
  transition: transform .12s ease;
}
.banner:active { transform: scale(.99); }

/* полоска слева */
.banner::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background-color: hsl(157.66423357664232, 73.2620320855615%, 63.33333333333333%);
  background: radial-gradient(at 66.7579738199936% 6.523516506836602%, hsla(134.64566929133858, 70.94972067039106%, 64.90196078431373%, 1) 0%, hsla(134.64566929133858, 70.94972067039106%, 64.90196078431373%, 0) 100%), radial-gradient(at 37.733537632096144% 45.42250418111844%, hsla(157.66423357664232, 73.2620320855615%, 63.33333333333333%, 1) 0%, hsla(157.66423357664232, 73.2620320855615%, 63.33333333333333%, 0) 100%), radial-gradient(at 83.4357710289493% 48.081993459537166%, hsla(177, 67.3076923076923%, 59.21568627450981%, 1) 0%, hsla(177, 67.3076923076923%, 59.21568627450981%, 0) 100%), radial-gradient(at 78.89420384453689% 36.18628962384385%, hsla(194.1732283464567, 70.94972067039106%, 64.90196078431373%, 1) 0%, hsla(194.1732283464567, 70.94972067039106%, 64.90196078431373%, 0) 100%), radial-gradient(at 90.33627187372191% 9.064137677348505%, hsla(134.64566929133858, 70.94972067039106%, 64.90196078431373%, 1) 0%, hsla(134.64566929133858, 70.94972067039106%, 64.90196078431373%, 0) 100%), radial-gradient(at 11.726809616151002% 93.34503527137488%, hsla(157.66423357664232, 73.2620320855615%, 63.33333333333333%, 1) 0%, hsla(157.66423357664232, 73.2620320855615%, 63.33333333333333%, 0) 100%), radial-gradient(at 97.53611469956618% 6.797198032458107%, hsla(177, 67.3076923076923%, 59.21568627450981%, 1) 0%, hsla(177, 67.3076923076923%, 59.21568627450981%, 0) 100%), radial-gradient(at 72.77047602106738% 27.47905906663899%, hsla(194.1732283464567, 70.94972067039106%, 64.90196078431373%, 1) 0%, hsla(194.1732283464567, 70.94972067039106%, 64.90196078431373%, 0) 100%);
}

.banner__art {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  object-fit: contain;
  pointer-events: none;
}

.banner__body { flex: 1; min-width: 0; }
.banner__title {
  color: var(--accent-soft);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -.1px;
  margin-bottom: 3px;
}
.banner__text {
  color: #DEE7F5;
  font-size: 13px;
  font-weight: 450;
  line-height: 1.35;
}

.banner__chevron {
  flex: 0 0 auto;
  font-size: 18px;
  color: #7089B4;
}

/* точки */
.banners__dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
}
.banners__dots:empty { display: none; }
.banners__dot {
  width: 5px; height: 5px;
  border-radius: 999px;
  background: #2C3550;
  transition: width .2s ease, background .2s ease;
}
.banners__dot.is-active { width: 16px; background: var(--accent); }

/* ---------- метрики ---------- */
.metrics { display: flex; gap: 12px; padding: 0 18px 22px; }
.metric {
  flex: 1;
  background: var(--surface);
  border-radius: 18px;
  padding: 15px 16px;
  border: .5px solid var(--line-2);
}
.metric__icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #1A1A1C;
  display: flex; align-items: center; justify-content: center;
  color: #8E8E93;
  font-size: 17px;
}
.metric__label { color: var(--muted); font-size: 12px; font-weight: 500; margin: 14px 0 5px; }
.metric__value {
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -.4px;
}

/* ---------- stubs ---------- */
.stub {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted-3);
  padding: 80px 24px;
}
.stub .ti { font-size: 34px; }
.stub p { margin: 0; font-size: 14px; font-weight: 500; }

/* ---------- tab bar ---------- */
.tabbar {
  display: flex;
  justify-content: space-between;
  padding: 12px 24px calc(10px + var(--tg-safe-bottom, 0px));
  border-top: .5px solid var(--line);
  background: var(--bg);
  position: sticky;
  bottom: 0;
}
.tab {
  text-align: center;
  flex: 1;
  color: var(--muted-3);
  padding: 0;
  transition: color .15s ease;
}
.tab .ti { font-size: 22px; }
.tab__label { font-size: 10px; margin-top: 5px; font-weight: 500; }
.tab.is-active { color: var(--text); }
.tab.is-active .tab__label { font-weight: 600; }
