/* ============================================================
   QUANTUM CELL LABS — PORTAL styles
   ============================================================ */

/* slim portal nav variant */
.nav-portal { background: rgba(12,12,13,0.85); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.nav-portal .nav-inner { height: 64px; }

.btn-portal { padding: 10px 18px; }

/* page bg */
.portal-body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 800px at 18% 25%, rgba(120,140,180,0.06) 0%, transparent 60%),
    radial-gradient(900px 600px at 95% 90%, rgba(180,180,160,0.04) 0%, transparent 55%),
    var(--bg-0);
}

/* ─── PORTAL SHELL ─── */
.portal {
  padding: 100px 0 60px;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}
.portal-shell {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 56px;
  align-items: stretch;
}
@media (max-width: 980px) {
  .portal-shell { grid-template-columns: 1fr; gap: 28px; }
}

/* ─── LEFT CONTEXT PANEL ─── */
.portal-context {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(22,22,25,0.6), rgba(15,15,18,0.4));
  border-radius: 2px;
  padding: 44px 40px 36px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.portal-context-bg { position: absolute; inset: 0; pointer-events: none; opacity: 0.55; }
.portal-context-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(232,232,230,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,232,230,0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, black 0%, transparent 90%);
}
.portal-context-glyph {
  position: absolute;
  right: -120px; bottom: -100px;
  width: 460px; height: 460px;
  background: url('assets/qcl-flower-of-life.png') center / contain no-repeat;
  opacity: 0.045;
  filter: invert(1) brightness(2);
}
.portal-context-inner { position: relative; display: flex; flex-direction: column; gap: 36px; flex: 1; }

.portal-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t3);
  transition: color 0.2s;
  width: max-content;
}
.portal-back:hover { color: var(--silver); }

.portal-context-head h1.portal-h {
  font-family: var(--f-sans);
  font-size: clamp(36px, 4.2vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 400;
  margin-top: 18px;
  margin-bottom: 20px;
  color: var(--t1);
}
.portal-context-head h1.portal-h .ser {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 300;
  color: var(--silver);
}
.portal-lede {
  color: var(--t2);
  font-size: 15px;
  line-height: 1.65;
  max-width: 460px;
}

/* portal switcher */
.portal-switch {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.portal-card {
  position: relative;
  text-align: left;
  background: rgba(20,20,24,0.55);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 22px 22px 20px;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.portal-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.25s;
}
.portal-card:hover { border-color: var(--line-2); background: rgba(24,24,28,0.7); }
.portal-card.active {
  border-color: var(--line-bright);
  background: rgba(28,28,32,0.85);
}
.portal-card.active::before { background: var(--silver); }

.portal-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.portal-card-icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  color: var(--silver-2);
  margin-top: 2px;
}
.portal-card-tag {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--t3);
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}
.portal-card-head h3 {
  font-family: var(--f-sans);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--t1);
  line-height: 1.2;
}
.portal-card p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--t2);
}
.portal-card-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.portal-card-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--t3);
  letter-spacing: 0.02em;
}
.portal-card-list .dot {
  width: 4px; height: 4px;
  background: var(--silver-3);
  border-radius: 50%;
  flex-shrink: 0;
}

.portal-context-foot {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.portal-foot-row { font-size: 11px; }

/* ─── RIGHT FORM ─── */
.portal-form-wrap { display: flex; flex-direction: column; gap: 18px; }

.portal-form-frame {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(22,22,26,0.85), rgba(16,16,19,0.92));
  border-radius: 2px;
  padding: 32px 40px 40px;
  overflow: hidden;
}
.portal-form-frame::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-bright), transparent);
}

/* top status row */
.portal-form-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.portal-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  padding: 6px 12px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silver-2);
  border-radius: 2px;
}
.portal-pill .dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: pillPulse 2.4s ease-in-out infinite;
}
@keyframes pillPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.portal-form-top-r { font-size: 11px; }

/* tabs */
.portal-tabs {
  position: relative;
  display: flex;
  gap: 0;
  margin: 24px 0 28px;
  border-bottom: 1px solid var(--line);
}
.portal-tab {
  position: relative;
  padding: 14px 24px 14px 0;
  margin-right: 28px;
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--t3);
  transition: color 0.2s;
  white-space: nowrap;
}
.portal-tab:hover { color: var(--t2); }
.portal-tab.active { color: var(--t1); }
.portal-tab-ind {
  position: absolute;
  bottom: -1px;
  height: 1px;
  background: var(--silver);
  transition: left 0.35s cubic-bezier(0.6,0,0.2,1), width 0.35s cubic-bezier(0.6,0,0.2,1);
  pointer-events: none;
}

