html { height: 100%; overflow: hidden; }

.portal-body {
  height: 100%;
  overflow: hidden;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(99, 102, 241, .12), transparent 30rem),
    radial-gradient(circle at 86% 78%, rgba(16, 185, 129, .08), transparent 28rem),
    var(--surface-50);
}

.portal-header {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-logo { width: 164px; height: auto; display: block; }
.portal-help { font-size: 14px; font-weight: 600; color: var(--surface-600); }
.portal-help:hover { color: var(--primary-600); }

.portal-main {
  width: min(1080px, calc(100% - 40px));
  min-height: calc(100vh - 112px);
  margin: 0 auto;
  padding: clamp(34px, 7vh, 80px) 0 60px;
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(430px, 1fr);
  gap: clamp(40px, 7vw, 90px);
  align-items: start;
}

.portal-intro { padding-top: 48px; }
.portal-kicker, .portal-step-label {
  display: block;
  margin-bottom: 13px;
  color: var(--primary-600);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.portal-intro h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1.04; letter-spacing: -.045em; }
.portal-intro > p { margin-top: 22px; color: var(--surface-600); font-size: 17px; line-height: 1.7; max-width: 510px; }
.portal-safety {
  display: flex; align-items: center; gap: 10px; margin-top: 28px;
  color: var(--success-700); font-size: 14px; font-weight: 600;
}
.portal-safety span { width: 24px; height: 24px; border-radius: 50%; background: var(--success-50); display: grid; place-items: center; }

.portal-card {
  position: relative;
  min-height: 470px;
  padding: clamp(28px, 5vw, 46px);
  background: rgba(255,255,255,.96);
  border: 1px solid var(--surface-200);
  border-radius: 22px;
  box-shadow: var(--shadow-xl);
}

.portal-progress { display: flex; align-items: center; margin-bottom: 36px; }
.portal-progress span { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--surface-300); border-radius: 50%; color: var(--surface-500); font-size: 12px; font-weight: 700; }
.portal-progress span.is-active { color: #fff; background: var(--primary-600); border-color: var(--primary-600); }
.portal-progress span.is-done { color: var(--success-700); background: var(--success-50); border-color: #a7f3d0; }
.portal-progress i { height: 1px; flex: 1; background: var(--surface-200); }

.portal-step h2, .portal-modal-card h2 { font-size: 25px; line-height: 1.2; }
.portal-step > p, .portal-panel-head p { margin-top: 10px; color: var(--surface-500); font-size: 14px; line-height: 1.6; }
.portal-step form { margin-top: 26px; }
.portal-step label { display: block; margin-bottom: 8px; color: var(--surface-700); font-size: 13px; font-weight: 700; }
.portal-step input {
  width: 100%; height: 52px; padding: 0 15px; border: 1px solid var(--surface-300); border-radius: 10px;
  outline: none; background: #fff; color: var(--surface-900); font: 500 16px var(--font); transition: border .18s, box-shadow .18s;
}
.portal-step input:focus { border-color: var(--primary-500); box-shadow: 0 0 0 4px var(--primary-50); }
.portal-code { text-align: center; letter-spacing: .35em; font: 700 25px var(--mono) !important; }

.portal-button {
  width: 100%; min-height: 50px; margin-top: 14px; padding: 12px 20px; border-radius: 10px;
  background: var(--primary-600); color: #fff; font-size: 15px; font-weight: 700; box-shadow: 0 5px 16px rgba(79,70,229,.18);
}
.portal-button:hover { background: var(--primary-700); }
.portal-button:disabled { opacity: .55; cursor: wait; }
.portal-secondary-actions { margin-top: 18px; display: flex; justify-content: space-between; gap: 18px; }
.portal-link { color: var(--primary-600); font-size: 13px; font-weight: 700; }
.portal-link:hover { color: var(--primary-800); text-decoration: underline; }
.portal-link:disabled { color: var(--surface-400); cursor: not-allowed; text-decoration: none; }
.portal-panel-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.subscription-list { display: grid; gap: 13px; margin-top: 24px; }
.subscription-card { padding: 19px; border: 1px solid var(--surface-200); border-radius: 13px; background: var(--surface-50); }
.subscription-top { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.subscription-name { font-weight: 750; color: var(--surface-900); }
.subscription-meta { margin-top: 5px; color: var(--surface-500); font-size: 13px; }
.subscription-status { flex: none; padding: 5px 9px; border-radius: 999px; color: var(--success-700); background: var(--success-50); font-size: 11px; font-weight: 800; }
.subscription-status.canceling { color: var(--warning-700); background: var(--warning-50); }
.subscription-actions { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--surface-200); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.subscription-actions span { color: var(--surface-600); font-size: 13px; }
.cancel-button { color: var(--danger-700); font-size: 13px; font-weight: 750; }
.cancel-button:hover { text-decoration: underline; }
.portal-empty { padding: 32px 20px; text-align: center; background: var(--surface-50); border-radius: 12px; color: var(--surface-600); }

.portal-message { margin-top: 20px; padding: 12px 14px; border-radius: 9px; background: var(--info-50); color: var(--info-700); font-size: 13px; line-height: 1.5; }
.portal-message.is-error { background: var(--danger-50); color: var(--danger-700); }
.portal-message.is-success { background: var(--success-50); color: var(--success-700); }
.portal-footnote { grid-column: 2; color: var(--surface-500); text-align: center; font-size: 13px; }
.portal-footnote a { color: var(--primary-600); font-weight: 600; }

.portal-modal { position: fixed; inset: 0; z-index: 50; padding: 20px; background: rgba(10,14,26,.68); display: grid; place-items: center; backdrop-filter: blur(4px); }
.portal-modal[hidden] { display: none; }
.portal-modal-card { width: min(440px, 100%); padding: 32px; border-radius: 18px; background: #fff; box-shadow: var(--shadow-xl); text-align: center; }
.portal-modal-icon { width: 48px; height: 48px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; color: var(--danger-700); background: var(--danger-50); font-size: 23px; font-weight: 800; }
.portal-modal-card p { margin-top: 13px; color: var(--surface-600); line-height: 1.6; }
.portal-modal-actions { margin-top: 24px; display: grid; gap: 8px; }
.portal-button-danger { margin: 0; background: var(--danger-700); box-shadow: none; }
.portal-button-danger:hover { background: #991b1b; }
.portal-button-light { margin: 0; color: var(--surface-700); background: var(--surface-100); box-shadow: none; }
.portal-button-light:hover { background: var(--surface-200); }

@media (max-width: 820px) {
  html { height: auto; overflow: auto; }
  .portal-body { height: auto; overflow: auto; }
  .portal-main { grid-template-columns: 1fr; gap: 32px; padding-top: 18px; }
  .portal-intro { padding-top: 10px; text-align: center; }
  .portal-intro > p { margin-left: auto; margin-right: auto; }
  .portal-safety { justify-content: center; }
  .portal-footnote { grid-column: 1; }
}
@media (max-width: 520px) {
  .portal-header { padding-top: 18px; }
  .portal-logo { width: 142px; }
  .portal-help { font-size: 12px; }
  .portal-main { width: min(100% - 24px, 1080px); }
  .portal-intro h1 { font-size: 36px; }
  .portal-card { min-height: 440px; padding: 25px 20px; border-radius: 17px; }
  .subscription-top, .subscription-actions { align-items: flex-start; flex-direction: column; }
}
