/* 1LOG Mini App UI (no framework). */
:root {
  --bg: #F2F3F5;
  --page-radial-alpha: .08;
  --page-top-start: #F8FAFF;
  --page-top-end: #F1F4FB;
  --text: #0E0F13;
  --muted: #6B7280;
  --nav: transparent;
  --blue: #05238B;
  --blue-2: #1539C7;
  --blue-3: #AFC4FF;
  --border: #041e90;
  --card: #FFFFFF;
  --shadow: 0 14px 28px rgba(0, 0, 0, .08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  /* Computed in JS for Telegram WebApp; falls back to env() safe-area in browsers. */
  --app-top: var(--safe-top);
  --app-bottom: var(--safe-bottom);
  --topbar-gap: 20px;
  --app-shell-top: calc(var(--app-top, 0px) + var(--topbar-gap, 20px));
  --viewport-h: 100dvh;
  --keyboard-inset: 0px;
  --compose-bottom-offset: 0px;
  --message-action-bottom: 10px;
  --topbar-h: 72px;
  --bottom-nav-h: 90px;
  --bottom-nav-bottom-offset: calc(16px + var(--app-bottom, 0px) - var(--safe-bottom, 0px));
  --bottom-nav-visual-height: var(--bottom-nav-h);
  --dashboard-cta-gap: 14px;
  --dashboard-cta-height: 56px;
  --dashboard-cta-bottom: calc(var(--bottom-nav-bottom-offset) + var(--bottom-nav-visual-height) + var(--dashboard-cta-gap));
  --dashboard-screen-bottom-reserve: calc(var(--dashboard-cta-bottom) + var(--dashboard-cta-height) + 24px);
}

* {
  box-sizing: border-box
}

html,
body {
  /* Added: base full-height + no default spacing for Telegram WebView */
  margin: 0;
  padding: 0;
  height: 100%;
  height: -webkit-fill-available;
  overflow-x: hidden;
}

[hidden] {
  display: none !important
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at top center, rgba(20, 53, 199, var(--page-radial-alpha)) 0%, rgba(20, 53, 199, 0) 38%),
    linear-gradient(180deg, var(--page-top-start) 0%, var(--page-top-end) 100%);
  color: var(--text);
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overscroll-behavior: none;
  position: relative;
}

html.is-ios body {
  --page-radial-alpha: .14;
  --page-top-start: #E4EBFF;
  --page-top-end: #D9E3FF;
  --topbar-gap: 30px;
}

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

.app {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: var(--tg-viewport-h, 100dvh);
  min-height: var(--tg-viewport-h, 100dvh);
  max-height: var(--tg-viewport-h, 100dvh);
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  /* Single shell-level top offset keeps the whole screen below Telegram controls on iPhone. */
  padding-top: var(--app-shell-top, calc(var(--app-top, 0px) + var(--topbar-gap, 20px)));
  padding-bottom: calc(24px + var(--app-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.topbar {
  width: calc(100% - 40px);
  max-width: 420px;
  position: sticky;
  top: 24px;
  margin-top: 0;
  z-index: 20;
  margin-left: auto;
  margin-right: auto;
  border-radius: 999px;
  overflow: hidden;
}

.topbar,
.content {
  position: relative;
  z-index: 1;
}

.bottom-nav {
  position: fixed;
  z-index: 40;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.topbar__pill {
  background: linear-gradient(180deg, #062CA8 0%, #031D73 100%);
  height: 72px;
  border-radius: 999px;
  padding: 0 18px 0 22px;
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 10px 28px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(2, 6, 23, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

button.topbar__brand {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.topbar__brand:active {
  transform: scale(.99);
}

.topbar__logo {
  font-weight: 800;
  font-size: 32px;
  letter-spacing: 1.5px;
  font-style: italic;
}

.topbar__actions {
  display: flex;
  align-items: center;
  color: #fff
}

.topbar__lang {
  gap: 8px;
  padding: 10px 12px
}

.topbar__lang span {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px
}

.topbar .icon--sm {
  width: 20px;
  height: 20px
}

.topbar .icon-btn {
  padding: 10px;
  border-radius: 16px
}

.topbar .icon-btn:active {
  transform: scale(.98)
}

.icon {
  width: 20px;
  height: 20px;
  fill: currentColor
}

.icon--sm {
  width: 18px;
  height: 18px
}

.icon--xs {
  width: 16px;
  height: 16px;
}

.flag-icon {
  width: 18px;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25);
  flex: 0 0 auto;
}

.topbar__flag {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .2);
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 6px;
  font-weight: 900;
  color: #111827;
}

.lang-option__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lang-option__flag {
  flex: 0 0 auto;
}

.lang-option__flag-badge {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #F8FAFF 0%, #E8EEFF 100%);
  box-shadow: inset 0 0 0 1px rgba(5, 35, 139, .08);
  font-size: 16px;
  line-height: 1;
  flex: 0 0 auto;
}

.lang-option__label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.icon-btn:active {
  transform: scale(.98)
}

.icon-btn--muted {
  color: #4B5563;
  background: #EFF2F7
}

.content {
  width: 100%;
  max-width: 420px;
  margin-top: 10px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

@media (max-height: 840px) {
  .app {
    padding-top: var(--app-shell-top, calc(var(--app-top, 0px) + var(--topbar-gap, 20px)));
    padding-bottom: calc(74px + var(--app-bottom, 0px) - var(--safe-bottom, 0px));
  }

  .topbar {
    top: 16px;
  }

  .topbar__pill {
    height: 62px;
    padding: 0 16px 0 18px;
  }

  .topbar__logo {
    font-size: 26px;
  }

  .content {
    margin-top: 8px;
  }

  .title-row {
    margin: 8px 2px 8px;
  }

  .title h1 {
    font-size: 24px;
  }

  .title__sub {
    font-size: 13px;
  }

  .card-grid {
    gap: 10px;
    margin: 10px 0 12px;
  }

  .stat-card {
    min-height: 90px;
    padding: 10px 10px 12px;
  }

  .stat-card__value {
    margin-top: 6px;
    font-size: 16px;
  }

  .btn {
    height: 50px;
    font-size: 15px;
  }
}

.screen {
  animation: fadeIn .18s ease-out;
  flex: 1 1 auto;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  padding-top: 12px;
  padding-bottom: calc(10px + var(--bottom-nav-h) + var(--app-bottom, 0px) - var(--safe-bottom, 0px));
  scroll-padding-top: 12px;
  scroll-padding-bottom: calc(10px + var(--bottom-nav-h) + var(--app-bottom, 0px) - var(--safe-bottom, 0px));
}

@keyframes fadeIn {
  from {
    opacity: .65;
    transform: translateY(2px)
  }

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

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 2px 10px;
  flex-wrap: nowrap;
}

.title {
  min-width: 0;
  flex: 1 1 auto;
}

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

.title__topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.title-row--stacked {
  display: block;
}

.title-row__aside {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}

#screen-groups .title-row__refresh {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(180deg, #1A45D4 0%, #0D2A9B 100%);
  color: #fff;
  box-shadow: 0 8px 16px rgba(13, 42, 155, 0.18);
  border: 1px solid rgba(255, 255, 255, .1);
}

#screen-groups .title-row__refresh svg {
  display: block;
  color: currentColor;
  width: 17px;
  height: 17px;
}

#screen-groups .title-row__refresh:active,
#screen-groups .title-row__refresh:disabled,
#screen-groups .title-row__refresh[aria-busy="true"] {
  opacity: .52;
  transform: none;
}

#screen-groups .title-row {
  display: block;
}

#screen-groups .title {
  flex: none;
  width: 100%;
}

#screen-groups .title__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#screen-groups .title__h {
  min-width: 0;
  flex: 1 1 auto;
}

#screen-groups .title h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#screen-groups .title-row__aside--groups {
  flex-shrink: 0;
}

