.apply-page { background: var(--bg-soft); min-height: 100vh; }
.secure-badge { margin-left: auto; font-size: 14px; color: var(--muted); font-weight: 500; }
.apply { padding: 36px 0 64px; }
.container--form { max-width: 760px; }

.progress { margin-bottom: 18px; }
.progress__label { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.progress__track { height: 8px; background: #dde7e3; border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; width: 16.6%; background: var(--primary); border-radius: inherit; transition: width .35s; }

.card { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 32px; }
.form-step h2 { font-size: 26px; font-weight: 800; margin-bottom: 20px; }
.hint { color: var(--muted); margin: -12px 0 18px; font-size: 15px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.span-2 { grid-column: span 2; }

.field label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field label em { font-weight: 400; color: var(--muted); font-style: normal; }
.field input, .field select { width: 100%; height: 50px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
.field input:focus, .field select:focus { outline: 2px solid var(--primary); border-color: transparent; }
.field.invalid input, .field.invalid select { border-color: #d33; background: #fff7f7; }
.err { display: block; color: #d33; font-size: 13px; min-height: 18px; margin-top: 4px; }
.err--check { margin: -6px 0 6px 30px; }

.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; font-size: 13px; color: var(--muted); line-height: 1.55; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; accent-color: var(--primary); }
.check a { color: var(--primary); text-decoration: underline; }

.actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 26px; }
.actions .btn--lg { min-width: 180px; }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: 14px 26px; font-size: 16px; }
.btn--ghost:hover { color: var(--ink); border-color: var(--ink); }
.btn[disabled] { opacity: .6; pointer-events: none; }
.form-alert { margin-top: 18px; padding: 12px 16px; border-radius: 10px; background: #fff1f1; color: #b42318; font-size: 14px; }
.fine { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.overlay { position: fixed; inset: 0; background: rgba(18, 32, 47, .6); display: grid; place-items: center; z-index: 100; padding: 16px; }
.overlay[hidden] { display: none; }
.overlay__box { background: #fff; border-radius: 18px; padding: 36px 28px; text-align: center; max-width: 380px; }
.overlay__box h3 { margin: 18px 0 8px; }
.overlay__box p { color: var(--muted); font-size: 14px; }
.spinner { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; border: 5px solid #e2efe9; border-top-color: var(--primary); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .card { padding: 22px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .actions { flex-direction: column-reverse; }
  .actions .btn { width: 100%; }
  .secure-badge { display: none; }
}

/* Legal dialog */
.legal-modal { position: fixed; inset: 0; margin: auto; /* the * { margin: 0 } reset removes the browser's centering */
  width: min(760px, calc(100% - 32px)); height: fit-content; max-height: 86vh; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(18, 32, 47, .35); color: var(--ink); }
.legal-modal[open] { display: flex; flex-direction: column; }
.legal-modal::backdrop { background: rgba(18, 32, 47, .55); }
.legal-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.legal-modal__head h3 { font-size: 20px; }
.legal-modal__x { background: none; border: 0; font-size: 30px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.legal-modal__x:hover { color: var(--ink); }
.legal-modal__body { overflow-y: auto; padding: 20px 24px; flex: 1; }
.legal-modal__foot { padding: 14px 24px; border-top: 1px solid var(--border); text-align: right; }
.legal-modal__foot .btn { padding: 12px 26px; font-size: 15px; }

/* Legal text (dialog + legal.php) */
.legal { font-size: 14.5px; line-height: 1.7; color: #334155; }
.legal h3 { font-size: 17px; color: var(--ink); margin: 22px 0 8px; }
.legal h3:first-child { margin-top: 0; }
.legal p, .legal ul { margin-bottom: 10px; }
.legal ul { padding-left: 22px; }
.legal li { margin-bottom: 4px; }
.legal a { color: var(--primary); text-decoration: underline; }
.legal .legal-meta { color: var(--muted); font-size: 13px; }
.legal-page h1 { font-size: 30px; font-weight: 800; margin-bottom: 4px; }
.legal-page .legal-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 18px; font-size: 14px; }
.legal-page .legal-nav a { color: var(--muted); }
.legal-page .legal-nav a.active { color: var(--primary); font-weight: 600; }

@media (max-width: 640px) {
  .legal-modal { max-height: 92vh; width: calc(100% - 16px); }
  .legal-modal__body, .legal-modal__head, .legal-modal__foot { padding-left: 16px; padding-right: 16px; }
  .legal-modal__foot .btn { width: 100%; }
}
