:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --text: #172033;
  --muted: #667085;
  --line: #dfe4ec;
  --brand: #4255a4;
  --brand-dark: #324486;
  --brand-deep: #27366f;
  --brand-soft: #eef1ff;
  --brand-border: #cfd6f4;
  --success: #087443;
  --success-soft: #eaf8f0;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --shadow: 0 22px 60px rgba(32, 44, 84, 0.12);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(66, 85, 164, 0.09), transparent 30rem),
    radial-gradient(circle at 92% 12%, rgba(143, 151, 178, 0.12), transparent 26rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

.hidden {
  display: none !important;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  width: min(100% - 40px, 1040px);
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-logo-wrap {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(66, 85, 164, 0.13);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(66, 85, 164, 0.12);
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  font-size: 1rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 650;
}

.secure-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.secure-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(8, 116, 67, 0.09);
}

.main {
  width: min(100% - 40px, 1040px);
  margin: 30px auto 58px;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.portal-card {
  position: relative;
  width: min(100%, 680px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(29, 41, 72, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.portal-card-wide {
  width: min(100%, 900px);
}

.card-accent {
  height: 5px;
  background: linear-gradient(90deg, var(--brand), #7180c2 58%, #aab2d6);
}

.card-head {
  padding: 34px 38px 26px;
  border-bottom: 1px solid var(--line);
}

.step-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.74rem;
  font-weight: 850;
}

.step-caption {
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 700;
}

.card-head h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.card-head > p {
  max-width: 680px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.65;
}

.portal-form {
  padding: 30px 38px 36px;
}

.field + .field {
  margin-top: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: #283449;
  font-size: 0.86rem;
  font-weight: 780;
}

.field label span[aria-hidden="true"] {
  color: var(--danger);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 51px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  background: #fff;
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field textarea {
  min-height: 94px;
  line-height: 1.5;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #98a2b3;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #c6cedb;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(66, 85, 164, 0.11);
}

.field-hint,
.field-error {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  line-height: 1.5;
}

.field-hint {
  color: var(--muted);
}

.field-error {
  color: var(--danger);
  font-weight: 680;
}

.form-message {
  margin: 20px 0 0;
  padding: 12px 13px;
  border: 1px solid rgba(180, 35, 24, 0.12);
  border-radius: 11px;
  background: var(--danger-soft);
}

.btn {
  min-height: 50px;
  padding: 12px 19px;
  border: 0;
  border-radius: 12px;
  font-weight: 820;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 3px solid rgba(66, 85, 164, 0.22);
  outline-offset: 2px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 20px rgba(66, 85, 164, 0.16);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
  box-shadow: 0 10px 24px rgba(66, 85, 164, 0.2);
}

.btn-secondary {
  background: #edf0f5;
  color: #273247;
}

.btn-secondary:hover:not(:disabled) {
  background: #e4e8ef;
}

.btn-block {
  width: 100%;
  margin-top: 24px;
}

.is-busy {
  cursor: wait;
}

.card-foot {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 38px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.5;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--brand);
}

.match-info {
  margin-top: 18px;
}

.match-message {
  margin: 0;
  padding: 12px 13px;
  border-radius: 11px;
  font-size: 0.84rem;
  font-weight: 720;
}

.match-message.success {
  color: var(--success);
  background: var(--success-soft);
}

.match-message.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.section-label {
  margin: 0 0 16px;
  color: #344054;
  font-size: 0.76rem;
  font-weight: 880;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.section-divider {
  height: 1px;
  margin: 30px 0 25px;
  background: var(--line);
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
}

.section-heading-row .section-label {
  margin-bottom: 5px;
}

.section-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.required-note {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f2f4f8;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
}

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

.form-grid .field + .field {
  margin-top: 0;
}

.field-span-2 {
  grid-column: span 2;
}

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

.payment-option {
  position: relative;
  min-height: 92px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, transform 0.12s ease;
}

.payment-option:hover {
  border-color: #bbc4d5;
  transform: translateY(-1px);
}

.payment-option.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(66, 85, 164, 0.08);
}

.payment-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.payment-checkbox:focus-visible + .payment-option-icon {
  outline: 3px solid rgba(66, 85, 164, 0.22);
  outline-offset: 3px;
}

.payment-option-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #f1f3f8;
  color: var(--brand-deep);
  font-size: 0.74rem;
  font-weight: 900;
}

.payment-option.selected .payment-option-icon {
  background: var(--brand);
  color: #fff;
}

.payment-option-copy {
  min-width: 0;
}

.payment-option-copy strong,
.payment-option-copy small {
  display: block;
}

.payment-option-copy strong {
  color: #273247;
  font-size: 0.86rem;
  line-height: 1.25;
}

.payment-option-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.payment-check {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd2de;
  border-radius: 7px;
  background: #fff;
  color: transparent;
  font-size: 0.78rem;
  font-weight: 900;
}

.payment-option.selected .payment-check {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.payment-panel {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--brand-border);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfcff 0%, #f8f9fd 100%);
}

.payment-panel + .payment-panel {
  margin-top: 12px;
}

.payment-panel-head {
  margin-bottom: 18px;
}

.payment-panel-head strong,
.payment-panel-head small {
  display: block;
}

.payment-panel-head strong {
  color: #273247;
  font-size: 0.9rem;
}

.payment-panel-head small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.state-card {
  min-height: 400px;
  padding: 48px 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.state-card h2 {
  margin: 17px 0 9px;
  font-size: 1.58rem;
}

.state-card p {
  max-width: 500px;
  margin: 0 0 23px;
  color: var(--muted);
  line-height: 1.65;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e1e5f2;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.success-icon {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 1.6rem;
  font-weight: 900;
}

.footer {
  width: min(100% - 40px, 1040px);
  margin: 0 auto 25px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.75rem;
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--accent, inherit);
  text-decoration: underline;
}

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

@media (max-width: 760px) {
  .topbar,
  .main,
  .footer {
    width: min(100% - 24px, 1040px);
  }

  .topbar {
    min-height: 76px;
  }

  .secure-label {
    display: none;
  }

  .main {
    margin: 18px auto 38px;
  }

  .portal-card {
    border-radius: 18px;
  }

  .card-head {
    padding: 27px 21px 21px;
  }

  .portal-form {
    padding: 24px 21px 27px;
  }

  .card-foot {
    padding: 16px 21px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .field-span-2 {
    grid-column: span 1;
  }

  .payment-options {
    grid-template-columns: 1fr;
  }

  .payment-option {
    min-height: 76px;
  }

  .payment-panel {
    padding: 17px;
  }

  .section-heading-row {
    flex-direction: column;
    gap: 9px;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
  }

  .state-card {
    min-height: 350px;
    padding: 36px 21px;
  }

  .footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .brand-logo-wrap {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 12px;
  }

  .brand-logo {
    width: 39px;
    height: 39px;
  }

  .brand-copy strong {
    font-size: 0.9rem;
  }

  .brand-copy small {
    font-size: 0.7rem;
  }

  .card-head h1 {
    font-size: 1.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