#screen-groups .title__meta--groups {
  margin-top: 6px;
  display: block;
}

#screen-groups .title__meta--groups .title__sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  color: #4B5563;
}

#screen-groups .title-row__aside--groups {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

#screen-groups .title__meta--groups .status-pill {
  align-self: center;
  flex: 0 0 auto;
}

#screen-groups .title-row__refresh {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(180deg, #1A45D4 0%, #153DB4 100%);
  color: #fff;
  box-shadow: 0 3px 8px rgba(13, 42, 155, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#screen-groups .title-row__refresh:hover {
  box-shadow: 0 4px 10px rgba(13, 42, 155, 0.12);
}

.title__icon {
  width: 22px;
  height: 22px
}

.title h1 {
  margin: 0;
  font-size: clamp(24px, 7.2vw, 28px);
  line-height: 1.1
}

.title__sub {
  margin: 4px 0 0;
  color: #4B5563;
  font-size: 14px
}

.status-pill {
  margin-top: 0;
  border-radius: 999px;
  padding: 9px 17px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #9CA3AF;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 15px;
  flex: 0 0 auto;
  align-self: flex-start;
  overflow: visible;
}

#dashboard-status {
  padding: 7px 13px;
  gap: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.01em;
  min-height: 38px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .06);
}

#dashboard-status .status-pill__icon {
  width: 16px;
  height: 16px;
  font-size: 10px;
}

#dashboard-status .status-pill__text {
  line-height: 1;
}

.status-pill__icon {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1;
}

.status-pill__text {
  min-width: 0;
  line-height: 1.1;
}

.status-pill--muted {
  color: #fff;
  background: #9CA3AF
}

.status-pill--idle {
  background: linear-gradient(180deg, #C8C8C3 0%, #BDBDBD 100%);
  color: #FFFFFF;
  box-shadow: 0 6px 14px rgba(70, 70, 70, 0.10);
}

.status-pill--idle .status-pill__icon {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 35%, #F7F7F5 0%, #E4E4DE 42%, #A8A8A1 100%);
  box-shadow: 0 0 10px rgba(138, 138, 132, 0.16);
}

.status-pill--idle .status-pill__text {
  text-shadow: none;
}

.status-pill--ok {
  background: #B9F5D0;
  color: #13A857
}

.status-pill--bad {
  background: #FFC7C7;
  color: #E44C4C
}

.status-pill--run {
  background: linear-gradient(180deg, #BDF8D3 0%, #A8F1C2 100%);
  color: #10924A;
  box-shadow: 0 6px 16px rgba(19, 168, 87, 0.12);
}

.status-pill--run .status-pill__icon {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 35%, #E9FFF1 0%, #4EE389 45%, #12B45A 100%);
  box-shadow:
    0 0 0 0 rgba(19, 168, 87, 0.24),
    0 0 10px rgba(59, 226, 122, 0.30),
    0 0 16px rgba(59, 226, 122, 0.12);
  animation: status-pill-pulse 1.35s ease-in-out infinite;
}

.status-pill--run .status-pill__icon::before {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.72);
}

.status-pill--run .status-pill__icon::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1.5px solid rgba(19, 168, 87, 0.24);
  opacity: 0;
  animation: status-pill-ripple 1.35s ease-out infinite;
}

.status-pill--run .status-pill__text {
  text-shadow: 0 0 10px rgba(59, 226, 122, 0.18);
}

.status-pill--stopped {
  background: linear-gradient(180deg, #FFF0C8 0%, #F1D78D 100%);
  color: #7A5A11;
  box-shadow: 0 6px 14px rgba(176, 139, 51, 0.12);
}

.status-pill--stopped .status-pill__icon {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 35%, #FFF9E8 0%, #F4D66C 46%, #CF9E22 100%);
  box-shadow:
    0 0 0 0 rgba(207, 158, 34, 0.18),
    0 0 10px rgba(244, 214, 108, 0.22),
    0 0 16px rgba(244, 214, 108, 0.10);
  animation: status-pill-idle-pulse 1.8s ease-in-out infinite;
}

.status-pill--stopped .status-pill__icon::before {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 251, 234, 0.94);
  box-shadow: 0 0 6px rgba(255, 251, 234, 0.56);
}

.status-pill--stopped .status-pill__icon::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1.5px solid rgba(207, 158, 34, 0.20);
  opacity: 0;
  animation: status-pill-idle-ripple 1.8s ease-out infinite;
}

.status-pill--stopped .status-pill__text {
  text-shadow: 0 0 8px rgba(244, 214, 108, 0.12);
}

@keyframes status-pill-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 0 rgba(19, 168, 87, 0.28),
      0 0 14px rgba(59, 226, 122, 0.30),
      0 0 22px rgba(59, 226, 122, 0.12);
  }

  50% {
    transform: scale(1.12);
    box-shadow:
      0 0 0 10px rgba(19, 168, 87, 0),
      0 0 20px rgba(59, 226, 122, 0.44),
      0 0 36px rgba(59, 226, 122, 0.20);
  }
}

@keyframes status-pill-ripple {
  0% {
    opacity: 0;
    transform: scale(0.88);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(1.28);
  }
}

@keyframes status-pill-idle-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 0 rgba(209, 166, 69, 0.22),
      0 0 10px rgba(236, 190, 82, 0.18),
      0 0 18px rgba(236, 190, 82, 0.08);
  }

  50% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 8px rgba(209, 166, 69, 0),
      0 0 16px rgba(236, 190, 82, 0.30),
      0 0 26px rgba(236, 190, 82, 0.12);
  }
}

@keyframes status-pill-idle-ripple {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }

  22% {
    opacity: .9;
  }

  100% {
    opacity: 0;
    transform: scale(1.22);
  }
}

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

.stat-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 30px;
  padding: 18px 18px 20px;
  min-height: 132px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  background: #EEF2FF;
}

.stat-card__icon--green {
  background: #D9FCE6;
  color: #12A853
}

.stat-card__icon--blue {
  background: #E7EDFF;
  color: #0B2AA6
}

.stat-card__icon--orange {
  background: #FFE8C9;
  color: #E59A2E
}

.stat-card__icon--red {
  background: #FFD7D7;
  color: #E04C4C
}

.stat-card__icon--purple {
  background: #EDE9FF;
  color: #6D4CFF
}

.stat-card__calendar-icon {
  width: 19px;
  height: 19px;
}

.stat-card__value {
  margin-top: 12px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .2px;
  line-height: 1.1;
  min-width: 0;
  overflow-wrap: anywhere;
}

#stat-interval {
  font-size: clamp(15px, 4.2vw, 19px);
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
  overflow-wrap: normal;
}

.stat-card__value--sent-progress {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.stat-card__value--groups-progress {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

#stat-sent-total {
  color: #111827;
}

.stat-sent-sep {
  color: #111827;
}

.stat-groups-sep {
  color: #111827;
}

#stat-sent-ok {
  color: #13A857;
}

#stat-sent-fail {
  color: #13A857
}

#stat-groups-active {
  color: #111827;
}

#stat-groups-inactive {
  color: #DC2626;
}

.stat-card__label {
  margin-top: 2px;
  font-size: 13px;
  color: #6B7280;
  min-width: 0;
  overflow-wrap: anywhere;
}

.problem-groups-trigger {
  margin-top: 6px;
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: #DC2626;
  padding: 0;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.problem-groups-trigger::before {
  content: "!";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #FEE2E2;
  color: #DC2626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  flex: 0 0 auto;
}

.problem-groups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.problem-group-card {
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 10px 12px;
  background: #F8FAFC;
}

.problem-group-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.problem-group-card__meta {
  min-width: 0;
}

.problem-group-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: #111827;
  word-break: break-word;
}