/* panels */
.portal-panel { display: none; animation: panelIn 0.4s ease both; }
.portal-panel.active { display: block; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.portal-panel-head { margin-bottom: 28px; }
.portal-panel-head h2 {
  font-family: var(--f-sans);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--t1);
  margin-bottom: 8px;
}
.portal-panel-head p {
  color: var(--t2);
  font-size: 14px;
}

/* ─── FORM PRIMITIVES ─── */
.portal-form { display: flex; flex-direction: column; gap: 20px; }

.field { display: flex; flex-direction: column; gap: 8px; position: relative; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 540px) { .field-pair { grid-template-columns: 1fr; } }

.field label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t3);
}
.field-row { display: flex; justify-content: space-between; align-items: center; }
.field-link {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--silver-3);
  transition: color 0.2s;
}
.field-link:hover { color: var(--silver); }

.field-hint { font-size: 11px; color: var(--t4); letter-spacing: 0.04em; }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field textarea,
.field select {
  font-family: var(--f-sans);
  font-size: 14.5px;
  background: rgba(12,12,14,0.6);
  border: 1px solid var(--line-2);
  color: var(--t1);
  padding: 13px 14px;
  border-radius: 2px;
  width: 100%;
  transition: border-color 0.2s, background 0.2s;
  outline: none;
}
.field textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
.field input::placeholder, .field textarea::placeholder { color: var(--t4); }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--line-bright); }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--silver);
  background: rgba(16,16,20,0.85);
}

.input-wrap { position: relative; }
.input-wrap input { padding-right: 44px; }
.input-icon {
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  border-radius: 2px;
  transition: color 0.2s, background 0.2s;
}
.input-icon:hover { color: var(--silver); background: rgba(232,232,230,0.05); }

.select-wrap { position: relative; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
}
.select-wrap select option { background: var(--bg-1); color: var(--t1); }
.select-arrow {
  position: absolute;
  top: 50%; right: 14px;
  transform: translateY(-50%);
  color: var(--t3);
  pointer-events: none;
}

.field-row-split { display: flex; justify-content: space-between; align-items: center; }

/* checkbox */
.check {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.check-stack { align-items: flex-start; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  width: 16px; height: 16px;
  border: 1px solid var(--line-bright);
  border-radius: 2px;
  background: rgba(12,12,14,0.6);
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}
.check-box::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--silver);
  border-radius: 1px;
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.6,0,0.2,1);
}
.check input:checked + .check-box { border-color: var(--silver); }
.check input:checked + .check-box::after { transform: scale(1); }
.check-label {
  font-size: 13px;
  line-height: 1.55;
  color: var(--t2);
}
.check-label strong { color: var(--silver); font-weight: 500; }
.check-label .ulink { color: var(--silver); text-decoration: underline; text-decoration-color: var(--line-bright); text-underline-offset: 3px; }
.check-label .ulink:hover { text-decoration-color: var(--silver); }

/* submit */
.btn-portal-submit { width: 100%; justify-content: center; }

/* divider */
.portal-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--t4);
  margin: 4px 0;
}
.portal-divider::before, .portal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* SSO */
.portal-sso { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 540px) { .portal-sso { grid-template-columns: 1fr; } }
.btn-sso {
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 13px;
}

.portal-foot-note {
  text-align: center;
  font-size: 13px;
  color: var(--t3);
  margin-top: 8px;
}
.portal-foot-note a {
  color: var(--silver);
  border-bottom: 1px solid var(--line-bright);
  transition: border-color 0.2s;
}
.portal-foot-note a:hover { border-color: var(--silver); }

/* ─── REGISTER STEPPER ─── */
.portal-steps {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  position: relative;
  margin-bottom: 30px;
  padding-bottom: 20px;
}
.step {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 14px;
  position: relative;
  z-index: 2;
  border-left: 1px solid var(--line);
  transition: opacity 0.3s;
  opacity: 0.5;
}
.step:first-child { border-left: 0; padding-left: 0; }
.step.active, .step.complete { opacity: 1; }
.step-num {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--silver-3);
}
.step.active .step-num, .step.complete .step-num { color: var(--silver); }
.step-label {
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--t2);
  letter-spacing: -0.005em;
}
.step.active .step-label { color: var(--t1); }
.step-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: var(--line);
  grid-column: 1 / -1;
}
.step-bar-fill {
  display: block;
  height: 100%;
  width: 33.33%;
  background: var(--silver);
  transition: width 0.4s cubic-bezier(0.6,0,0.2,1);
}

