* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 76% 8%, rgba(58, 45, 151, 0.075), transparent 28%),
    linear-gradient(180deg, var(--surface) 0%, var(--app-bg) 100%);
  color: var(--fg);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.035em; }

.AuthShell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: clamp(22px, 4vw, 48px);
  position: relative;
  overflow: hidden;
}

.AuthShell::before {
  content: "";
  position: fixed;
  inset: auto auto -150px -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(58, 45, 151, 0.045);
  filter: blur(4px);
  pointer-events: none;
}

.AuthFrame {
  width: min(100%, 1120px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 500px);
  gap: clamp(26px, 5vw, 72px);
  align-items: center;
}

.AuthNarrative {
  max-width: 520px;
  display: grid;
  gap: 26px;
}

.AuthNarrative .eyebrow,
.LauncherHeader .eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.AuthNarrative h2,
.LauncherHeader h1 {
  max-width: 650px;
  font-size: clamp(40px, 5vw, 70px);
  line-height: 0.98;
}

.AuthNarrative p,
.LauncherHeader p {
  max-width: 610px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.58;
}

.PreviewPanel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-document-lg);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-auth-soft);
}

.PreviewRow {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.PreviewIcon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 850;
}

.PreviewRow strong { display: block; font-size: 14px; letter-spacing: -0.02em; }
.PreviewRow span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.PreviewMeta { color: var(--accent); font-size: 12px; font-weight: 800; }

.AuthCard {
  width: min(100%, 500px);
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid rgba(218, 213, 234, 0.95);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-auth);
  backdrop-filter: blur(18px);
}
.AuthFrame.is-hidden,
.AuthForm.is-hidden,
.is-hidden { display: none !important; }

.LoadingBackdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--dark-surface) 48%, transparent);
}

.LoadingSpinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--surface-glass-18);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.InvitationCard {
  width: min(100%, 560px);
  text-align: center;
}

.InvitationMark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid var(--accent-border);
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.InvitationMark.success {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}

.InvitationMark.error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.InvitationActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.LogoHeader {
  display: grid;
  justify-items: center;
  gap: 22px;
  margin-bottom: 28px;
  text-align: center;
}

.LogoHeader img {
  width: 112px;
  height: auto;
  display: block;
}

.LogoHeader h1 {
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.02;
}

.LogoHeader p {
  max-width: 360px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.AuthForm { display: grid; gap: 16px; }
.FieldGroup { display: grid; gap: 8px; }
.FieldRow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.SelectField { position: relative; width: 100%; }
.SelectField .select2-container { width: 100% !important; }
.select2-container .select2-selection--single {
  min-height: 50px !important;
  display: flex;
  align-items: center;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  background: var(--surface);
  box-shadow: var(--shadow-document-soft);
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 48px;
  right: 14px;
}
.select2-dropdown {
  overflow: hidden;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  box-shadow: var(--shadow) !important;
}

.LabelLine {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.TextInput {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--fg);
  outline: 0;
  padding: 0 14px;
  box-shadow: 0 8px 18px rgba(30, 24, 70, 0.025);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.TextInput::placeholder { color: var(--placeholder); }
.TextInput:focus {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  box-shadow: 0 0 0 4px rgba(58, 45, 151, 0.08);
}

.PasswordWrap, .CurrencyWrap { position: relative; }
.PasswordWrap .TextInput { padding-right: 54px; }
.RevealButton {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.RevealButton:hover { background: var(--app-surface-soft); color: var(--accent); }

.PrimaryButton {
  position: relative;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 850;
  box-shadow: 0 16px 34px rgba(58, 45, 151, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.PrimaryButton:hover { transform: translateY(-1px); box-shadow: 0 20px 42px rgba(58, 45, 151, 0.26); }
.PrimaryButton[disabled] { opacity: 0.72; cursor: wait; transform: none; }
.PrimaryButton.is-loading .ButtonText { opacity: 0; }
.PrimaryButton.is-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.42);
  border-top-color: var(--on-accent);
  animation: spin 800ms linear infinite;
}

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

.SecondaryLine {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.SecondaryLine a,
.InlineLink {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.TrustLine {
  padding-top: 8px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.ResetMeta {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--app-surface-soft);
}

.ResetMetaItem {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.ResetMetaIcon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.ResetConfirmation {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--success-border);
  border-radius: 20px;
  background: var(--success-bg);
  color: var(--success);
}

.ResetConfirmation.is-visible { display: grid; }
.ResetConfirmation strong {
  display: block;
  color: var(--success);
  font-size: 15px;
  letter-spacing: -0.02em;
}
.ResetConfirmation span {
  display: block;
  margin-top: 4px;
  color: color-mix(in srgb, var(--success) 70%, var(--muted));
  font-size: 13px;
  line-height: 1.45;
}

.ResetLinkState {
  display: none;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--accent-border);
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
}

.ResetLinkState.is-visible { display: grid; }

.ResetLinkState strong,
.ResetSuccessPanel strong {
  display: block;
  color: var(--fg);
  font-size: 14px;
  letter-spacing: -0.02em;
}

.ResetLinkState span,
.ResetSuccessPanel span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ResetLinkStateExpired {
  grid-template-columns: 38px 1fr auto;
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.ResetStateIcon,
.ResetSuccessMark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface);
  color: currentColor;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.SecondaryButton {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.ResetSuccessPanel {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--success-border);
  border-radius: 18px;
  background: var(--success-bg);
}

.ResetSuccessPanel.is-visible { display: grid; }

.ResetSuccessMark {
  color: var(--success);
}

.Alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 15px;
  font-size: 13px;
  line-height: 1.4;
}

.Alert.is-visible { display: flex; }
.Alert::before {
  content: "!";
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
}
.Alert.error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.Alert.error::before { background: var(--surface); }
.Alert.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.Alert.success::before { content: "ok"; background: var(--surface); font-size: 9px; text-transform: uppercase; }
.Alert.loading { background: var(--surface-purple); color: var(--accent); border: 1px solid var(--accent-border-soft); }
.Alert.loading::before { content: ""; border: 2px solid var(--accent-border); border-top-color: var(--accent); animation: spin 800ms linear infinite; }

.PasswordRules {
  display: grid;
  gap: 8px;
  margin-top: 3px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--app-surface-soft);
}

.PasswordRule {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 690;
}

.RuleDot {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
  font-size: 11px;
  font-weight: 900;
}

.PasswordRule.is-valid { color: var(--success); }
.PasswordRule.is-valid .RuleDot {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}

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

.ChoiceCard {
  min-height: 82px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.ChoiceCard strong {
  display: block;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.2;
}

.ChoiceCard span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
}

.ChoiceCard[aria-pressed="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: 0 10px 24px rgba(58, 45, 151, 0.08);
}
.ChoiceCard[aria-pressed="true"] strong { color: var(--accent); }

.HelperText {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.35;
}

.Tooltip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.Tooltip:hover::after,
.Tooltip:focus::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 4;
  width: 210px;
  transform: translateX(-50%);
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--dark-surface);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  box-shadow: 0 14px 30px rgba(23, 19, 41, 0.2);
}