.problem-group-card__username {
  margin-top: 2px;
  font-size: 12px;
  color: #1D4ED8;
  font-weight: 700;
  word-break: break-word;
}

.problem-group-card__account {
  margin-top: 3px;
  font-size: 11px;
  color: #6B7280;
}

.problem-group-card__reason {
  margin-top: 6px;
  font-size: 12px;
  color: #B91C1C;
  font-weight: 800;
  line-height: 1.35;
}

.problem-group-card__time {
  margin-top: 3px;
  font-size: 11px;
  color: #6B7280;
}

.problem-group-card__link {
  margin-top: 8px;
  height: 42px;
  font-size: 14px;
}

.item-card--special .item-card__meta {
  gap: 10px;
  flex-wrap: nowrap;
}

.item-card__meta-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6B7280;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#groups-special-list {
  margin-top: 0;
}

.join-request-modal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.join-request-note {
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #F8FBFF 0%, #FFFFFF 100%);
  border: 1px solid #D9E4FF;
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

.join-request-note--warn {
  background: #FFF7ED;
  border-color: #F2B764;
  color: #9A3412;
  font-weight: 800;
}

.join-request-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.join-request-card {
  width: 100%;
  border: 1px solid #D9E4FF;
  border-radius: 16px;
  padding: 12px 14px;
  background: #FFFFFF;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: transform .05s ease, box-shadow .2s ease, border-color .2s ease;
  flex: 1;
}

.join-request-card:active {
  transform: scale(.995);
}

.join-request-card:hover {
  border-color: #BCD1FF;
  box-shadow: 0 8px 18px rgba(5, 35, 139, .08);
}

.join-request-card__index {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #E7EDFF;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  flex: 0 0 auto;
}

.join-request-card__main {
  min-width: 0;
  flex: 1;
}

.join-request-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.join-request-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: #111827;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.join-request-card__link {
  margin-top: 3px;
  font-size: 12px;
  color: #1D4ED8;
  font-weight: 700;
  word-break: break-all;
}

.join-request-card__hint {
  margin-top: 5px;
  font-size: 11px;
  color: #6B7280;
}

.join-request-card__copy-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  background: #EFF4FF;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid #D9E4FF;
  cursor: pointer;
  transition: transform .05s ease, background .2s ease, border-color .2s ease;
}

.join-request-card__copy-btn:active {
  transform: scale(.98);
}

.join-request-card__copy-btn:hover {
  background: #E6EEFF;
  border-color: #BCD1FF;
}

.btn {
  height: var(--h);
  border-radius: 999px;
  border: 0;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: transform .05s ease, filter .2s ease, opacity .2s ease;
}

.btn:active {
  transform: scale(.99)
}

.btn[disabled] {
  opacity: .55;
  cursor: not-allowed
}

.btn-full {
  width: 100%
}

.btn__icon {
  font-size: 20px;
  font-weight: 900;
  line-height: 1
}

.btn__icon--svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow)
}

.btn-secondary {
  background: #AFC4FF;
  color: var(--blue);
  border: 2px solid var(--border)
}

.btn-outline-primary {
  background: #fff;
  color: var(--blue);
  border: 2px solid var(--border);
  box-shadow: none
}

.btn-danger {
  background: #FFE2E2;
  color: #F04747;
  border: 2px solid #FFB9B9
}

.btn-success {
  background: #33C85A;
  color: #fff
}

.btn-warn {
  background: #FFE8B5;
  color: #F59E0B;
  border: 2px solid #FFC66E
}

.actions-stack #btn-start.btn-success {
  background: #D9FCE6;
  color: #13A857;
  border: 2px solid #7EE6A0
}

.actions-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px
}

#screen-dashboard {
  padding-top: 12px;
  padding-bottom: var(--dashboard-screen-bottom-reserve);
  scroll-padding-bottom: var(--dashboard-screen-bottom-reserve);
}

#screen-dashboard [data-action="create-flow"],
#screen-dashboard #dashboard-actions {
  position: static;
  flex: 0 0 auto;
  margin-top: 8px;
  margin-bottom: 8px;
  padding-top: 0;
  z-index: 1;
}

#screen-dashboard #dashboard-actions,
#screen-dashboard [data-action="create-flow"] {
  margin-bottom: 8px;
}

#screen-dashboard #dashboard-actions::before,
#screen-dashboard [data-action="create-flow"]::before {
  content: none;
}

.empty {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.empty__icon {
  width: 120px;
  height: 120px;
  border-radius: 0;
  background: transparent;
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.empty__icon .icon {
  width: 42px;
  height: 42px
}

.empty__icon svg {
  width: 96px;
  height: 96px
}

.empty__plus {
  position: absolute;
  right: 14px;
  top: 14px;
  font-size: 34px;
  font-weight: 900;
}

.empty__text {
  margin: 0;
  text-align: center;
  color: #353B45;
  max-width: 280px;
  line-height: 1.35;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 14px
}

.import {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 30px;
  padding: 14px 14px;
  margin: 12px 0 14px;
}

.import__title {
  font-weight: 900;
  font-size: 15px
}

.import__sub {
  margin-top: 4px;
  color: #6B7280;
  font-size: 12px;
  line-height: 1.35
}

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

.import__link {
  height: 44px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

.import__link:active {
  transform: scale(.99)
}

.item-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-card__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #E7EDFF;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex: 0 0 auto;
}

.item-card__main {
  min-width: 0
}

.account-card__main {
  min-width: 0;
  flex: 1
}

.account-card__top {
  display: flex;
  align-items: center;
  gap: 10px
}

.account-card__namewrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.account-card__name {
  min-width: 0;
  flex: 0 1 auto;
  font-weight: 900;
  font-size: 15px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.account-card__meta {
  margin-top: 4px;
  font-size: 12px;
  color: #6B7280;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.account-card__meta .meta-icon {
  color: #9CA3AF;
  flex: 0 0 auto;
}

.account-card__meta .meta-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-card__status {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap
}

.item-card--account .item-card__actions {
  gap: 10px
}

.item-card--account .action {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #EFF2F7;
  color: #4B5563;
}

.item-card--account .action svg {
  width: 20px;
  height: 20px
}

.item-card--account .action:active {
  background: #E5E7EB
}

.item-card__title {
  font-weight: 900;
  font-size: 15px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-card__meta {
  margin-top: 4px;
  font-size: 12px;
  color: #6B7280;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap
}

.tag {
  border-radius: 999px;
  min-height: 20px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  white-space: nowrap;
}

.tag--ok {
  background: #D4FBE2;
  color: #13A857
}

.tag--pause {
  background: #FFE8B5;
  color: #F59E0B
}

.tag--bad {
  background: #FFC7C7;
  color: #E44C4C
}

.tag--alert {
  background: #FFD1D1;
  color: #C81E1E
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  background: #F3F4F6;
  color: #4B5563;
  white-space: nowrap;
  flex: 0 0 auto;
}

.item-card__actions {
  display: flex;
  align-items: center;
  gap: 6px
}

.action {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 0;
  background: #F3F4F6;
  color: #4B5563;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action:active {
  transform: scale(.98)
}

.action--danger {
  background: #FFE2E2;
  color: #F04747
}

.action--primary {
  background: #E7EDFF;
  color: var(--blue)
}

.editor {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 30px;
  overflow: hidden;
  margin: 14px 0 14px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  height: 320px;
}

.editor__toolbar {
  order: 1;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  align-items: center;
  min-width: 0;
  min-height: 68px;
}

.editor__clear-btn {
  margin-left: auto;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(240, 71, 71, 0.24);
  background: linear-gradient(180deg, #FFF5F5 0%, #FFE8E8 100%);
  color: #D43D3D;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition:
    transform .12s ease,
    box-shadow .18s ease,
    background-color .18s ease;
  box-shadow: 0 6px 16px rgba(212, 61, 61, 0.10);
  white-space: nowrap;
}

.editor__clear-btn:active {
  transform: scale(.98);
}

.editor__clear-btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
}

.editor__textarea {
  order: 3;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: auto;
  max-height: none;
  border: 0;
  padding: 16px 14px;
  font-size: 16px;
  line-height: 1.5;
  color: #111827;
  caret-color: var(--blue);
  resize: none;
  outline: none;
  font-family: inherit;
  overflow-y: scroll;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  scrollbar-color: #173DCC #C9D7FF;
}

.editor__textarea::-webkit-scrollbar {
  width: 10px;
}

.editor__textarea::-webkit-scrollbar-track {
  background: #C9D7FF;
  border-radius: 999px;
}

.editor__textarea::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4A6CFF 0%, #173DCC 100%);
  border-radius: 999px;
  border: 2px solid #C9D7FF;
}

.editor__textarea::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4266FF 0%, #1235BA 100%);
}

.editor__textarea::placeholder {
  color: #A0A4AE;
  font-weight: 600
}

.editor__footer {
  order: 4;
  flex: 0 0 auto;
  padding: 10px 14px;
  border-top: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  color: #8A909B;
  font-size: 12px;
  font-weight: 700;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 2px solid var(--border);
  background: var(--card);
}

#message-editor #message-media.media-grid {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: 48px;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #6C86FF #DCE6FF;
  align-items: center;
}

#message-editor #message-media.media-grid::-webkit-scrollbar {
  height: 6px;
}

