* { box-sizing: border-box; }

:root {
  --navy: #08224f;
  --red: #ef141c;
  --green: #238733;
  --blue: #1d5ca8;
  --text: #0d2347;
  --muted: #67718a;
  --line: #dce4ee;
  --white: #fff;
  --login-col: clamp(400px, 30vw, 460px);
  --banner-w: min(calc(100vh * 1024 / 841), calc(100vw - var(--login-col)));
  --banner-h: calc(var(--banner-w) * 841 / 1024);
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

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

button, input { font: inherit; }

.layout {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--banner-w) minmax(400px, 1fr);
  gap: 0;
}

/* ── Marketing banner (aspect-matched, no side gaps) ── */
.marketing {
  width: var(--banner-w);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #eef3ea;
}

.marketing-banner {
  display: block;
  width: var(--banner-w);
  height: var(--banner-h);
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

/* ── Login panel (flush white column) ── */
.login-panel {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 40px;
  overflow: hidden;
  background: var(--white);
  box-shadow: -12px 0 40px rgba(8, 34, 79, .08);
}

.login-card {
  width: 100%;
  max-width: 400px;
  max-height: 100%;
  overflow-y: auto;
  padding: 0 4px;
  scrollbar-width: thin;
  scrollbar-color: #c5d0de transparent;
}

.login-card__header {
  margin-bottom: 28px;
}

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

.login-card__header p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

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

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

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

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: #3d4d68;
}

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

.field:focus-within {
  border-color: #8fa3be;
  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: 15px;
  color: var(--navy);
  background: transparent;
}

.field input::placeholder { color: #8b97ab; }

.field-icon {
  width: 18px;
  flex-shrink: 0;
  font-size: 16px;
  color: #7b879c;
  display: grid;
  place-items: center;
}

.eye-btn {
  border: 0;
  background: transparent;
  color: #7b879c;
  cursor: pointer;
  font-size: 16px;
  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: 600;
  color: #3d4d68;
}

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

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

.refresh-btn {
  padding: 0 14px;
  border: 1px solid #cfd8e4;
  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: 10px;
}

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

.answer-grid span {
  min-height: 48px;
  border: 1px solid #cfd8e4;
  border-radius: 10px;
  background: #fff;
  font-size: 17px;
  font-weight: 800;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color .15s, color .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: 600;
}

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

.login-btn {
  min-height: 52px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(239, 20, 28, .2);
  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: 8px;
  color: #59647c;
  font-size: 13px;
}

.signup::before,
.signup::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e8edf3;
}

.trust {
  margin-top: 24px;
  padding-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border-top: 1px solid #e8edf3;
}

.trust article {
  text-align: center;
  padding: 0 6px;
}

.trust article + article {
  border-left: 1px solid #e8edf3;
}

.trust-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0 auto 6px;
  border-radius: 10px;
  font-size: 16px;
}

.trust-icon--shield { color: var(--green); background: #edf8ef; }
.trust-icon--lock { color: var(--red); background: #fff1f2; }
.trust-icon--truck { color: var(--blue); background: #eef5fd; }

.trust b {
  display: block;
  font-size: 11px;
  color: var(--text);
  line-height: 1.3;
}

.trust small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.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-height: 780px) {
  .login-panel { padding: 20px 32px; }

  .login-card__header {
    margin-bottom: 18px;
  }

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

  #login-form { gap: 12px; }

  .field,
  .challenge,
  .answer-grid span { min-height: 44px; }

  .login-btn { min-height: 46px; }

  .trust {
    margin-top: 16px;
    padding-top: 14px;
  }
}

@media (max-width: 1024px) {
  :root {
    --login-col: clamp(360px, 34vw, 420px);
  }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  html, body {
    overflow: auto;
    height: auto;
  }

  .marketing {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    height: auto;
    padding: 32px 24px 40px;
    box-shadow: none;
  }

  .login-card {
    max-width: 480px;
    overflow: visible;
  }

  .trust {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    align-items: start;
  }

  .trust article {
    padding: 0 4px;
    min-width: 0;
  }

  .trust article + article {
    border-left: 1px solid #e8edf3;
    border-top: 0;
    padding-top: 0;
  }

  .trust-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
    border-radius: 8px;
    font-size: 14px;
  }

  .trust b {
    font-size: 10px;
    line-height: 1.25;
    word-break: break-word;
  }

  .trust small {
    margin-top: 2px;
    font-size: 9px;
    line-height: 1.25;
    word-break: break-word;
  }
}

@media (max-width: 560px) {
  .login-panel { padding: 24px 18px 32px; }

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

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

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

  .signup::before,
  .signup::after { display: none; }

  .trust-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .trust b { font-size: 9px; }

  .trust small { font-size: 8px; }
}
