:root {
  --plum-900: #1E0728;
  --plum-800: #2A0B37;
  --plum-700: #3A0F4A;
  --plum-600: #49155C;
  --plum-500: #5E1D75;
  --violet-600: #7A2A96;
  --violet-400: #A855F7;
  --violet-300: #C084FC;
  --violet-200: #DDBEFB;
  --gold-400: #F2C14E;

  --surface: #FFFFFF;
  --line: #ECE2F5;
  --track: #F3EBFA;
  --ink: #1B0A24;
  --muted: #6C5A77;

  --on-dark: #FFFFFF;
  --on-dark-soft: #D6C2E4;
  --on-dark-muted: #9C86AE;

  --danger: #B91C1C;
  --good: #15803D;

  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;

  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: #FFFFFF;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -0.02em; }
p, ul, ol, dl { margin: 0; }
a { color: var(--violet-600); text-decoration: none; }

:focus-visible { outline: 3px solid var(--violet-400); outline-offset: 3px; border-radius: 8px; }

.svg-defs { position: absolute; width: 0; height: 0; }
.icon { width: 20px; height: 20px; }

.page { min-height: 100dvh; padding-bottom: calc(104px + env(safe-area-inset-bottom)); }

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--space-3) + env(safe-area-inset-top));
  background: var(--plum-900);
}

.top-logo { width: auto; height: 34px; object-fit: contain; }

.top-tag {
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  background: var(--violet-400);
  color: #22062E;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
}

.body {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  max-width: 560px;
  margin: 0 auto;
}

.hero {
  padding: var(--space-5) var(--space-4);
  margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) 0;
  background:
    radial-gradient(700px 420px at 15% 0%, var(--plum-500) 0%, transparent 62%),
    linear-gradient(170deg, var(--plum-800) 0%, var(--plum-900) 100%);
  color: var(--on-dark);
}

.hero h1 {
  font-size: clamp(1.55rem, 7vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
}

.hero-lead {
  margin-top: var(--space-3);
  font-size: 0.96rem;
  color: var(--on-dark-soft);
}

.figures {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.figure {
  flex: 1 1 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.07);
}

.figure-value {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 4.4vw, 1.25rem);
  font-weight: 700;
  color: var(--gold-400);
  white-space: nowrap;
}

.figure-label { display: block; font-size: 0.8rem; color: var(--on-dark-soft); }

.card {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(43, 12, 56, 0.06);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.card-text { margin-top: var(--space-2); font-size: 0.94rem; color: var(--muted); }

.slots-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.slots-label { font-size: 0.86rem; color: var(--muted); }

.slots-count {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--violet-600);
}

.progress {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--track);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--plum-500), var(--violet-400));
}

.slots-note { margin-top: var(--space-2); font-size: 0.82rem; color: var(--muted); }

.ticks { display: grid; gap: var(--space-2); margin-top: var(--space-3); padding: 0; list-style: none; }

.ticks li {
  position: relative;
  padding-left: 26px;
  font-size: 0.92rem;
  color: var(--muted);
}

.ticks li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 14px;
  height: 8px;
  border-left: 2px solid var(--violet-400);
  border-bottom: 2px solid var(--violet-400);
  transform: rotate(-45deg);
}

.field { display: grid; gap: var(--space-2); margin-top: var(--space-3); }

.field-label { font-family: var(--font-display); font-size: 0.88rem; font-weight: 600; }

.field-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--track);
  transition: border-color 180ms ease, background-color 180ms ease;
}

.field-control:focus-within { border-color: var(--violet-400); background: var(--surface); }
.field.has-error .field-control { border-color: var(--danger); }

.field-prefix {
  padding-left: 14px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--muted);
}

.input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 14px;
  background: none;
  border: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
}

.input:focus { outline: none; }
.input:disabled { color: var(--muted); }
.link-control .input { font-size: 0.86rem; }

.reveal {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-right: 3px;
  background: none;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
}

.reveal:hover { background: var(--track); color: var(--ink); }
.reveal:disabled { opacity: 0.4; cursor: not-allowed; }

.field-note { font-size: 0.8rem; color: var(--muted); }
.field-error { font-size: 0.84rem; color: var(--danger); }
.field-error:empty { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 180ms ease, transform 160ms ease, opacity 160ms ease;
}

.btn-block { width: 100%; }

.btn-primary {
  margin-top: var(--space-4);
  background: var(--violet-400);
  color: #22062E;
  box-shadow: 0 12px 28px rgba(122, 42, 150, 0.35);
}

.btn-primary:hover { background: var(--violet-300); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-quiet {
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted);
}

.btn-quiet:hover { background: var(--track); color: var(--ink); }
.btn-plain { margin-top: var(--space-2); background: none; color: var(--muted); }
.btn-plain:hover { background: var(--track); color: var(--ink); }

.btn.is-loading { position: relative; color: transparent; }

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(34, 6, 46, 0.3);
  border-top-color: #22062E;
  animation: spin 700ms linear infinite;
}

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

.form-legal { margin-top: var(--space-3); font-size: 0.8rem; color: var(--muted); text-align: center; }
.form-login { margin-top: var(--space-3); font-size: 0.9rem; color: var(--muted); text-align: center; }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--violet-600);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.profile-head { text-align: center; }

.profile-tag {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet-600);
}