#message-editor #message-media.media-grid::-webkit-scrollbar-track {
  background: #DCE6FF;
  border-radius: 999px;
}

#message-editor #message-media.media-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #6C86FF 0%, #183CC9 100%);
  border-radius: 999px;
}

#message-editor #message-media .media-item {
  width: 48px;
  min-width: 48px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border-width: 1.5px;
  cursor: pointer;
}

#message-editor #message-media .media-item img {
  cursor: zoom-in;
}

#message-editor #message-media .media-item__remove {
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  font-size: 13px;
  background: rgba(12, 18, 38, .88);
  color: #fff;
  font-weight: 900;
  line-height: 1;
  z-index: 3;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
  border: 1px solid rgba(255, 255, 255, .22);
}

.media-item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: #F3F4F6;
  aspect-ratio: 1/1;
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.media-item__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-item__remove:active {
  transform: scale(.98)
}

.media-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.media-preview img,
.media-preview video {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(68dvh, 520px);
  object-fit: contain;
  border-radius: 18px;
  background: #F3F4F6;
  box-shadow: 0 16px 32px rgba(0, 0, 0, .12);
}

.bubble__media.media-grid {
  padding: 10px 0 0;
  border-top: 0;
  background: transparent;
  display: grid;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: 64px;
  gap: 8px;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #90A5FF #EEF2FF;
  align-items: start;
}

.bubble__media.media-grid::-webkit-scrollbar {
  height: 6px;
}

.bubble__media.media-grid::-webkit-scrollbar-track {
  background: #EEF2FF;
  border-radius: 999px;
}

.bubble__media.media-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #A2B4FF 0%, #5A78FF 100%);
  border-radius: 999px;
}

#message-preview-media .media-item {
  width: 64px;
  min-width: 64px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border-width: 1.5px;
}

.preview {
  margin-top: 10px
}

.preview__title {
  margin: 14px 2px 10px;
  font-size: 18px
}

#screen-message #message-next,
#screen-message #message-next-preview,
#screen-message [data-action="edit-message"] {
  flex: 0 0 auto;
  min-height: var(--h);
}

#screen-message .editor {
  flex: 0 0 auto;
}

#screen-message .title__sub {
  font-size: 15px;
}

#screen-message #message-next {
  margin-top: 12px;
}

html.is-message-composing .bottom-nav,
html.is-message-composing .bottom-nav__pill {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html.is-message-composing .app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: var(--viewport-h, var(--tg-viewport-h, 100dvh)) !important;
  min-height: var(--viewport-h, var(--tg-viewport-h, 100dvh)) !important;
  max-height: var(--viewport-h, var(--tg-viewport-h, 100dvh)) !important;
  padding-bottom: calc(16px + var(--app-bottom, 0px) - var(--safe-bottom, 0px)) !important;
  overflow: hidden;
}

html.is-message-composing .content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  padding-top: calc(var(--topbar-h, 72px) + var(--topbar-gap, 20px) + 14px);
}

html.is-message-composing #screen-message {
  padding-bottom: calc(var(--keyboard-inset, 0px) + var(--safe-bottom, 0px) + 92px) !important;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-padding-top: calc(var(--topbar-h, 76px) + 10px);
  scroll-padding-bottom: calc(var(--keyboard-inset, 0px) + var(--safe-bottom, 0px) + 96px);
  align-items: stretch;
  min-height: 0;
  gap: 12px;
}

html.is-message-composing .topbar {
  position: fixed;
  top: calc(24px + var(--app-shell-top, calc(var(--app-top, 0px) + var(--topbar-gap, 20px))));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 32px - var(--safe-left, 0px) - var(--safe-right, 0px)), 420px);
  max-width: 420px;
  margin-top: 0;
  z-index: 28;
}

html.is-message-composing #screen-message #message-next,
html.is-message-composing #screen-message #message-next-preview {
  margin-top: 0;
  margin-bottom: 0;
  flex: 0 0 auto;
  position: fixed;
  left: 50%;
  bottom: calc(var(--message-action-bottom, 10px) + var(--safe-bottom, 0px));
  transform: translateX(-50%);
  width: min(calc(100vw - 32px - var(--safe-left, 0px) - var(--safe-right, 0px)), 420px);
  max-width: 420px;
  z-index: 24;
}

html.is-message-composing #screen-message [data-action="edit-message"] {
  margin-top: 0;
  margin-bottom: 0;
}

html.is-message-composing #screen-message .editor__textarea {
  min-height: clamp(240px, 34vh, 360px);
  flex: 1 1 auto;
  height: auto;
  max-height: none;
}

html.is-ios #screen-message .editor {
  align-self: stretch;
}

html.is-message-composing #screen-message .editor {
  flex: 0 0 auto;
  min-height: clamp(340px, 48vh, 500px);
  height: auto;
  max-height: none;
  margin: 4px 0 10px;
}

html.is-ios.is-message-composing #screen-message .editor {
  min-height: clamp(360px, 50vh, 540px);
}

html.is-message-composing #screen-message .editor__toolbar {
  min-height: 56px;
  padding: 8px 12px;
}

html.is-message-composing #screen-message .title-row {
  flex: 0 0 auto;
  margin: 2px 2px 6px;
}

html.is-message-composing #screen-message .title__sub {
  margin-top: 3px;
  font-size: 14px;
}

html.is-message-composing #screen-message #message-next {
  width: 100%;
  max-width: none;
  box-shadow: 0 10px 24px rgba(5, 35, 139, .18);
  margin-top: 8px;
  margin-bottom: 0;
}

html.is-message-composing #screen-message .preview {
  flex: 0 0 auto;
  min-height: clamp(280px, 42vh, 380px);
  margin: 0;
  overflow: visible;
}

html.is-message-composing #screen-message .bubble {
  max-height: 100%;
  overflow: hidden;
}

html.is-message-composing #screen-message .bubble__text,
html.is-message-composing #screen-message .editor__textarea {
  overscroll-behavior: contain;
}

html.is-message-composing #screen-message .editor__textarea {
  min-height: 240px;
}

html.is-ios.is-message-composing #screen-message .editor__textarea {
  min-height: 260px;
}

html.is-message-composing #screen-message [data-action="edit-message"] {
  position: relative;
  z-index: 2;
}

#screen-accounts {
  padding-top: 12px;
  padding-bottom: 8px;
}

