:root {
  --primary: #0068A7;
  --primary-strong: #0b76b4;
  --primary-soft: #e6f1f8;
  --text: #102039;
  --muted: #5a6a84;
  --card-bg: #ffffff;
  --card-border: rgba(16, 32, 57, 0.1);
  --input-bg: #f7f9fc;
  --input-border: #d4dde9;
  --focus: rgba(0, 104, 167, 0.22);
  --surface: #f2f6fb;
  --shadow: 0 20px 45px rgba(6, 30, 61, 0.14);
  --danger-bg: #fff1f2;
  --danger-border: #fecdd3;
  --danger-text: #9f1239;
}

html[data-theme="dark"] {
  --text: #e6edf8;
  --muted: #9fb0cc;
  --card-bg: #0f1f39;
  --card-border: rgba(255, 255, 255, 0.1);
  --input-bg: #112748;
  --input-border: #2b456d;
  --focus: rgba(77, 176, 233, 0.24);
  --surface: #091527;
  --shadow: 0 18px 42px rgba(2, 8, 18, 0.5);
  --danger-bg: rgba(190, 24, 93, 0.2);
  --danger-border: rgba(244, 114, 182, 0.5);
  --danger-text: #fecdd3;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.auth-page {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 10%, rgba(0, 104, 167, 0.2) 0, transparent 46%),
    radial-gradient(circle at 95% 87%, rgba(0, 104, 167, 0.18) 0, transparent 50%),
    linear-gradient(145deg, #f8fbff 0%, var(--surface) 100%);
}

html[data-theme="dark"] body.auth-page {
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 104, 167, 0.34) 0, transparent 48%),
    radial-gradient(circle at 92% 92%, rgba(27, 78, 126, 0.26) 0, transparent 52%),
    linear-gradient(145deg, #071221 0%, var(--surface) 100%);
}

.auth-shell {
  position: relative;
  min-height: 100dvh;
  padding: 20px 16px;
  display: grid;
  place-items: center;
}

.auth-theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 5;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.auth-theme-toggle:hover {
  border-color: rgba(0, 104, 167, 0.4);
}

.auth-layout {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.auth-card,
.auth-brand {
  border-radius: 22px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 26px 20px;
}

.auth-mobile-logo-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 22px;
}

.auth-mobile-logo {
  display: block;
  width: min(100%, 248px);
  height: auto;
}

.auth-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.auth-eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.15;
}

.auth-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.auth-alert {
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.93rem;
  margin: 0 0 14px;
  border: 1px solid transparent;
}

.auth-alert-error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

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

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

.auth-field label {
  font-weight: 600;
  font-size: 0.95rem;
}

.auth-field small {
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-field input {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  padding: 0 14px;
  outline: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-field input::placeholder {
  color: #8ea0bc;
}

.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus);
}

.auth-field input.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18);
}

.auth-password-wrap {
  position: relative;
}

.auth-password-wrap input {
  padding-right: 94px;
}

.btn-password-toggle {
  position: absolute;
  right: 8px;
  top: 7px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  min-height: 32px;
  min-width: 72px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-password-toggle:hover,
.btn-password-toggle:focus-visible {
  background: var(--primary-soft);
  outline: none;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  user-select: none;
  cursor: pointer;
}

.auth-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.btn-login {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: linear-gradient(140deg, var(--primary), var(--primary-strong));
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-login:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 14px 24px rgba(0, 104, 167, 0.28);
}

.btn-login:disabled,
.btn-login.is-loading {
  opacity: 0.82;
  cursor: progress;
  transform: none;
  box-shadow: none;
}

.auth-brand {
  display: none;
  overflow: hidden;
  position: relative;
}

.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.auth-brand::before {
  width: 260px;
  height: 260px;
  right: -120px;
  top: -80px;
  background: rgba(0, 104, 167, 0.25);
}

.auth-brand::after {
  width: 320px;
  height: 320px;
  left: -160px;
  bottom: -180px;
  background: rgba(0, 104, 167, 0.17);
}

.auth-brand-inner {
  position: relative;
  z-index: 1;
  padding: 44px;
  height: 100%;
  background: linear-gradient(160deg, rgba(0, 104, 167, 0.96), rgba(0, 71, 115, 0.94));
  color: #ffffff;
}

.auth-brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0 0 18px;
}

.auth-brand-logo {
  display: block;
  width: clamp(170px, 20vw, 260px);
  max-width: 100%;
  height: auto;
}

.auth-brand h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.3rem);
  line-height: 1.12;
}

.auth-brand p {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.92);
  max-width: 48ch;
  line-height: 1.55;
}

.auth-highlights {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.auth-highlights li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.96);
}

.auth-highlights .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0.95;
}

@media (min-width: 992px) {
  .auth-mobile-logo-wrap {
    display: none;
  }

  .auth-shell {
    padding: 26px;
  }

  .auth-layout {
    grid-template-columns: minmax(390px, 430px) minmax(520px, 1fr);
    gap: 22px;
    align-items: stretch;
  }

  .auth-card {
    padding: 34px 30px;
  }

  .auth-brand {
    display: block;
  }
}

@media (max-width: 420px) {
  .auth-mobile-logo-wrap {
    margin-bottom: 18px;
  }

  .auth-mobile-logo {
    width: min(100%, 200px);
  }

  .auth-card {
    padding: 22px 16px;
    border-radius: 18px;
  }

  .auth-theme-toggle {
    top: 10px;
    right: 10px;
    padding: 7px 10px;
  }
}
