button {
  cursor: pointer;
}

a {
  color: inherit;
}

.phone-screen {
  position: relative;
  width: min(100%, 440px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow-x: hidden;
  padding: max(16px, env(safe-area-inset-top)) max(var(--screen-gutter), var(--safe-inline))
    max(18px, env(safe-area-inset-bottom)) max(var(--screen-gutter), var(--safe-inline));
}

.content {
  display: grid;
  gap: 10px;
  animation: section-enter 0.22s ease-out both;
}

.content.with-nav {
  padding-bottom: 86px;
}

.public-install-shell {
  width: min(100%, 440px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow-x: hidden;
  padding: max(16px, env(safe-area-inset-top)) max(var(--screen-gutter), var(--safe-inline))
    max(18px, env(safe-area-inset-bottom)) max(var(--screen-gutter), var(--safe-inline));
}

.public-install-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  padding: 0 16px;
  color: var(--text);
  text-decoration: none;
}

.public-install-brand strong {
  color: var(--accent);
  font-size: 15px;
  line-height: 1.2;
}

.loader {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  align-content: safe center;
  gap: 14px;
  color: var(--muted);
  font-weight: 800;
}

.app-shell .loader .brand-mark.brand-mark-lg {
  width: calc(4.125rem * var(--home-logo-scale, 1));
  height: calc(4.125rem * var(--home-logo-scale, 1));
  font-size: calc(2.875rem * var(--home-logo-scale, 1));
}

.app-header,
.preview-header,
.screen-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.screen-head {
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  margin-bottom: 6px;
}

.center-title {
  align-items: start;
}

.center-copy {
  min-width: 0;
  text-align: center;
}

.screen-head h1,
.center-copy h1 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.16;
  font-weight: 850;
}

.screen-head p,
.center-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.screen-head strong {
  color: var(--accent);
}

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

.brand-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
  font-family: var(--font-logo);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accent-title .brand-row strong {
  color: var(--accent);
}

.brand-mark {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  overflow: visible;
  place-items: center;
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.brand-mark img.loaded {
  opacity: 1;
}

.brand-mark-spinner {
  position: absolute;
  width: 42%;
  height: 42%;
  border: 2px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: brand-mark-spin 0.72s linear infinite;
}

@keyframes brand-mark-spin {
  to {
    transform: rotate(360deg);
  }
}

.brand-mark-lg {
  width: 66px;
  height: 66px;
  font-size: 46px;
}

.brand-mark-xl {
  width: 96px;
  height: 96px;
  font-size: 70px;
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, var(--surface-sheen), var(--surface-sheen-soft)), var(--panel);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 var(--inset-highlight);
  padding: 14px;
}

.card-active {
  border-color: color-mix(in srgb, var(--accent) 76%, var(--border));
  box-shadow:
    var(--shadow-soft),
    0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent),
    inset 0 1px 0 var(--inset-highlight);
}

.card-compact {
  padding: 11px;
}

.status-card {
  padding: 16px;
}

.status-card-inactive {
  border-color: color-mix(in srgb, var(--danger) 58%, var(--border));
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--danger) 14%, var(--surface-sheen-soft)),
      var(--surface-sheen-soft)
    ),
    var(--panel);
}

.status-card-inactive .sub-status {
  color: var(--danger);
}

.sub-status-inactive {
  min-height: 0;
  justify-content: flex-start;
}

.sub-status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
}

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

.sub-status h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.16;
}

.sub-status p {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 12px;
  opacity: 0.82;
}

.sub-status .current-tariff-line {
  font-weight: 850;
  opacity: 1;
}

.sub-status-details {
  min-width: 0;
}

