*, *::before, *::after { box-sizing: border-box; }
body { background: #f0f4f8; font-family: 'Segoe UI', Arial, sans-serif; margin: 0; padding: 0; color:#222; }

.page-wrap { max-width: 820px; margin: 0 auto; padding: 0 16px 60px; }

/* Sticky slim header: logo left, steps centre, Apply Offline right */
.top-header { background: #fff; border-bottom: 1px solid #e6edf5; position: sticky; top: 0; z-index: 500;
    transition: transform .25s ease, box-shadow .25s ease; box-shadow: 0 1px 8px rgba(16,40,70,.06); }
.top-header.hdr-hidden { transform: translateY(-100%); box-shadow: none; }
.hdr-main { max-width: 1040px; margin: 0 auto; height: 56px; padding: 0 20px; display: flex; align-items: center; gap: 24px; }
.hdr-logo { display: flex; align-items: center; flex-shrink: 0; }
.hdr-logo img { height: 30px; display: block; }
.btn-offline { margin-left: auto; flex-shrink: 0; display: inline-flex; align-items: center; color: #1a5fa8; background: #fff;
    border: 1px solid #1a5fa8; padding: 7px 16px; border-radius: 6px; text-decoration: none;
    font-size: 13px; font-weight: 600; transition: background .15s, color .15s; }
.btn-offline:hover { background: #1a5fa8; color: #fff; text-decoration: none; }

.progress-bar-bg { height: 3px; background: #e3ecf7; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg,#1a5fa8,#2f7fd0); transition: width .35s ease; width: 25%; }

.steps-bar { display: flex; align-items: center; justify-content: center; gap: 6px; flex: 1; min-width: 0; }
.step-item { display: flex; align-items: center; gap: 8px; position: relative; cursor: default; padding: 4px 8px; border-radius: 6px; }
.step-item.clickable { cursor: pointer; }
.step-item.clickable:hover { background: #f0f5fb; }
.step-item:not(:last-child)::after { content: ''; width: 20px; height: 2px; background: #d3dfec; margin-left: 6px; flex-shrink: 0; }
.step-item.completed:not(:last-child)::after { background: #43a047; }
.step-circle { width: 24px; height: 24px; border-radius: 50%; background: #d3dfec; color: #fff; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; transition: background .2s; }
.step-item.active .step-circle { background: #1a5fa8; }
.step-item.completed .step-circle { background: #43a047; }
.step-label { font-size: 13px; color: #8a97a6; font-weight: 600; white-space: nowrap; }
.step-item.active .step-label, .step-item.completed .step-label { color: #222; }

.page-intro { padding: 22px 0 0; }
.page-title { color: #1a5fa8; font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.page-subtitle { color: #667; font-size: 13px; margin: 0; line-height: 1.5; }

/* Schools & Universities mode */
.school-only, .lbl-school { display: none; }
body.school-mode .school-only { display: block; }
body.school-mode span.school-only { display: inline; }
body.school-mode .lbl-school { display: inline; }
body.school-mode .lbl-normal, body.school-mode .normal-only { display: none !important; }

/* Cards */
.card { background: #fff; border-radius: 12px; box-shadow: 0 2px 16px rgba(0,0,0,.07); padding: 28px 32px; margin: 16px 0 24px; }
.section-title { font-size: 12px; font-weight: 700; color: #1a5fa8; text-transform: uppercase; letter-spacing: .6px;
    margin: 26px 0 16px; padding-bottom: 8px; border-bottom: 1px dashed #e2eaf5; }
.section-title:first-child { margin-top: 0; }
.section-hint { font-size: 12px; color: #888; margin: -10px 0 16px; }

/* Grid */
.row { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 -8px; }
.col-6 { flex: 1 1 calc(50% - 16px); min-width: 220px; }
.col-4 { flex: 1 1 calc(33.333% - 16px); min-width: 180px; }
.col-12 { flex: 1 1 100%; }

/* Form fields */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #333; margin-bottom: 6px; }
.form-group label .req { color: #e53935; margin-left: 2px; }
.form-control { width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid #cfd8e3; border-radius: 6px;
    background: #fff; transition: border-color .15s, box-shadow .15s; font-family: inherit; }
.form-control:focus { outline: none; border-color: #1a5fa8; box-shadow: 0 0 0 3px rgba(26,95,168,.12); }
.form-control.error { border-color: #e53935; }
textarea.form-control { resize: vertical; min-height: 80px; }
.field-error { display: none; font-size: 12px; color: #e53935; margin-top: 5px; }
.form-group.has-error .field-error { display: block; }

/* Address autocomplete dropdown */
.addr-suggest-wrap { position: relative; }
.addr-suggest-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 50;
    background: #fff; border: 1px solid #cfd8e3; border-radius: 6px; margin-top: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1); max-height: 220px; overflow-y: auto; }
.addr-suggest-list:empty { display: none; border: none; box-shadow: none; margin-top: 0; }
.addr-suggest-item { padding: 9px 12px; font-size: 13px; color: #333; cursor: pointer; }
.addr-suggest-item:hover { background: #eef5ff; color: #1a5fa8; }
.addr-suggest-item:not(:last-child) { border-bottom: 1px solid #f0f0f0; }

/* Toggle pills */
.toggle-group { display: inline-flex; border: 1px solid #cfd8e3; border-radius: 6px; overflow: hidden; }
.toggle-btn { padding: 9px 22px; font-size: 13px; font-weight: 600; color: #555; background: #fff; border: none;
    cursor: pointer; transition: background .15s, color .15s; }
.toggle-btn:not(:last-child) { border-right: 1px solid #cfd8e3; }
.toggle-btn.active { background: #1a5fa8; color: #fff; }

/* Repeatable mini-cards */
.mini-card { border: 1px solid #e3ecf7; border-radius: 8px; padding: 18px 20px; margin-bottom: 14px; background: #fafcff; position: relative; }
.mini-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mini-card-head h4 { margin: 0; font-size: 13px; font-weight: 700; color: #1a5fa8; }
.mini-remove { color: #e53935; font-size: 12px; font-weight: 600; cursor: pointer; background: none; border: none; }
.btn-add { display: inline-flex; align-items: center; gap: 6px; background: #eef5ff; color: #1a5fa8; border: 1px dashed #a0bcd8;
    padding: 9px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-add:hover { background: #e0edff; }

/* Drop zone */
.drop-zone { border: 2px dashed #a0bcd8; border-radius: 10px; padding: 26px 20px; text-align: center;
    cursor: pointer; transition: border-color .2s, background .2s; background: #f7fbff; }
.drop-zone:hover, .drop-zone.drag-over { border-color: #1a5fa8; background: #eef5ff; }
.drop-zone .dz-icon { font-size: 30px; color: #a0bcd8; margin-bottom: 6px; }
.drop-zone .dz-label { font-size: 13px; font-weight: 600; color: #333; }
.drop-zone .dz-sub { font-size: 11px; color: #888; }
.drop-zone input[type=file] { display: none; }
.file-selected { margin-top: 12px; display: none; align-items: center; gap: 10px; padding: 9px 14px;
    background: #eef5ff; border-radius: 6px; border: 1px solid #b8d0ed; }
.file-selected .fs-name { font-size: 13px; color: #1a5fa8; font-weight: 600; flex: 1; }
.file-selected .fs-remove { color: #999; cursor: pointer; font-size: 16px; text-decoration: none; }

.note-box { background: #fffbea; border-left: 4px solid #f0b429; border-radius: 6px;
    padding: 12px 16px; font-size: 13px; color: #555; margin-top: 18px; }
.note-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
    border-radius: 50%; background: #f0b429; color: #fff; font-size: 11px; font-weight: 700; margin-right: 4px; }

/* Review */
.review-block { margin-bottom: 18px; }
.review-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #1a5fa8; margin: 0 0 8px; }
.review-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 20px; font-size: 13px; }
.review-grid .rk { color: #888; }
.review-grid .rv { color: #222; font-weight: 600; word-break: break-word; }
.review-empty { font-size: 13px; color: #aaa; font-style: italic; }
.edit-link { font-size: 12px; color: #1a5fa8; cursor: pointer; font-weight: 600; }

/* Signature */
.sig-input { font-family: 'Brush Script MT', 'Segoe Script', cursive; font-size: 30px; border: none;
    border-bottom: 2px solid #1a5fa8; background: transparent; width: 100%; padding: 6px 4px; color: #1a5fa8; }
.sig-input:focus { outline: none; }
.captcha-box { display: flex; align-items: center; gap: 12px; border: 1px solid #cfd8e3; border-radius: 8px;
    padding: 14px 16px; background: #f7fbff; }
.captcha-box input[type=checkbox] { width: 20px; height: 20px; }
.captcha-box .cb-label { font-size: 13px; color: #444; }
.captcha-box .cb-sub { font-size: 11px; color: #999; margin-top: 2px; }

.certify-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; }
.certify-row input[type=checkbox] { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; }
.certify-row label { font-size: 12px; color: #666; line-height: 1.5; }

/* Nav buttons */
.stage-nav { display: flex; justify-content: space-between; margin-top: 8px; }
.btn-back { padding: 12px 24px; background: #fff; color: #1a5fa8; border: 1px solid #1a5fa8;
    border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; transition: background .2s; }
.btn-back:hover { background: #eef5ff; }
.btn-back:disabled { opacity: .35; cursor: not-allowed; }
.btn-next, .btn-submit { padding: 12px 28px; background: #1a5fa8; color: #fff; border: none;
    border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; transition: background .2s; }
.btn-next:hover, .btn-submit:hover { background: #144d8a; }

/* Stage visibility */
.stage { display: none; }
.stage.active { display: block; }

/* Modal (spinner / success) */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000;
    align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal-box { background: #fff; border-radius: 14px; padding: 36px 40px; max-width: 420px; width: 90%;
    text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,.18); }
.modal-box.success-box { border-top: 5px solid #43a047; }
.spinner-steps { list-style: none; padding: 0; margin: 24px 0 0; text-align: left; }
.spinner-steps li { display: flex; align-items: center; gap: 14px; padding: 10px 0;
    border-bottom: 1px solid #f0f0f0; font-size: 14px; color: #aaa; }
.spinner-steps li:last-child { border-bottom: none; }
.spinner-steps li.active { color: #1a5fa8; font-weight: 600; }
.spinner-steps li.done { color: #43a047; }
.spinner-steps li .s-icon { width: 26px; height: 26px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; background: #eee; }
.spinner-steps li.active .s-icon { background: #1a5fa8; color:#fff; }
.spinner-steps li.done .s-icon { background: #43a047; color:#fff; }
.modal-title { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.modal-sub { font-size: 13px; color: #777; margin: 0; }
.modal-btn { margin-top: 24px; padding: 10px 28px; border: none; border-radius: 6px; cursor: pointer;
    font-size: 14px; font-weight: 600; background:#43a047; color:#fff; }
.modal-btn:hover { background:#2e7d32; }
.success-icon { font-size: 52px; color: #43a047; }

@media (max-width: 640px) {
    .col-6, .col-4 { flex: 1 1 100%; }
    .review-grid { grid-template-columns: 1fr; }
    .step-label { display: none; }
    .step-item.active .step-label { display: inline; font-size: 12px; }
    .step-item:not(:last-child)::after { width: 8px; margin-left: 2px; }
    .hdr-main { padding: 0 12px; gap: 10px; }
    .hdr-logo img { height: 24px; }
    .btn-offline { padding: 6px 10px; font-size: 12px; }
    .card { padding: 20px 16px; }
}

/* newdesign2: logo + Apply Offline row, step tracker on its own row below */
.hdr-two-row .hdr-main { height: 50px; justify-content: space-between; }
.hdr-two-row .hdr-steps { border-top: 1px solid #eef2f7; }
.hdr-two-row .hdr-steps .steps-bar { max-width: 1040px; margin: 0 auto; padding: 6px 20px; }
.hdr-two-row .top-header.hdr-hidden { transform: none; box-shadow: 0 1px 8px rgba(16,40,70,.06); } /* newdesign2: always visible */
.hdr-two-row .hdr-main { position: relative; }
.hdr-two-row .hdr-title { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; font-size: 24px; line-height: 1; font-weight: 700; color: #1a5fa8; white-space: nowrap; }
@media (max-width: 640px) {
    .hdr-two-row .hdr-main { height: auto; flex-wrap: wrap; padding: 8px 12px 6px; row-gap: 4px; }
    .hdr-two-row .hdr-title { position: static; transform: none; order: 3; width: 100%; text-align: center; font-size: 18px; white-space: normal; }
}

/* Instant email check message */
.email-msg { font-size: 12px; margin-top: 5px; }
.email-msg:empty { display: none; }
.email-msg.invalid { color: #e53935; }
.email-msg.warn { color: #b26a00; }
.email-msg.warn a { color: #1a5fa8; font-weight: 600; text-decoration: underline; }
.email-msg.checking { color: #8a97a6; }

/* Email check feedback: green tick when valid, red cross when not */
.form-control.valid { border-color: #2e9e4f; }
.email-msg.valid { color: #2e9e4f; font-weight: 600; }
.email-msg.valid::before { content: '\2713'; margin-right: 6px; font-weight: 700; }
.email-msg.invalid { font-weight: 600; }
.email-msg.invalid::before { content: '\2715'; margin-right: 6px; font-weight: 700; }
.email-msg.warn::before { content: '!'; margin-right: 6px; font-weight: 700; }
