.actions,
.action-row {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn,
.copy-compact,
.link-button,
.dialog-close,
.auth-close {
  min-height: var(--touch-target);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  background: var(--surface-soft);
  font-weight: 780;
  line-height: 1.2;
  transition:
    transform var(--duration-fast) ease,
    color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    background var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    opacity var(--duration-fast) ease;
}

.btn {
  position: relative;
  min-width: 0;
  padding: 10px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
  text-align: center;
}

.btn:not(:disabled, [aria-disabled="true"]):hover,
.copy-compact:not(:disabled, [aria-disabled="true"]):hover,
.link-button:not(:disabled, [aria-disabled="true"]):hover,
.dialog-close:not(:disabled, [aria-disabled="true"]):hover,
.auth-close:not(:disabled, [aria-disabled="true"]):hover {
  transform: translateY(-1px);
}

.btn.primary {
  color: var(--on-brand);
  border-color: rgb(255 163 61 / 58%);
  background: var(--brand-gradient);
  box-shadow: 0 16px 42px rgb(255 77 63 / 19%), 0 10px 32px rgb(255 0 122 / 14%), inset 0 1px 0 rgb(255 255 255 / 36%);
  text-shadow: 0 1px 0 rgb(255 255 255 / 18%);
}

.btn.primary:not(:disabled, [aria-disabled="true"]):hover {
  color: #0c0507;
  border-color: rgb(255 187 105 / 78%);
  box-shadow: 0 19px 52px rgb(255 77 63 / 25%), 0 13px 39px rgb(255 0 122 / 20%), inset 0 1px 0 rgb(255 255 255 / 42%);
}

.btn.ghost {
  color: var(--text-secondary);
  background: rgb(255 255 255 / 2.8%);
}

.btn.ghost:not(:disabled, [aria-disabled="true"]):hover {
  color: var(--text-primary);
  border-color: rgb(255 77 63 / 30%);
  background: rgb(255 77 63 / 8%);
}

.btn.warn {
  color: #1a1103;
  border-color: rgb(247 199 95 / 72%);
  background: linear-gradient(135deg, #ffe29b, var(--warning));
}

.btn.danger {
  color: #fff;
  border-color: rgb(255 102 124 / 72%);
  background: linear-gradient(135deg, #ff8293, #df3852);
}

.btn.telegram {
  color: var(--on-telegram);
  border-color: rgb(116 210 255 / 58%);
  background: linear-gradient(135deg, #0d6c96, #075777);
  box-shadow: 0 13px 32px rgb(13 108 150 / 24%);
}

.btn.telegram:not(:disabled, [aria-disabled="true"]):hover {
  color: #fff;
  border-color: rgb(167 226 255 / 75%);
  background: linear-gradient(135deg, #1179a6, #086084);
}

.btn.btn-large,
.btn-large {
  min-height: 52px;
  padding-inline: 22px;
  font-size: 1rem;
  font-weight: 850;
}

.btn:disabled,
.btn[aria-disabled="true"],
.copy-compact:disabled,
.copy-compact[aria-disabled="true"],
.link-button:disabled,
.link-button[aria-disabled="true"] {
  opacity: .52;
  filter: saturate(.45);
  transform: none;
  box-shadow: none;
}

.button-spinner,
.loader-dot {
  flex: 0 0 auto;
  border: 2px solid rgb(255 255 255 / 27%);
  border-top-color: currentcolor;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.button-spinner {
  width: 16px;
  height: 16px;
}

.loader-dot {
  width: 13px;
  height: 13px;
  margin-top: 5px;
}

.chip,
.flow-badge,
.tiny-label,
.plan-label-v2 {
  width: fit-content;
  max-width: 100%;
  min-height: 32px;
  padding: 6px 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgb(121 184 255 / 25%);
  border-radius: 999px;
  color: var(--info);
  background: var(--info-soft);
  font-size: .76rem;
  font-weight: 850;
  line-height: 1.25;
}

.chip.ok,
.flow-badge.ok,
.tiny-label.ok,
.plan-label-v2.ok {
  color: var(--success);
  border-color: rgb(104 217 170 / 29%);
  background: var(--success-soft);
}

.chip.warn,
.flow-badge.warn,
.tiny-label.warn {
  color: var(--warning);
  border-color: rgb(247 199 95 / 31%);
  background: var(--warning-soft);
}

.chip.danger,
.flow-badge.danger,
.tiny-label.danger {
  color: var(--danger);
  border-color: rgb(255 102 124 / 31%);
  background: var(--danger-soft);
}

.chip.pending {
  color: var(--warning);
  border-color: rgb(247 199 95 / 31%);
  background: linear-gradient(135deg, var(--warning-soft), var(--info-soft));
}

.flow-badge.brand {
  color: #ffb069;
  border-color: rgb(255 77 63 / 30%);
  background: var(--brand-gradient-soft);
}

.flow-pulse {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentcolor;
  box-shadow: 0 0 0 6px color-mix(in srgb, currentcolor 14%, transparent);
}

.flow-glass,
.hero,
.panel,
.card,
.auth-panel {
  position: relative;
  isolation: isolate;
  min-width: 0;
  border: 1px solid var(--border-subtle);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 7.5%), rgb(255 255 255 / 2.8%)),
    rgb(8 8 11 / 76%);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(1.08);
}

.flow-glass {
  width: 100%;
  padding: clamp(24px, 4vw, 44px);
  border-radius: var(--radius-xl);
}

/* The decorative glow is clipped inside its own layer. Interactive children remain unclipped. */
.flow-glass::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 102% -8%, rgb(255 0 122 / 18%), transparent 34%),
    radial-gradient(circle at -5% 108%, rgb(255 138 0 / 13%), transparent 37%);
  clip-path: inset(0 round var(--radius-xl));
  pointer-events: none;
}

.flow-content {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  gap: 22px;
}

.flow-orb {
  position: absolute;
  z-index: 0;
  width: min(34vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(28px);
  opacity: .42;
  pointer-events: none;
}

.flow-orb-mint {
  top: 0;
  right: 0;
  background: radial-gradient(circle at center, rgb(255 138 0 / 32%), transparent 68%);
}

.flow-orb-blue {
  bottom: 0;
  left: 0;
  background: radial-gradient(circle at center, rgb(255 0 122 / 25%), transparent 68%);
}

.flow-page {
  min-height: min(760px, calc(100svh - 150px));
  align-content: center;
}

.flow-heading,
.dashboard-hero {
  max-width: 840px;
}

.flow-heading h1,
.dashboard-hero h1,
.welcome-content h1,
.payment-empty h1 {
  margin: 18px 0;
  font-size: clamp(2.35rem, 5.4vw, 4.15rem);
  line-height: .99;
  letter-spacing: -.045em;
}

.flow-heading h1,
.payment-empty h1 {
  font-size: clamp(2.25rem, 4.8vw, 3.75rem);
}

.flow-footnote {
  margin: 0;
  color: var(--text-tertiary);
  text-align: center;
  font-size: .82rem;
}

.flow-notice {
  min-width: 0;
  padding: 17px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgb(121 184 255 / 25%);
  border-radius: var(--radius-md);
  background: var(--info-soft);
}

.flow-notice.ok {
  border-color: rgb(104 217 170 / 29%);
  background: var(--success-soft);
}

.flow-notice.warn {
  border-color: rgb(247 199 95 / 31%);
  background: var(--warning-soft);
}

.flow-notice.danger {
  border-color: rgb(255 102 124 / 32%);
  background: var(--danger-soft);
}

.flow-notice > div {
  min-width: 0;
}

.flow-notice strong {
  font-size: 1rem;
}

.flow-notice p {
  margin: 4px 0 0;
  font-size: .88rem;
}

.flow-notice > .btn,
.flow-notice > .actions {
  flex: 0 0 auto;
}

.flow-notice > .actions {
  margin-top: 0;
}

.page-header,
.panel {
  padding: 24px;
  border-radius: var(--radius-lg);
}

.card {
  padding: 20px;
  border-radius: var(--radius-md);
}

.card-row,
.section-title-row {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row > * {
  min-width: 0;
}

.section-title-row h2,
.section-title-row h3 {
  margin: 0 0 5px;
}

.section-title-row p {
  margin: 0;
}

.link-box {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}

.link-box .top {
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px 16px;
  color: var(--text-tertiary);
  font-size: .76rem;
}

.journey-v2 {
  max-width: 790px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto minmax(24px, 1fr) auto minmax(24px, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 21px;
  background: var(--surface-sunken);
}

.journey-v2-step {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-tertiary);
}

.journey-v2-step > span:last-child {
  min-width: 0;
  display: grid;
}

.journey-v2-step strong {
  color: inherit;
  font-size: .86rem;
}

.journey-v2-step small {
  font-size: .72rem;
  white-space: nowrap;
}

.journey-v2-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--surface-soft);
  font-weight: 900;
}

.journey-v2-step.current {
  color: var(--text-primary);
}

.journey-v2-step.current .journey-v2-number {
  color: var(--on-brand);
  border-color: var(--brand-orange);
  background: var(--brand-gradient);
  box-shadow: 0 0 0 6px rgb(255 77 63 / 10%);
}

.journey-v2-step.done {
  color: var(--success);
}

.journey-v2-step.done .journey-v2-number {
  border-color: rgb(104 217 170 / 35%);
  background: var(--success-soft);
}

.journey-v2-line {
  height: 1px;
  background: var(--border-strong);
}

.copy-compact {
  min-width: 112px;
  padding: 7px 11px;
  flex: 0 0 auto;
  border-color: rgb(121 184 255 / 29%);
  border-radius: 12px;
  color: #dce8ff;
  background: var(--info-soft);
  font-size: .76rem;
}

.copy-compact:not(:disabled, [aria-disabled="true"]):hover {
  color: #fff;
  border-color: rgb(104 217 170 / 42%);
  background: var(--success-soft);
}

.renewal-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 100% 0, rgb(255 0 122 / 10%), transparent 34%),
    var(--surface-elevated);
  box-shadow: 0 42px 140px rgb(0 0 0 / 70%);
}

