/* Telegram WebApp: высота viewport */
:root {
  color-scheme: light dark;
  --f7-button-border-radius: 980px;
  --app-height: 100vh;
  --sheet-max-height: min(88dvh, var(--checkout-height, var(--app-height, 100dvh)));
  --content-inset-x: 16px;
  --app-fill-1: rgba(0, 0, 0, 0.06);
  --app-fill-2: rgba(0, 0, 0, 0.05);
  --app-fill-3: rgba(0, 0, 0, 0.04);
  --app-fill-4: rgba(0, 0, 0, 0.08);
  --app-fill-5: rgba(0, 0, 0, 0.1);
  --app-divider: rgba(0, 0, 0, 0.08);
  --app-sheet-footer-bg: rgba(255, 255, 255, 0.82);
  --app-grabber: rgba(0, 0, 0, 0.18);
  --app-gradient-end: rgba(0, 0, 0, 0.04);
  --skeleton-color: rgba(0, 0, 0, 0.08);
  --skeleton-icon-color: rgba(0, 0, 0, 0.12);
}

html.dark {
  --app-fill-1: rgba(255, 255, 255, 0.06);
  --app-fill-2: rgba(255, 255, 255, 0.05);
  --app-fill-3: rgba(255, 255, 255, 0.04);
  --app-fill-4: rgba(255, 255, 255, 0.08);
  --app-fill-5: rgba(255, 255, 255, 0.1);
  --app-divider: rgba(255, 255, 255, 0.08);
  --app-sheet-footer-bg: rgba(0, 0, 0, 0.22);
  --app-grabber: rgba(255, 255, 255, 0.28);
  --app-gradient-end: rgba(255, 255, 255, 0.05);
  --skeleton-color: rgba(255, 255, 255, 0.12);
  --skeleton-icon-color: rgba(255, 255, 255, 0.2);
}

html, body, #app, .views.tabs {
  height: var(--app-height);
}

/* В Telegram «Назад» — в шапке клиента, не дублируем в navbar */
html.telegram-webapp .navbar .left {
  display: none;
}

/* ===== Tabbar: плавное «liquid glass» ===== */
.ios .toolbar.tabbar .toolbar-pane {
  position: relative;
  isolation: isolate;
}

.ios .toolbar.tabbar .tab-link-highlight {
  transition-property: transform, width;
  transition-duration: 0.42s;
  transition-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}

.ios .toolbar.tabbar .tab-link-highlight::before,
.ios .toolbar.tabbar .tab-link-highlight::after {
  transition-property: opacity, scale, background-color, box-shadow;
  transition-duration: 0.38s;
  transition-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ===== Servers status card ===== */
.servers-card {
  margin: 0 !important;
  overflow: hidden;
}

.servers-card .card-content {
  padding: 16px;
}

.servers-card--ok .servers-head-icon {
  background: rgba(48, 209, 88, 0.15);
  color: #30d158;
}

.servers-card--warn .servers-head-icon {
  background: rgba(255, 159, 10, 0.15);
  color: #ff9f0a;
}

.servers-card--bad .servers-head-icon {
  background: rgba(255, 69, 58, 0.15);
  color: #ff453a;
}

.servers-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.servers-head-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.servers-head-icon .icon {
  font-size: 22px;
}

.servers-head-info {
  flex: 1;
  min-width: 0;
}

.servers-head-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.servers-head-sub {
  margin-top: 3px;
  font-size: 13px;
  opacity: 0.65;
}

.servers-head-pct {
  flex-shrink: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.9;
}

.servers-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--app-fill-4);
  overflow: hidden;
  margin-bottom: 14px;
}

.servers-progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.servers-progress-bar--ok { background: linear-gradient(90deg, #30d158, #34c759); }
.servers-progress-bar--warn { background: linear-gradient(90deg, #ff9f0a, #ffb340); }
.servers-progress-bar--bad { background: linear-gradient(90deg, #ff453a, #ff6961); }

.servers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.servers-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.servers-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--app-fill-2);
  min-width: 0;
}

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

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

.servers-item.is-online {
  background: rgba(48, 209, 88, 0.08);
}

.servers-item.is-offline {
  background: rgba(255, 69, 58, 0.08);
}

.servers-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
}

.servers-item.is-online .servers-dot {
  background: #30d158;
  box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.25);
  animation: servers-pulse 2s ease-in-out infinite;
}

.servers-item.is-offline .servers-dot {
  background: #ff453a;
}

@keyframes servers-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.servers-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.servers-state {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 2px;
}

.servers-item.is-online .servers-state { color: #30d158; }
.servers-item.is-offline .servers-state { color: #ff453a; }

.servers-traffic-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(255, 159, 10, 0.16);
  color: #c93400;
}

.servers-traffic-legend {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--f7-text-color);
  opacity: 0.82;
  background: rgba(10, 132, 255, 0.08);
  border: 1px solid rgba(10, 132, 255, 0.16);
}

.servers-traffic-legend .servers-traffic-mark {
  margin-top: 1px;
  flex-shrink: 0;
}

.servers-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  color: #ff453a;
  font-size: 14px;
}

.servers-empty .icon {
  font-size: 20px;
}

/* ===== Subscription card ===== */
.sub-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-card {
  margin: 0 !important;
  overflow: hidden;
}

.sub-card .card-content {
  padding: 16px;
}

.sub-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-top: 0;
}

.sub-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.15);
  color: var(--f7-theme-color, #0a84ff);
}

.sub-card-icon .icon {
  font-size: 22px;
}

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

.sub-card-email {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-card-date {
  margin-top: 3px;
  font-size: 13px;
  opacity: 0.65;
  line-height: 1.3;
}

.sub-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.sub-card-stats--top {
  margin-top: 0;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--app-divider);
}

.sub-card-stat {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--app-fill-2);
  min-width: 0;
}

.sub-card-stat-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.12);
  color: var(--f7-theme-color, #0a84ff);
}

.sub-card-stat-icon .icon {
  font-size: 16px;
}

.sub-card-stat-body {
  flex: 1;
  min-width: 0;
}

.sub-card-stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.55;
  line-height: 1.2;
}

.sub-card-stat-value {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.sub-card-stat-hint {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.7;
  line-height: 1.3;
}

.sub-card-stat-hint--warn {
  color: #ff9f0a;
  opacity: 1;
}

.sub-devices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-devices-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--app-fill-3);
  font-size: 13px;
  opacity: 0.65;
  line-height: 1.35;
}

.sub-devices-empty .icon {
  font-size: 20px;
  flex-shrink: 0;
  opacity: 0.5;
}

.sub-device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--app-fill-2);
}

.sub-device-delete-btn {
  flex: 0 0 auto;
  flex-shrink: 0;
  align-self: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 69, 58, 0.12);
  color: #ff453a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  box-shadow: none;
}

.sub-device-delete-btn:active {
  background: rgba(255, 69, 58, 0.22);
  transform: scale(0.96);
}

