:root {
  --ink: #06133a;
  --muted: #64708a;
  --brand: #2563ff;
  --brand-dark: #071b5a;
  --panel: #ffffff;
  --line: #dbe6fb;
  --soft: #eef5ff;
  --success: #14b86a;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(37, 99, 255, .13), transparent 34%),
    linear-gradient(135deg, #f7fbff 0%, #edf4ff 52%, #f9fbff 100%);
}

body.modal-open { overflow: hidden; }

button, input, select { font: inherit; }

.partner-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 42px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .75fr);
  gap: 22px;
  align-items: start;
}

.brand {
  font-weight: 900;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: -.03em;
}

.brand span {
  display: inline-block;
  padding: 2px 10px 4px;
  margin-left: 5px;
  color: #fff;
  font-style: italic;
  border-radius: 9px;
  background: linear-gradient(135deg, #1d4ed8, #2f7bff);
}

.hero, .panel {
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 22px 60px rgba(18, 39, 91, .10);
}

.hero {
  min-height: 520px;
  padding: clamp(24px, 4vw, 46px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 650px;
  font-size: clamp(34px, 5.6vw, 64px);
  line-height: .98;
  letter-spacing: -.05em;
  margin-bottom: 16px;
}

.lead {
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
}

.hero-grid div, .stats article, .calc-result {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.hero-grid strong, .stats strong, .calc-result strong {
  display: block;
  font-size: 22px;
  color: var(--brand-dark);
}

.hero-grid small, .stats span, .calc-result span, .muted, .hint {
  color: var(--muted);
}

.panel { padding: 22px; }

.login-card {
  position: sticky;
  top: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7fbff;
}

.auth-tabs button {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.auth-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #2f7bff);
}

.auth-form h2 { margin-bottom: 8px; }

label {
  display: block;
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input, select {
  width: 100%;
  min-height: 52px;
  margin-top: 7px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 255, .10);
}

button, .ghost {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary {
  width: 100%;
  margin-top: 8px;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #2f7bff);
  box-shadow: 0 16px 28px rgba(37, 99, 255, .22);
}

.message {
  margin-top: 12px;
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.message.info { color: var(--brand); }

.terms-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbff;
  color: var(--ink);
}

.terms-check input {
  width: 18px;
  min-height: 18px;
  margin: 1px 0 0;
  padding: 0;
}

.terms-open-button {
  width: 100%;
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--brand-dark);
}

.terms-open-button:hover,
.terms-open-button:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 255, .10);
  outline: none;
}

.terms-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 19, 58, .46);
  backdrop-filter: blur(7px);
}

.terms-modal {
  width: min(760px, 100%);
  max-height: min(88vh, 760px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(6, 19, 58, .24);
  overflow: hidden;
}

.terms-modal-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.terms-modal-header h2 { margin: 0; }

.modal-close {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 14px;
  font-size: 26px;
  line-height: 1;
}

.terms-modal-body {
  overflow: auto;
  padding: 18px 24px 24px;
}

.terms-body {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.terms-body ol {
  padding-left: 22px;
  margin: 10px 0 0;
}

.terms-body li { margin-bottom: 10px; }

.dashboard {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
}

.hidden { display: none !important; }

.dashboard-head, .section-title, .referral-panel {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stats strong { font-size: 30px; }

.link-text {
  margin: 0;
  color: var(--brand);
  font-weight: 800;
  word-break: break-all;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.actions .primary { width: auto; margin: 0; }

.status-banner {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.status-banner strong {
  color: var(--brand-dark);
  font-size: 18px;
}

.status-banner span {
  color: var(--muted);
  line-height: 1.45;
}

.status-banner.warning {
  border-color: rgba(245, 158, 11, .28);
  background: #fffaf0;
}

.status-banner.success {
  border-color: rgba(20, 184, 106, .25);
  background: #f0fdf6;
}

.narrow-primary {
  width: auto;
  min-width: 220px;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.calc-help {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.calc-example {
  margin: 14px 0 0;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 255, .16);
  border-radius: 16px;
  background: #f7fbff;
  color: var(--brand-dark);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 800;
}

.payment-list {
  display: grid;
  gap: 10px;
}

.payment-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(120px, .55fr));
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.pill {
  display: inline-flex;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--success);
  background: rgba(20, 184, 106, .12);
  font-size: 12px;
  font-weight: 900;
}

@media (max-width: 860px) {
  .partner-shell {
    grid-template-columns: 1fr;
    padding-top: 14px;
  }
  .login-card { position: static; }
  .hero { min-height: auto; }
  .hero-grid, .stats, .calc-grid { grid-template-columns: 1fr; }
  .dashboard-head, .section-title, .referral-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .actions { justify-content: stretch; }
  .actions > * { width: 100%; }
  .narrow-primary { width: 100%; }
  .payment-row { grid-template-columns: 1fr; }
}