.renewal-dialog::backdrop {
  background: rgb(2 2 4 / 80%);
  backdrop-filter: blur(10px);
}

.renewal-dialog-head {
  min-height: 78px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-soft);
}

.renewal-dialog-head span {
  color: var(--text-tertiary);
  font-size: .76rem;
}

.renewal-dialog-head h2 {
  margin: 2px 0 0;
  font-size: 1.3rem;
}

.dialog-close,
.auth-close {
  padding: 8px 12px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 13px;
}

.dialog-close {
  width: var(--touch-target);
  padding: 0;
  font-size: 1.65rem;
}

.renewal-dialog-body {
  max-height: calc(100dvh - 112px);
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.renewal-step .flow-heading h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
}

.renewal-step .plans-grid-v2 {
  margin-top: 20px;
}

.auth-overlay,
.modal {
  position: fixed;
  z-index: 220;
  inset: 0;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: grid;
  place-items: center;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.auth-backdrop {
  position: fixed;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgb(2 2 4 / 82%);
  backdrop-filter: blur(11px);
}

.auth-dialog,
.modal-panel {
  width: min(100%, 540px);
  max-height: calc(100dvh - 32px);
  padding: clamp(22px, 4vw, 34px);
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 27px;
  background:
    radial-gradient(circle at 100% 0, rgb(255 0 122 / 12%), transparent 36%),
    var(--surface-elevated);
  box-shadow: 0 42px 140px rgb(0 0 0 / 72%);
}

.auth-dialog-head {
  margin-bottom: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.auth-dialog-head > div {
  min-width: 0;
}

.auth-dialog-head h2 {
  max-width: 380px;
  margin: 12px 0 0;
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  letter-spacing: -.035em;
}

.auth-form,
.auth-form form {
  display: grid;
  gap: 16px;
}

.field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--text-secondary);
  font-size: .84rem;
  font-weight: 800;
}

