:root {
  --brand-deep: #1e4091;
  --brand-mid: #302a77;
  --brand-accent: #465db8;
  --brand-gradient: linear-gradient(135deg, #465db8 0%, #1e4091 26%, #1e3688 58%, #302a77 100%);
  --surface: #ffffff;
  --surface-muted: #eef1f8;
  --text-primary: #0f172a;
  --text-secondary: #5b6478;
  --text-on-brand: rgba(255, 255, 255, 0.96);
  --border: #c5cee8;
  --border-focus: #465db8;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body.auth-page {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--surface-muted);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr 1fr;
}

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem clamp(2rem, 5vw, 4rem);
  background: var(--brand-gradient);
  color: var(--text-on-brand);
  overflow: hidden;
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 78%, rgba(122, 146, 212, 0.14) 0%, transparent 48%),
    radial-gradient(circle at 88% 12%, rgba(70, 60, 130, 0.12) 0%, transparent 42%),
    radial-gradient(circle at 50% 50%, rgba(70, 93, 184, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand > *:not(.auth-brand-watermark-wrap) {
  position: relative;
  z-index: 1;
}

/* Clip window: bottom-right of panel shows only the logo's top-left corner */
.auth-brand-watermark-wrap {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 48%;
  height: 48%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.auth-brand-watermark {
  position: absolute;
  top: -6%;
  left: -5%;
  width: 185%;
  max-width: none;
  height: auto;
  opacity: 0.38;
  filter: brightness(0) invert(1);
  user-select: none;
}

.auth-brand-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.auth-brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 11px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.auth-brand-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.auth-brand-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.85;
}

.auth-brand-body {
  max-width: 28rem;
}

.auth-brand-headline {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.auth-brand-tagline {
  margin: 0 0 2.5rem;
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: 0.9;
}

.auth-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.auth-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.auth-feature-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.auth-brand-footer {
  font-size: 0.8rem;
  opacity: 0.75;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem clamp(1.5rem, 4vw, 3rem);
}

.auth-form-wrap {
  width: 100%;
  max-width: 420px;
}

.auth-form-mobile-brand {
  display: none;
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-form-mobile-brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  margin-bottom: 0.75rem;
}

.auth-form-mobile-brand h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-mid);
}

.auth-form-mobile-brand p {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.auth-form-heading {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.auth-form-subheading {
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.45;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.auth-alert i {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.auth-alert--success {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-back-link:hover {
  color: var(--brand-deep);
}

.auth-hint {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.auth-hint i {
  color: var(--brand-accent);
  margin-right: 0.35rem;
}

.auth-field {
  margin-bottom: 1.25rem;
}

.auth-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

.auth-input-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 1;
}

.auth-input {
  width: 100%;
  padding: 0.8rem 0.95rem 0.8rem 2.65rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-input-wrap--password .auth-input {
  padding-right: 2.75rem;
}

.auth-input:hover {
  border-color: #cbd5e1;
}

.auth-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(70, 93, 184, 0.28);
}

.auth-toggle-password {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.auth-toggle-password:hover {
  color: var(--brand-mid);
  background: rgba(70, 93, 184, 0.09);
}

.auth-toggle-password:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
  user-select: none;
}

.auth-checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--brand-accent);
  cursor: pointer;
}

.auth-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--brand-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.auth-submit {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--brand-gradient);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(48, 64, 145, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(48, 64, 145, 0.38);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.auth-spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

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

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

.auth-form-footnote {
  margin: 1.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    display: none;
  }

  .auth-form-mobile-brand {
    display: block;
  }

  .auth-panel {
    align-items: flex-start;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
}

@media (max-width: 480px) {
  .auth-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit,
  .auth-input,
  .auth-toggle-password,
  .auth-link {
    transition: none;
  }

  .auth-spinner {
    animation-duration: 1.2s;
  }
}