.sub-device-delete-btn .icon {
  font-size: 15px;
  line-height: 1;
}

.sub-device-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--app-fill-4);
  color: var(--f7-theme-color, #0a84ff);
}

.sub-device-icon .icon {
  font-size: 18px;
}

.sub-device-body {
  flex: 1;
  min-width: 0;
}

.sub-device-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.sub-device-meta {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.6;
  line-height: 1.3;
}

.sub-traffic-bar {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: var(--app-fill-5);
  overflow: hidden;
}

.sub-traffic-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #30d158;
  transition: width 0.35s ease;
}

.sub-traffic-bar-fill--warn {
  background: #ff9f0a;
}

.sub-traffic-bar-fill--critical {
  background: #ff453a;
}

.sub-card-stat-value--traffic {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1.1;
}

.sub-traffic-remain-num {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #30d158;
}

.sub-traffic-remain-num--warn {
  color: #ff9f0a;
}

.sub-traffic-remain-num--critical {
  color: #ff453a;
}

.sub-traffic-remain-num--unlimited {
  font-size: 28px;
  color: var(--f7-theme-color, #0a84ff);
}

.sub-traffic-remain-unit {
  font-size: 15px;
  font-weight: 700;
  opacity: 0.75;
}

.sub-card-status {
  flex-shrink: 0;
}

.sub-card-status .badge {
  font-size: 11px;
  padding: 4px 8px;
}

.sub-card-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--app-divider);
}

.sub-card-section--compact {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.sub-card-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 8px;
}

.sub-card-url {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--app-fill-1);
  min-width: 0;
}

.sub-url-text {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-card-url .link.icon-only {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.15);
  color: var(--f7-theme-color, #0a84ff);
}

/* ===== Крупный блок статуса подписки на главной ===== */
.sub-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 2px 14px;
  border-bottom: 1px solid var(--app-divider);
  margin-bottom: 4px;
}

.sub-hero-days {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.sub-hero-days-num {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #30d158;
}

.sub-hero-days--warn .sub-hero-days-num {
  color: #ff9f0a;
}

.sub-hero-days-num .icon {
  font-size: 34px;
}

.sub-hero-days-word {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.7;
}

.sub-hero-traffic {
  flex: 1;
  min-width: 0;
}

.sub-hero-traffic-remain {
  margin-bottom: 4px;
}

.sub-hero-traffic-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1;
}

.sub-hero-traffic-num {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #30d158;
}

.sub-hero-traffic-num--warn {
  color: #ff9f0a;
}

.sub-hero-traffic-num--critical {
  color: #ff453a;
}

.sub-hero-traffic-num--unlimited {
  font-size: 40px;
  color: var(--f7-theme-color, #0a84ff);
}

.sub-hero-traffic-unit {
  font-size: 18px;
  font-weight: 700;
  opacity: 0.8;
}

.sub-hero-traffic-caption {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.65;
}

.sub-hero-traffic-meta {
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.55;
  line-height: 1.35;
}

.sub-hero-traffic-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.sub-hero-traffic-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.55;
}

.sub-hero-traffic-val {
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

.sub-hero-bar {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: var(--app-fill-5);
  overflow: hidden;
}

.sub-hero-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #30d158;
  transition: width 0.35s ease;
}

.sub-hero-bar-fill--warn {
  background: #ff9f0a;
}

.sub-hero-bar-fill--critical {
  background: #ff453a;
}

/* Компактная карточка подписки на главной */
.sub-card--compact .card-content {
  padding-top: 12px;
  padding-bottom: 12px;
}

.sub-hero--compact {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 0 0 10px;
  margin-bottom: 0;
}

.sub-hero-compact-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sub-hero-chip {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.sub-hero-chip--days {
  color: #30d158;
}

.sub-hero-chip--traffic {
  color: #30d158;
  text-align: right;
}

.sub-hero-chip--warn,
.sub-hero-chip--critical {
  color: #ff9f0a;
}

.sub-hero-chip--critical {
  color: #ff453a;
}

.sub-hero-bar--compact {
  margin-top: 4px;
  height: 6px;
}

.sub-hero-compact-meta {
  font-size: 11px;
  opacity: 0.55;
  line-height: 1.3;
}

.sub-hero--compact .traffic-whitelist-notice--compact {
  margin-top: 8px;
  margin-bottom: 0;
}

.sub-card-head--compact {
  padding: 8px 0 6px;
  gap: 8px;
  border-bottom: none;
}

.sub-card-head--compact .sub-card-email {
  font-size: 15px;
  font-weight: 600;
}

.sub-card-devices-hint {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.5;
}

.sub-card--compact .sub-card-status .badge {
  font-size: 11px;
  padding: 3px 8px;
}

.sub-card--compact .sub-card-section--compact {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--app-divider);
}

.sub-card-section--compact .sub-card-label {
  font-size: 10px;
  margin-bottom: 4px;
}

.sub-card-url--compact {
  padding: 8px 10px;
  min-height: 36px;
}

.sub-card-actions-wrap--compact {
  margin-top: 10px;
  gap: 8px;
}

.sub-card-actions-wrap--compact .button {
  min-height: 40px;
  font-size: 14px;
}

.sub-card--compact .sub-card-footer {
  margin-top: 8px;
  padding-top: 8px;
}

/* Кнопка «Продлить» */
a.sub-card-renew {
  width: 100%;
  margin-top: 14px;
  --f7-button-bg-color: #30d158;
  --f7-button-pressed-bg-color: #28b84c;
  --f7-button-text-color: #fff;
  color: #fff !important;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

a.sub-card-renew .icon {
  font-size: 19px;
}

.sub-card-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.sub-card-actions-wrap .sub-card-renew,
.sub-card-actions-wrap .sub-card-renew-secondary {
  width: 100%;
  margin-top: 0;
}

button.sub-card-renew,
button.sub-card-renew-secondary,
a.sub-card-renew-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  text-decoration: none;
}

button.sub-card-renew {
  --f7-button-bg-color: #30d158;
  --f7-button-pressed-bg-color: #28b84c;
  --f7-button-text-color: #fff;
}

a.sub-card-renew-secondary,
button.sub-card-renew-secondary {
  --f7-button-border-color: rgba(120, 120, 128, 0.45);
}

.traffic-packages-intro p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0.85;
}

.traffic-packages-intro-note {
  margin-top: 10px !important;
  font-size: 13px !important;
  opacity: 0.72 !important;
}

.traffic-whitelist-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(10, 132, 255, 0.1);
  border: 1px solid rgba(10, 132, 255, 0.22);
}

.traffic-whitelist-notice--compact {
  margin-top: 10px;
  padding: 10px 12px;
}

.traffic-whitelist-notice .icon {
  flex-shrink: 0;
  font-size: 18px;
  color: var(--f7-theme-color, #0a84ff);
  margin-top: 1px;
}

.traffic-whitelist-notice p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.9;
}

.traffic-packages-sheet.checkout-sheet .checkout-sheet-body {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
}