#screen-groups {
  padding-top: 12px;
  padding-bottom: 8px;
}

#screen-groups #groups-next {
  position: relative;
  margin-top: 12px;
  margin-bottom: 8px;
  z-index: 6;
  box-shadow: 0 10px 24px rgba(4, 30, 144, 0.12);
}

.bubble {
  background: var(--card);
  border-radius: 22px;
  padding: 14px 14px 18px;
  position: relative;
  box-shadow: 0 10px 18px rgba(0, 0, 0, .06);
  margin-bottom: 14px;
}

#screen-message .bubble {
  max-height: min(52dvh, 460px);
  overflow: hidden;
}

#screen-message .preview {
  padding-bottom: 8px;
}

.bubble__text {
  margin: 0;
  font-family: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  color: #20222A;
  font-size: 15px;
  line-height: 1.35;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #90A5FF #EEF2FF;
}

.bubble.is-collapsible .bubble__text {
  max-height: 220px;
  padding-bottom: 0;
  -webkit-mask-image: none;
  mask-image: none;
}

.bubble.is-collapsible.is-expanded .bubble__text {
  max-height: 320px;
  padding-bottom: 0;
  -webkit-mask-image: none;
  mask-image: none;
}

.bubble__text::-webkit-scrollbar,
.bubble.is-collapsible .bubble__text::-webkit-scrollbar,
.bubble.is-collapsible.is-expanded .bubble__text::-webkit-scrollbar {
  width: 6px;
}

.bubble__text::-webkit-scrollbar-track,
.bubble.is-collapsible .bubble__text::-webkit-scrollbar-track,
.bubble.is-collapsible.is-expanded .bubble__text::-webkit-scrollbar-track {
  background: #EEF2FF;
  border-radius: 999px;
}

.bubble__text::-webkit-scrollbar-thumb,
.bubble.is-collapsible .bubble__text::-webkit-scrollbar-thumb,
.bubble.is-collapsible.is-expanded .bubble__text::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #A2B4FF 0%, #5A78FF 100%);
  border-radius: 999px;
}

.bubble__copy {
  position: absolute;
  right: 10px;
  top: 10px;
  background: #F3F4F6;
  color: #4B5563;
}

.bubble__chev {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 0;
  background: #F3F4F6;
  color: #6B7280;
  font-size: 18px;
  display: none;
  align-items: center;
  justify-content: center;
}

.bubble__chev:active {
  transform: scale(.98)
}

.bubble.is-collapsible .bubble__chev {
  display: inline-flex
}

.bubble.is-collapsible.is-expanded .bubble__chev {
  transform: rotate(180deg)
}

.setting-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 30px;
  padding: 12px 12px;
  margin: 14px 0 14px;
}

.setting-card__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px
}

.setting-card__left {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
  min-width: 0
}

.setting-card__right {
  flex: 0 0 auto;
  padding-top: 2px;
}

.setting-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #E7EDFF;
  color: var(--blue);
  flex: 0 0 auto;
}

.setting-card__title {
  font-weight: 900;
  font-size: 14px
}

.setting-card__sub {
  margin-top: 4px;
  color: #6B7280;
  font-size: 12px
}

.setting-card__value {
  margin-top: 8px;
  font-weight: 900;
  color: var(--blue);
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
}

.setting-card__value-main {
  flex: 0 0 auto;
}

.setting-card__value-note {
  color: #DC2626;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  letter-spacing: .01em;
}

.setting-card__warn {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 900;
  color: #DC2626;
}

.chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0
}

.chips--three {
  grid-template-columns: repeat(3, 1fr);
}

.chip {
  height: 44px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: #fff;
  color: var(--blue);
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
}

.chip.is-active {
  background: var(--blue);
  color: #fff
}

.chip--wide {
  width: 100%;
  margin-top: 0px
}

#screen-interval .chip--wide {
  margin-top: 2px;
  margin-bottom: 0
}

#screen-interval .setting-card {
  margin: 10px 0;
}

#screen-interval {
  padding-top: 12px;
  padding-bottom: calc(5px + var(--bottom-nav-h) + var(--app-bottom, 0px));
  scroll-padding-bottom: calc(5px + var(--bottom-nav-h) + var(--app-bottom, 0px));
}

#screen-interval .chips {
  margin: 6px 0 8px;
  gap: 10px;
}

#screen-interval .chip--wide+.setting-card {
  margin-top: 6px
}

#screen-interval .chip--wide+#btn-launch {
  margin-top: 8px
}

#screen-interval #btn-launch {
  height: 56px;
  min-height: 56px;
  margin-top: 12px;
  margin-bottom: 0;
  flex: 0 0 auto;
  position: static;
}

html.is-ios #screen-interval .chip {
  font-size: 15px;
  font-weight: 950;
  letter-spacing: .01em;
}

html.is-ios #screen-interval #btn-launch {
  margin-top: 12px;
}

html.is-ios #screen-interval {
  padding-bottom: calc(5px + var(--bottom-nav-h) + var(--app-bottom, 0px));
  scroll-padding-bottom: calc(5px + var(--bottom-nav-h) + var(--app-bottom, 0px));
}

html.is-ios #screen-dashboard {
  padding-bottom: var(--dashboard-screen-bottom-reserve);
  scroll-padding-bottom: var(--dashboard-screen-bottom-reserve);
}

html.is-ios #screen-dashboard .title-row {
  margin: 6px 2px 4px;
  gap: 7px;
}

html.is-ios #screen-dashboard .title__topline {
  gap: 7px;
}

html.is-ios #screen-dashboard .title-row__aside {
  gap: 5px;
}

html.is-ios #screen-dashboard .title__sub {
  margin-top: 1px;
  font-size: 13px;
  line-height: 1.18;
}

html.is-ios #screen-dashboard .card-grid {
  gap: 14px;
  margin: 8px 0 6px;
}

html.is-ios #screen-dashboard .stat-card {
  min-height: 128px;
  padding: 17px 17px 19px;
  border-radius: 30px;
  min-width: 0;
}

html.is-ios #screen-dashboard .stat-card__icon {
  width: 34px;
  height: 34px;
}

html.is-ios #screen-dashboard .stat-card__value {
  margin-top: 12px;
  font-size: 18px;
  line-height: 1.15;
  min-width: 0;
  overflow-wrap: anywhere;
}

html.is-ios #screen-dashboard #stat-interval {
  font-size: clamp(14px, 3.9vw, 18px);
  line-height: 1.08;
}

html.is-ios #screen-dashboard .stat-card__label {
  font-size: 12px;
  line-height: 1.15;
  min-width: 0;
  overflow-wrap: anywhere;
}

html.is-ios #screen-dashboard [data-action="create-flow"],
html.is-ios #screen-dashboard #dashboard-actions {
  margin-top: 6px;
  margin-bottom: 0;
  padding-top: 0;
}

html.is-ios #screen-groups {
  padding-bottom: 10px;
}

html.is-ios #groups-special-list {
  margin-bottom: 0;
}

html.is-ios #screen-groups #groups-next {
  margin-top: 12px;
  margin-bottom: 10px;
}

html.is-ios .bottom-nav {
  padding-bottom: calc(12px + var(--app-bottom, 0px) - var(--safe-bottom, 0px));
}

@media (display-mode: standalone) {
  html.is-ios .app {
    padding-bottom: calc(12px + var(--app-bottom, 0px));
  }

  html.is-ios .bottom-nav {
    padding-bottom: calc(4px + var(--safe-bottom, 0px));
  }

  html.is-ios .bottom-nav__pill {
    height: 68px;
    padding: 8px 10px 7px;
    gap: 2px;
    border-radius: 28px;
  }

  html.is-ios .nav-pill {
    top: 8px;
    bottom: 7px;
    left: 10px;
    width: calc((100% - 20px) / var(--nav-count));
  }

  html.is-ios .nav-item {
    gap: 3px;
  }

  html.is-ios .nav-item__icon {
    width: 32px;
    height: 26px;
  }

  html.is-ios .nav-item__label {
    font-size: 8px;
    letter-spacing: -0.01em;
  }
}

