/* NorthBridge Portal — sign-in / entry design.
   Loaded only on portal auth pages (see templates/portal/auth_base.html). */

html:has(body.portal-body) {
  background: #eef0f4;
}

body.portal-body {
  --bg: #eef0f4;
  --ink: #14161b;
  --ink-soft: #565c6b;
  --card: #ffffff;
  --line: #dfe2ea;
  --navy-1: #232c52;
  --navy-2: #131a33;
  --blue: #3f6fd6;
  --blue-1: #3f6fd6;
  --blue-2: #2c50aa;
  --field: #f5f6f9;

  margin: 0;
  background: var(--bg);
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* ---------- decorative background ---------- */
.portal-body .blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .35;
  pointer-events: none;
  z-index: 0;
}
.portal-body .blob-1 { width: 420px; height: 420px; background: #3f6fd6; top: -160px; left: -140px; }
.portal-body .blob-2 { width: 380px; height: 380px; background: #3f8f66; bottom: -80px; right: -120px; }
.portal-body .blob-3 { width: 300px; height: 300px; background: #c8862c; top: 38%; right: -160px; opacity: .18; }
.portal-body .grid-overlay {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(20,22,27,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,22,27,.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 40%, black 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 40%, black 40%, transparent 85%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- top bar ---------- */
.portal-body .topbar {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 24px 0;
}
.portal-body .brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.portal-body .brand-mark {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.portal-body .brand-mark svg,
.portal-body .brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.portal-body .brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 16px; line-height: 1.1;
}
.portal-body .brand-name span {
  display: block; font-weight: 500; font-size: 11px;
  color: var(--ink-soft); letter-spacing: .02em;
}

/* ---------- main ---------- */
.portal-body main {
  position: relative; z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.portal-body .stage {
  width: 100%;
  max-width: 520px;
  opacity: 0;
  transform: translateY(10px);
  animation: portalRise .6s cubic-bezier(.2,.8,.2,1) .1s forwards;
}
@keyframes portalRise { to { opacity: 1; transform: translateY(0); } }

.portal-body .eyebrow-pill { display: flex; justify-content: center; margin-bottom: 18px; }
.portal-body .eyebrow-pill span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 6px;
}
.portal-body .eyebrow-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: #3f8f66; }

/* ---------- card ---------- */
.portal-body .card {
  background: var(--card);
  border-radius: 24px;
  padding: 40px 38px 36px;
  box-shadow: 0 30px 60px -26px rgba(20,22,27,.22);
  border: 1px solid var(--line);
}
.portal-body .card h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px; font-weight: 700;
  text-align: center;
  margin: 0 0 8px;
  letter-spacing: -.01em;
}
.portal-body .card .sub {
  font-size: 14px; color: var(--ink-soft);
  text-align: center;
  margin: 0 0 30px;
}

/* ---------- option cards ---------- */
.portal-body .options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.portal-body .opt {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 22px 18px;
  text-align: left;
  cursor: pointer;
  background: #fff;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), border-color .25s ease, box-shadow .25s ease;
  position: relative;
  text-decoration: none;
  color: inherit;
  display: block;
}
.portal-body .opt:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--tone) 45%, var(--line));
  box-shadow: 0 18px 32px -18px color-mix(in srgb, var(--tone) 55%, transparent);
}
.portal-body .opt:focus-visible { outline: 2px solid var(--tone); outline-offset: 2px; }
.portal-body .opt-icon {
  width: 40px; height: 40px; border-radius: 11px;
  background: color-mix(in srgb, var(--tone) 14%, white);
  color: var(--tone);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.portal-body .opt:hover .opt-icon { transform: rotate(-6deg) scale(1.06); }
.portal-body .opt-icon svg { width: 19px; height: 19px; }
.portal-body .opt-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15.5px; margin-bottom: 5px; }
.portal-body .opt-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; margin-bottom: 18px; }
.portal-body .opt-go {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), background .25s ease;
}
.portal-body .opt:hover .opt-go { background: var(--tone); transform: translateX(3px); }
.portal-body .opt-go svg { width: 13px; height: 13px; }

/* ---------- login form ---------- */
.portal-body .portal-form { display: grid; gap: 16px; text-align: left; }
.portal-body .portal-form .field { display: grid; gap: 6px; }
.portal-body .portal-form label {
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}
.portal-body .portal-form input {
  width: 100%;
  font: inherit; font-size: 14px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #f7f8fb;
  color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.portal-body .portal-form input:focus {
  outline: none;
  background: #fff;
  border-color: var(--tone, var(--blue));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone, var(--blue)) 18%, transparent);
}
.portal-body .btn-submit {
  margin-top: 4px;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; font-size: 15px;
  color: #fff;
  background: var(--ink);
  padding: 13px 18px;
  border-radius: 12px;
  transition: transform .2s cubic-bezier(.2,.8,.2,1), background .2s ease;
}
.portal-body .btn-submit:hover { background: var(--tone, var(--navy-1)); transform: translateY(-2px); }
.portal-body .btn-submit:active { transform: translateY(0); }