.status-tariff-action {
  min-height: 34px;
  margin-left: auto;
  padding: 0 12px;
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 1023px) {
  .status-card {
    padding: 13px;
  }

  .sub-status {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 8px 10px;
  }

  .sub-status-icon {
    width: 30px;
    height: 30px;
  }

  .sub-status h2 {
    overflow: hidden;
    font-size: 14px;
    line-height: 1.14;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sub-status-details {
    display: flex;
    min-width: 0;
    gap: 4px;
    align-items: baseline;
    overflow: hidden;
  }

  .sub-status-details p {
    min-width: 0;
    margin-top: 3px;
    overflow: hidden;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sub-status-details-with-tariff .current-tariff-line {
    flex: 0 1 auto;
  }

  .sub-status-details-with-tariff .subscription-end-line {
    flex: 0 0 auto;
  }

  .status-tariff-action {
    grid-column: 1 / -1;
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
}

.traffic-top,
.total-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.traffic-top span,
.card-label,
.total-card span,
.settings-row small,
.method-card small {
  color: var(--muted);
  font-size: 12px;
}

.traffic-top strong {
  font-size: 12px;
  font-weight: 850;
}

.traffic-card-compact {
  display: grid;
}

.traffic-card-compact .progress {
  margin-top: 8px;
}

.traffic-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  line-height: 1.15;
}

.traffic-summary-left,
.traffic-summary-right {
  align-items: baseline;
  min-width: 0;
  gap: 5px;
}

.traffic-summary-left {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.traffic-summary-right {
  display: inline-flex;
  justify-content: flex-end;
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.traffic-summary-separator {
  color: color-mix(in srgb, var(--muted) 58%, transparent);
}

.traffic-summary-right .traffic-summary-separator {
  flex: 0 0 auto;
}

.card-heading {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.2;
}

.card-heading-accent {
  color: var(--accent);
}

.promo-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.traffic-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.traffic-percent {
  margin-top: 0;
  text-align: right;
  color: var(--muted);
  font-size: 11px;
}

.traffic-card-clickable {
  cursor: pointer;
}

.traffic-card-depleted {
  border-color: var(--danger-border);
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--danger) 16%, var(--surface-sheen-soft)),
      var(--surface-sheen-soft)
    ),
    var(--panel);
}

.traffic-card-depleted .traffic-top span,
.traffic-card-depleted .traffic-top strong,
.traffic-card-depleted .traffic-summary-left,
.traffic-card-depleted .traffic-summary-right,
.traffic-card-depleted .traffic-summary-separator,
.traffic-card-depleted .traffic-meta,
.traffic-card-depleted .traffic-percent {
  color: var(--danger-text);
}

.traffic-card-depleted .progress {
  background: color-mix(in srgb, var(--danger) 18%, transparent);
}

.traffic-card-depleted .progress span {
  background: linear-gradient(90deg, var(--danger), color-mix(in srgb, var(--danger) 68%, white));
  box-shadow: 0 0 18px color-mix(in srgb, var(--danger) 40%, transparent);
}

.card-click-target {
  position: absolute;
  z-index: 6;
  inset: 0;
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.card-click-target:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.premium-traffic-card {
  display: block;
}

.premium-traffic-card-limited {
  border-color: rgba(255, 193, 7, 0.34);
}

.premium-progress span {
  background: linear-gradient(90deg, #38bdf8, var(--accent));
}

.premium-traffic-meta {
  align-items: flex-start;
  margin-top: 5px;
}

.premium-server-dropdown {
  position: relative;
  z-index: 7;
  min-width: 0;
}

.premium-server-dropdown-inline {
  display: grid;
  min-width: 0;
}

.premium-server-dropdown summary {
  min-width: 0;
  min-height: 26px;
  margin: -4px -7px 0;
  padding: 4px 7px;
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

.premium-server-dropdown-inline summary {
  display: grid;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.premium-server-summary {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
}

.premium-summary-trigger {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}

.premium-server-dropdown summary:focus {
  outline: none;
}

.premium-server-dropdown summary:focus-visible {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.premium-server-dropdown summary::-webkit-details-marker {
  display: none;
}

.premium-server-dropdown summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.premium-summary-copy {
  display: block;
}

.premium-summary-copy {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.premium-server-dropdown svg {
  flex: 0 0 auto;
  opacity: 0.82;
}

.premium-server-help-icon {
  padding: 1px;
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  transition:
    color 0.16s ease,
    background 0.16s ease,
    transform 0.18s ease;
}

.premium-server-dropdown summary:hover .premium-server-help-icon,
.premium-server-dropdown[open] .premium-server-help-icon {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.premium-server-list-dropdown {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  transform: translateY(-2px);
  transform-origin: top;
  transition:
    grid-template-rows 0.22s ease,
    margin-top 0.22s ease,
    opacity 0.18s ease,
    transform 0.22s ease;
}

.premium-server-dropdown[open] .premium-server-list-dropdown {
  grid-template-rows: 1fr;
  margin-top: 6px;
  opacity: 1;
  transform: translateY(0);
}

.premium-server-list-dropdown > div {
  min-height: 0;
  overflow: hidden;
}

.premium-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.premium-detail-grid span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.premium-detail-grid small,
.premium-server-list small,
.topup-summary-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.premium-detail-grid strong {
  font-size: 12px;
  line-height: 1.2;
}

.premium-server-list {
  display: grid;
  gap: 6px;
}

.premium-server-list > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.premium-server-list span {
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--surface-subtle-border);
  border-radius: 999px;
  color: var(--text);
  font-size: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.topup-summary-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.topup-summary-card > div:not(.premium-server-list) {
  display: grid;
  gap: 3px;
}

.topup-summary-card strong {
  font-size: 12px;
  line-height: 1.2;
}

.premium-server-list-modal {
  margin-top: 0;
}

.trial-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.trial-offer-card {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
}

.trial-card-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.trial-card-head > svg {
  flex: 0 0 auto;
  color: var(--accent);
}

.trial-card-head span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.trial-card-head strong {
  font-size: 13px;
  line-height: 1.18;
}

.trial-card-head small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.28;
}

.trial-card-description {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.trial-card-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.trial-card-facts span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--surface-subtle-border);
  border-radius: 12px;
  background: var(--surface-subtle);
}

.trial-card-facts small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.trial-card-facts strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
}

.trial-card-action {
  margin-top: 2px;
}

.devices-summary-card {
  display: grid;
  gap: 10px;
}

.devices-summary-head,
.device-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.devices-summary-head > svg {
  color: var(--accent);
}

.devices-summary-head span,
.device-card-head span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.devices-summary-head strong,
.device-card-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.devices-summary-head small,
.device-card-head small,
.device-meta span,
.device-meta small,
.devices-empty-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.devices-progress {
  margin-top: 0;
}

.devices-topup-validity {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.devices-list {
  display: grid;
  gap: 8px;
}

.device-card {
  display: grid;
  gap: 12px;
}

.device-card-head {
  grid-template-columns: 38px minmax(0, 1fr);
}

.device-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-muted));
  color: var(--accent);
}

.device-meta {
  display: grid;
  gap: 7px;
}

.device-meta div {
  display: grid;
  gap: 2px;
}

.device-meta strong,
.device-meta code {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-meta code {
  font-family: var(--font-mono);
}

.device-user-agent small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-disconnect-button,
.device-danger-button {
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.devices-empty-card {
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
}

.devices-empty-card svg {
  color: var(--accent);
}

.devices-inactive-card {
  border-color: color-mix(in srgb, var(--danger) 58%, var(--border));
}

.devices-inactive-card svg {
  color: var(--danger);
}

.action-stack {
  display: grid;
  gap: 8px;
}

.bottom-action {
  margin-top: 4px;
}

.period-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.period-grid-two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.period-card,
.method-card,
.settings-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-sheen), var(--surface-sheen-soft));
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--inset-highlight);
}

.period-card {
  position: relative;
  display: grid;
  min-height: 82px;
  place-items: center;
  gap: 4px;
  background: var(--surface-muted);
  padding: 10px 8px;
}

.period-card strong {
  font-size: 12px;
  line-height: 1.12;
  text-align: center;
  overflow-wrap: anywhere;
}

.period-card span {
  font-size: 16px;
  font-weight: 850;
}

.period-card em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
}