#traffic-packages-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.traffic-package-btn {
  width: 100%;
  justify-content: space-between;
  padding-left: 18px;
  padding-right: 18px;
}

.traffic-package-gb {
  font-weight: 700;
  font-size: 17px;
}

.traffic-package-price {
  font-size: 15px;
  opacity: 0.9;
}

.traffic-packages-empty {
  text-align: center;
  font-size: 14px;
  opacity: 0.75;
}

/* ===== Payments tab ===== */
.pay-page {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  padding: 8px 0 12px;
}

.pay-section {
  margin: 0 var(--content-inset-x) 12px;
  max-width: 100%;
  box-sizing: border-box;
}

.page[data-name="cabinet"] .page-content {
  overflow-x: hidden;
}

.page[data-name="cabinet"] #payments-list,
.page[data-name="cabinet"] #subscriptions-list {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.page[data-name="cabinet"] .tab {
  overflow-x: hidden;
}

.pay-summary-card {
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.14), rgba(48, 209, 88, 0.1));
}

.pay-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.pay-summary-metric--main .pay-summary-num {
  font-size: 32px;
}

.pay-summary-num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.pay-summary-label {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.72;
}

.pay-summary-last {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--app-divider);
  font-size: 13px;
  opacity: 0.8;
}

.pay-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pay-filter-chip {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--app-divider);
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
}

.pay-filter-chip--active {
  background: var(--f7-theme-color, #007aff);
  border-color: transparent;
  color: #fff;
}

.pay-month-title {
  margin: 4px var(--content-inset-x) 8px;
  text-transform: capitalize;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.65;
}

.pay-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pay-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  border-radius: 14px;
  border: 1px solid var(--app-divider);
  background: var(--f7-card-bg-color, rgba(120, 120, 128, 0.08));
  overflow: hidden;
}

.pay-card-main {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  cursor: pointer;
}

.pay-card-footer {
  padding: 0 14px 12px;
}

.pay-card-footer .button {
  width: 100%;
  margin: 0;
}

.pay-card-repeat {
  width: 100%;
}

.pay-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(10, 132, 255, 0.12);
}

