:root {
  --auth-bg-deep: #102e2a;
  --auth-bg-mid: #0f5e57;
  --auth-ink: #172421;
  --auth-muted: #667571;
  --auth-accent: #0f766e;
  --auth-accent-strong: #124b47;
  --auth-accent-soft: rgba(15, 118, 110, 0.16);
  --auth-warm: #d97745;
  --auth-card: rgba(255, 255, 255, 0.94);
  --auth-border: rgba(15, 26, 35, 0.12);
  --auth-shadow: 0 24px 60px rgba(12, 23, 31, 0.25);
}

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

html,
body {
  height: 100%;
}

body.auth-body {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  color: var(--auth-ink);
  background: radial-gradient(circle at 10% 15%, rgba(217, 119, 69, 0.28), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(52, 170, 159, 0.3), transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(159, 225, 216, 0.16), transparent 45%),
    linear-gradient(180deg, #102e2a 0%, #0f504a 48%, #0a201d 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body.auth-body::before,
body.auth-body::after {
  content: "";
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 70%);
  filter: blur(0);
  opacity: 0.55;
  z-index: 0;
}

body.auth-body::before {
  top: -140px;
  right: -120px;
}

body.auth-body::after {
  bottom: -180px;
  left: -140px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.auth-shell,
.login-container,
.forgot-password-container,
.activation-container,
.password-container {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(80px, 12vh, 140px) 20px 80px;
  position: relative;
  z-index: 1;
}

.auth-card,
.login-box,
.forgot-password-box,
.activation-box,
.password-box {
  width: min(540px, 92vw);
  background: var(--auth-card);
  border-radius: 24px;
  padding: clamp(24px, 4vw, 36px);
  box-shadow: var(--auth-shadow);
  border: 1px solid rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
}

.auth-card::before,
.login-box::before,
.forgot-password-box::before,
.activation-box::before,
.password-box::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -140px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(43, 154, 163, 0.32), transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}

.auth-card::after,
.login-box::after,
.forgot-password-box::after,
.activation-box::after,
.password-box::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--auth-accent), var(--auth-warm));
  border-radius: 24px 24px 0 0;
  pointer-events: none;
}

.auth-card__header {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.oidc-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.oidc-brand__logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.oidc-brand__divider {
  font-weight: 600;
  color: var(--auth-muted);
}

.oidc-connection {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
}

.oidc-connection__brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.oidc-connection__line {
  height: 1px;
  flex: 1 1 auto;
  min-width: 28px;
  margin: 0 14px;
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.22), rgba(15, 118, 110, 0.7), rgba(15, 118, 110, 0.22));
  position: relative;
}

.oidc-connection__line::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--auth-accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px #dcefeb;
}

.oidc-connection__app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--auth-accent), var(--auth-accent-strong));
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.22);
  font-family: "Sora", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--auth-accent-strong);
  background: rgba(43, 154, 163, 0.12);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  width: fit-content;
}

.auth-chip svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.02em;
  color: var(--auth-ink);
}

.auth-subtitle {
  margin: 0;
  color: var(--auth-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field label,
.auth-form label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #3f485a;
}

.auth-form .form-control,
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(23, 33, 44, 0.12);
  padding: 12px 14px;
  font-size: 0.98rem;
  background: #f6f8fb;
  color: var(--auth-ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-form .form-control:focus,
.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus,
.auth-form input[type="text"]:focus {
  outline: none;
  border-color: var(--auth-accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(43, 154, 163, 0.18);
}

.auth-form img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(23, 33, 44, 0.12);
}

.auth-form .errorlist {
  margin: 6px 0 0;
  padding-left: 18px;
  color: #b43030;
  font-size: 0.85rem;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--auth-muted);
}

.auth-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.auth-row a {
  color: var(--auth-accent-strong);
  text-decoration: none;
  font-weight: 600;
}

.auth-row a:hover {
  color: var(--auth-accent);
}

.auth-form input[type="checkbox"] {
  accent-color: var(--auth-accent);
}

.auth-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-mobile-actions {
  display: none;
  gap: 12px;
  margin: 12px 0 20px;
}

.auth-mobile-actions .btn-secondary,
.auth-mobile-actions .btn-google {
  width: 100%;
  margin-top: 0;
}

.auth-form-wrapper {
  display: block;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 12px 18px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
}

.btn-primary {
  background: linear-gradient(120deg, var(--auth-accent), var(--auth-accent-strong));
  color: #fff;
  box-shadow: 0 12px 30px rgba(43, 154, 163, 0.28);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(43, 154, 163, 0.32);
}

.btn-primary:disabled {
  background: #b8c6c9;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  color: var(--auth-ink);
  border: 1px solid rgba(23, 33, 44, 0.18);
}

.btn-secondary:hover {
  border-color: var(--auth-accent);
  color: var(--auth-accent-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--auth-accent-strong);
  border: 1px dashed rgba(43, 154, 163, 0.4);
}

.btn-ghost:hover {
  color: var(--auth-accent);
  border-color: var(--auth-accent);
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--auth-muted);
  margin-top: 10px;
}