.field input,
.field select,
.auth-code-input,
.auth-code-single,
.platform-picker-v2 select {
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: rgb(7 7 9 / 92%);
  outline: 0;
  transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.field input:hover,
.field select:hover,
.auth-code-input:hover,
.auth-code-single:hover,
.platform-picker-v2 select:hover {
  border-color: rgb(255 255 255 / 28%);
}

.field input[aria-invalid="true"],
.auth-code-single[aria-invalid="true"],
.auth-code-input[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.field-error,
.form-error,
[data-field-error] {
  margin: 0;
  color: #ff9dac;
  font-size: .82rem;
}

.field-error:empty {
  display: none;
}

.field.has-error input {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.auth-form .btn[type="submit"] {
  width: 100%;
}

.auth-code-summary {
  min-width: 0;
}

.auth-code-summary p {
  margin: 0;
  overflow-wrap: anywhere;
}

.auth-code-status {
  color: #cfe4ff;
  font-weight: 750;
}

.auth-code-summary .auth-code-destination {
  margin-top: 5px;
  color: var(--text-tertiary);
}

.auth-code-destination strong {
  color: var(--text-secondary);
}

.auth-code-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.auth-code-input {
  min-width: 0;
  padding-inline: 3px;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 900;
}

.auth-code-single {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 850;
  letter-spacing: .32em;
  font-variant-numeric: tabular-nums;
}

.auth-code-help {
  display: grid;
  gap: 2px;
  color: var(--text-tertiary);
  font-size: .78rem;
}

.auth-code-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.link-button {
  padding: 8px;
  border-color: transparent;
  color: var(--text-secondary);
  background: transparent;
  text-decoration: underline;
  text-decoration-color: rgb(255 255 255 / 28%);
  text-underline-offset: 4px;
}

.link-button.accent {
  color: #ff9c65;
}

.message {
  padding: 12px 14px;
  border: 1px solid rgb(121 184 255 / 28%);
  border-radius: var(--radius-sm);
  color: #cfe4ff;
  background: var(--info-soft);
  overflow-wrap: anywhere;
}

.message.error {
  color: #ffc1cb;
  border-color: rgb(255 102 124 / 34%);
  background: var(--danger-soft);
}

@media (max-width: 720px) {
  .flow-glass {
    padding: clamp(18px, 5vw, 24px);
    border-radius: 24px;
  }

  .flow-glass::before {
    clip-path: inset(0 round 24px);
  }

  .flow-page {
    min-height: 0;
  }

  .flow-heading h1,
  .dashboard-hero h1,
  .welcome-content h1,
  .payment-empty h1 {
    margin: 14px 0;
    font-size: clamp(2rem, 9.5vw, 2.65rem);
    line-height: 1.04;
    letter-spacing: -.032em;
  }

  .flow-lead,
  .lead {
    font-size: 1rem;
    line-height: 1.55;
  }

  .flow-notice {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .flow-notice > .btn,
  .flow-notice > .actions {
    width: 100%;
  }

  .journey-v2 {
    width: 100%;
    padding: 12px 8px;
    grid-template-columns: minmax(0, 1fr) minmax(12px, .35fr) minmax(0, 1fr) minmax(12px, .35fr) minmax(0, 1fr);
    gap: 4px;
    border-radius: 18px;
  }

  .journey-v2-step {
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
  }

  .journey-v2-step > span:last-child {
    display: block;
  }

  .journey-v2-step strong {
    display: block;
    font-size: .72rem;
    line-height: 1.15;
  }

  .journey-v2-step small {
    display: none;
  }

  .journey-v2-number {
    width: 32px;
    height: 32px;
  }

  .btn,
  .btn.btn-large {
    min-height: 48px;
    white-space: normal;
  }

  .renewal-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - env(safe-area-inset-top));
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
  }

  .renewal-dialog-head {
    min-height: 68px;
    padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  }

  .renewal-dialog-head h2 {
    font-size: 1.1rem;
  }

  .renewal-dialog-body {
    max-height: calc(100dvh - 68px - env(safe-area-inset-top));
    padding: 14px max(12px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .auth-overlay {
    align-items: center;
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .auth-dialog {
    width: 100%;
    max-height: 100%;
    padding: 20px 18px;
    border-radius: 24px;
  }

  .auth-dialog-head {
    margin-bottom: 16px;
    gap: 12px;
  }

  .auth-close {
    min-height: var(--touch-target);
  }

  .auth-code-grid {
    gap: 5px;
  }

  .auth-code-input {
    min-height: 48px;
    border-radius: 11px;
    font-size: 1.3rem;
  }

  .field input,
  .auth-code-single,
  .platform-picker-v2 select {
    min-height: 48px;
    font-size: 1rem;
  }
}

@media (max-width: 370px) {
  .auth-close {
    width: var(--touch-target);
    padding: 0;
    font-size: 0;
  }

  .auth-close::before {
    content: "×";
    font-size: 1.65rem;
    line-height: 1;
  }

  .flow-heading h1,
  .dashboard-hero h1,
  .welcome-content h1,
  .payment-empty h1 {
    font-size: 1.9rem;
  }

  .journey-v2 {
    padding-inline: 5px;
  }

  .journey-v2-step strong {
    font-size: .68rem;
  }
}

@media (forced-colors: active) {
  .btn,
  .copy-compact,
  .link-button,
  .flow-notice,
  .flow-glass,
  .card,
  .panel,
  .auth-dialog,
  .renewal-dialog {
    border: 1px solid CanvasText;
  }

  .btn.primary,
  .btn.telegram,
  .instruction-app-icon,
  .journey-v2-step.current .journey-v2-number {
    color: ButtonText;
    background: ButtonFace;
  }
}