.pay-card-icon--stars { background: rgba(255, 159, 10, 0.15); color: #ff9f0a; }
.pay-card-icon--telegram { background: rgba(10, 132, 255, 0.15); color: #0a84ff; }
.pay-card-icon--yookassa { background: rgba(48, 209, 88, 0.14); color: #30d158; }
.pay-card-icon--crypto { background: rgba(255, 214, 10, 0.15); color: #ffd60a; }

.pay-card-body {
  min-width: 0;
  flex: 1;
}

.pay-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.pay-card-amount {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pay-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.pay-status--success { background: rgba(48, 209, 88, 0.16); color: #248a3d; }
.pay-status--pending { background: rgba(255, 159, 10, 0.16); color: #c93400; }
.pay-status--failed { background: rgba(255, 69, 58, 0.14); color: #d70015; }

html.dark .pay-status--success { color: #30d158; }
html.dark .pay-status--pending { color: #ff9f0a; }
html.dark .pay-status--failed { color: #ff453a; }

.pay-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.pay-product-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
}

.pay-product-badge .icon { font-size: 13px; }

.pay-product-badge--traffic {
  background: rgba(255, 159, 10, 0.14);
  color: #c93400;
}

.pay-product-badge--sub {
  background: rgba(10, 132, 255, 0.12);
  color: #0a84ff;
}

.pay-card-method {
  font-size: 12px;
  opacity: 0.7;
}

.pay-card-sub {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.62;
  line-height: 1.35;
  word-break: break-word;
}

.pay-empty {
  text-align: center;
  padding: 28px 18px;
}

.pay-empty-icon .icon {
  font-size: 42px;
  opacity: 0.35;
}

.pay-empty-title {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 700;
}

.pay-empty-sub {
  margin-top: 6px;
  font-size: 14px;
  opacity: 0.72;
  line-height: 1.45;
}

.pay-empty-hint {
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.6;
}

.pay-empty-btn {
  margin-top: 16px;
  width: 100%;
}

.pay-load-more-btn {
  width: 100%;
  margin: 0;
}

.pay-list-footer {
  text-align: center;
  opacity: 0.65;
  padding: 0 var(--content-inset-x) 8px;
}

.pay-detail-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pay-detail-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: start;
}

.pay-detail-label {
  font-size: 13px;
  opacity: 0.65;
}

.pay-detail-value {
  font-size: 14px;
  font-weight: 500;
  word-break: break-word;
}

.pay-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.payment-detail-sheet .checkout-sheet-footer {
  padding-top: 12px;
}

/* Кнопка QR */
.sub-qr-btn {
  --f7-button-border-color: rgba(120, 120, 128, 0.4);
  color: var(--f7-text-color, inherit);
}

/* Попап с QR-кодом */
.qr-popup-hint {
  font-size: 14px;
  opacity: 0.7;
  line-height: 1.45;
  margin: 8px 0 18px;
}

.qr-popup-code {
  width: 248px;
  max-width: 72vw;
  margin: 0 auto 20px;
  padding: 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.qr-popup-code svg {
  display: block;
  width: 100%;
  height: auto;
}

.qr-popup-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sub-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.sub-card-action-full {
  grid-column: 1 / -1;
}

.sub-card-actions.sub-card-actions--compact {
  margin-top: 8px;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "happ incy"
    "qr qr";
}

.sub-card-actions--compact .happ-import-btn {
  grid-area: happ;
}

.sub-card-actions--compact .incy-import-btn {
  grid-area: incy;
}

.sub-card-actions--compact .sub-qr-btn--center {
  grid-area: qr;
  width: 100%;
  justify-self: stretch;
  max-width: none;
}

.sub-card-actions--compact .button {
  min-height: 36px;
  font-size: 13px;
  padding-left: 8px;
  padding-right: 8px;
}

.sub-card-actions--compact .button .icon {
  font-size: 16px;
}

.sub-card-actions .button {
  margin: 0;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
}

.sub-card-actions .button .icon {
  font-size: 17px;
}

.happ-import-btn {
  --f7-button-border-color: rgba(48, 209, 88, 0.45);
  color: #30d158;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}

.incy-import-btn {
  --f7-button-border-color: rgba(94, 92, 230, 0.45);
  color: #5e5ce6;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}

a.happ-import-btn,
a.incy-import-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sub-card-actions--single {
  grid-template-columns: 1fr;
}

.sub-card-empty {
  font-size: 14px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sub-card-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--app-divider);
  text-align: center;
}

.sub-card-footer .link {
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.sub-card-footer .icon {
  font-size: 14px;
}

.ref-link-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
}

.price-old {
  text-decoration: line-through;
  opacity: 0.6;
  margin-right: 6px;
}

/* ===== Prices ===== */
.page-prices {
  position: relative;
}

.page-prices .prices-page-content {
  padding-bottom: calc(
    var(--prices-footer-height, 76px) +
    var(--f7-tabbar-icons-height, 50px) +
    16px +
    env(safe-area-inset-bottom, 0px)
  );
}

.prices-wrap {
  padding-bottom: 8px;
}

.prices-hero {
  display: flex;
  gap: 14px;
  padding: 18px 16px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: var(--app-fill-1);
  border: 1px solid var(--app-divider);
}

.prices-hero-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.16);
  color: var(--f7-theme-color, #0a84ff);
}

.prices-hero-icon .icon {
  font-size: 24px;
}

.prices-hero-body {
  min-width: 0;
}

.prices-hero-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 6px;
}

.prices-hero-text {
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.68;
  margin-bottom: 12px;
}

.prices-pay-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prices-pay-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-fill-4);
  color: var(--f7-text-color);
  opacity: 0.85;
}

.prices-pay-icon .icon {
  font-size: 16px;
}

.prices-discount {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(48, 209, 88, 0.12);
  border: 1px solid rgba(48, 209, 88, 0.25);
}

.prices-discount-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(48, 209, 88, 0.2);
  color: #30d158;
}

.prices-discount-icon .icon {
  font-size: 20px;
}

.prices-discount-title {
  font-size: 16px;
  font-weight: 600;
  color: #30d158;
  line-height: 1.2;
}

.prices-discount-sub {
  font-size: 13px;
  opacity: 0.65;
  margin-top: 2px;
}

.prices-section {
  margin-bottom: 18px;
}

.prices-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.prices-section-title {
  font-size: 17px;
  font-weight: 700;
}

.prices-section-badge {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.55;
}

.prices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.price-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 14px 12px 13px;
  border-radius: 16px;
  background: var(--app-fill-1);
  border: 2px solid var(--app-divider);
  overflow: hidden;
  min-height: 118px;
}

.price-card--selectable {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.price-card--selectable:active {
  transform: scale(0.98);
}

.price-card--selected {
  border-color: var(--f7-theme-color, #0a84ff);
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.1);
  box-shadow: 0 0 0 1px rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.25);
}

.price-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--app-divider);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  background: var(--app-fill-3);
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.price-card--selected .price-card-check {
  border-color: var(--f7-theme-color, #0a84ff);
  background: var(--f7-theme-color, #0a84ff);
  color: #fff;
}

.price-card-check .icon {
  font-size: 12px;
  font-weight: 700;
}

.price-card-popular {
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 10px 4px 12px;
  border-bottom-left-radius: 12px;
  background: var(--f7-theme-color, #0a84ff);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.price-card-period {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  padding-right: 26px;
}

.price-card-price {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.price-card-old {
  font-size: 13px;
  text-decoration: line-through;
  opacity: 0.5;
}

.price-card-amount {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--f7-text-color);
}

.price-card-currency {
  font-size: 15px;
  font-weight: 600;
  margin-left: 2px;
}

.price-card-per {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.58;
}

.price-card-benefit {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(48, 209, 88, 0.18);
  color: #30d158;
}

.price-card-stars {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.72;
}

.prices-traffic-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--app-fill-1);
  border: 2px solid var(--app-divider);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.prices-traffic-card:active {
  transform: scale(0.99);
}

.prices-traffic-card--selected {
  border-color: var(--f7-theme-color, #0a84ff);
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.1);
}

.prices-traffic-main {
  min-width: 0;
}

.prices-traffic-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.prices-traffic-price {
  font-size: 24px;
  font-weight: 700;
}

.prices-traffic-meta {
  text-align: right;
  flex-shrink: 0;
}

.prices-traffic-gb {
  font-size: 15px;
  font-weight: 700;
  color: var(--f7-theme-color, #0a84ff);
}

.prices-traffic-label {
  font-size: 12px;
  opacity: 0.58;
  margin-top: 2px;
}

.prices-sticky-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--f7-tabbar-icons-height, 50px) + env(safe-area-inset-bottom, 0px));
  z-index: 620;
  padding: 10px 16px 10px;
  background: transparent;
  border-top: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

#view-prices:not(.tab-active) .prices-sticky-footer {
  display: none !important;
}

.prices-sticky-footer[hidden] {
  display: none !important;
}

.prices-sticky-footer .button {
  width: 100%;
  font-weight: 700;
  pointer-events: auto;
}

.skeleton-prices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.skeleton-prices-hero {
  width: 100%;
  height: 132px;
  border-radius: 18px;
  margin-bottom: 14px;
}

/* Legacy price-card modifiers kept for compatibility */
.price-card--clickable {
  cursor: pointer;
}

.price-card-action,
.price-card-top,
.price-card-icon,
.price-card-ribbon,
.price-card--best,
.price-card-save {
  display: none;
}

.prices-note {
  display: none;
}

/* ===== Payment method sheet ===== */
.payment-method-sheet.checkout-sheet {
  --payment-method-sheet-top-gap: max(120px, 22dvh);
  --payment-method-sheet-height: min(
    68dvh,
    calc(100dvh - var(--payment-method-sheet-top-gap))
  );
  --f7-sheet-height: var(--payment-method-sheet-height);
  height: var(--payment-method-sheet-height) !important;
  max-height: var(--payment-method-sheet-height) !important;
  overflow: hidden !important;
}

.payment-method-sheet.checkout-sheet .sheet-modal-inner {
  display: flex;
  flex-direction: column;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0;
  overflow: hidden !important;
}

.payment-method-sheet.checkout-sheet.input-focused,
.payment-method-sheet.checkout-sheet.keyboard-open {
  --payment-method-sheet-height: min(68dvh, calc(var(--checkout-height, 100dvh) - 24px));
  height: var(--payment-method-sheet-height) !important;
  max-height: var(--payment-method-sheet-height) !important;
}

.payment-method-sheet .payment-method-header {
  position: relative;
  padding-bottom: 8px;
  flex-shrink: 0;
}

.payment-method-close {
  position: absolute;
  top: 16px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-fill-4);
  color: var(--f7-text-color);
  opacity: 0.88;
  cursor: pointer;
  transition: opacity 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.payment-method-close:active {
  opacity: 1;
  transform: scale(0.94);
  background: var(--app-fill-5);
}

.payment-method-close .icon {
  font-size: 16px;
  font-weight: 700;
}

.payment-method-sheet .checkout-sheet-body.payment-method-body {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.payment-method-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding-bottom: 12px;
}

.payment-method-sheet .checkout-sheet-footer.payment-method-footer {
  flex-shrink: 0;
}

.payment-method-sheet.checkout-sheet.input-focused .payment-method-scroll,
.payment-method-sheet.checkout-sheet.keyboard-open .payment-method-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.payment-method-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 36px 2px 0;
}

.payment-method-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.16);
  color: var(--f7-theme-color, #0a84ff);
  flex-shrink: 0;
}

.payment-method-icon .icon {
  font-size: 22px;
}

.payment-method-head-text {
  min-width: 0;
}

.payment-method-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.62;
  line-height: 1.35;
}

.payment-method-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 16px 12px;
}