.auth-footer a {
  color: var(--auth-accent-strong);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--auth-accent);
}

.auth-alert,
.error-message,
.success-message {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-alert--error,
.error-message {
  background: rgba(220, 70, 70, 0.12);
  color: #b43030;
  border: 1px solid rgba(220, 70, 70, 0.2);
}

.auth-alert--success,
.success-message {
  background: rgba(43, 154, 163, 0.12);
  color: #1b6f76;
  border: 1px solid rgba(43, 154, 163, 0.2);
}

.oidc-error-detail {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #8f2d2d;
}

.auth-card .errorlist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.auth-card .errorlist li + li {
  margin-top: 6px;
}

.auth-status {
  margin-top: 18px;
  border-radius: 16px;
  padding: 16px;
  background: rgba(245, 250, 249, 0.95);
  border: 1px solid rgba(23, 33, 44, 0.12);
  display: grid;
  gap: 8px;
}

.auth-status__timer {
  font-size: 0.88rem;
  color: var(--auth-muted);
}

.auth-status__timer span {
  font-weight: 700;
  color: var(--auth-ink);
}

.auth-note {
  font-size: 0.88rem;
  color: var(--auth-muted);
  margin: 0;
}

.auth-shell--consent {
  min-height: 100vh;
  min-height: 100svh;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
}

.auth-card--consent {
  width: min(520px, 100%);
  padding: clamp(24px, 5vw, 36px);
}

.auth-card__header--consent {
  gap: 12px;
  margin-bottom: 18px;
}

.auth-title--consent {
  font-size: clamp(1.45rem, 5.5vw, 1.9rem);
  line-height: 1.25;
}

.consent-account {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 14px;
  background: rgba(237, 247, 245, 0.85);
}

.consent-account__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: var(--auth-accent-strong);
  font-family: "Sora", sans-serif;
  font-weight: 700;
}

.consent-account__details {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.consent-account__details strong {
  overflow: hidden;
  color: var(--auth-ink);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.consent-account__label {
  color: var(--auth-muted);
  font-size: 0.76rem;
}

.consent-form {
  gap: 18px;
}

.consent-permissions {
  display: grid;
  gap: 12px;
}

.consent-permissions h2 {
  margin: 0;
  color: var(--auth-ink);
  font-family: "Sora", sans-serif;
  font-size: 0.96rem;
  font-weight: 600;
}

.consent-permissions__list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.consent-permissions__list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #44534f;
  font-size: 0.92rem;
  line-height: 1.45;
}

.consent-permissions__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  color: var(--auth-accent-strong);
  background: rgba(15, 118, 110, 0.12);
}

.consent-permissions__check svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.consent-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--auth-border);
  color: var(--auth-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.consent-note svg {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-actions--consent {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, auto);
  gap: 10px;
}

.auth-actions--consent .btn-primary,
.auth-actions--consent .btn-ghost {
  min-width: 0;
  min-height: 50px;
  touch-action: manipulation;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-ghost:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 3px;
}

.consent-error {
  display: grid;
  justify-items: start;
  gap: 14px;
}

.consent-error__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #9b312d;
  background: rgba(220, 70, 70, 0.12);
  font-family: "Sora", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.social-login {
  margin-top: 18px;
}

.terms-note {
  font-size: 0.82rem;
  color: var(--auth-muted);
  margin: 10px 0 0;
}

.fade-in {
  animation: auth-fade-up 0.6s ease both;
}

@keyframes auth-fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .auth-shell,
  .login-container,
  .forgot-password-container,
  .activation-container,
  .password-container {
    padding: 100px 16px 60px;
  }

  .auth-card,
  .login-box,
  .forgot-password-box,
  .activation-box,
  .password-box {
    padding: 22px;
  }

  .auth-actions,
  .auth-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary,
  .btn-secondary,
  .btn-ghost {
    width: 100%;
  }

  .auth-mobile-actions {
    display: grid;
  }

  .auth-shell--consent {
    /* A tall consent card must grow down into the scrollable page, never above it. */
    align-items: flex-start;
    padding-top: max(14px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .auth-card--consent {
    padding: 22px 20px;
    border-radius: 20px;
  }

  .auth-actions--consent {
    grid-template-columns: 1fr;
  }

  .auth-actions--consent .btn-primary {
    order: 1;
  }

  .auth-actions--consent .btn-ghost {
    order: 2;
  }

  .social-login--desktop {
    display: none;
  }

  body.auth-body.js-enabled .auth-form-wrapper {
    display: none;
  }

  body.auth-body.js-enabled .auth-form-wrapper.is-expanded {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .auth-card,
  .login-box,
  .forgot-password-box,
  .activation-box,
  .password-box {
    animation: none;
  }
}
