:root {
  --brand: #1a5a9a;
  --brand-2: #0ea5e9;
  --brand-lighter: rgba(26, 90, 154, .10);
  --brand-dark: #0f3762;
  --ink: #102033;
  --muted: #64748b;
  --line: #dbe7f3;
  --danger: #dc2626;
  --page: #eef7ff;
  --panel: rgba(255, 255, 255, .86);
  --radius: 24px;
  --transition: 180ms ease;
}

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

body.auth-page {
  min-height: 100vh;
  padding: 18px;
  color: var(--ink);
  font-family: "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at 15% 15%, rgba(14, 165, 233, .22), transparent 32%),
    radial-gradient(circle at 85% 20%, rgba(26, 90, 154, .18), transparent 30%),
    linear-gradient(135deg, #f7fbff 0%, #eaf6ff 45%, #f8fbff 100%);
}

.reference-auth {
  width: 100%;
  min-height: calc(100vh - 36px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reference-card {
  position: relative;
  width: min(100%, 460px);
  padding: 42px 34px 34px;
  overflow: hidden;
  border: 1px solid rgba(26, 90, 154, .12);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(15, 55, 98, .14);
  backdrop-filter: blur(18px);
}

.reference-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.login-card,
.forgot-card,
.register-card {
  padding: 42px 34px 34px;
}

.register-card {
  max-width: 500px;
}

.auth-card.is-loading-in {
  opacity: 0;
  transform: translateY(10px);
}

.reference-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  margin-right: 10px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #ffffff;
  font-size: 34px;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(26, 90, 154, .25);
}

.logo-text {
  color: var(--brand-dark);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -1.2px;
}

.auth-title {
  margin: 0 0 28px;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.15;
  font-weight: 900;
  text-align: center;
}

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

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.form-control {
  width: 100%;
  height: 54px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  transition: var(--transition);
}

.password-field {
  position: relative;
}

.password-field .form-control {
  padding-right: 48px;
}

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

.password-toggle:hover,
.password-toggle:focus {
  outline: none;
  background: var(--brand-lighter);
  color: var(--brand);
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-2);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, .14);
}

.form-control:user-invalid {
  border-color: var(--danger);
}

.field-error {
  display: none;
  margin-top: 7px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.form-control:user-invalid+.field-error {
  display: block;
}

.hint-text {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.forgot-link {
  display: inline-block;
  margin: 0 0 22px;
  font-size: 14px;
  font-weight: 800;
}

.link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 800;
}

.link:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.auth-btn,
.btn-login,
.btn-register {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 54px;
  padding: 13px 22px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(26, 90, 154, .24);
  transition: transform var(--transition), box-shadow var(--transition);
}

.auth-btn:hover,
.btn-login:hover,
.btn-register:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 38px rgba(26, 90, 154, .30);
}

.auth-btn[disabled],
.btn-login[disabled],
.btn-register[disabled] {
  opacity: .72;
  cursor: not-allowed;
  transform: none;
}

.btn-text,
.btn-spinner {
  transition: opacity var(--transition);
}

.btn-spinner {
  position: absolute;
  opacity: 0;
  font-size: 13px;
}

.is-submitting .btn-text,
.loading .btn-text {
  opacity: 0;
}

.is-submitting .btn-spinner,
.loading .btn-spinner {
  opacity: 1;
}

.terms-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-check-input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
}

.auth-switch {
  margin-top: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.ref-detected {
  display: block;
  margin-top: 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.admin-auth {
  align-items: center;
}

.admin-login-card {
  max-width: 440px;
  padding: 30px;
}

.admin-login-card::before {
  height: 6px;
}

.admin-auth-top {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 24px;
  padding: 13px;
  border: 1px solid rgba(26, 90, 154, .12);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(248, 251, 255, .76)),
    var(--brand-lighter);
}

.admin-mark {
  width: 52px;
  height: 52px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #ffffff;
  font-size: 24px;
  box-shadow: 0 15px 28px rgba(26, 90, 154, .22);
}

.admin-kicker {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-auth-top h1 {
  max-width: 260px;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-auth-heading {
  margin-bottom: 22px;
}

.admin-auth-heading h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 27px;
  line-height: 1.1;
  font-weight: 900;
}

.admin-auth-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 700;
}

.admin-login-card .btn-login {
  margin-top: 4px;
}

.admin-auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  font-size: 13px;
}

.admin-security-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 22px;
  padding: 12px 13px;
  border: 1px solid rgba(26, 90, 154, .10);
  border-radius: 16px;
  background: var(--brand-lighter);
  color: var(--brand-dark);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 800;
}

.admin-security-note i {
  margin-top: 1px;
  color: var(--brand);
}

.input-icon,
.card-footer {
  display: none;
}

.strength {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dcecf8;
}

#pwBar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width .2s ease, background .2s ease;
}

.auth-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 32, 51, .38);
  backdrop-filter: blur(6px);
}

.auth-loader.is-visible {
  display: flex;
}

.swal2-container {
  z-index: 10000;
}

.auth-loader-box {
  min-width: 210px;
  padding: 24px;
  border-radius: 20px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(15, 55, 98, .20);
  text-align: center;
}

.auth-loader-spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 13px;
  border: 4px solid rgba(14, 165, 233, .16);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: auth-spin .8s linear infinite;
}

.auth-loader-text {
  font-size: 14px;
  font-weight: 900;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 520px) {
  body.auth-page {
    padding: 12px;
  }

  .reference-auth {
    min-height: calc(100vh - 24px);
  }

  .reference-card,
  .login-card,
  .forgot-card,
  .register-card {
    width: 100%;
    padding: 38px 22px 28px;
    border-radius: 22px;
  }

  .logo-badge {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    font-size: 30px;
  }

  .logo-text {
    font-size: 29px;
  }

  .auth-title {
    font-size: 23px;
  }

  .admin-login-card {
    padding: 28px 20px 24px;
  }

  .admin-auth-top {
    margin-bottom: 20px;
  }

  .admin-auth-heading h2 {
    font-size: 24px;
  }

  .admin-auth-links {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
