:root {
  --blue: #2e78b8;
  --red: #d97a45;
  --blue-mid: #3f8ccc;
  --blue-lt: #75acd8;
  --blue-dk: #235c90;
  --red-dk: #b96538;
  --white: #ffffff;
  --cream: #fcf5ee;
  --text: #223548;
  --muted: #62778b;
  --border: #d4e0ea;
  --accent-soft: #f1c7ad;
  --auth-shadow:
    0 4px 6px rgba(34, 53, 72, 0.04),
    0 12px 30px rgba(34, 53, 72, 0.08),
    0 24px 60px rgba(35, 92, 144, 0.12);
}

html:has(body.auth-mode) {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html:has(body.auth-mode)::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body.auth-mode {
  font-family: "DM Sans", sans-serif;
  background: var(--blue-dk);
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: visible;
  display: flex;
  justify-content: center;
  padding: 16px 12px;
}

body.auth-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(46, 120, 184, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(217, 122, 69, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(63, 140, 204, 0.08) 0%, transparent 50%);
  z-index: 0;
}

body.auth-mode::after {
  content: "";
  position: fixed;
  top: -120px;
  right: -100px;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(217, 122, 69, 0.06);
  z-index: 0;
  animation: authFloatOrb 12s ease-in-out infinite;
}

@keyframes authFloatOrb {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(-30px, 20px) scale(1.08);
  }
}

.is-hidden {
  display: none !important;
}

#portalApp.is-hidden {
  display: none !important;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--blue-dk);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ld-spin {
  position: relative;
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ld-spin::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--red);
  border-right-color: rgba(185, 101, 56, 0.34);
  animation: authLoaderSpin 1s linear infinite;
}

.ld-spin::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: rgba(255, 255, 255, 0.25);
  border-left-color: rgba(255, 255, 255, 0.12);
  animation: authLoaderSpin 1.7s linear infinite reverse;
}

@keyframes authLoaderSpin {
  to {
    transform: rotate(360deg);
  }
}

.ld-img {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  padding: 6px;
  position: relative;
  z-index: 1;
  animation: authLoaderPulse 2s ease-in-out infinite;
  box-shadow: 0 0 30px rgba(185, 101, 56, 0.42);
}

@keyframes authLoaderPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(185, 101, 56, 0.34);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 46px rgba(185, 101, 56, 0.55);
  }
}

.ld-fallback {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 28px;
  color: #fff;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 30px rgba(185, 101, 56, 0.42);
}

.ld-name {
  text-align: center;
  color: var(--white);
  font-family: "Sora", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.ld-name small {
  display: block;
  margin-top: 0.3rem;
  font-family: "DM Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 3px;
}

.ld-track {
  width: 200px;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  overflow: hidden;
}

.ld-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), #e4ad85);
  border-radius: 99px;
  transition: width 0.15s ease;
}

.loader-status {
  min-height: 18px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  letter-spacing: 0.4px;
}

.login-wrapper {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}

body.auth-mode .login-wrapper {
  position: relative;
  inset: auto;
  width: 100%;
  margin: auto 0;
  flex-shrink: 0;
  padding: 0;
}

.login-shell {
  width: min(100%, 380px);
  position: relative;
  z-index: 1;
}

.login-card {
  width: 100%;
  background: var(--white);
  border: 2px solid var(--accent-soft);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--auth-shadow);
  animation: authCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-header {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 14px;
  text-align: center;
  background: linear-gradient(135deg, var(--blue-dk) 0%, #1a4a74 60%, #1e5a8a 100%);
}

.login-header::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.login-header::after {
  content: "";
  position: absolute;
  left: -20px;
  bottom: -60px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(217, 122, 69, 0.08);
}

.login-wrapper .brand-row {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.login-wrapper .brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--white);
  box-shadow: 0 8px 20px rgba(9, 28, 45, 0.16);
  overflow: hidden;
  flex-shrink: 0;
}

.login-wrapper .brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  padding: 2px;
}

.login-wrapper .brand-label strong {
  display: block;
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-transform: uppercase;
}

.login-wrapper .brand-label span {
  margin-top: 1px;
  display: block;
  font-size: 9px;
  color: var(--blue-lt);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-subtitle {
  position: relative;
  z-index: 1;
  font-size: 11.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.66);
}

.login-body {
  padding: 14px 18px 16px;
}

.error-msg {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent-soft);
  background: var(--cream);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--red-dk);
}

.error-msg.show {
  display: flex;
}

.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.2px;
}

.form-input-wrap {
  position: relative;
}

.form-input-wrap > svg {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  stroke: var(--muted);
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.15s;
}

.form-input-wrap:focus-within > svg {
  opacity: 1;
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 36px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-input::placeholder {
  color: #90a0af;
}

.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(46, 120, 184, 0.12);
  background: #fff;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle:hover {
  background: rgba(46, 120, 184, 0.08);
  color: var(--blue-dk);
}

.form-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  font-size: 12px;
  line-height: 1.25;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-wrap input {
  accent-color: var(--blue);
}

.forgot-link {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  font-size: 12px;
  line-height: 1.25;
  color: var(--blue-dk);
  text-decoration: none;
}

.form-row-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.forgot-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.login-btn {
  position: relative;
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dk) 100%);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  box-shadow: 0 10px 20px rgba(35, 92, 144, 0.22);
}