.payment-method-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid var(--app-divider);
  background: var(--app-fill-1);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.payment-method-item:active {
  background: var(--app-fill-5);
}

.payment-method-item--active {
  border-color: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.55);
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.1);
}

.payment-method-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-fill-4);
  flex-shrink: 0;
}

.payment-method-item-icon .icon {
  font-size: 20px;
}

.payment-method-item-body {
  flex: 1;
  min-width: 0;
}

.payment-method-item-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.payment-method-item-sub {
  font-size: 13px;
  opacity: 0.58;
  margin-top: 2px;
}

.payment-method-item-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--app-divider);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.payment-method-item--active .payment-method-item-check {
  border-color: var(--f7-theme-color, #0a84ff);
  background: var(--f7-theme-color, #0a84ff);
  color: #fff;
}

.payment-method-item-check .icon {
  font-size: 13px;
}

.payment-method-extra {
  margin-bottom: 4px;
}

.payment-method-promo {
  margin-top: 4px;
}

.payment-method-footer .button-fill {
  width: 100%;
  font-weight: 700;
}

.payment-method-check-block {
  margin-top: 10px;
}

.payment-method-check-block .button {
  width: 100%;
}

.payment-method-item-badge {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.18);
  color: var(--f7-theme-color, #0a84ff);
  vertical-align: middle;
}

/* ===== Checkout sheet ===== */
.checkout-sheet {
  --f7-sheet-height: auto;
  max-height: var(--sheet-max-height);
}

.checkout-sheet .sheet-modal-inner {
  display: flex;
  flex-direction: column;
  height: auto;
  max-height: var(--sheet-max-height);
  overflow: hidden;
  background: var(--f7-sheet-bg-color);
}

.checkout-sheet.input-focused,
.checkout-sheet.keyboard-open {
  transform: none !important;
  max-height: var(--checkout-height, 88dvh);
}

.checkout-sheet.input-focused .sheet-modal-inner,
.checkout-sheet.keyboard-open .sheet-modal-inner {
  max-height: var(--checkout-height, 88dvh);
}

.checkout-sheet.input-focused .checkout-sheet-footer,
.checkout-sheet.keyboard-open .checkout-sheet-footer {
  display: none;
}

.checkout-sheet.input-focused .checkout-sheet-body,
.checkout-sheet.keyboard-open .checkout-sheet-body {
  max-height: calc(var(--checkout-height, 100dvh) - 56px);
  padding-bottom: 16px;
}

.checkout-sheet input,
.trial-sheet input {
  font-size: 16px;
}

/* Desktop / мышь: не ломаем layout шторки при фокусе на input */
@media (pointer: fine) {
  .checkout-sheet.input-focused,
  .checkout-sheet.keyboard-open,
  .trial-sheet.input-focused,
  .trial-sheet.keyboard-open {
    transform: translate3d(0, 0, 0) !important;
    max-height: var(--sheet-max-height);
  }

  .checkout-sheet.input-focused .sheet-modal-inner,
  .checkout-sheet.keyboard-open .sheet-modal-inner,
  .trial-sheet.input-focused .sheet-modal-inner,
  .trial-sheet.keyboard-open .sheet-modal-inner {
    max-height: var(--sheet-max-height);
  }

  .checkout-sheet.input-focused .checkout-sheet-footer,
  .checkout-sheet.keyboard-open .checkout-sheet-footer,
  .trial-sheet.input-focused .checkout-sheet-footer,
  .trial-sheet.keyboard-open .checkout-sheet-footer {
    display: block !important;
  }

  .checkout-sheet.input-focused .checkout-sheet-body,
  .checkout-sheet.keyboard-open .checkout-sheet-body {
    max-height: none;
    padding-bottom: 8px;
  }

  .checkout-sheet .item-input-wrap input,
  .trial-sheet .item-input-wrap input {
    pointer-events: auto;
    position: relative;
    z-index: 2;
  }
}

html.desktop-pointer .checkout-sheet.input-focused .checkout-sheet-footer,
html.desktop-pointer .checkout-sheet.keyboard-open .checkout-sheet-footer {
  display: block !important;
}

.checkout-sheet-header {
  flex-shrink: 0;
  padding: 8px 16px 12px;
  text-align: center;
}

.checkout-grabber {
  width: 36px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 3px;
  background: var(--app-grabber);
}

.checkout-sheet-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.checkout-sheet-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 0 16px;
}

.checkout-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.checkout-card-actions .checkout-pay-btn {
  margin-bottom: 0;
}

.checkout-sheet-footer {
  flex-shrink: 0;
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + var(--checkout-safe-bottom, 0px) + 12px);
  border-top: 1px solid var(--app-divider);
  background: var(--app-sheet-footer-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.checkout-sheet-footer .checkout-pay-btn:last-child {
  margin-bottom: 0;
}

.checkout-sheet-footer .checkout-hint {
  margin-bottom: 0;
}

.checkout-check-block {
  margin-top: 8px;
}

.checkout-summary {
  background: var(--app-fill-1);
  border-radius: 14px;
  padding: 14px 16px;
}

.checkout-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.checkout-row--amount {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--app-divider);
}

.checkout-label {
  font-size: 14px;
  opacity: 0.65;
}

.checkout-value {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.checkout-amount {
  font-size: 22px;
  color: var(--f7-theme-color, #0a84ff);
}

.checkout-discount {
  margin-top: 8px;
  font-size: 12px;
  color: #30d158;
}

.checkout-stars-btn {
  --f7-button-bg-color: #ffd60a;
  --f7-button-text-color: #1c1c1e;
  --f7-button-pressed-bg-color: #e6c009;
}

html.dark .checkout-stars-btn {
  --f7-button-text-color: #1c1c1e;
}

.price-card-stars {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.85;
}

.checkout-pay-btn {
  margin-bottom: 10px;
}

.checkout-pay-btn .icon {
  margin-right: 6px;
}

.checkout-hint {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.55;
  text-align: center;
  line-height: 1.4;
}

.checkout-status-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.12);
  font-size: 13px;
  line-height: 1.45;
}

.checkout-status-box .icon {
  font-size: 22px;
  color: var(--f7-theme-color, #0a84ff);
  flex-shrink: 0;
}

.checkout-status-box p {
  margin: 0;
}

/* ===== Onboarding ===== */
.onboarding-card {
  text-align: center;
  padding: 20px 16px 18px;
  background: linear-gradient(180deg, rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.14) 0%, var(--app-gradient-end) 100%);
  border: 1px solid rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.22);
  border-radius: 18px;
}

.onboarding-card--compact {
  text-align: left;
  padding: 16px;
}

.onboarding-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.18);
  color: var(--f7-theme-color, #0a84ff);
}

.onboarding-card--compact .onboarding-icon {
  display: none;
}

.onboarding-icon .icon {
  font-size: 26px;
}