.profile-code {
  margin-top: var(--space-2);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.profile-phone { margin-top: 2px; font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

.stat {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: var(--space-4) var(--space-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-align: center;
}

.stat-icon { width: 22px; height: 22px; color: var(--violet-400); margin-bottom: var(--space-1); }

.stat-value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.stat-label { font-size: 0.78rem; color: var(--muted); }

.wallet-card {
  background:
    radial-gradient(520px 240px at 100% 0%, rgba(168, 85, 247, 0.5) 0%, transparent 62%),
    linear-gradient(150deg, var(--plum-600) 0%, var(--plum-900) 100%);
  border-color: transparent;
  color: var(--on-dark);
}

.wallet-label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--violet-200);
}

.wallet-amount {
  margin-top: var(--space-2);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 8vw, 2.2rem);
  font-weight: 800;
  white-space: nowrap;
}

.wallet-note { margin-top: var(--space-2); font-size: 0.84rem; color: var(--on-dark-soft); }
.wallet-card .btn-primary { background: #FFFFFF; color: var(--plum-900); box-shadow: none; }
.wallet-card .btn-primary:hover { background: var(--violet-200); }

.rows { display: grid; gap: var(--space-2); margin-top: var(--space-3); padding: 0; list-style: none; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--track);
}

.row-main { display: grid; gap: 1px; min-width: 0; }
.row-title { font-family: var(--font-display); font-weight: 600; }
.row-sub { font-size: 0.78rem; color: var(--muted); }

.tag {
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--violet-600);
  white-space: nowrap;
}

.tag-completed { background: rgba(74, 222, 128, 0.18); color: var(--good); }
.tag-failed, .tag-rejected { background: rgba(248, 113, 113, 0.18); color: var(--danger); }

.doc-heading { font-size: 1.5rem; font-weight: 700; }

.segment {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--track);
  overflow-x: auto;
  scrollbar-width: none;
}

.segment::-webkit-scrollbar { display: none; }

.segment-pill {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: 0 3px 10px rgba(43, 12, 56, 0.1);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.segment-pill.no-anim { transition: none; }

.segment-btn {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  background: none;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: color 220ms ease;
}

.segment-btn.is-active { color: var(--ink); }

.doc { display: grid; gap: var(--space-2); }

.doc-title {
  margin-top: var(--space-3);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.doc-title:first-child { margin-top: 0; }
.doc-text { font-size: 0.93rem; line-height: 1.6; color: var(--muted); }

.doc-note {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
  font-style: italic;
  color: var(--muted);
}

.doc-list { display: grid; gap: 6px; padding-left: 20px; font-size: 0.93rem; color: var(--muted); }

.doc-steps { display: grid; gap: var(--space-2); padding: 0; list-style: none; }

.doc-steps li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 0.93rem;
  color: var(--muted);
}

.doc-num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--violet-400);
  color: #22062E;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
}

.doc-table { display: grid; gap: 2px; }

.doc-table div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.doc-table div:last-child { border-bottom: 0; }
.doc-table dt { color: var(--muted); }
.doc-table dd { margin: 0; font-family: var(--font-display); font-weight: 600; color: var(--ink); text-align: right; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 0 var(--space-3) calc(var(--space-3) + env(safe-area-inset-bottom));
  pointer-events: none;
}

.tabbar-inner {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px;
  border-radius: var(--radius-pill);
  background: var(--plum-900);
  box-shadow: 0 14px 34px rgba(30, 7, 40, 0.35);
  pointer-events: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 48px;
  height: 50px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  color: rgba(214, 194, 228, 0.6);
  transition: background-color 240ms ease, color 240ms ease;
}

.tab.is-active { background: #FFFFFF; color: var(--plum-900); }
.tab-icon { flex: 0 0 auto; width: 21px; height: 21px; }

.tab-label {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(27, 10, 36, 0.55);
  opacity: 0;
  transition: opacity 280ms ease;
}

.sheet-overlay.is-visible { opacity: 1; }

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 88dvh;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  transform: translateY(100%);
  transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-overlay.is-visible .sheet { transform: translateY(0); }

.sheet-grip {
  display: block;
  width: 42px;
  height: 4px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--line);
}

.sheet-title { font-size: 1.2rem; font-weight: 700; }
.sheet-text { margin-top: var(--space-2); font-size: 0.92rem; color: var(--muted); }

.pay-facts {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--track);
}

.pay-facts div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.pay-facts dt { font-size: 0.88rem; color: var(--muted); }

.pay-facts dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pay-facts dd.strong { font-size: 1.1rem; color: var(--violet-600); }

.pay-state { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-4) 0 var(--space-5); text-align: center; }
.pay-state h3 { font-size: 1.1rem; font-weight: 700; }
.pay-state p { font-size: 0.92rem; color: var(--muted); }
.pay-state.is-ok h3 { color: var(--good); }
.pay-state.is-error h3 { color: var(--danger); }

.pay-spinner {
  width: 42px;
  height: 42px;
  margin-bottom: var(--space-2);
  border-radius: 50%;
  border: 3px solid var(--track);
  border-top-color: var(--violet-400);
  animation: spin 800ms linear infinite;
}

body.sheet-open { overflow: hidden; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  width: min(420px, calc(100% - 32px));
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--plum-900);
  color: #FFFFFF;
  font-size: 0.92rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, 18px);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: #7F1D1D; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