.period-card small {
  color: var(--muted);
  font-size: 10px;
}

.period-card svg {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--accent);
}

.period-card.active,
.method-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-muted));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent),
    inset 0 1px 0 var(--inset-highlight);
}

.total-card {
  padding: 12px 14px;
}

.total-card strong {
  font-size: 22px;
  font-weight: 900;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.method-grid-single .method-card,
.method-grid-many .method-card:first-child,
.method-grid-many .method-card:last-child:nth-child(even) {
  grid-column: 1 / -1;
}

.option-list {
  display: grid;
  gap: 8px;
}

.option-row,
.tariff-selected-card {
  display: flex;
  width: 100%;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-sheen), var(--surface-sheen-soft));
  color: var(--text);
  padding: 12px;
  text-align: left;
  box-shadow: inset 0 1px 0 var(--inset-highlight);
}

.option-row-main,
.tariff-selected-card span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.option-row-main strong,
.tariff-selected-card strong {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.option-row-main small,
.tariff-selected-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.option-row-meta {
  display: grid;
  justify-items: end;
  gap: 3px;
  flex: 0 0 auto;
  max-width: 42%;
  text-align: right;
}

.option-row-meta em,
.tariff-selected-card em {
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.option-row-meta small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.option-row.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-muted));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent),
    inset 0 1px 0 var(--inset-highlight);
}

.tariff-row {
  min-height: 74px;
}

.plan-row,
.change-action-row {
  min-height: 62px;
}

.change-action-row {
  align-items: flex-start;
}

.change-action-row > svg {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--accent);
}

.topup-carryover-note {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.topup-carryover-note p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.subscription-purchase-description {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-muted));
  box-shadow: inset 0 1px 0 var(--inset-highlight);
}

.subscription-purchase-description p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.skeleton-row,
.skeleton-method,
.skeleton-pay-button {
  pointer-events: none;
}

.skeleton-line,
.skeleton-dot,
.skeleton-pay-button {
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--muted) 10%, transparent) 0%,
    color-mix(in srgb, var(--muted) 18%, transparent) 42%,
    color-mix(in srgb, var(--muted) 10%, transparent) 84%
  );
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.15s ease-in-out infinite;
}

.skeleton-line-title {
  width: 118px;
  height: 13px;
}

.skeleton-line-short {
  width: 76px;
  height: 10px;
  opacity: 0.75;
}

.skeleton-line-price {
  width: 58px;
  height: 12px;
  min-height: 0;
}

.skeleton-line-tiny {
  width: 34px;
  height: 9px;
  min-height: 0;
  opacity: 0.7;
}

.skeleton-line-method {
  width: 72px;
  height: 12px;
  min-height: 0;
}

.skeleton-dot {
  width: 18px;
  height: 18px;
  min-height: 0;
  flex: 0 0 auto;
}

.skeleton-method {
  gap: 8px;
}

.skeleton-pay-button {
  width: 100%;
  height: 46px;
  border-radius: var(--radius);
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 120% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

.back-inline {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  font-weight: 850;
}

.tariff-step-caption,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.section-kicker {
  color: var(--dim);
  text-transform: uppercase;
}

.tariff-selected-card {
  min-height: 58px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-muted));
}

.tariff-action-list {
  display: grid;
  gap: 8px;
}

.tariff-action-card,
.tariff-warning-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-sheen), var(--surface-sheen-soft));
  color: var(--text);
  padding: 12px;
  text-align: left;
}

.tariff-action-card span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.tariff-action-card strong,
.tariff-warning-card span {
  font-size: 13px;
  font-weight: 850;
}

.tariff-action-card small {
  color: var(--muted);
  font-size: 11px;
}

.tariff-action-card em {
  color: var(--accent);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.tariff-action-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-muted));
}

.tariff-warning-card {
  justify-content: flex-start;
  color: var(--warning-text);
}

.confirm-summary-card {
  display: grid;
  gap: 8px;
}

.confirm-summary-card p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.method-card {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted);
  padding: 10px;
  text-align: center;
}

.method-card svg {
  flex: 0 0 auto;
}

.method-card-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.method-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.method-card strong {
  font-size: 12px;
}