.reg-step { display: none; animation: panelIn 0.35s ease both; flex-direction: column; gap: 20px; }
.reg-step.active { display: flex; }

.reg-step-foot {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.reg-step-foot .btn-ghost { flex: 0 0 auto; padding: 14px 20px; }
.reg-step-foot .btn-portal-submit { flex: 1; }

/* portal-type-conditional credential blocks */
.reg-cred { display: none; flex-direction: column; gap: 20px; }
body[data-portal="physician"] .reg-cred-physician { display: flex; }
body[data-portal="researcher"] .reg-cred-researcher { display: flex; }

/* ─── REVIEW ─── */
.reg-review {
  background: rgba(12,12,14,0.5);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 20px 22px;
}
.reg-review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.reg-review-list {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 18px;
  font-size: 13.5px;
}
.reg-review-list dt {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t3);
  align-self: center;
}
.reg-review-list dd { color: var(--t1); }
.reg-review-list dd.empty { color: var(--t4); font-style: italic; }

/* password strength */
.pw-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.pw-bar {
  flex: 1;
  height: 3px;
  background: var(--bg-2);
  border-radius: 2px;
  overflow: hidden;
}
.pw-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--t4);
  transition: width 0.3s, background 0.3s;
}
.pw-strength.s1 .pw-fill { width: 25%; background: #b04a4a; }
.pw-strength.s2 .pw-fill { width: 50%; background: #b08a4a; }
.pw-strength.s3 .pw-fill { width: 75%; background: #8aa86a; }
.pw-strength.s4 .pw-fill { width: 100%; background: var(--silver); }
.pw-label { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; }

/* ─── SUCCESS ─── */
.reg-success { display: none; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding: 24px 20px 8px; }
.reg-success.active { display: flex; }
.reg-success-mark {
  width: 88px; height: 88px;
  color: var(--silver);
  margin-bottom: 4px;
  animation: successIn 0.6s cubic-bezier(0.6,0,0.2,1) both;
}
@keyframes successIn { from { opacity: 0; transform: scale(0.92); } }
.reg-success h3 {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 300;
  font-size: 30px;
  letter-spacing: -0.01em;
  color: var(--t1);
}
.reg-success > p { color: var(--t2); max-width: 460px; line-height: 1.6; }
.reg-success > p strong { color: var(--silver); }
.reg-success-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  max-width: 440px;
  gap: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  margin: 8px 0 4px;
  font-size: 11px;
}
.reg-success-meta > div { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.reg-success-meta > div span:first-child { color: var(--t4); letter-spacing: 0.12em; text-transform: uppercase; }
.reg-success-meta > div span:last-child { color: var(--silver); font-size: 12px; }

/* outer foot */
.portal-form-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 4px;
  flex-wrap: wrap;
  font-size: 11px;
}
.portal-foot-divider { width: 4px; height: 4px; background: var(--t4); border-radius: 50%; }
.portal-form-foot a { transition: color 0.2s; }
.portal-form-foot a:hover { color: var(--silver); }

/* ── REFERRAL FIELD (researcher signup) ── */
.field-optional {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--t4);
  text-transform: uppercase;
  margin-left: 4px;
}
.referral-field input { letter-spacing: 0.06em; }
.referral-note {
  font-size: 12px;
  color: var(--t3);
  line-height: 1.55;
  margin-top: 2px;
}
.referral-mark {
  pointer-events: none;
  color: transparent;
  transition: color 0.2s;
}
.referral-mark.valid { color: oklch(0.78 0.12 150); }
.referral-mark.invalid { color: oklch(0.65 0.16 25); }
.field-hint.valid { color: oklch(0.78 0.12 150); }
.field-hint.invalid { color: oklch(0.65 0.16 25); }
.field-hint.pending { color: oklch(0.78 0.06 220); }
@media (max-width: 540px) {
  .portal { padding: 88px 0 40px; }
  .portal-context { padding: 32px 24px 28px; }
  .portal-form-frame { padding: 24px 22px 32px; }
  .portal-tab { padding: 12px 0; margin-right: 22px; font-size: 13px; }
  .portal-panel-head h2 { font-size: 22px; }
  .reg-review-list { grid-template-columns: 1fr; gap: 4px 0; }
  .reg-review-list dd { padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
}
