:root {
  color-scheme: dark;
  --bg-primary: #1a1a1a;
  --bg-secondary: #0a0a0a;
  --bg-card: rgba(32, 32, 32, 0.94);
  --bg-input: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #989898;
  --border-color: #2a2a2a;
  --border-hover: #3a3a3a;
  --accent-color: #7a9bff;
  --accent-hover: #5a7adf;
  --accent-rgb: 122, 155, 255;
  --danger-color: #ff5c7f;
  --success-color: #4ade80;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-primary);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: 24px;
  overflow-x: hidden;
  display: grid;
  place-items: center;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.auth-lottie {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  opacity: 0.25;
  pointer-events: none;
}

.auth-lottie svg,
.auth-lottie canvas {
  width: 100% !important;
  height: 100% !important;
}

.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at center, rgba(26, 26, 26, 0.08) 0%, rgba(10, 10, 10, 0.7) 100%),
    rgba(10, 10, 10, 0.22);
  pointer-events: none;
}

.auth-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 430px);
  margin: auto;
  justify-self: center;
}

.auth-shell.auth-shell-wide {
  width: min(100%, 560px);
}

.auth-card,
.auth-shell .card {
  width: 100%;
  padding: 28px !important;
  overflow: hidden;
  border: 1px solid var(--border-color) !important;
  border-radius: 16px !important;
  background: var(--bg-card) !important;
  color: var(--text-primary);
  box-shadow: none !important;
  backdrop-filter: blur(6px);
}

.auth-brand {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 650;
}

.auth-logo,
.rp-logo {
  margin-bottom: 18px !important;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.auth-shell hr {
  margin: 0 0 20px !important;
  border-color: var(--border-color);
  opacity: 1;
}

.auth-shell h1,
.auth-title {
  margin: 0 0 7px !important;
  color: var(--text-primary) !important;
  font-size: 22px !important;
  font-weight: 650 !important;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.auth-shell .text-secondary,
.auth-subtitle {
  margin: 0 0 22px !important;
  color: var(--text-muted) !important;
  font-size: 14px !important;
  line-height: 1.55;
  text-wrap: pretty;
}

.form-label {
  margin-bottom: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.form-control {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  box-shadow: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.form-control::placeholder {
  color: #a8a8a8;
  opacity: 1;
}

.form-control:focus {
  border-color: var(--accent-color);
  background: var(--bg-input);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.form-control:disabled {
  border-color: var(--border-color);
  background: #242424;
  color: var(--text-secondary);
  opacity: 1;
}

.input-group .form-control {
  border-right: 0;
}

.input-group .btn-outline-secondary {
  min-width: 44px;
  border: 1px solid var(--border-hover);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--bg-input);
  color: var(--text-muted);
}

.input-group .btn-outline-secondary:hover,
.input-group .btn-outline-secondary:focus-visible {
  border-color: var(--accent-color);
  background: #252525;
  color: var(--text-primary);
}

.btn-dark,
.auth-primary {
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid var(--accent-hover);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
  color: #10131a;
  font-size: 14px;
  font-weight: 650;
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.btn-dark:hover,
.auth-primary:hover {
  border-color: var(--accent-hover);
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-color));
  color: #10131a;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
  transform: translateY(-1px);
}

.btn-dark:active,
.auth-primary:active {
  transform: translateY(0);
}

.btn-dark:focus-visible,
.auth-primary:focus-visible {
  outline: 3px solid rgba(var(--accent-rgb), 0.35);
  outline-offset: 3px;
}

.btn-dark:disabled,
.auth-primary:disabled {
  border-color: var(--border-hover);
  background: #333333;
  color: #8d8d8d;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

#message {
  min-height: 20px !important;
  margin-top: 14px !important;
  margin-bottom: 0 !important;
  font-size: 13px !important;
  line-height: 1.45;
}

.text-danger {
  color: var(--danger-color) !important;
}

.text-success {
  color: var(--success-color) !important;
}

.text-muted,
#message.text-secondary {
  color: var(--text-muted) !important;
}

.auth-home {
  text-align: center;
}

.auth-home .auth-brand {
  justify-content: center;
}

.auth-home-copy {
  max-width: 46ch;
  margin-inline: auto;
}

.auth-error-icon {
  display: inline-grid;
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 92, 127, 0.12);
  color: var(--danger-color);
  font-size: 24px;
}

.auth-error-icon[hidden] {
  display: none;
}

.auth-error-help {
  max-width: 44ch;
  margin: -8px auto 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  text-wrap: pretty;
}

@media (max-width: 520px) {
  body {
    padding: 16px;
  }

  .auth-card,
  .auth-shell .card {
    padding: 22px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-lottie {
    display: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