#screen-dashboard [data-action="create-flow"],
#screen-dashboard #dashboard-actions .btn {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-left: 18px;
  padding-right: 18px;
}

#screen-dashboard [data-action="create-flow"] .btn__icon,
#screen-dashboard #dashboard-actions .icon {
  position: static;
  transform: none;
}

#screen-dashboard [data-action="create-flow"] .btn__icon,
#screen-dashboard #dashboard-actions .icon {
  flex: 0 0 auto;
  align-self: center;
}

.bottom-nav {
  --finder-nav-gap: 8px;
  --finder-nav-count: 5;
  position: fixed;
  left: 0;
  right: 0;
  z-index: 40;
  width: min(360px, calc(100vw - 48px));
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  /* iOS (notably iPhone 15 Pro) can drop tap events on fixed + backdrop-filter
     unless the element is promoted to its own compositing layer. */
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  bottom: var(--bottom-nav-bottom-offset);
  overflow: visible;
  display: flex;
  justify-content: center;
  isolation: isolate;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.76) 0%,
    rgba(255, 255, 255, 0.6) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 10px 28px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(2, 6, 23, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 10px 12px 11px;
  transition:
    transform 300ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 300ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 300ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
  touch-action: manipulation;
}

.bottom-nav__pill {
  position: relative;
  z-index: 1;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(var(--finder-nav-count), minmax(0, 1fr));
  width: 100%;
  align-items: center;
  gap: var(--finder-nav-gap);
  filter: saturate(1.02);
}

.nav-motion-blob,
.nav-active-pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  border-radius: 999px;
  pointer-events: none;
  will-change: transform, width, opacity, filter;
}

.nav-motion-blob {
  width: var(--finder-pill-trail-width, 0px);
  transform: translate3d(var(--finder-pill-trail-x, 0px), 0, 0) scaleX(1.03);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.48) 0%, rgba(255, 255, 255, 0.12) 52%, transparent 78%),
    linear-gradient(180deg, rgba(187, 214, 255, 0.36) 0%, rgba(255, 255, 255, 0.1) 100%);
  filter: blur(10px) saturate(1.18);
  opacity: 0;
  transition:
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    width 420ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 240ms ease,
    filter 240ms ease;
  z-index: 0;
}

.nav-motion-blob.motionBlobActive {
  opacity: 0.9;
  filter: blur(12px) saturate(1.24);
}

.nav-active-pill {
  width: var(--finder-pill-width, 0px);
  transform: translate3d(var(--finder-pill-x, 0px), 0, 0);
  opacity: 0;
  border: 1px solid rgba(242, 245, 249, 0.92);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.38) 0%,
      rgba(236, 242, 250, 0.26) 44%,
      rgba(223, 232, 245, 0.2) 100%
    ),
    linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.06) 58%, rgba(210, 214, 222, 0.12) 100%);
  box-shadow:
    0 10px 22px -18px rgba(15, 23, 42, 0.2),
    0 0 0 0.5px rgba(255, 255, 255, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -1px 0 rgba(182, 188, 199, 0.16),
    inset 0 0 0 1px rgba(229, 234, 241, 0.46);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  transition:
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    width 420ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 200ms ease,
    background 320ms ease,
    box-shadow 320ms ease;
  z-index: 1;
}

.nav-active-pill.activePillReady {
  opacity: 1;
}

.nav-active-pill::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 26% 18%, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.22) 28%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, transparent 62%),
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.14) 48%, transparent 76%);
  pointer-events: none;
}

.nav-active-pill::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 120%, rgba(168, 176, 189, 0.16) 0%, transparent 42%),
    radial-gradient(circle at calc(50% + (var(--finder-pill-direction, 0) * 14%)) 22%, rgba(180, 214, 255, 0.22) 0%, transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, transparent 100%);
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.nav-active-pill.is-ready {
  opacity: 1;
}

.nav-item {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  gap: 4px;
  border-radius: 999px;
  color: #072aa8 !important;
  text-decoration: none;
  transform:
    translateY(calc(var(--finder-item-proximity, 0) * -1px))
    scale(calc(0.985 + (var(--finder-item-proximity, 0) * 0.035)));
  transition:
    color 280ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 420ms cubic-bezier(0.22, 1.18, 0.36, 1),
    filter 260ms ease;
  will-change: transform;
  min-width: 0;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.nav-item:active {
  transform:
    translateY(calc(var(--finder-item-proximity, 0) * -1px))
    scale(calc(0.97 + (var(--finder-item-proximity, 0) * 0.02)));
}

.nav-item:hover {
  color: #072aa8;
}

.nav-item__icon {
  position: relative;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  color: currentColor;
  transition:
    color 280ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 420ms cubic-bezier(0.22, 1.18, 0.36, 1),
    filter 260ms ease;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.08));
  transform: scale(calc(0.98 + (var(--finder-item-proximity, 0) * 0.05)));
  pointer-events: none;
}

.nav-item__icon svg {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.nav-item__icon-outline {
  display: block;
  fill: none;
  stroke: currentColor;
}

.nav-item__icon-filled {
  display: none;
  fill: currentColor;
  stroke: none;
}

.nav-item__label {
  position: relative;
  z-index: 4;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
  color: currentColor;
  pointer-events: none;
  transition:
    color 280ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 420ms cubic-bezier(0.22, 1.18, 0.36, 1),
    opacity 220ms ease,
    text-shadow 260ms ease;
  letter-spacing: -0.26px;
  transform: scale(calc(0.99 + (var(--finder-item-proximity, 0) * 0.03)));
  padding-inline: 1px;
}

.navItemActive {
  color: #072aa8;
}

.navItemActive .nav-item__icon {
  color: #072aa8;
  transform: translateY(0) scale(1.06);
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.72))
    drop-shadow(0 4px 10px rgba(7, 42, 168, 0.2));
}

.navItemActive .nav-item__icon svg {
  fill: currentColor;
  stroke: currentColor;
}

.navItemActive .nav-item__icon-outline {
  display: none;
}

.navItemActive .nav-item__icon-filled {
  display: block;
}

.nav-item:not(.navItemActive) .nav-item__icon-filled {
  display: none;
}

.nav-item:not(.navItemActive) .nav-item__icon-outline {
  display: block;
}

.navItemActive .nav-item__label {
  color: #072aa8;
  font-weight: 700;
  font-size: 10px;
  transform: translateY(0);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.52);
}

/* PWA standalone mode */
@media (display-mode: standalone) {
  .bottom-nav {
    width: min(360px, calc(100% - 32px));
    max-width: 360px;
    --bottom-nav-bottom-offset: calc(20px + env(safe-area-inset-bottom, 0px));
    bottom: var(--bottom-nav-bottom-offset);
    border-radius: 999px;
  }

  .bottom-nav::before,
  .bottom-nav::after {
    border-radius: inherit;
  }
}

@media (max-width: 430px) {
  .bottom-nav {
    --finder-nav-gap: 4px;
    width: min(360px, calc(100vw - 32px));
    max-width: 360px;
    padding: 8px 6px 9px;
    --bottom-nav-bottom-offset: calc(10px + var(--app-bottom, 0px) - var(--safe-bottom, 0px));
    bottom: var(--bottom-nav-bottom-offset);
    border-radius: 999px;
  }

  .bottom-nav::before,
  .bottom-nav::after {
    border-radius: inherit;
  }

  .nav-item {
    min-height: 56px;
    gap: 3px;
  }

  .nav-item__icon {
    width: 24px;
    height: 24px;
  }

  .nav-item__label {
    font-size: 8px;
    letter-spacing: -0.28px;
  }

  .navItemActive .nav-item__label {
    font-size: 8px;
  }

  .nav-active-pill {
    top: 4px;
    bottom: 4px;
  }

  .topbar {
    width: 100%;
    top: 10px;
    border-radius: 999px;
  }

  .topbar__pill {
    height: 66px;
    padding: 0 14px 0 18px;
  }
}

