.portal-page {
  min-height: 100vh;
  background: #edf3fa;
}

.portal-header {
  width: min(1360px, calc(100% - 48px));
  min-height: 82px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 17px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 800;
  transition: transform .2s ease, border-color .2s ease;
}

.home-link:hover { transform: translateY(-2px); border-color: #b8c9de; }
.home-link svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.portal-shell {
  width: min(1360px, calc(100% - 48px));
  min-height: calc(100vh - 106px);
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: minmax(310px, .72fr) minmax(620px, 1.28fr);
  overflow: hidden;
  background: white;
  border-radius: 30px;
  box-shadow: 0 28px 80px rgba(7, 23, 44, .13);
}

.portal-intro {
  position: relative;
  overflow: hidden;
  min-height: 780px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(38px, 5vw, 72px);
  color: white;
  background: radial-gradient(circle at 100% 0%, #174b83 0, transparent 38%), var(--navy);
}

.portal-intro::before,
.portal-intro::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(92, 153, 255, .22);
  border-radius: 50%;
  pointer-events: none;
}

.portal-intro::before { width: 420px; height: 170px; right: -165px; bottom: 120px; transform: rotate(45deg); }
.portal-intro::after { width: 420px; height: 170px; right: -165px; bottom: 120px; transform: rotate(-45deg); }
.portal-intro > * { position: relative; z-index: 1; }
.portal-kicker, .form-eyebrow { color: var(--orange); font-size: .78rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.portal-intro h1 { margin: 19px 0 22px; font-size: clamp(2.45rem, 4vw, 4.15rem); line-height: 1.02; letter-spacing: -.055em; }
.portal-intro h1 em { color: #78aaff; font-style: normal; }
.portal-intro > div > p { max-width: 470px; margin: 0; color: #adc0d7; }

.portal-points { display: grid; gap: 19px; margin: 60px 0; }
.portal-points > div { display: grid; grid-template-columns: 42px 1fr; gap: 15px; align-items: start; }
.portal-points span { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); border-radius: 13px; font-size: .72rem; font-weight: 900; }
.portal-points p { margin: 0; color: #8fa4bd; font-size: .87rem; line-height: 1.45; }
.portal-points strong { display: block; margin-bottom: 3px; color: white; font-size: .96rem; }
.portal-formulas { display: flex; align-items: center; gap: 13px; color: #7890aa; font-family: Georgia, serif; font-size: .86rem; font-style: italic; }
.portal-formulas i { width: 4px; height: 4px; background: var(--orange); border-radius: 50%; }

.portal-panel { padding: clamp(36px, 5vw, 72px); }
.portal-panel-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 36px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.portal-panel h2 { margin: 8px 0 5px; font-size: clamp(2rem, 3.2vw, 3.05rem); line-height: 1.08; letter-spacing: -.045em; }
.portal-panel-top p { max-width: 580px; margin: 0; color: var(--muted); font-size: .94rem; }

.portal-tabs { flex: 0 0 auto; display: flex; gap: 5px; padding: 5px; background: var(--mist); border-radius: 999px; }
.portal-tab { min-height: 42px; padding: 0 18px; color: var(--muted); background: transparent; border: 0; border-radius: 999px; font-weight: 850; cursor: pointer; }
.portal-tab.active { color: white; background: var(--navy); box-shadow: 0 6px 18px rgba(7,23,44,.15); }
.portal-tab:focus-visible, .portal-submit:focus-visible, .switch-prompt button:focus-visible, .home-link:focus-visible { outline: 3px solid rgba(39,119,255,.28); outline-offset: 3px; }

.student-form { padding-top: 31px; }
.student-form fieldset { min-width: 0; margin: 0 0 29px; padding: 0; border: 0; }
.student-form legend { width: 100%; margin: 0 0 17px; padding: 0 0 9px; color: var(--ink); border-bottom: 1px solid #edf0f5; font-size: .84rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; color: #38465a; font-size: .84rem; font-weight: 780; }
.field-wide { grid-column: 1 / -1; }
.field b, .terms-check b { color: var(--orange); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid #dce4ee;
  border-radius: 12px;
  font: inherit;
  font-size: .94rem;
  font-weight: 520;
  outline: none;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #98a4b5; }
.field input:focus, .field select:focus, .field textarea:focus { background: white; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(39,119,255,.1); }
.field input:user-invalid, .field select:user-invalid, .field textarea:user-invalid { border-color: #e04b3e; }

.terms-check { display: flex; align-items: flex-start; gap: 11px; margin: 5px 0 22px; color: #4e5a6c; font-size: .87rem; cursor: pointer; }
.terms-check input { width: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--orange); }
.portal-submit { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 14px; color: white; background: var(--orange); border: 0; border-radius: 14px; box-shadow: 0 13px 30px rgba(255,103,56,.24); font: inherit; font-weight: 900; cursor: pointer; transition: transform .2s ease, background .2s ease, box-shadow .2s ease; }
.portal-submit:hover { transform: translateY(-2px); background: var(--orange-dark); box-shadow: 0 16px 34px rgba(255,103,56,.3); }
.portal-submit:disabled { transform: none; opacity: .72; cursor: wait; box-shadow: none; }
.button-spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.45); border-top-color: white; border-radius: 50%; animation: portal-spin .75s linear infinite; }
.switch-prompt { margin: 17px 0 0; text-align: center; color: var(--muted); font-size: .87rem; }
.switch-prompt button { padding: 0; color: #155bbd; background: none; border: 0; font: inherit; font-weight: 850; cursor: pointer; }

.form-alert { margin-top: 26px; padding: 13px 15px; color: #7a4a00; background: #fff5dd; border: 1px solid #f3d798; border-radius: 12px; font-size: .88rem; font-weight: 700; }
.form-alert.error { color: #9b2c26; background: #fff0ee; border-color: #f2bbb5; }
.form-alert.success { color: #236a40; background: #eaf8ef; border-color: #addbbb; }

.login-form { width: min(480px, 100%); margin: 22px auto 0; }
.login-form .field { margin-bottom: 19px; }
.login-mark { width: 78px; height: 78px; display: grid; place-items: center; margin: 0 auto 34px; color: #155bbd; background: #edf4ff; border-radius: 25px; }
.login-mark svg { width: 38px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.demo-access { margin: -3px 0 20px; padding: 12px 14px; color: #607086; background: #f5f8fc; border: 1px solid #e2e9f2; border-radius: 11px; font-size: .79rem; line-height: 1.45; }
.demo-access strong { display: block; color: var(--ink); }
.demo-access b { color: #155bbd; font-weight: 850; }

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

@media (max-width: 1040px) {
  .portal-shell { grid-template-columns: minmax(270px, .58fr) minmax(530px, 1.42fr); }
  .portal-intro { padding: 42px 34px; }
  .portal-points { margin: 45px 0; }
  .portal-panel { padding: 44px 36px; }
  .portal-panel-top { flex-direction: column; gap: 23px; }
}

@media (max-width: 820px) {
  .portal-header, .portal-shell { width: min(100% - 28px, 680px); }
  .portal-shell { display: block; }
  .portal-intro { min-height: auto; padding: 35px; }
  .portal-intro h1 { max-width: 550px; }
  .portal-points, .portal-formulas { display: none; }
  .portal-panel { padding: 38px 30px 46px; }
}

@media (max-width: 560px) {
  .portal-header { min-height: 72px; }
  .portal-header .brand { font-size: .98rem; }
  .home-link { width: 43px; padding: 0; justify-content: center; font-size: 0; }
  .portal-shell { width: 100%; margin-bottom: 0; border-radius: 24px 24px 0 0; }
  .portal-intro { padding: 30px 22px; }
  .portal-intro h1 { margin-bottom: 13px; font-size: 2.25rem; }
  .portal-intro > div > p { font-size: .91rem; }
  .portal-panel { padding: 31px 20px 42px; }
  .portal-panel-top { padding-bottom: 25px; }
  .portal-panel h2 { font-size: 2rem; }
  .portal-tabs { width: 100%; }
  .portal-tab { flex: 1; }
  .form-grid { grid-template-columns: 1fr; gap: 15px; }
  .field-wide { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .home-link, .portal-submit { transition: none; }
  .button-spinner { animation: none; }
}