.settings-list {
  display: grid;
  gap: 8px;
}

.settings-list.settings-list--language-open .settings-row:not(.settings-row-language) {
  pointer-events: none;
}

.language-select-guard {
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  position: fixed;
  inset: 0;
  z-index: 100;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  padding: 0;
  pointer-events: auto;
  touch-action: manipulation;
}

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

.field-error-wrap {
  position: relative;
  min-width: 0;
}

.field-error-icon {
  color: var(--danger);
  pointer-events: none;
}

.field-error-trigger {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: help;
}

.field-error-tooltip {
  z-index: 120;
  max-width: 280px;
  border: 1px solid var(--danger-border);
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger-text);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.3;
  transform-origin: top center;
}

.field-error-tooltip[data-state="delayed-open"],
.field-error-tooltip[data-state="instant-open"] {
  animation: tooltip-in 0.16s ease-out both;
}

.field-error-tooltip[data-state="closed"] {
  animation: tooltip-out 0.12s ease-in both;
}

@keyframes tooltip-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }

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

@keyframes tooltip-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(2px) scale(0.98);
  }
}

.copy-row code {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 86%, transparent);
  color: var(--text);
  padding: 12px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.referral-copy-row {
  align-items: stretch;
}

.referral-copy-button {
  height: 100%;
}

.bonus-card {
  display: grid;
  gap: 10px;
}

.bonus-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bonus-card-head > svg {
  flex: 0 0 auto;
  color: var(--accent);
}

.bonus-card strong {
  display: block;
  color: var(--accent);
  font-size: 17px;
}

.bonus-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.referral-bonus-list {
  display: grid;
  gap: 8px;
}

.referral-bonus-intro {
  margin: 2px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.referral-bonus-row {
  display: grid;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-sheen-soft);
  padding: 10px 11px;
}

.referral-bonus-row strong {
  font-size: 13px;
}

.referral-bonus-row small {
  color: var(--muted);
  font-size: 12px;
}

.referral-tariff-dropdown {
  display: grid;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-sheen-soft);
}

.referral-tariff-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 10px 11px;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.referral-tariff-summary::-webkit-details-marker {
  display: none;
}

.referral-tariff-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.referral-tariff-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.referral-tariff-copy small {
  color: var(--muted);
  font-size: 12px;
}

.referral-tariff-dropdown summary:hover .premium-server-help-icon,
.referral-tariff-dropdown[open] .premium-server-help-icon {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.referral-tariff-details {
  display: grid;
  grid-template-rows: 0fr;
  padding: 0 8px;
  opacity: 0;
  transform: translateY(-2px);
  transform-origin: top;
  transition:
    grid-template-rows 0.22s ease,
    padding 0.22s ease,
    opacity 0.18s ease,
    transform 0.22s ease;
}

.referral-tariff-details > div {
  min-height: 0;
  overflow: hidden;
}

.referral-tariff-detail-list {
  display: grid;
  gap: 8px;
}

.referral-tariff-dropdown[open] .referral-tariff-details {
  grid-template-rows: 1fr;
  padding: 0 8px 8px;
  opacity: 1;
  transform: translateY(0);
}

.referral-bonus-row-nested {
  background: var(--surface);
}

.settings-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-avatar {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
}

.settings-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-avatar svg {
  color: var(--accent);
}

.settings-profile-meta {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.settings-profile-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.settings-profile-meta small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.settings-links-block {
  display: grid;
  gap: 8px;
}

.settings-admin-block {
  display: grid;
  gap: 8px;
}

.settings-divider {
  height: 1px;
  background: var(--border);
}

.settings-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 9px 10px;
  text-align: left;
  background: var(--surface-muted);
}

.settings-row > svg:first-child {
  color: var(--text);
  opacity: 0.9;
}

.settings-row > svg:last-child {
  color: var(--muted);
}

.settings-row span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.settings-row strong,
.settings-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row strong {
  font-size: 12px;
}

.settings-row.settings-row-admin {
  min-height: 54px;
  border-color: var(--warning-border);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--warning) 13%, var(--panel)),
    color-mix(in srgb, var(--warning) 7%, var(--panel-2))
  );
  cursor: pointer;
  transition:
    transform 0.14s ease,
    border-color 0.14s ease,
    background 0.14s ease,
    box-shadow 0.14s ease;
}

.settings-row.settings-row-admin:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--warning) 52%, var(--border));
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--warning) 16%, var(--panel)),
    color-mix(in srgb, var(--warning) 9%, var(--panel-2))
  );
}

.settings-row.settings-row-admin:active:not(:disabled) {
  transform: translateY(1px);
}

.settings-row.settings-row-admin:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--warning) 58%, var(--border));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--warning) 24%, transparent),
    inset 0 1px 0 var(--inset-highlight);
}

.settings-row.settings-row-admin > svg:first-child {
  color: var(--warning-text);
  opacity: 1;
}

.settings-row.settings-row-admin > svg:last-child {
  color: color-mix(in srgb, var(--warning) 70%, var(--muted));
}

.settings-row.settings-row-admin strong {
  color: var(--warning-text);
}

.settings-row-linked {
  grid-template-columns: 28px minmax(0, 1fr);
  border-color: var(--success-border);
  background: var(--success-soft);
}

.settings-row-linked-with-action {
  grid-template-columns: 28px minmax(0, 1fr);
  row-gap: 8px;
}

