/* ── Portal selection & sign-in ── */
:root {
  --portal-green-900: #064e3b;
  --portal-green-800: #065f46;
  --portal-green-700: #047857;
  --portal-green-600: #059669;
  --portal-green-100: #d1fae5;
  --portal-green-50: #ecfdf5;
  --portal-lime: #a3e635;
  --portal-lime-hover: #84cc16;
  --portal-ink: #0f172a;
  --portal-muted: #64748b;
  --portal-muted-light: #94a3b8;
  --portal-border: #e2e8f0;
  --portal-surface: #ffffff;
  --portal-font: "Inter", system-ui, -apple-system, sans-serif;
  --portal-container: 1120px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.portal-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--portal-font);
  color: var(--portal-ink);
  background:
    radial-gradient(ellipse 90% 70% at 0% 0%, rgba(167, 243, 208, 0.45), transparent 58%),
    radial-gradient(ellipse 60% 50% at 100% 20%, rgba(236, 253, 245, 0.8), transparent 55%),
    #ffffff;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.portal-page::before {
  content: "";
  position: fixed;
  right: -6%;
  bottom: -8%;
  width: min(58vw, 680px);
  height: min(62vh, 560px);
  background: radial-gradient(
    ellipse at 72% 68%,
    rgba(167, 243, 208, 0.55) 0%,
    rgba(209, 250, 229, 0.42) 30%,
    rgba(236, 253, 245, 0.22) 55%,
    transparent 74%
  );
  pointer-events: none;
  z-index: 0;
}

.portal-header,
.portal-flashes,
.portal-main,
.portal-lower,
.portal-footer {
  position: relative;
  z-index: 1;
}

a { color: inherit; text-decoration: none; }

/* ── Header ── */
.portal-header {
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.portal-header__inner {
  width: min(100% - 2.5rem, var(--portal-container));
  margin: 0 auto;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.portal-brand__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--portal-green-800);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.portal-brand__icon svg { width: 20px; height: 20px; }

.portal-brand__text { display: flex; flex-direction: column; line-height: 1.15; }

.portal-brand__name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.portal-brand__tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--portal-muted-light);
}

.portal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.portal-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--portal-muted);
  transition: color 0.15s ease;
}

.portal-nav a:hover { color: var(--portal-ink); }

.portal-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--portal-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--portal-green-800);
  white-space: nowrap;
}

.portal-live-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--portal-green-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18);
}

/* ── Flashes ── */
.portal-flashes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(100% - 2.5rem, var(--portal-container));
  margin: 1rem auto 0;
}

.portal-flashes .portal-flash {
  margin-bottom: 0;
}

.portal-flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  background: var(--portal-green-50);
  color: var(--portal-green-800);
  border: 1px solid var(--portal-green-100);
}

.portal-flash--error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* ── Main ── */
.portal-main {
  flex: 1;
  width: min(100% - 2.5rem, var(--portal-container));
  margin: 0 auto;
  padding: 3rem 0 3.5rem;
}

/* ── Hero ── */
.portal-hero {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 3rem;
}

.portal-welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  margin-bottom: 1.35rem;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: rgba(236, 253, 245, 0.95);
  color: var(--portal-green-800);
  font-size: 0.78rem;
  font-weight: 700;
}

.portal-welcome-badge span[aria-hidden="true"] {
  color: var(--portal-green-600);
  font-size: 0.85rem;
}

.portal-welcome-badge--compact { margin-bottom: 1rem; }

.portal-hero__title {
  font-size: clamp(2rem, 5vw, 3.15rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin-bottom: 1rem;
}

.portal-hero__accent {
  color: var(--portal-green-800);
}

.portal-hero__subtitle {
  max-width: 620px;
  margin: 0 auto;
  color: var(--portal-muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

/* ── Portal cards ── */
.portal-card-form {
  margin: 0;
  display: contents;
}

.portal-card-form .portal-card {
  width: 100%;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
}

.portal-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem;
  max-width: 860px;
  margin: 0 auto 2.25rem;
}

.portal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 320px;
  padding: 1.85rem 1.75rem 1.45rem;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: 24px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.28s ease;
}

.portal-card__glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(circle at 92% 4%, rgba(45, 212, 191, 0.55) 0%, rgba(167, 243, 208, 0.28) 24%, transparent 58%),
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(110, 231, 183, 0.35), transparent 65%);
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.portal-card:hover {
  transform: translateY(-6px);
  border-color: #d1d5db;
  box-shadow:
    0 2px 6px rgba(15, 23, 42, 0.04),
    0 14px 28px rgba(15, 23, 42, 0.07),
    0 28px 56px rgba(6, 95, 70, 0.14);
}

.portal-card:hover .portal-card__glow {
  opacity: 1;
}

.portal-card__icon {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--portal-green-600), var(--portal-green-800));
  color: #fff;
  display: grid;
  place-items: center;
  margin-bottom: 0.55rem;
  box-shadow: 0 8px 20px rgba(6, 95, 70, 0.22);
}

.portal-card__icon svg { width: 24px; height: 24px; }

.portal-card__eyebrow {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--portal-green-700);
}

.portal-card__title {
  position: relative;
  z-index: 1;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.portal-card__desc {
  position: relative;
  z-index: 1;
  color: var(--portal-muted);
  font-size: 0.94rem;
  line-height: 1.6;
  flex: 1;
  padding-top: 0.15rem;
}

.portal-card__footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--portal-border);
  margin-top: auto;
}

.portal-card__cta {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--portal-ink);
}

.portal-card__arrow {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--portal-green-800);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition:
    background 0.28s ease,
    color 0.28s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s ease;
}

.portal-card__arrow svg { width: 18px; height: 18px; }