.onboarding-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.onboarding-subtitle {
  font-size: 14px;
  opacity: 0.7;
  line-height: 1.45;
  margin-bottom: 16px;
}

.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.onboarding-actions--row {
  flex-direction: row;
}

.onboarding-actions--row .button {
  flex: 1;
}

.onboarding-btn .icon {
  margin-right: 6px;
}

.trial-sheet {
  --f7-sheet-height: auto;
  max-height: min(82vh, var(--sheet-max-height));
}

/* Trial-шит использует общие классы шапки/тела/футера, но НЕ класс .checkout-sheet,
   поэтому flex-раскладку контейнера нужно задать отдельно — иначе футер с кнопкой
   выпадает за низ экрана при высоком контенте (после добавления цифровой панели). */
.trial-sheet .sheet-modal-inner {
  display: flex;
  flex-direction: column;
  height: auto;
  max-height: min(82vh, var(--sheet-max-height));
  overflow: hidden;
}

/* Клавиатура открыта: позицию шита (top/bottom) задаёт JS через visualViewport
   (см. updateTrialSheetKeyboardLayout) — на iOS это надёжнее, чем bottom:0,
   которое ломается при появлении клавиатуры. Здесь только форма/высота контента. */
.trial-sheet.input-focused,
.trial-sheet.keyboard-open {
  transform: none !important;
  max-height: var(--checkout-height, 72vh);
}

.trial-sheet.input-focused .sheet-modal-inner,
.trial-sheet.keyboard-open .sheet-modal-inner {
  height: auto;
  max-height: var(--checkout-height, 72vh);
}

.trial-sheet.input-focused .checkout-sheet-footer,
.trial-sheet.keyboard-open .checkout-sheet-footer {
  display: none;
}

/* Прячем длинное интро, чтобы вопрос + поле помещались над клавиатурой */
.trial-sheet.input-focused .trial-intro,
.trial-sheet.keyboard-open .trial-intro {
  display: none;
}

/* Тело — по высоте контента (без растягивания и без внутреннего скролла) */
.trial-sheet.input-focused .checkout-sheet-body,
.trial-sheet.keyboard-open .checkout-sheet-body {
  flex: 0 0 auto;
  overflow: hidden;
}

.trial-question {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 4px 0;
}

.trial-attempts {
  font-size: 13px;
  opacity: 0.55;
}

.trial-intro p {
  margin: 0;
  line-height: 1.45;
  opacity: 0.8;
}

#trial-answer {
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Встроенная цифровая панель — нативная клавиатура не используется,
   поэтому окно не может «уехать» вверх при вводе */
.trial-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 2px 16px 6px;
}

.trial-key {
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--app-sheet-footer-bg, rgba(120, 120, 128, 0.12));
  color: var(--f7-text-color, inherit);
  font-size: 24px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.06s ease, background 0.15s ease;
}

.trial-key:active {
  transform: scale(0.94);
  background: rgba(120, 120, 128, 0.24);
}

.trial-key-action {
  font-size: 20px;
  font-weight: 500;
  opacity: 0.85;
}

/* ===== Вывод средств (отдельное окно) ===== */
.withdraw-popup input,
.withdraw-popup select {
  font-size: 16px; /* не даём iOS зумить при фокусе */
  color: var(--f7-text-color, inherit);
  -webkit-text-fill-color: var(--f7-text-color, inherit);
  background: transparent;
}

.withdraw-popup select option {
  color: #000; /* нативный список опций всегда на светлом фоне */
}

.withdraw-balance {
  padding: 18px 16px;
}

.withdraw-balance-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.withdraw-balance-hint {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.6;
}

/* ===== Instructions ===== */
.instruction-intro-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 12px 16px 16px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.14), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.instruction-intro-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.18);
  color: var(--f7-theme-color, #0a84ff);
  flex-shrink: 0;
}

.instruction-intro-icon .icon {
  font-size: 20px;
}

.instruction-intro-text {
  margin: 0;
  line-height: 1.5;
  font-size: 15px;
  opacity: 0.86;
}

.instruction-platform-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0 16px 16px;
}

.instruction-platform-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--app-fill-2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.instruction-platform-card:active {
  transform: scale(0.985);
}

.instruction-platform-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.instruction-platform-icon .icon {
  font-size: 24px;
}

.instruction-platform-body {
  flex: 1;
  min-width: 0;
}

.instruction-platform-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.instruction-platform-meta {
  font-size: 13px;
  opacity: 0.58;
}

.instruction-platform-chevron {
  font-size: 16px;
  opacity: 0.35;
  flex-shrink: 0;
}

.instruction-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 16px 8px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.instruction-hero-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.instruction-hero-icon .icon {
  font-size: 28px;
}

.instruction-hero-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.instruction-hero-sub {
  font-size: 14px;
  opacity: 0.62;
}

.instruction-steps-wrap {
  padding-top: 8px;
  padding-bottom: 8px;
}

.instruction-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.instruction-step {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.instruction-step-rail {
  width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.instruction-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.16);
  color: var(--f7-theme-color, #0a84ff);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.08);
}

.instruction-step-line {
  flex: 1;
  width: 2px;
  margin: 6px 0 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(var(--f7-theme-color-rgb, 10, 132, 255), 0.35), rgba(255, 255, 255, 0.08));
  min-height: 24px;
}

.instruction-step-card {
  flex: 1;
  min-width: 0;
  padding: 2px 0 22px;
}

.instruction-step-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.instruction-step-text {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.5;
  opacity: 0.78;
}

.instruction-step-media {
  overflow: hidden;
  border-radius: 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: var(--app-fill-3);
}

.instruction-step-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: top center;
  max-height: min(480px, 58vh);
}

.instruction-step-action {
  margin-top: 2px;
}