/* ---------- flashes ---------- */
.portal-body .portal-flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.portal-body .portal-flash {
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
}
.portal-body .portal-flash-success { border-color: #bfe0c6; background: #eef8f0; color: #1f6b39; }
.portal-body .portal-flash-error { border-color: #f0c4c4; background: #fdeeee; color: #a12727; }

/* ---------- helper + footer ---------- */
.portal-body .helper { text-align: center; margin: 26px 0 0; font-size: 12.5px; color: var(--ink-soft); }
.portal-body .helper a { color: var(--navy-1); font-weight: 600; text-decoration: none; }
.portal-body .helper a:hover { text-decoration: underline; }

.portal-body footer {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  gap: 22px;
  margin: 0;
  background: transparent;
  padding: 0 24px 32px;
  font-size: 12px;
  color: #9aa0b0;
}
.portal-body footer a { color: inherit; text-decoration: none; }
.portal-body footer a:hover { color: var(--ink-soft); }
.portal-body footer .sep { width: 3px; height: 3px; border-radius: 50%; background: #c3c7d2; }

/* ---------- rich auth form (employee / single-column sign-in) ---------- */
.portal-body .stage.narrow { max-width: 420px; }

.portal-body .back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 18px;
}
.portal-body .back-link:hover { color: var(--ink); }
.portal-body .back-link svg { width: 13px; height: 13px; }

.portal-body .card.auth-card {
  padding: 38px 36px 34px;
  --accent: var(--navy-1);
  --accent-strong: var(--navy-2);
}
.portal-body .card.auth-card.accent-blue {
  --accent: var(--blue-1);
  --accent-strong: var(--blue-2);
}
.portal-body .card.auth-card h1 { text-align: left; font-size: 25px; }
.portal-body .card.auth-card .sub { text-align: left; font-size: 13.5px; line-height: 1.55; margin-bottom: 28px; }

.portal-body .role-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: #9098ab;
  background: #f5f6f9;
  padding: 6px 12px; border-radius: 20px;
  margin-bottom: 18px;
}
.portal-body .role-tag svg { width: 12px; height: 12px; color: var(--accent, var(--navy-1)); }
.portal-body .auth-card.accent-blue .role-tag { color: #7c8cc4; background: #eef2fc; }

.portal-body .auth-form .field { margin-bottom: 16px; }
.portal-body .auth-form .field-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: #8b91a1;
  margin-bottom: 7px;
}
.portal-body .auth-form .field-row { position: relative; }
.portal-body .auth-form input {
  width: 100%;
  background: var(--field);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  padding: 13px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--ink);
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.portal-body .auth-form input::placeholder { color: #a3a9b8; }
.portal-body .auth-form input:focus {
  outline: none;
  border-color: var(--accent, var(--navy-1));
  background: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, var(--navy-1)) 13%, transparent);
}
.portal-body .auth-form .field.pw input { padding-right: 42px; }
.portal-body .auth-form .pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  color: #a3a9b8;
  background: none; border: none; cursor: pointer;
  padding: 0;
}
.portal-body .auth-form .pw-toggle:hover { color: var(--ink-soft); }
.portal-body .auth-form .pw-toggle svg { width: 17px; height: 17px; }

.portal-body .auth-form .field-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 7px;
}
.portal-body .auth-form .forgot {
  font-size: 11.5px; color: var(--accent, var(--navy-1)); text-decoration: none; font-weight: 600;
}
.portal-body .auth-form .forgot:hover { text-decoration: underline; }

.portal-body .auth-form .submit {
  width: 100%;
  background: var(--accent, var(--navy-1));
  color: #fff;
  border: none; border-radius: 30px;
  padding: 14px 22px;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 14.5px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  cursor: pointer;
  margin-top: 8px;
  transition: background .2s ease, transform .2s ease;
}
.portal-body .auth-form .submit:hover { background: var(--accent-strong, var(--navy-2)); }
.portal-body .auth-form .submit:active { transform: scale(.98); }
.portal-body .auth-form .submit svg { width: 16px; height: 16px; }

.portal-body .switch-role { text-align: center; margin: 22px 0 0; font-size: 13px; color: var(--ink-soft); }
.portal-body .switch-role a { color: var(--accent, var(--navy-1)); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.portal-body .switch-role a:hover { color: var(--accent-strong, var(--navy-2)); }

@media (max-width: 520px) {
  .portal-body .options { grid-template-columns: 1fr; }
  .portal-body .card { padding: 32px 24px 30px; }
  .portal-body footer { flex-wrap: wrap; row-gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-body .stage { animation: none; opacity: 1; transform: none; }
  .portal-body .opt, .portal-body .opt-icon, .portal-body .opt-go,
  .portal-body .btn-submit, .portal-body .portal-form input,
  .portal-body .auth-form input, .portal-body .auth-form .submit { transition: none; }
}