.portal-card:hover .portal-card__arrow {
  background: var(--portal-lime);
  color: var(--portal-ink);
  transform: translateX(3px);
  box-shadow: 0 6px 16px rgba(163, 230, 53, 0.45);
}

/* ── Lower section ── */
.portal-lower {
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding-top: 0.25rem;
}

.portal-lower::before {
  content: "";
  position: absolute;
  top: -2.5rem;
  right: -4%;
  width: 62%;
  height: calc(100% + 4rem);
  background: radial-gradient(
    ellipse at 88% 58%,
    rgba(167, 243, 208, 0.5) 0%,
    rgba(209, 250, 229, 0.32) 34%,
    rgba(236, 253, 245, 0.14) 58%,
    transparent 76%
  );
  pointer-events: none;
  z-index: 0;
}

.portal-lower > * {
  position: relative;
  z-index: 1;
}

/* ── Feature bar ── */
.portal-features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  padding: 1.15rem 2rem;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 999px;
  box-shadow: 0 10px 36px rgba(15, 23, 42, 0.06);
}

.portal-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.portal-feature__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--portal-green-50);
  color: var(--portal-green-800);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}

.portal-feature__icon svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.portal-feature__text {
  min-width: 0;
}

.portal-feature strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--portal-ink);
}

.portal-feature__text span {
  display: block;
  font-size: 0.78rem;
  color: var(--portal-muted);
  margin-top: 0.1rem;
  line-height: 1.3;
}

/* ── Sign-in page ── */
.portal-main--auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2rem;
}

.portal-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--portal-muted);
  transition: color 0.15s ease;
}

.portal-back svg { width: 18px; height: 18px; }

.portal-back:hover { color: var(--portal-ink); }

.portal-auth-card {
  width: min(100%, 460px);
  padding: 2rem 2rem 1.75rem;
  background: var(--portal-surface);
  border: 1px solid var(--portal-border);
  border-radius: 24px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.07);
}

.portal-auth-card__title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.45rem;
}

.portal-auth-card__subtitle {
  color: var(--portal-muted);
  font-size: 0.94rem;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.portal-auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portal-auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.portal-auth-field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--portal-ink);
}

.portal-auth-field input {
  width: 100%;
  padding: 0.82rem 0.95rem;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
  color: var(--portal-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.portal-auth-field input::placeholder { color: var(--portal-muted-light); }

.portal-auth-field input:focus {
  outline: none;
  border-color: var(--portal-green-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.portal-auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.9rem 1.25rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--portal-green-600), var(--portal-green-800));
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(6, 95, 70, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.portal-auth-submit svg { width: 18px; height: 18px; }

.portal-auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(6, 95, 70, 0.28);
}

.portal-auth-footer {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--portal-muted);
}

.portal-auth-footer a {
  color: var(--portal-green-800);
  font-weight: 700;
}

.portal-auth-footer a:hover { text-decoration: underline; }

/* ── Footer ── */
.portal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  width: min(100% - 2.5rem, var(--portal-container));
  margin: 0 auto;
  padding: 1.75rem 0 2rem;
  font-size: 0.84rem;
  color: var(--portal-muted);
}

.portal-footer--in-lower {
  width: 100%;
  padding: 1.5rem 0.25rem 0.5rem;
}

.portal-footer nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.portal-footer nav a { transition: color 0.15s ease; }

.portal-footer nav a:hover { color: var(--portal-ink); }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .portal-header__inner {
    width: min(100% - 1.75rem, var(--portal-container));
  }

  .portal-main {
    width: min(100% - 1.75rem, var(--portal-container));
  }

  .portal-cards {
    max-width: 720px;
  }
}

@media (max-width: 900px) {
  .portal-header__inner {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }

  .portal-brand { grid-column: 1; }

  .portal-live-badge {
    grid-column: 2;
    grid-row: 1;
  }

  .portal-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 1.25rem;
    padding-bottom: 0.25rem;
  }
}

@media (max-width: 820px) {
  .portal-hero__subtitle {
    font-size: 0.95rem;
    padding: 0 0.5rem;
  }

  .portal-cards {
    grid-template-columns: 1fr;
    max-width: 440px;
  }

  .portal-card {
    min-height: auto;
  }

  .portal-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 28px;
    padding: 1.25rem 1.35rem;
  }

  .portal-lower {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .portal-header__inner {
    min-height: auto;
    padding: 0.75rem 0 0.5rem;
    gap: 0.75rem;
  }

  .portal-nav {
    gap: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .portal-nav::-webkit-scrollbar { display: none; }

  .portal-main {
    padding: 2rem 0 2.5rem;
  }

  .portal-hero {
    margin-bottom: 2rem;
  }

  .portal-footer,
  .portal-footer--in-lower {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

@media (max-width: 520px) {
  .portal-main { padding-top: 2rem; }

  .portal-hero__title { font-size: 1.85rem; }

  .portal-nav { flex-wrap: wrap; gap: 0.85rem 1.25rem; }

  .portal-live-badge { display: none; }

  .portal-features {
    grid-template-columns: 1fr;
    border-radius: 24px;
  }

  .portal-lower::before {
    width: 85%;
    right: -12%;
  }

  .portal-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .portal-auth-card {
    padding: 1.5rem 1.25rem 1.35rem;
  }
}

@media (max-width: 380px) {
  .portal-header__inner,
  .portal-main,
  .portal-lower {
    width: min(100% - 1.25rem, var(--portal-container));
  }

  .portal-card {
    padding: 1.35rem 1.2rem 1.15rem;
  }

  .portal-card__title {
    font-size: 1.35rem;
  }

  .portal-features {
    padding: 1rem;
    gap: 1rem;
  }
}