.instruction-support-card {
  margin: 0 16px 20px;
  padding: 18px;
  border-radius: 18px;
  background: var(--app-fill-2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.instruction-support-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.instruction-support-text {
  font-size: 14px;
  line-height: 1.45;
  opacity: 0.68;
  margin-bottom: 14px;
}

.color-blue .instruction-platform-icon,
.color-blue .instruction-hero-icon { color: #0a84ff; background: rgba(10, 132, 255, 0.12); }
.color-green .instruction-platform-icon,
.color-green .instruction-hero-icon { color: #30d158; background: rgba(48, 209, 88, 0.12); }
.color-gray .instruction-platform-icon,
.color-gray .instruction-hero-icon { color: #aeaeb2; background: rgba(174, 174, 178, 0.12); }
.color-purple .instruction-platform-icon,
.color-purple .instruction-hero-icon { color: #bf5af2; background: rgba(191, 90, 242, 0.12); }
.color-orange .instruction-platform-icon,
.color-orange .instruction-hero-icon { color: #ff9f0a; background: rgba(255, 159, 10, 0.12); }
.color-red .instruction-platform-icon,
.color-red .instruction-hero-icon { color: #ff453a; background: rgba(255, 69, 58, 0.12); }
.color-pink .instruction-platform-icon,
.color-pink .instruction-hero-icon { color: #ff375f; background: rgba(255, 55, 95, 0.12); }
.color-teal .instruction-platform-icon,
.color-teal .instruction-hero-icon { color: #64d2ff; background: rgba(100, 210, 255, 0.12); }
.color-yellow .instruction-platform-icon,
.color-yellow .instruction-hero-icon { color: #ffd60a; background: rgba(255, 214, 10, 0.12); }

/* legacy aliases */
.instruction-intro p {
  margin: 0;
  line-height: 1.45;
  opacity: 0.75;
}

.instruction-detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.instruction-detail-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-fill-4);
  flex-shrink: 0;
}

.instruction-detail-icon .icon {
  font-size: 24px;
}

.instruction-detail-title {
  font-size: 20px;
  font-weight: 700;
}

.instruction-step-body {
  flex: 1;
  min-width: 0;
}

.instruction-footer-hint {
  text-align: center;
  padding-bottom: 16px;
}

/* ===== FAQ ===== */
.faq-intro p {
  margin: 0;
  line-height: 1.45;
  opacity: 0.75;
}

.faq-list .item-title {
  font-size: 15px;
  font-weight: 600;
  white-space: normal;
  line-height: 1.35;
}

.faq-answer {
  padding-top: 4px;
  padding-bottom: 12px;
}

.faq-answer p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.85;
}

.faq-footer-hint {
  text-align: center;
  padding: 8px 16px 20px;
  font-size: 13px;
  opacity: 0.7;
}

.faq-footer-hint .link {
  font-size: 13px;
}

/* ===== Skeleton Elements ===== */
.skeleton-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.skeleton-head-body {
  flex: 1;
  min-width: 0;
}

.skeleton-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.skeleton-prices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.skeleton-card .card-content {
  pointer-events: none;
}

.skeleton-list .item-content {
  pointer-events: none;
}

.skeleton-greeting .skeleton-block:last-child {
  margin-bottom: 0;
}

.skeleton-intro .skeleton-block:last-child {
  margin-bottom: 0;
}

.block-title-large .skeleton-text {
  font-size: 28px;
  line-height: 1.15;
}

.color-teal { color: #64d2ff; }
.color-gray { color: #8e8e93; }

/* ===== Small screens (iPhone mini, SE, Telegram WebView) ===== */
html.compact-screen {
  --content-inset-x: 12px;
  --sheet-max-height: min(94dvh, var(--checkout-height, var(--app-height, 100dvh)));
  --f7-tabbar-icons-height: 72px;
  --f7-tabbar-icon-size: 24px;
  --f7-tabbar-label-font-size: 11px;
  --f7-block-title-large-font-size: 20px;
  --f7-button-large-height: 44px;
  --f7-button-large-font-size: 15px;
  --f7-navbar-title-font-size: 16px;
  --f7-block-margin-vertical: 12px;
  --f7-list-margin-vertical: 12px;
}

html.compact-screen .block.inset,
html.compact-screen .list.inset,
html.compact-screen .card.inset {
  margin-left: var(--content-inset-x);
  margin-right: var(--content-inset-x);
}

html.compact-screen .block-title {
  padding-left: calc(var(--content-inset-x) + 4px);
  padding-right: calc(var(--content-inset-x) + 4px);
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 14px;
}

html.compact-screen .block.block-strong.inset {
  padding: 12px;
}

html.compact-screen .block.block-strong.inset > p {
  margin: 0;
  font-size: 14px;
}

html.compact-screen .sub-card .card-content,
html.compact-screen .servers-card .card-content {
  padding: 12px;
}

html.compact-screen .sub-card-stats {
  gap: 8px;
}

html.compact-screen .sub-card-stat {
  padding: 8px 10px;
}

html.compact-screen .sub-card-head {
  gap: 10px;
}

html.compact-screen .sub-card-icon,
html.compact-screen .servers-head-icon {
  width: 40px;
  height: 40px;
}

html.compact-screen .sub-card-email {
  font-size: 15px;
}

html.compact-screen .sub-card-actions .button {
  min-height: 38px;
  font-size: 13px;
}

html.compact-screen .prices-discount {
  padding: 12px;
  gap: 10px;
}

html.compact-screen .price-card {
  padding: 14px 10px 12px;
}

html.compact-screen .price-card-amount {
  font-size: 24px;
}

html.compact-screen .price-card--best .price-card-amount {
  font-size: 28px;
}

html.compact-screen .price-card--best {
  padding: 14px;
}

html.compact-screen .onboarding-card {
  padding: 14px 12px 12px;
}

html.compact-screen .onboarding-title {
  font-size: 16px;
}

html.compact-screen .onboarding-subtitle {
  font-size: 13px;
  margin-bottom: 12px;
}

html.compact-width .onboarding-actions--row {
  flex-direction: column;
}

html.compact-width .row .col-50 {
  width: 100%;
}

html.compact-screen .checkout-sheet-header {
  padding: 6px 12px 8px;
}

html.compact-screen .checkout-grabber {
  margin-bottom: 8px;
}

html.compact-screen .checkout-sheet-title {
  font-size: 16px;
}

html.compact-screen .checkout-sheet-footer {
  padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + var(--checkout-safe-bottom, 0px) + 10px);
}

html.compact-screen .checkout-summary {
  padding: 12px;
}

html.compact-screen .checkout-amount {
  font-size: 20px;
}

html.compact-screen .checkout-pay-btn {
  margin-bottom: 8px;
}

html.compact-screen .checkout-hint {
  font-size: 11px;
}

html.compact-screen .trial-question {
  font-size: 28px;
}

html.compact-screen .instruction-hero {
  padding: 14px;
  gap: 12px;
}

html.compact-screen .instruction-hero-icon {
  width: 48px;
  height: 48px;
}

html.compact-screen .instruction-hero-title {
  font-size: 19px;
}

html.compact-screen .instruction-step-title {
  font-size: 15px;
}

html.compact-screen .instruction-step-text {
  font-size: 13px;
}

html.compact-width .prices-grid,
html.compact-width .sub-card-stats,
html.compact-width .sub-card-actions:not(.sub-card-actions--compact),
html.compact-width .servers-grid-2 {
  grid-template-columns: 1fr;
}

html.compact-width .price-card--best {
  flex-direction: column;
  text-align: center;
}

html.compact-width .price-card--best .price-card-top,
html.compact-width .price-card--best .price-card-price {
  align-items: center;
}

html.compact-width .price-card--best .price-card-save {
  position: static;
  margin-top: 8px;
}

@media (max-width: 390px) {
  html:not(.compact-width) .prices-grid,
  html:not(.compact-width) .sub-card-stats,
  html:not(.compact-width) .sub-card-actions:not(.sub-card-actions--compact),
  html:not(.compact-width) .servers-grid-2 {
    grid-template-columns: 1fr;
  }
}

.push-settings-wrap {
  margin-top: 8px;
}

.push-settings-block {
  margin: 8px 16px 12px;
}

.push-settings-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.push-settings-title .icon {
  font-size: 20px;
  color: var(--f7-theme-color, #0a84ff);
}

.push-settings-hint {
  margin: 0 0 14px;
  font-size: 14px;
  opacity: 0.65;
  line-height: 1.45;
}

.push-settings-actions {
  display: flex;
  gap: 10px;
}

.push-settings-actions .button {
  flex: 1;
  margin: 0;
}

.push-test-btn {
  display: none !important;
}

.push-settings-list-item .item-content {
  align-items: center;
}

.push-settings-list-actions .button {
  margin: 0;
}

/* Support tab badge */
.toolbar.tabbar.toolbar-bottom .tab-link {
  position: relative;
}

.toolbar.tabbar.toolbar-bottom .tab-link .support-tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  min-width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 999px;
  line-height: 8px;
  font-size: 10px;
  font-weight: 700;
}

.toolbar.tabbar.toolbar-bottom .tab-link .support-tab-badge:not(:empty) {
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
}

.toolbar.tabbar.tabbar-icons.tabbar-labels.toolbar-bottom .tabbar-label {
  font-size: 10px;
}

/* Support chat (Framework7 Messages + Messagebar) */
body.support-chat-open {
  overflow: hidden;
  width: 100%;
}

body.support-chat-open .toolbar.tabbar.toolbar-bottom {
  display: none !important;
}

.page.support-chat-page {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Навбар — абсолютный оверлей с blur (вне потока), чтобы сообщения
   прокручивались под ним, но авто-паддинг F7 не мешал отступу ленты. */
.page.support-chat-page .navbar {
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  flex-shrink: 0;
  z-index: 500;
}

.page.support-chat-page .navbar .navbar-inner {
  align-items: center;
}

.page.support-chat-page .support-back-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Сообщения заходят под translucent navbar — blur работает.
   Навбар вне потока (absolute), поэтому лента занимает всю высоту,
   а верхний padding гарантирует, что первое сообщение ниже blur. */
.page.support-chat-page .page-content.messages-content {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  margin-top: 0 !important;
  padding-top: calc(var(--f7-navbar-height, 44px) + var(--f7-safe-area-top, 0px) + 24px) !important;
  padding-bottom: calc(var(--f7-messagebar-height, 60px) + var(--f7-safe-area-bottom, 0px) + 12px) !important;
  scroll-padding-top: calc(var(--f7-navbar-height, 44px) + var(--f7-safe-area-top, 0px) + 24px) !important;
}

/* Поле ввода — стекло, сообщения прокручиваются под ним */
.page.support-chat-page > .toolbar.messagebar {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  flex-shrink: 0;
  z-index: 20 !important;
  margin: 0 !important;
  transform: none !important;
  width: 100% !important;
  background: transparent !important;
  border-top: none !important;
  padding-bottom: var(--f7-safe-area-bottom, env(safe-area-inset-bottom, 0px));
  overflow: visible !important;
}

.page.support-chat-page > .toolbar.messagebar::before {
  display: none !important;
}

.page.support-chat-page > .toolbar.messagebar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  z-index: -1;
  pointer-events: none;
}

html.dark .page.support-chat-page > .toolbar.messagebar::after {
  background: rgba(28, 28, 30, 0.78);
  border-top-color: rgba(255, 255, 255, 0.1);
}

.page.support-chat-page > .toolbar.messagebar .toolbar-inner {
  position: relative;
  z-index: 1;
  background: transparent !important;
}

/* С клавиатурой — фиксированные navbar, список и поле ввода */
html.support-kb-open .page.support-chat-page .navbar {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1500;
}

html.support-kb-open .page.support-chat-page .page-content.messages-content {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: var(--support-content-h) !important;
  max-height: none !important;
  flex: none !important;
  margin-top: 0 !important;
  padding-top: calc(var(--support-content-top) + 24px) !important;
  padding-bottom: 8px !important;
  scroll-padding-top: calc(var(--support-content-top) + 24px) !important;
  z-index: 1;
  background: var(--f7-messages-content-bg-color, #fff) !important;
}

html.dark.support-kb-open .page.support-chat-page .page-content.messages-content,
html.dark html.support-kb-open .page.support-chat-page .page-content.messages-content {
  background: var(--f7-messages-content-bg-color, #000) !important;
}

html.support-kb-open .page.support-chat-page > .toolbar.messagebar {
  position: fixed !important;
  top: var(--support-bar-top, auto) !important;
  bottom: auto !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1400 !important;
  padding-bottom: 0 !important;
  --f7-safe-area-bottom: 0px !important;
  background: transparent !important;
}

html.support-kb-open .page.support-chat-page > .toolbar.messagebar::after {
  top: 0;
  bottom: 0;
}

html.support-kb-open .page.support-chat-page::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--support-kb-gap, 0px);
  background: var(--f7-messagebar-bg-color, #fff);
  z-index: 1250;
  pointer-events: none;
}

html.dark.support-kb-open .page.support-chat-page::after,
html.dark html.support-kb-open .page.support-chat-page::after {
  background: var(--f7-messagebar-bg-color, #000);
}

.page.support-chat-page .messages-title.support-notice {
  white-space: normal;
  line-height: 1.45;
  padding: 0 16px 12px;
}

.page.support-chat-page .support-loading {
  display: flex;
  justify-content: center;
  padding: 32px 0;
}

.page.support-chat-page .message-image img {
  display: block;
  max-width: min(240px, 72vw);
  border-radius: 12px;
  min-height: 48px;
  background: var(--app-fill-3);
}

.page.support-chat-page .message-image--loading img {
  opacity: 0.35;
}

.page.support-chat-page .message-image--error {
  min-width: 120px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--app-fill-3);
  font-size: 12px;
  opacity: 0.65;
}

.page.support-chat-page .message-image--error::before {
  content: 'Не удалось загрузить фото';
}

/* ===== Плавность и тактильность интерфейса ===== */
:root {
  --ease-emphasized: cubic-bezier(0.22, 0.61, 0.36, 1);
}

.button,
.list-button,
.link,
.fab,
.list .item-link,
a.item-content,
.card {
  transition:
    transform 0.16s var(--ease-emphasized),
    background-color 0.22s ease,
    opacity 0.22s ease,
    box-shadow 0.22s ease;
}

/* Мягкое «нажатие» на кнопки */
.button:active,
.list-button:active {
  transform: scale(0.97);
}

.button.button-large:active {
  transform: scale(0.985);
}

/* Кликабельные строки и карточки — лёгкое затемнение вместо резкого flash */
.list .item-link:active,
a.item-content:active,
.card:active {
  opacity: 0.82;
}

/* Убираем серый flash при тапе на iOS */
a,
button,
.button,
.item-link,
.link,
.tab-link,
.fab {
  -webkit-tap-highlight-color: transparent;
}

/* Уважаем системную настройку «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