.login-btn:hover {
  transform: translateY(-1px);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn.loading .btn-text {
  opacity: 0;
}

.login-btn.loading .btn-spinner {
  opacity: 1;
}

.btn-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: authLoaderSpin 0.8s linear infinite;
}

.login-divider {
  position: relative;
  margin: 14px 0 10px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-divider span {
  position: relative;
  z-index: 1;
  padding: 0 10px;
  background: var(--white);
}

.login-divider::before,
.login-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 58px);
  height: 1px;
  background: var(--border);
}

.login-divider::before {
  left: 0;
}

.login-divider::after {
  right: 0;
}

.login-divider-compact {
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.login-divider-compact span {
  background: transparent;
  padding: 0;
  flex-shrink: 0;
}

.login-divider-compact::before,
.login-divider-compact::after {
  position: static;
  flex: 1;
  width: auto;
  height: 1px;
}

.login-btn-secondary {
  background: #fff;
  color: var(--blue-dk);
  border: 1.5px solid rgba(46, 120, 184, 0.35);
  box-shadow: none;
}

.login-btn-secondary:hover {
  background: rgba(46, 120, 184, 0.06);
  border-color: var(--blue);
}

.login-btn-secondary:focus-visible {
  outline: 2px solid rgba(46, 120, 184, 0.35);
  outline-offset: 2px;
}

.activate-account-btn {
  width: 100%;
}

.demo-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.demo-wrap--roles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.demo-role {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(46, 120, 184, 0.18);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 248, 252, 0.96) 100%);
  font-family: "Sora", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-dk);
  cursor: pointer;
  text-align: center;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.demo-role:hover {
  transform: translateY(-1px);
  border-color: rgba(46, 120, 184, 0.36);
  box-shadow: 0 8px 18px rgba(35, 92, 144, 0.1);
  background: #fff;
}

.demo-role:active {
  transform: translateY(0);
}

.demo-card {
  padding: 12px;
  border: 1px solid rgba(46, 120, 184, 0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 248, 252, 0.96) 100%);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.demo-card:hover {
  transform: translateY(-2px);
  border-color: rgba(46, 120, 184, 0.36);
  box-shadow: 0 12px 24px rgba(35, 92, 144, 0.12);
}

.demo-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.demo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red) 0%, var(--blue-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Sora", sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.demo-info {
  min-width: 0;
}

.demo-info strong {
  display: block;
  font-size: 12px;
  color: var(--text);
  line-height: 1.2;
}

.demo-info span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
}

.demo-badge {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(46, 120, 184, 0.1);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue-dk);
}

.demo-creds {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.demo-cred {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
}

.demo-cred span {
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}

.demo-cred svg {
  stroke: currentColor;
  flex-shrink: 0;
}

.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 14px 8px;
  color: #fff;
}

.login-aside-card {
  padding: 24px 24px 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 40px rgba(9, 28, 45, 0.12);
}

.login-aside-card h2 {
  font-family: "Playfair Display", serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.login-aside-card p {
  margin-top: 12px;
  max-width: 40ch;
  font-size: 0.98rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.78);
}

.login-feature-list {
  display: grid;
  gap: 12px;
}

.login-feature {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-feature i {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(217, 122, 69, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--accent-soft);
  flex-shrink: 0;
}

.login-feature strong {
  display: block;
  font-family: "Sora", sans-serif;
  font-size: 0.94rem;
}

.login-feature span {
  display: block;
  margin-top: 3px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.7);
}

.login-footer {
  padding: 0 18px 16px;
  text-align: center;
  font-size: 10px;
  line-height: 1.55;
  color: var(--muted);
}

.login-footer a {
  color: var(--blue-dk);
  text-decoration: none;
}

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

.activation-wizard-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(220, 53, 69, 0.08);
  color: #b42318;
  font-size: 12px;
  line-height: 1.5;
}

.activation-wizard-error.is-hidden {
  display: none;
}

.activation-verify-card,
.activation-credentials-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: rgba(46, 120, 184, 0.04);
}

.activation-verify-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--blue-dk);
  margin-bottom: 12px;
}

.activation-verify-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.activation-verify-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.activation-verify-note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.activation-credential-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.activation-credential-row:first-of-type {
  border-top: none;
}

.activation-modal-note {
  margin-top: 14px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

.activation-wizard-pane.is-hidden {
  display: none;
}

.login-card.shake {
  animation: authLoginShake 0.38s ease;
}

@keyframes authLoginShake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  50% {
    transform: translateX(5px);
  }

  75% {
    transform: translateX(-3px);
  }
}



@media (max-width: 640px) {
  body.auth-mode {
    padding: 14px 10px;
    align-items: flex-start;
  }

  body.auth-mode .login-wrapper {
    padding: 0;
    width: 100%;
    max-width: 100%;
  }

  .login-card {
    width: 100%;
    max-width: 100%;
  }

  .login-header {
    padding: 16px 16px 12px;
  }

  .login-body {
    padding: 12px 16px 14px;
  }

  .login-footer {
    padding: 0 16px 14px;
  }

  .demo-wrap:not(.demo-wrap--roles) {
    grid-template-columns: 1fr;
  }

  .demo-wrap--roles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .demo-role {
    font-size: 10.5px;
    padding: 8px 6px;
  }

.form-row {
  flex-direction: column;
  align-items: flex-start;
}

.form-row-links {
  align-items: flex-start;
}
}