.settings-inline-action {
  grid-column: 1 / -1;
  justify-self: stretch;
  width: 100%;
  min-height: 34px;
  max-width: none;
  padding-left: 10px;
  padding-right: 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
}

.settings-row-linked > svg:first-child {
  color: var(--success-text);
}

.settings-row-linked strong {
  color: var(--success-text);
}

.emoji-flag {
  font-family:
    "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
    "Noto Color Emoji", sans-serif;
  font-variant-emoji: emoji;
  line-height: 1;
}

.settings-row-language {
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 7px 10px;
}

.language-select-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0;
}

.language-select-trigger:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 6px;
}

.language-select-trigger > svg {
  color: var(--muted);
}

.language-select-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.language-select-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.language-select-current {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.language-select-current .emoji-flag {
  font-size: 14px;
}

.language-select-content {
  z-index: 140;
  width: min(210px, calc(100vw - 28px));
  min-width: 170px;
  max-width: min(210px, calc(100vw - 28px));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel-3);
  box-shadow: var(--shadow-popover);
  overflow: hidden;
  box-sizing: border-box;
  transform-origin: top right;
  animation: dropdown-enter 0.16s ease-out both;
}

.language-select-viewport {
  max-height: min(220px, 45dvh);
  padding: 6px;
}

.language-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.language-select-item[data-highlighted] {
  background: var(--surface-hover);
}

.language-select-item[data-selected] {
  color: var(--text) !important;
}

.language-select-item[data-selected] .language-select-item-check {
  color: var(--text);
}

.language-select-item-main {
  display: inline-flex !important;
  align-items: center;
  flex-wrap: nowrap !important;
  gap: 11px;
  min-width: 0;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.language-select-item-main > span {
  display: inline-block !important;
}

.language-select-item-main > span:last-child {
  margin-left: 6px;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.language-select-item-main .emoji-flag {
  font-size: 14px;
}

.language-select-item-check {
  opacity: 0;
  color: var(--accent);
}

.language-select-item[data-selected] .language-select-item-check {
  opacity: 1;
}

.settings-telegram-link-btn {
  justify-content: center;
}

.telegram-notifications-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border-color: color-mix(in srgb, #ff4b4b 46%, var(--border));
  background:
    linear-gradient(135deg, rgba(255, 75, 75, 0.11), rgba(0, 254, 122, 0.05)), var(--card);
}

.home-layout > .telegram-notifications-card {
  align-self: end;
}

.telegram-notifications-dot {
  top: 9px;
  right: 9px;
  transform: none;
}

.telegram-notifications-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, #ff4b4b 16%, var(--surface));
  color: #ff6b6b;
}

.telegram-notifications-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.telegram-notifications-copy strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
}

.telegram-notifications-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.telegram-notifications-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.telegram-notifications-actions .btn {
  min-width: 0;
  width: 100%;
  white-space: nowrap;
}

.telegram-notifications-actions .btn svg {
  flex: 0 0 auto;
}

.telegram-notifications-primary {
  grid-column: 1;
  grid-row: 1;
}

.attention-wrap {
  position: relative;
}

.nav-attention-dot {
  top: 6px;
  right: 10px;
  transform: none;
}

.bottom-nav button.attention-wrap {
  padding-right: 6px;
}

.bottom-nav {
  position: fixed !important;
  left: var(--bottom-nav-left);
  right: auto;
  width: var(--bottom-nav-width);
  max-width: none;
  transform: none;
  bottom: max(var(--bottom-nav-offset), env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(var(--bottom-nav-visible-items, 3), minmax(0, 1fr));
  grid-auto-flow: column;
  gap: 2px;
  min-height: 64px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--nav-bg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.bottom-nav-devices {
  grid-template-columns: repeat(var(--bottom-nav-visible-items, 4), minmax(0, 1fr));
}

.bottom-nav.static {
  position: fixed;
}

.bottom-nav button {
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
  padding: 6px 2px;
}

.bottom-nav button.active {
  color: var(--accent);
}

.bottom-nav .bottom-nav-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}

.rail-admin-entry {
  display: none !important;
}

@media (max-width: 380px) {
  .bottom-nav.bottom-nav-many {
    min-height: 58px;
  }

  .bottom-nav.bottom-nav-many button {
    gap: 0;
    padding: 0 2px;
  }

  .bottom-nav.bottom-nav-many .bottom-nav-label {
    display: none;
  }

  .bottom-nav.bottom-nav-many .nav-attention-dot {
    top: 8px;
    right: calc(50% - 18px);
  }

  .bottom-nav.bottom-nav-many .nav-badge-floating {
    top: 6px;
    right: calc(50% - 24px);
  }
}

@media (max-width: 360px) {
  .bottom-nav {
    min-height: 56px;
  }

  .bottom-nav button {
    gap: 0;
    padding: 0 2px;
  }

  .bottom-nav .bottom-nav-label {
    display: none;
  }

  .bottom-nav .nav-attention-dot {
    top: 8px;
    right: calc(50% - 18px);
  }

  .bottom-nav .nav-badge-floating {
    top: 6px;
    right: calc(50% - 24px);
  }
}

.home-layout {
  display: grid;
  min-height: calc(100dvh - 34px);
  grid-template-rows: minmax(min-content, 1fr) auto;
  gap: 18px;
  padding-bottom: 86px;
  animation: section-enter 0.24s ease-out both;
}

.home-brand {
  align-self: safe center;
  padding-top: 0;
}

.app-shell .home-brand .brand-mark.brand-mark-xl {
  width: calc(6rem * var(--home-logo-scale, 1));
  height: calc(6rem * var(--home-logo-scale, 1));
  font-size: calc(4.375rem * var(--home-logo-scale, 1));
}

.app-shell .login-brand-auth .brand-mark.brand-mark-xl {
  width: calc(116px * var(--home-logo-scale, 1));
  height: calc(116px * var(--home-logo-scale, 1));
  font-size: calc(84px * var(--home-logo-scale, 1));
}

.home-bottom {
  display: grid;
  gap: 10px;
  align-self: end;
}

.auth-screen {
  display: grid;
  align-content: safe center;
}

.auth-card-wrap {
  display: grid;
  gap: 24px;
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.login-brand.small {
  gap: 5px;
}

.login-brand h1 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--accent);
  font-size: 32px;
  font-weight: 900;
  font-family: var(--font-logo);
  line-height: 1.04;
}

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

