/* Online application (/apply/). Builds on styles.css variables. Mobile first. */
.apply-page { background: var(--bg-alt); }
/* New HTL logo (blue #076398 / gray #575A5B): /apply/ only for now, so the brand colors are re-pointed here. */
.apply-page {
  --royal: #076398;
  --royal-dark: #054b74;
  --navy: #0b3a5b;
  --shadow: 0 4px 20px rgba(11, 58, 91, 0.10);
}
.apply-page .header-inner { padding: 8px 20px; }
.apply-page .apply-brand img { height: 66px; width: auto; display: block; }
@media (max-width: 540px) {
  .apply-page .header-inner { padding: 8px 14px; }
  .apply-page .apply-brand img { height: 56px; }
}
.apply-call { padding: 10px 16px; font-size: 0.95rem; white-space: nowrap; }
.apply-main { padding: 18px 14px 40px; }
.apply-shell { max-width: 720px; margin: 0 auto; }
.apply-loading { text-align: center; color: var(--text-muted); padding: 60px 0; }
.apply-footer .footer-bottom { justify-content: center; text-align: center; }

.preview-banner {
  background: #fff7e0; border: 1px solid #f1d27a; color: #5b4500;
  border-radius: 8px; padding: 10px 14px; font-size: 0.92rem; margin-bottom: 14px;
}

/* ---------- step header ---------- */
.step-head { margin-bottom: 14px; }
.progress { height: 8px; background: #dfe6f3; border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--royal), var(--sky)); border-radius: 99px; transition: width 0.3s ease; }
.step-count { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.step-head h1 {
  font-family: var(--font-head); font-weight: 700; text-transform: uppercase;
  color: var(--navy); font-size: clamp(1.7rem, 6vw, 2.3rem); line-height: 1.08; margin-bottom: 8px;
}
.step-head h1:focus { outline: none; }
.step-intro { color: var(--text-muted); }

.step {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  border-top: 5px solid var(--sky); padding: 20px 16px;
}

/* ---------- fields ---------- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 14px; }
.grid > * { grid-column: 1 / -1; min-width: 0; }
@media (min-width: 560px) {
  .grid > .half { grid-column: span 2; }
  .grid > .quarter { grid-column: span 1; }
  .step { padding: 28px 28px; }
}
@media (max-width: 559px) {
  .grid > .quarter { grid-column: span 2; }
}
.field label, .field legend, .photo-label, .consent-title, .repeat-title {
  display: block; font-weight: 700; color: var(--navy); margin-bottom: 6px; line-height: 1.35;
}
.req { color: #b3261e; }
.help { font-size: 0.9rem; color: var(--text-muted); margin: -2px 0 8px; }
.field input[type=text], .field input[type=email], .field input[type=tel], .field input[type=date],
.field input[type=month], .field input[type=number], .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 12px; font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  color: var(--text); background: #fff; border: 1.5px solid var(--border); border-radius: 8px;
  -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--royal) 50%), linear-gradient(135deg, var(--royal) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--sky); outline-offset: 1px; border-color: var(--royal); }
.field input[readonly] { background: var(--bg-alt); }
.counter { display: block; text-align: right; font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.field-error { color: #b3261e; font-weight: 600; font-size: 0.9rem; margin-top: 4px; }
.field-error:empty { display: none; }
.has-error input, .has-error select, .has-error textarea { border-color: #b3261e; }
.has-error .choice { border-color: #e2a29c; }

fieldset.choices { border: 0; padding: 0; margin: 0; min-width: 0; }
.choice-list { display: grid; gap: 8px; }
.choices.inline .choice-list { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.choices.checks .choice-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field label.choice, .choice {
  position: relative; display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: 8px; padding: 12px 12px; background: #fff;
  min-height: 48px; font-weight: 500; margin: 0 !important; color: var(--text) !important;
}
.field label.choice { margin-bottom: 0; }
.choice input { width: 20px; height: 20px; margin-top: 1px; flex-shrink: 0; accent-color: var(--royal); }
.choice:has(input:checked) { border-color: var(--royal); background: var(--sky-soft); }
.choice:has(input:focus-visible) { outline: 3px solid var(--sky); outline-offset: 2px; }
.choice-body { display: flex; flex-direction: column; }
.choice-label { font-weight: 600; }
.choice-desc { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; }
.choices.cards .choice { padding: 16px 14px; border-width: 2px; }
.choices.cards .choice-label { font-family: var(--font-head); font-size: 1.35rem; text-transform: uppercase; color: var(--navy); line-height: 1.1; }
.choices.rating .choice-list { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.choices.rating .choice { justify-content: center; padding: 10px 0; }
.choices.rating .choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choices.rating .choice-label { font-size: 1.1rem; }
.rating-ends { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.consent { display: flex !important; gap: 12px; align-items: flex-start; font-weight: 500 !important; color: var(--text) !important; cursor: pointer;
  background: var(--bg-alt); border: 1.5px solid var(--border); border-radius: 8px; padding: 12px; }
.consent input { width: 22px; height: 22px; flex-shrink: 0; margin-top: 2px; accent-color: var(--royal); }
.consent span { font-size: 0.95rem; line-height: 1.45; }

.note { background: var(--bg-alt); border-left: 4px solid var(--royal); border-radius: 6px; padding: 10px 14px; font-size: 0.95rem; color: var(--text); }
.note-sky { background: var(--sky-soft); border-left-color: var(--sky); font-weight: 600; color: var(--navy); }

.sig-input { font-size: 18px !important; }
.sig-preview { font-family: "Brush Script MT", "Segoe Script", "Snell Roundhand", cursive; font-size: 1.9rem; color: var(--navy); min-height: 2.4rem; border-bottom: 1.5px solid var(--navy); margin-top: 6px; padding: 0 4px; }

/* photos */
.photo-preview { border: 2px dashed var(--border); border-radius: 10px; background: var(--bg-alt); aspect-ratio: 1.586; overflow: hidden; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; max-width: 420px; }
.photo-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.photo-placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); font-weight: 600; }
.photo-icon { font-size: 2.4rem; line-height: 1; }
.photo-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-btns .btn { flex: 1 1 160px; padding: 12px 16px; }
.photo-status { font-size: 0.92rem; color: var(--navy); margin-top: 8px; }
.photo-status:empty { display: none; }