.CurrencyButton {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--fg);
  text-align: left;
}

.CurrencyButton span { color: var(--muted); }
.CurrencyMenu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  display: none;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-auth);
}
.CurrencyWrap.is-open .CurrencyMenu { display: grid; gap: 8px; }
.CurrencySearch { min-height: 42px; border-radius: 13px; }
.CurrencyOptions { display: grid; gap: 4px; max-height: 176px; overflow: auto; }
.CurrencyOption {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--fg);
  padding: 0 10px;
  text-align: left;
}
.CurrencyOption:hover,
.CurrencyOption.is-selected { background: var(--accent-soft); color: var(--accent); }

.LauncherShell {
  min-height: 100vh;
  padding: clamp(24px, 4vw, 54px);
}

.LauncherHeader {
  width: min(1120px, 100%);
  margin: 0 auto 28px;
  display: grid;
  gap: 16px;
}

.LauncherGrid {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 16px;
}

.LauncherCard {
  min-height: 250px;
  display: grid;
  align-content: space-between;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-document-lg);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-auth-soft);
}

.LauncherCard h2 { font-size: 25px; line-height: 1.05; }
.LauncherCard p { margin-top: 9px; color: var(--muted); line-height: 1.5; }
.RouteMeta {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 760;
}

.MiniButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 820;
  box-shadow: 0 14px 30px rgba(58, 45, 151, 0.18);
}

.LauncherActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.MiniButtonSecondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  box-shadow: none;
}

.MobilePreview {
  display: none;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
}

@media (max-width: 980px) {
  .AuthFrame { grid-template-columns: 1fr; justify-items: center; }
  .AuthNarrative { display: none; }
  .AuthCard { width: min(100%, 520px); }
  .LauncherGrid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body {
    background: linear-gradient(180deg, var(--surface) 0%, var(--app-bg) 100%);
  }
  .AuthShell { display: block; padding: 16px; }
  .AuthCard {
    width: 100%;
    min-height: calc(100vh - 32px);
    display: grid;
    align-content: center;
    border-radius: 24px;
    padding: 22px;
  }
  .LogoHeader { gap: 18px; margin-bottom: 22px; }
  .LogoHeader img { width: 102px; }
  .LogoHeader h1 { font-size: 32px; }
  .FieldRow, .WorkspaceToggle { grid-template-columns: 1fr; }
  .TextInput, .CurrencyButton, .PrimaryButton { min-height: 52px; }
  .ResetLinkState,
  .ResetSuccessPanel {
    grid-template-columns: 1fr;
  }
  .ResetLinkStateExpired {
    grid-template-columns: 1fr;
  }
  .ResetStateIcon,
  .ResetSuccessMark {
    width: 34px;
    height: 34px;
  }
  .TrustLine { padding-bottom: 4px; }
  .LauncherShell { padding: 18px; }
  .LauncherHeader h1 { font-size: 38px; }
}

@media (max-width: 390px) {
  .AuthCard { padding: 20px; }
  .LogoHeader { gap: 14px; margin-bottom: 18px; }
  .LogoHeader img { width: 92px; }
  .LogoHeader h1 { font-size: 30px; }
  .AuthForm { gap: 13px; }
  .ChoiceCard { min-height: 76px; padding: 12px; }
}
