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

body {
  font-family: 'Segoe UI', sans-serif;
  background-color: #f0f4ff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP BAR */
.topbar {
  background-color: #1a3c8f;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.topbar .logo-circle {
  width: 42px;
  height: 42px;
  background-color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  color: #1a3c8f;
  letter-spacing: -1px;
}

.topbar .app-name {
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

.topbar .app-subtitle {
  color: #a8c0f0;
  font-size: 12px;
  margin-top: 2px;
}

/* MAIN CONTENT */
.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(26, 60, 143, 0.12);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.card h2 {
  color: #1a3c8f;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.card p.subtitle {
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 32px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  /* AA upgrade: #9ca3af is 3.06:1 against #fff — passes the 3:1 UI-control rule
     (was #d1d5db at 1.59:1 which failed WCAG AA for UI controls). */
  border: 1.5px solid #9ca3af;
  border-radius: 8px;
  font-size: 14px;
  color: #111827;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #1a3c8f;
}

/* AA focus-visible upgrade: explicit outline for keyboard navigation */
.form-group input:focus-visible,
.btn-login:focus-visible {
  outline: 2px solid #1a3c8f;
  outline-offset: 2px;
}

/* Inline error region — single role="alert" per form (D-170) */
[role="alert"] {
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

[role="alert"][hidden] {
  display: none;
}

.btn-login {
  width: 100%;
  padding: 13px;
  min-height: 48px;
  background-color: #1a3c8f;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login:hover {
  background-color: #142f72;
}

/* Disabled state during loading */
.btn-login:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

/* Loading spinner — 16x16 ring */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}

/* The `hidden` attribute must win over the display rule above, or the spinner
   shows permanently (the markup ships it `hidden` and reveals it during fetch). */
.btn-spinner[hidden] {
  display: none !important;
}

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

/* Reduce-motion: keep spinner visible but stop animation */
@media (prefers-reduced-motion: reduce) {
  .btn-spinner {
    animation: none;
    border-top-color: transparent;
  }
}

.divider {
  text-align: center;
  margin: 24px 0 16px;
  color: #9ca3af;
  font-size: 12px;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: #e5e7eb;
}

.divider::before { left: 0; }
.divider::after { right: 0; }

.contact-text {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
}

.contact-text a {
  color: #1a3c8f;
  font-weight: 600;
  text-decoration: none;
}

.contact-text a:hover {
  text-decoration: underline;
}

/* FOOTER — AA upgrade: #6b7280 is 5.04:1 against #f0f4ff background
   (was #9ca3af at 2.85:1 which failed WCAG AA for 12px regular text). */
footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: #6b7280;
}

/* Screen-reader only utility (a11y — 43-23) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mobile reductions */
@media (max-width: 767px) {
  .topbar {
    padding: 16px 20px;
  }

  .main {
    padding: 24px 16px;
  }

  .card {
    padding: 32px 24px;
  }
}
