* { box-sizing: border-box; }

:root {
  --navy: #08224f;
  --red: #ef141c;
  --blue: #1d5ca8;
  --text: #0d2347;
  --muted: #67718a;
  --line: #e5e7eb;
  --white: #fff;
  --page-bg: #f3f4f6;
}

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

body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page-bg);
}

button, input { font: inherit; }

.layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.login-panel {
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  background: var(--white);
  border: 1px solid #e8edf3;
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(8, 34, 79, 0.1);
  padding: 24px 24px 20px;
}

.login-card__brand {
  text-align: center;
  margin-bottom: 14px;
}

.login-logo {
  display: inline-flex;
  line-height: 0;
  text-decoration: none;
}

.login-logo img {
  display: block;
  height: 30px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  margin: 0 auto;
}

.login-tagline {
  margin: 4px 0 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.login-card__header {
  margin-bottom: 14px;
  text-align: center;
}

.login-card__header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.5px;
  font-weight: 800;
  color: var(--navy);
}

.login-card__header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

#login-form {
  display: grid;
  gap: 11px;
}

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

.field-group.has-error .field-label {
  color: #dc2626;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.field {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}

.field:focus-within {
  border-color: #9eb0cb;
  box-shadow: 0 0 0 3px rgba(8, 34, 79, .07);
}

.field.is-invalid {
  border-color: #ef4444;
}

.field input {
  width: 100%;
  border: 0;
  outline: 0;
  font-size: 14px;
  color: var(--navy);
  background: transparent;
}

.field input::placeholder { color: #9aa3b2; }

.field-icon {
  width: 18px;
  flex-shrink: 0;
  font-size: 15px;
  color: #8b93a7;
  display: grid;
  place-items: center;
}

.eye-btn {
  border: 0;
  background: transparent;
  color: #8b93a7;
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
}

.eye-btn:hover { color: var(--navy); }

.field-error {
  font-size: 12px;
  color: #ef4444;
  margin: 0;
}

.verification > label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.verify-row {
  display: flex;
  gap: 10px;
}

.challenge {
  min-width: 120px;
  flex: 1;
  min-height: 42px;
  padding: 0 14px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--navy);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.refresh-btn {
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.refresh-btn:hover { background: #f8fafc; }

.answer-label {
  display: block;
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.answer-grid label { cursor: pointer; margin: 0; }
.answer-grid input { position: absolute; opacity: 0; pointer-events: none; }

.answer-grid span {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color .15s, color .15s, box-shadow .15s;
}

.answer-grid input:checked + span {
  border-color: var(--red);
  color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}

.verification.is-invalid .answer-grid span { border-color: #fca5a5; }

.captcha-error {
  font-size: 12px;
  color: #ef4444;
  margin-top: 6px;
  display: none;
}

.options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #59647c;
  font-size: 13px;
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.remember input { accent-color: var(--red); }

.options a,
.signup a {
  color: var(--red);
  text-decoration: none;
  font-weight: 700;
}

.options a:hover,
.signup a:hover { text-decoration: underline; }

.login-btn {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(239, 20, 28, .18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  transition: filter .12s;
}

.login-btn:hover { filter: brightness(1.05); }

.login-btn:disabled,
.login-btn.is-submitting {
  opacity: .7;
  cursor: not-allowed;
}

.signup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #59647c;
  font-size: 13px;
  margin-top: 2px;
}

.login-alert {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.login-alert-danger { background: #fff5f5; border: 1px solid #fecaca; color: #991b1b; }
.login-alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.login-alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.login-alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

@media (max-width: 560px) {
  .layout { padding: 18px 12px; }

  .login-card {
    padding: 20px 16px 16px;
    border-radius: 12px;
  }

  .login-card__header h2 { font-size: 20px; }

  .verify-row { flex-direction: column; }

  .refresh-btn {
    min-height: 44px;
    justify-content: center;
  }

  .options {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-height: 760px) {
  .layout {
    align-items: flex-start;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .login-card__brand { margin-bottom: 14px; }
  .login-card__header { margin-bottom: 14px; }
  #login-form { gap: 12px; }
  .field,
  .challenge,
  .answer-grid span { min-height: 44px; }
  .login-btn { min-height: 46px; }
}