.auth-card {
  box-sizing: content-box;
  display: grid;
  align-content: start;
  overflow: hidden;
  transition: height 0.22s ease;
  will-change: height;
}

.auth-mode-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  animation: auth-mode-enter 0.18s ease-out both;
}

.auth-mode-panel-password {
  padding-top: 2px;
}

.auth-pane {
  display: grid;
  gap: 10px;
}

.auth-email-stack {
  display: grid;
  gap: 12px;
}

.auth-pane .field-label,
.auth-card .field-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.auth-bottom {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.telegram-login-button {
  justify-content: center;
  padding-left: 14px;
  padding-right: 14px;
}

.telegram-login-button.unavailable:disabled {
  cursor: not-allowed;
}

.telegram-login-button.checking:disabled {
  opacity: 0.82;
}

.telegram-login-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.telegram-button-spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 999px;
  animation: telegram-button-spin 0.72s linear infinite;
}

.password-switch-divider {
  height: 1px;
  background: var(--border);
}

.password-switch-stack {
  display: grid;
  gap: 5px;
  justify-items: center;
  margin-top: -3px;
}

.password-switch-button,
.auth-code-fallback {
  width: fit-content;
  justify-self: center;
  margin-right: auto;
  margin-left: auto;
}

@keyframes auth-mode-enter {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.985);
  }

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

@keyframes telegram-button-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-legal {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.auth-legal-intro,
.auth-legal-links {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.auth-legal a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-legal a:hover {
  color: var(--accent);
}

.auth-bottom strong {
  color: var(--accent);
}

.or-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.or-line span {
  height: 1px;
  background: var(--border);
}

.otp-wrap {
  display: grid;
  align-content: center;
  gap: 20px;
  min-height: calc(100dvh - 120px);
}

.otp-input-wrap {
  position: relative;
  display: block;
}

.otp-input-wrap input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  outline: none;
}

.otp-slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.otp-slots span {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 74%, var(--border));
  border-radius: var(--radius);
  background: var(--surface-muted);
  font-size: 25px;
  font-weight: 900;
}

.otp-slots span.filled {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-muted));
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.status-line {
  color: var(--success-text);
  font-size: 12px;
  line-height: 1.4;
}

.auth-login-status {
  justify-self: center;
  text-align: center;
  width: 100%;
}

.status-line.error,
.error {
  color: var(--danger);
}

.empty-card {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 120;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow-popover);
  color: var(--text);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 800;
  animation: toast-enter 0.22s ease-out both;
}

.motion-height-stage {
  display: grid;
  align-content: start;
  min-width: 0;
}

.motion-height-stage.motion-height-locked {
  overflow: hidden;
  transition: height var(--motion-stage-duration, 360ms) cubic-bezier(0.22, 0.72, 0.2, 1);
  will-change: height;
}

.motion-height-stage.motion-height-instant {
  transition: none;
}

.motion-enter-card {
  animation: motion-card-enter var(--motion-enter-duration, 340ms) cubic-bezier(0.22, 0.72, 0.2, 1)
    backwards;
  animation-delay: var(--motion-delay, 0ms);
  transform-origin: var(--motion-origin, center top);
  will-change: opacity, transform;
}

.motion-fade-up {
  animation: motion-fade-up var(--motion-enter-duration, 160ms) ease-out both;
}

.motion-scale-in {
  animation: motion-scale-in var(--motion-enter-duration, 240ms) cubic-bezier(0.22, 0.72, 0.2, 1)
    both;
}

.motion-shimmer {
  animation: motion-shimmer var(--motion-shimmer-duration, 1.15s) ease-in-out infinite;
}

@keyframes section-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

@keyframes dropdown-enter {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }

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