@media (max-width: 380px) {
  .bottom-nav {
    --finder-nav-gap: 4px;
    width: min(360px, calc(100vw - 24px));
    max-width: 360px;
    padding: 8px 6px 9px;
    --bottom-nav-bottom-offset: calc(8px + var(--app-bottom, 0px) - var(--safe-bottom, 0px));
    bottom: var(--bottom-nav-bottom-offset);
    border-radius: 999px;
  }

  .topbar {
    width: 100%;
    top: 10px;
    border-radius: 999px;
  }

  .topbar__pill {
    height: 60px;
    padding: 0 12px 0 16px;
  }

  .bottom-nav::before,
  .bottom-nav::after {
    border-radius: inherit;
  }

  .nav-item {
    min-height: 52px;
  }

  .nav-item__icon {
    width: 22px;
    height: 22px;
  }

  .nav-item__label {
    font-size: 7.5px;
    letter-spacing: -0.22px;
  }

  .navItemActive .nav-item__label {
    font-size: 7.5px;
  }

  .nav-active-pill {
    top: 3px;
    bottom: 3px;
  }

  .nav-item {
    transform:
      translateY(calc(var(--finder-item-proximity, 0) * -1px))
      scale(calc(0.99 + (var(--finder-item-proximity, 0) * 0.02)));
  }
}

@media (prefers-reduced-motion: reduce) {
  .bottom-nav,
  .nav-motion-blob,
  .nav-item,
  .nav-active-pill,
  .nav-item__icon,
  .nav-item__label {
    transition: none;
  }
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(92px + var(--safe-bottom));
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: var(--shadow);
  max-width: calc(100% - 32px - var(--safe-left) - var(--safe-right));
  width: max-content;
  z-index: 120;
  pointer-events: none;
}

.countdown-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(12px + var(--safe-top) + 72px + 10px);
  z-index: 25;
  width: calc(100% - 32px - var(--safe-left) - var(--safe-right));
  max-width: 420px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 16px 28px rgba(0, 0, 0, .20);
  backdrop-filter: blur(10px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  justify-items: center;
  padding:
    calc(12px + var(--app-top, 0px))
    calc(16px + var(--safe-right, 0px))
    calc(12px + var(--app-bottom, 0px))
    calc(16px + var(--safe-left, 0px));
  overflow: hidden;
  pointer-events: auto;
  touch-action: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  pointer-events: auto;
}

.modal__sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 420px);
  margin-top: auto;
  max-height: min(
    82dvh,
    calc(var(--modal-visible-height, var(--viewport-h, var(--tg-viewport-h, 100dvh))) - var(--app-top, 0px) - 24px)
  );
  background: #fff;
  border-radius: 26px 26px 0 0;
  padding: 14px 14px calc(14px + var(--safe-bottom));
  box-shadow: 0 -18px 28px rgba(0, 0, 0, .16);
  overflow: hidden;
  pointer-events: auto;
  touch-action: manipulation;
}

.modal.modal--input-active {
  align-items: start;
  overflow-y: auto;
}

.modal.modal--input-active .modal__sheet {
  margin-top: 0;
  max-height: calc(
    var(--modal-visible-height, var(--viewport-h, var(--tg-viewport-h, 100dvh))) - var(--app-top, 0px) - 16px
  );
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}

.modal__title {
  margin: 0;
  font-size: 18px
}

.modal__body {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 12px;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-right: 4px;
}

.modal__body .btn + .btn {
  margin-top: 14px
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.modal__footer {
  flex: 0 0 auto;
  margin-top: 14px;
  padding-top: 10px ;
  display: flex;
  gap: 10px
}

.modal__footer .btn {
  flex: 1
}

.modal-media-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.modal-media-preview__img {
  display: block;
  width: 100%;
  max-height: min(62dvh, 560px);
  object-fit: contain;
  border-radius: 18px;
  background: #F3F4F6;
  border: 1px solid rgba(23, 61, 204, 0.14);
}

.hint {
  margin: 0;
  color: #6B7280;
  font-size: 13px;
  line-height: 1.35
}

.hint b {
  color: #111827
}

.hint a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 900
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.field label {
  font-size: 13px;
  font-weight: 900;
  color: #374151
}

.field input {
  height: 46px;
  border-radius: 14px;
  border: 2px solid #E5E7EB;
  padding: 0 12px;
  font-size: 15px;
  outline: none;
}

.field input:focus {
  border-color: var(--border)
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.field .input-with-action input {
  width: 100%;
  flex: 1 1 auto;
  padding-right: 48px;
}

.pass-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 12px;
  background: #EFF2F7;
  color: #374151;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pass-toggle:active {
  transform: translateY(-50%) scale(.98);
}

.phone-input {
  height: 46px;
  border-radius: 14px;
  border: 2px solid #E5E7EB;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.phone-input:focus-within {
  border-color: var(--border)
}

.phone-prefix {
  font-weight: 500;
  color: #6B7280
}

.phone-input input {
  border: 0;
  height: 100%;
  padding: 0;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  background: transparent;
  flex: 1;
  min-width: 0;
}

@media (max-width:380px) {
  .title-row {
    gap: 8px;
  }

  .title-row__aside {
    gap: 6px;
  }

  #screen-groups .title-row__refresh {
    width: 32px;
    height: 32px;
  }

  #screen-groups .title__topline {
    gap: 8px;
  }

  #screen-groups .title__meta--groups {
    margin-top: 4px;
  }

  #screen-groups .title__meta--groups .title__sub {
    font-size: 14px;
  }

  #screen-groups .title-row__aside--groups {
    gap: 8px;
  }

  .title h1 {
    font-size: 22px
  }

  .status-pill {
    padding: 8px 14px;
    font-size: 12px;
    gap: 12px;
  }

  .topbar {
    top: 0
  }

  .topbar__pill {
    height: 66px;
    padding: 0 14px 0 18px
  }

  .topbar__logo {
    font-size: 28px
  }

  .topbar .icon--sm {
    width: 24px;
    height: 24px
  }

  .topbar__actions {
    gap: 12px
  }

  .topbar__lang {
    padding: 8px 10px;
    gap: 6px
  }

  .topbar__lang span {
    font-size: 16px
  }

  .card-grid {
    gap: 10px
  }

  .nav-item {
    gap: 4px;
  }

  .nav-item__label {
    font-size: 8px;
  }
}

html.is-ios .bottom-nav {
  bottom: calc(24px + max(var(--app-bottom, 0px), var(--safe-bottom, 0px)));
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

@supports (-webkit-touch-callout: none) {
  html.is-ios .bottom-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.86);
  }
}

/* Unified page header sizing across all mini-app tabs. */
.topbar {
  width: min(420px, calc(100vw - 40px));
  max-width: 420px;
  flex: 0 0 auto;
}

.topbar__pill {
  height: var(--topbar-h, 72px);
  min-height: var(--topbar-h, 72px);
}

.screen > .title-row,
#screen-groups > .title-row,
#screen-message > .title-row {
  margin: 20px 2px 14px;
}

html.is-ios .screen > .title-row,
html.is-ios #screen-dashboard .title-row,
html.is-ios #screen-groups .title-row,
html.is-ios #screen-message .title-row,
html.is-ios #screen-accounts .title-row,
html.is-ios #screen-interval .title-row {
  margin: 20px 2px 14px;
}

.title__h,
#screen-groups .title__h {
  min-height: 34px;
  align-items: center;
}