/* repeat */
.repeat-item { border: 1.5px solid var(--border); border-radius: 10px; padding: 14px 12px 16px; margin: 0 0 12px; position: relative; background: #fbfcfe; }
.repeat-item legend { font-family: var(--font-head); font-weight: 700; text-transform: uppercase; color: var(--royal); padding: 0 6px; font-size: 1.1rem; }
.repeat-item .remove { position: absolute; top: 8px; right: 12px; }
.add-item { width: 100%; }
.linkish { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--royal); text-decoration: underline; cursor: pointer; font-weight: 600; }

/* nav */
.step-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; }
.step-nav .btn { cursor: pointer; font-family: inherit; }
.step-nav .btn-lg { flex: 1; max-width: 340px; margin-left: auto; padding: 15px 20px; }
.btn-sm { padding: 6px 14px; font-size: 0.9rem; cursor: pointer; font-family: inherit; }
button.btn { cursor: pointer; font-family: inherit; }
button.btn:disabled { opacity: 0.6; cursor: progress; transform: none; }
.error-summary { border: 2px solid #b3261e; background: #fdf1f0; border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; color: #7a1a14; font-weight: 600; }
.error-summary ul { margin: 6px 0 0 18px; font-weight: 500; }
.error-summary a { color: #7a1a14; }
.error-summary:focus { outline: 3px solid var(--sky); }
.apply-foot { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-top: 18px; }

/* checkpoint / done */
.checkpoint { text-align: center; padding: 10px 4px; }
.checkpoint-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; background: var(--sky); color: var(--navy); }
.checkpoint.is-review .checkpoint-icon { background: var(--sky-soft); color: var(--royal); }
.checkpoint h1, .checkpoint h2 { font-family: var(--font-head); text-transform: uppercase; color: var(--navy); font-size: clamp(1.6rem, 5.5vw, 2.1rem); line-height: 1.1; margin-bottom: 10px; }
.checkpoint p { color: var(--text-muted); margin-bottom: 10px; }
.checkpoint .note { text-align: left; }
.small { font-size: 0.85rem; }

/* PSP stand-alone document */
.psp-doc { font-size: 0.93rem; line-height: 1.55; color: var(--text); }
.psp-doc p { margin-bottom: 12px; }
.psp-doc .psp-h { font-weight: 700; text-align: center; color: var(--navy); margin: 14px 0 8px; }
.psp-sign { background: var(--bg-alt); border: 1.5px solid var(--border); border-radius: 10px; padding: 14px; margin: 16px 0; }

/* review */
.review { display: grid; gap: 14px; }
.r-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.r-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 8px; }
.r-head h2 { font-size: 1.3rem; margin: 0; }
.r-card dl { display: grid; gap: 6px; }
.r-row { display: grid; grid-template-columns: 1fr; gap: 0; padding: 4px 0; border-bottom: 1px dashed #e3e8f2; }
.r-row:last-child { border-bottom: 0; }
.r-row dt { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.r-row dd { font-weight: 600; word-break: break-word; white-space: pre-wrap; }
.r-sublabel { color: var(--text-muted); font-weight: 500; }
@media (min-width: 560px) { .r-row { grid-template-columns: 42% 1fr; gap: 12px; } }
.r-thumb { max-width: 180px; border-radius: 6px; border: 1px solid var(--border); }
.submit-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); border-top: 5px solid var(--sky); padding: 16px; }
.submit-box .step-nav { margin-top: 8px; }
.submit-status { margin-top: 10px; font-weight: 600; color: var(--navy); }
.submit-status:empty { display: none; }
.ts-box:empty { display: none; }
.hp { position: absolute !important; left: -10000px !important; top: auto; width: 1px; height: 1px; overflow: hidden; }
.preview-card { margin-top: 16px; }
.preview-card h2 { font-size: 1.3rem; }
.preview-card ul { margin: 6px 0 12px 20px; }
.sms-preview { background: #e9f6e9; border-radius: 14px 14px 14px 4px; padding: 10px 14px; margin: 6px 0 14px; max-width: 420px; }

@media (max-width: 880px) { .apply-page body, body.apply-page { padding-bottom: 0; } }

/* manual license entry */
.t-toggle { margin-top: 4px; }
.toggle-btn { width: 100%; padding: 12px 14px; font-size: 0.98rem; border-style: dashed; }
.t-toggle.is-on .toggle-btn { border-style: solid; }
.review-flag { background: #fff7e0; border: 2px solid #e0a42a; color: #5b4500; border-radius: 10px; padding: 12px 14px; }
.r-row.r-flag dd { color: #8a5a00; }

/* barcode reader: retake tip + ?debug=1 panel (preview only) */
.photo-tip { display: block; margin-top: .35rem; color: #555; }
.bc-debug { margin-top: .6rem; padding: .5rem .7rem; border: 1px dashed #b45309; border-radius: 8px; background: #fffbeb; font-size: .8rem; }
.bc-debug summary { font-weight: 600; cursor: pointer; }
.bc-debug table { border-collapse: collapse; margin: .4rem 0; width: 100%; }
.bc-debug th, .bc-debug td { white-space: pre-line; text-align: left; vertical-align: top; padding: .1rem .4rem .1rem 0; font-weight: normal; word-break: break-word; }
.bc-debug th { color: #78350f; white-space: pre; width: 8.5rem; }
.bc-debug pre { white-space: pre-wrap; margin: 0; max-height: 14rem; overflow: auto; font-size: .72rem; }