@keyframes motion-card-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.985);
  }

  70% {
    opacity: 1;
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes motion-fade-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

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

@keyframes motion-scale-in {
  from {
    opacity: 0;
    transform: scale(0.975);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes motion-shimmer {
  0% {
    background-position: 120% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

.preview-board {
  display: grid;
  width: max-content;
  min-height: 100vh;
  grid-template-columns: repeat(3, auto);
  gap: 22px 38px;
  align-items: start;
  padding: 18px 74px 28px;
  background: linear-gradient(180deg, #06100c 0%, #02060b 32%, #010407 100%);
}

.preview-phone-wrap {
  display: grid;
  gap: 9px;
}

.preview-phone-wrap h2 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  line-height: 1.1;
}

.preview-phone-wrap h2 span {
  color: var(--accent);
}

.preview-phone {
  position: relative;
  display: grid;
  width: 430px;
  min-height: 318px;
  align-content: start;
  gap: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.015)), #071017;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 15px 16px 16px;
}

.preview-phone-wrap.wide .preview-phone {
  width: 510px;
}

.preview-phone .bottom-nav {
  right: 16px;
  bottom: 8px;
  left: 16px;
  width: auto;
  min-height: 50px;
  box-shadow: none;
}

.preview-phone .bottom-nav span {
  font-size: 9px;
}

.preview-phone .bottom-nav .bottom-nav-label {
  font-size: 9px;
}

.preview-phone .card {
  padding: 12px;
}

.preview-phone .status-card {
  padding: 14px;
}

.preview-phone .period-card {
  min-height: 72px;
}

.preview-phone .method-card {
  min-height: 42px;
}

.preview-phone .settings-row {
  min-height: 39px;
}

.preview-phone .settings-avatar {
  width: 46px;
  height: 46px;
}

.preview-phone .settings-profile-meta strong {
  font-size: 12px;
}

.preview-phone .settings-profile-meta small {
  font-size: 10px;
}

.preview-phone .brand-mark {
  width: 34px;
  height: 34px;
  font-size: 23px;
}

.preview-phone .brand-mark-lg {
  width: 56px;
  height: 56px;
  font-size: 39px;
}

.preview-phone .brand-mark-xl {
  width: 78px;
  height: 78px;
  font-size: 56px;
}

.preview-phone .home-layout {
  min-height: 300px;
  gap: 12px;
  padding-bottom: 58px;
}

.preview-phone .home-brand {
  padding-top: 0;
}

.preview-phone .login-brand h1 {
  font-size: 24px;
}

.preview-modal {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: 178px;
  gap: 8px;
  justify-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: rgba(20, 29, 35, 0.94);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.46);
  padding: 16px;
  text-align: center;
}

.preview-modal svg {
  color: var(--accent);
}

.preview-modal strong {
  font-size: 13px;
}

.preview-modal p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

@media (max-width: 460px) {
  :root {
    --screen-gutter: 10px;
  }

  .traffic-summary-row {
    gap: 6px;
  }

  .traffic-summary-left,
  .traffic-summary-right {
    font-size: 10px;
  }

  .period-grid,
  .method-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .copy-row,
  .email-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .content,
  .home-layout,
  .language-select-content,
  .dialog-backdrop,
  .dialog-card,
  .auth-mode-panel,
  .motion-enter-card,
  .motion-fade-up,
  .motion-scale-in,
  .motion-shimmer,
  .toast {
    animation: none !important;
  }

  .auth-card,
  .motion-height-stage.motion-height-locked {
    transition: none !important;
  }

  .premium-server-dropdown summary,
  .premium-server-help-icon,
  .premium-server-list-dropdown {
    transition: none !important;
  }
}

@supports not (color: color-mix(in srgb, #000 50%, #fff)) {
  .btn-primary {
    background: var(--accent);
  }
}

/* ============================================================
   Desktop layout for the user-facing Mini App (≥ 1024px)
   A full-bleed dashboard: brand + nav rail on the left (the
   mobile bottom-nav is repositioned, no markup changes), main
   content area takes the rest of the viewport with a generous
   max-width. Auth screens are kept centered.
   Mobile (≤ 1023px) is intentionally untouched.
   ============================================================ */

@media (min-width: 1024px) {
  body {
    background: var(--bg);
  }

  .app-shell {
    min-height: 100dvh;
    display: block;
    padding: 0;
    background: transparent !important;
  }

  /* Full-width canvas: the side rail is a fixed sibling, so we leave room
     for it on the left and center content inside the right-hand work area. */
  .phone-screen {
    width: auto;
    max-width: none;
    min-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: max(28px, env(safe-area-inset-top)) var(--desktop-page-gutter) 40px
      calc(var(--desktop-rail-width) + var(--desktop-page-gutter));
    overflow-x: visible;
  }

  /* Centre and cap the width of the actual content blocks. */
  .phone-screen > .app-header,
  .phone-screen > main,
  .phone-screen > .home-layout,
  .phone-screen > nav.bottom-nav ~ * {
    max-width: 1080px;
    margin-left: auto;
    margin-right: auto;
  }

  .public-install-shell {
    width: auto;
    max-width: none;
    min-height: 100dvh;
    margin: 0;
    overflow-x: visible;
    padding: max(28px, env(safe-area-inset-top)) var(--desktop-page-gutter) 40px;
  }

  .public-install-shell > .public-install-brand,
  .public-install-shell > main {
    max-width: 1080px;
    margin-left: auto;
    margin-right: auto;
  }

  .public-install-shell > .public-install-brand {
    width: min(100%, 1080px);
  }

  /* Auth screen: keep it as a focused card in the centre, hide rail. */
  .phone-screen.auth-screen {
    width: min(100%, 460px);
    min-height: 100dvh;
    padding: max(16px, env(safe-area-inset-top)) clamp(24px, 4vw, 16px) 16px;
    margin: 0 auto;
  }

  .phone-screen.auth-screen ~ .bottom-nav,
  .auth-screen .bottom-nav {
    display: none !important;
  }

  .phone-screen.home-screen {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    min-height: 100dvh;
    padding: max(32px, env(safe-area-inset-top)) var(--desktop-page-gutter) 42px
      calc(var(--desktop-rail-width) + var(--desktop-page-gutter));
  }

  /* Home: keep the phone-style vertical flow, but center it in the
     right-hand desktop area and let the action block sit on the bottom. */
  .home-layout {
    width: min(100%, 680px);
    min-height: calc(100dvh - 74px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(280px, 1fr) auto;
    justify-self: center;
    gap: clamp(24px, 4vh, 52px);
    max-width: none;
    margin: 0;
    padding-bottom: 0;
    align-items: stretch;
  }

  .home-layout > .home-brand {
    grid-column: auto;
    align-self: center;
    justify-items: center;
    text-align: center;
    gap: 22px;
  }

  .home-brand h1 {
    max-width: 560px;
    font-size: clamp(36px, 4vw, 58px);
    letter-spacing: 0;
    line-height: 1.02;
  }

  /* Make the brand mark a focal element on desktop. */
  .app-shell .home-brand .brand-mark,
  .app-shell .home-brand .brand-mark.brand-mark-lg,
  .app-shell .home-brand .brand-mark.brand-mark-xl {
    width: calc(clamp(180px, 18vw, 260px) * var(--home-logo-scale, 1));
    height: calc(clamp(180px, 18vw, 260px) * var(--home-logo-scale, 1));
    font-size: calc(clamp(124px, 13vw, 184px) * var(--home-logo-scale, 1));
  }

  .home-bottom {
    align-self: end;
    width: min(100%, 560px);
    justify-self: center;
    gap: 12px;
  }

  /* Top header (brand on settings/invite/devices) becomes a flat strip. */
  .app-header.accent-title {
    display: none;
  }

  /* Reset clearance — the bottom-nav is now a sidebar. */
  .content.with-nav {
    padding-bottom: 32px;
  }

  /* Transform the mobile bottom-nav into a fixed-left vertical rail. */
  .bottom-nav {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    right: auto !important;
    width: var(--desktop-rail-width) !important;
    height: 100dvh !important;
    transform: none !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: none !important;
    grid-auto-flow: row !important;
    grid-auto-rows: auto !important;
    grid-auto-columns: 1fr !important;
    align-content: start !important;
    gap: 2px !important;
    padding: 28px 14px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border: 0 !important;
    border-right: 1px solid var(--border) !important;
    border-radius: 0 !important;
    background: var(--rail-bg) !important;
    backdrop-filter: blur(14px) !important;
    box-shadow: inset -1px 0 0 var(--border) !important;
    z-index: 40;
  }

  .bottom-nav-devices {
    grid-template-columns: 1fr !important;
  }

  .bottom-nav button {
    display: grid !important;
    grid-template-columns: 22px 1fr !important;
    grid-template-rows: auto !important;
    align-items: center !important;
    justify-items: start !important;
    gap: 12px !important;
    padding: 12px 42px 12px 14px !important;
    border-radius: 10px !important;
    text-align: left !important;
    font-size: 13px !important;
    color: var(--muted);
    border: 1px solid transparent;
    transition:
      background 0.12s ease,
      color 0.12s ease,
      border-color 0.12s ease;
    width: 100%;
  }

  .bottom-nav button > svg {
    width: 20px;
    height: 20px;
  }

  .bottom-nav .bottom-nav-label {
    text-align: left !important;
    font-size: 13px !important;
    font-weight: 600;
  }

  .bottom-nav button:hover {
    background: var(--surface-hover);
    color: var(--text);
  }

  .bottom-nav button.active {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--text);
  }

  .bottom-nav .nav-attention-dot,
  .bottom-nav .nav-badge-floating {
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
  }

  .bottom-nav .rail-admin-entry {
    display: grid !important;
  }

  .settings-admin-block {
    display: none !important;
  }

  .phone-screen > main.content.with-nav {
    padding-top: 0;
  }

  .settings-profile {
    padding: 12px;
  }

  .settings-links-block {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .settings-links-block .settings-divider {
    display: none;
  }

  .settings-links-block .settings-row,
  .settings-links-block .settings-telegram-link-btn {
    min-height: 48px;
  }

  .settings-row-linked-with-action {
    grid-template-columns: 28px minmax(0, 1fr) max-content;
    row-gap: 0;
  }

  .settings-row-linked-with-action .settings-inline-action {
    grid-column: auto;
    justify-self: end;
    width: auto;
    max-width: 132px;
  }

  .settings-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .settings-list .settings-row {
    min-height: 48px;
  }

  .settings-row-language,
  .settings-row-support,
  .settings-row-logout {
    grid-column: 1 / -1;
  }

  /* Wider modals on desktop. */
  .dialog-card {
    width: min(100%, 560px);
  }

  .payment-dialog-card {
    width: min(100%, 640px);
  }
}

@media (min-width: 1280px) {
  :root {
    --desktop-rail-width: 264px;
  }
}

/* Brand block sits at the top of the desktop side rail; hidden on mobile. */

.rail-brand {
  display: none;
}

@media (min-width: 1024px) {
  .bottom-nav .rail-brand {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    padding: 4px 12px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
  }

  .bottom-nav .rail-brand strong {
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
    font-family: var(--font-logo);
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
}