.title h1 {
  font-size: clamp(26px, 7.2vw, 30px);
  line-height: 1.05;
}

.title__icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.title__sub,
#screen-message .title__sub,
#screen-groups .title__meta--groups .title__sub,
html.is-ios #screen-dashboard .title__sub {
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.25;
}

.status-pill,
#dashboard-status {
  min-height: 42px;
  padding: 9px 16px;
  font-size: 13px;
  line-height: 1;
  gap: 10px;
  align-self: flex-start;
}

.title__topline,
#screen-groups .title__topline {
  align-items: flex-start;
}

@media (max-height: 840px) {
  .topbar__pill {
    height: var(--topbar-h, 72px);
    min-height: var(--topbar-h, 72px);
  }

  .topbar__logo {
    font-size: 32px;
  }

  .screen > .title-row,
  #screen-groups > .title-row,
  #screen-message > .title-row {
    margin: 20px 2px 14px;
  }
}

@media (max-width: 430px) {
  .topbar {
    width: min(420px, calc(100vw - 40px));
  }

  .topbar__pill {
    height: var(--topbar-h, 72px);
    min-height: var(--topbar-h, 72px);
  }
}

/* Compact mobile spacing: align the topbar with the content column and keep title rows below it. */
html.is-ios .topbar {
  width: min(420px, calc(100vw - 32px));
  left: auto;
  transform: none;
  margin-left: auto;
  margin-right: auto;
}

html.is-ios .screen {
  padding-top: 0;
  scroll-padding-top: 0;
}

html.is-ios .content {
  margin-top: 12px;
}

html.is-ios .screen > .title-row,
html.is-ios #screen-dashboard .title-row,
html.is-ios #screen-groups .title-row,
html.is-ios #screen-message .title-row,
html.is-ios #screen-accounts .title-row,
html.is-ios #screen-interval .title-row {
  margin: 0 2px 12px;
}

html.is-ios .bottom-nav {
  --bottom-nav-bottom-offset: calc(2px + var(--safe-bottom, 0px));
  bottom: var(--bottom-nav-bottom-offset);
}

html.is-ios #screen-dashboard {
  padding-bottom: var(--dashboard-screen-bottom-reserve);
  scroll-padding-bottom: var(--dashboard-screen-bottom-reserve);
}

html.is-ios #screen-dashboard [data-action="create-flow"],
html.is-ios #screen-dashboard #dashboard-actions {
  margin-bottom: 0;
}

html.is-ios #screen-dashboard .card-grid {
  gap: 10px;
  margin: 6px 0 6px;
}

html.is-ios:not(.is-message-composing) #screen-message > .title-row {
  margin: 20px 2px 12px;
}

html.is-ios #screen-dashboard .stat-card {
  min-height: 116px;
  padding: 14px 16px 16px;
}

html.is-ios #screen-dashboard [data-action="create-flow"] {
  bottom: auto;
  position: static;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  z-index: 1;
  flex: 0 0 auto;
  box-shadow: 0 14px 26px rgba(4, 30, 144, 0.18);
}

html.is-ios #screen-dashboard #dashboard-actions {
  bottom: auto;
  position: static;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  z-index: 1;
}

/* Android Telegram layout: match the reported screenshot without changing iOS rules. */
html.is-android .topbar {
  width: min(420px, calc(100vw - 32px));
  max-width: 420px;
  transform: none;
  align-self: center;
  margin-left: auto;
  margin-right: auto;
}

html.is-android .screen {
  padding-top: 12px;
  scroll-padding-top: 12px;
}

html.is-android .content {
  margin-top: 16px;
}

html.is-android .screen > .title-row,
html.is-android #screen-dashboard .title-row,
html.is-android #screen-groups .title-row,
html.is-android #screen-message .title-row,
html.is-android #screen-accounts .title-row,
html.is-android #screen-interval .title-row {
  margin: 0 2px 16px;
}

html.is-android.is-message-composing .topbar {
  position: fixed;
  top: calc(24px + var(--app-shell-top, calc(var(--app-top, 0px) + var(--topbar-gap, 20px))));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 32px - var(--safe-left, 0px) - var(--safe-right, 0px)), 420px);
  max-width: 420px;
}

html.is-android #screen-dashboard {
  padding-bottom: var(--dashboard-screen-bottom-reserve);
  scroll-padding-bottom: var(--dashboard-screen-bottom-reserve);
}

html.is-android #screen-dashboard .card-grid {
  gap: 10px;
  margin: 6px 0 6px;
}

html.is-android #screen-dashboard .stat-card {
  min-height: 116px;
  padding: 14px 16px 16px;
}

html.is-android #screen-dashboard [data-action="create-flow"] {
  bottom: auto;
  position: static;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  z-index: 1;
  flex: 0 0 auto;
  box-shadow: 0 14px 26px rgba(4, 30, 144, 0.18);
}

html.is-android #screen-dashboard #dashboard-actions {
  bottom: auto;
  position: static;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  z-index: 1;
}

/* iOS PWA dock: keep the CTA and tab bar separated from each other and from dashboard cards. */
html.is-ios.is-standalone-pwa {
  --bottom-nav-bottom-offset: max(4px, calc(var(--safe-bottom, 0px) - 2px));
  --dashboard-cta-gap: 12px;
}

html.is-ios.is-standalone-pwa .app {
  padding-bottom: calc(12px + var(--safe-bottom, 0px));
}

html.is-ios.is-standalone-pwa .bottom-nav {
  bottom: var(--bottom-nav-bottom-offset);
  width: min(360px, calc(100vw - 32px));
  max-width: 360px;
  padding: 7px 8px 8px;
  border-radius: 999px;
}

html.is-ios.is-standalone-pwa .bottom-nav__pill {
  gap: 3px;
}

html.is-ios.is-standalone-pwa #screen-dashboard {
  padding-bottom: var(--dashboard-screen-bottom-reserve);
  scroll-padding-bottom: var(--dashboard-screen-bottom-reserve);
}

html.is-ios.is-standalone-pwa #screen-dashboard [data-action="create-flow"],
html.is-ios.is-standalone-pwa #screen-dashboard #dashboard-actions {
  bottom: var(--dashboard-cta-bottom);
  width: min(420px, calc(100vw - 32px));
  max-width: 420px;
}

html.is-ios.is-standalone-pwa #screen-dashboard #dashboard-actions .btn,
html.is-ios.is-standalone-pwa #screen-dashboard [data-action="create-flow"] {
  min-height: 56px;
  height: 56px;
  border-radius: 999px;
}

@media (max-height: 880px) {
  html.is-ios.is-standalone-pwa .content {
    margin-top: 10px;
  }

  html.is-ios.is-standalone-pwa #screen-dashboard .title-row {
    margin-bottom: 10px;
  }

  html.is-ios.is-standalone-pwa #screen-dashboard .card-grid {
    gap: 8px;
    margin: 4px 0 6px;
  }

  html.is-ios.is-standalone-pwa #screen-dashboard .stat-card {
    min-height: 104px;
    padding: 13px 15px 14px;
    border-radius: 26px;
  }

  html.is-ios.is-standalone-pwa #screen-dashboard .stat-card__icon {
    width: 32px;
    height: 32px;
  }

  html.is-ios.is-standalone-pwa #screen-dashboard .stat-card__value {
    margin-top: 10px;
    font-size: 17px;
  }
}

@media (max-height: 820px) {
  html.is-ios.is-standalone-pwa {
    --dashboard-cta-gap: 10px;
  }

  html.is-ios.is-standalone-pwa #screen-dashboard .stat-card {
    min-height: 98px;
    padding: 11px 14px 13px;
  }

  html.is-ios.is-standalone-pwa #screen-dashboard .stat-card__value {
    margin-top: 8px;
    font-size: 16px;
  }
}
