/* MetaPi TPMS 2.8.1 Applicant Portal — aligned with the deployed unified-auth shell. */
.ap-main{width:min(1080px,100%);margin:0 auto;padding:28px 20px 42px}.ap-page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin-bottom:18px}.ap-page-head h1{margin:0;font-size:27px;line-height:1.2}.ap-page-head p{margin:6px 0 0;color:#64748b;line-height:1.5}.ap-grid{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(310px,.85fr);gap:18px}.ap-card{background:#fff;border:1px solid #dce5f0;border-radius:14px;box-shadow:0 8px 28px rgba(15,32,58,.06);overflow:hidden}.ap-card-head{padding:16px 18px;border-bottom:1px solid #e6ecf3;display:flex;align-items:center;justify-content:space-between;gap:12px}.ap-card-head h2{font-size:16px;margin:0}.ap-card-body{padding:18px}.ap-row{display:grid;grid-template-columns:minmax(135px,.42fr) 1fr;gap:12px;padding:10px 0;border-bottom:1px solid #eef2f7}.ap-row:last-child{border-bottom:0}.ap-row small{color:#64748b}.ap-row strong{font-size:13px;overflow-wrap:anywhere}.ap-status{display:inline-flex;align-items:center;min-height:26px;padding:0 10px;border-radius:999px;background:#e8f2ff;color:#1759b9;font-size:11px;font-weight:800}.ap-status.good{background:#dcfce7;color:#166534}.ap-status.warn{background:#fef3c7;color:#92400e}.ap-status.bad{background:#fee2e2;color:#991b1b}.ap-action-stack{display:grid;gap:10px}.ap-btn{min-height:42px;display:inline-flex;align-items:center;justify-content:center;padding:0 16px;border-radius:9px;border:1px solid #cbd7e5;background:#fff;color:#163252;text-decoration:none;font-size:13px;font-weight:800;cursor:pointer}.ap-btn.primary{background:#2468e8;color:#fff;border-color:#2468e8}.ap-btn.success{background:#128a4b;color:#fff;border-color:#128a4b}.ap-btn:disabled{opacity:.55;cursor:not-allowed}.ap-payment-breakdown{display:grid;gap:0}.ap-money-row{display:flex;justify-content:space-between;gap:18px;padding:10px 0;border-bottom:1px solid #eef2f7;font-size:13px}.ap-money-row.due{font-weight:800;color:#b42318}.ap-message{padding:12px 14px;border-radius:10px;margin-bottom:15px;font-size:13px}.ap-message.success{background:#ecfdf5;border:1px solid #bbf7d0;color:#166534}.ap-message.error{background:#fff1f2;border:1px solid #fecdd3;color:#9f1239}.ap-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.ap-form-grid label{margin:0!important}.ap-form-grid .full{grid-column:1/-1}.ap-form-grid select,.ap-form-grid input,.ap-form-grid textarea{display:block;width:100%;min-height:44px;margin-top:6px;border:1px solid #cbd7e5;border-radius:9px;padding:10px 12px;background:#fff;color:#0b1f3a;font:inherit}.ap-form-grid select:focus,.ap-form-grid input:focus,.ap-form-grid textarea:focus{outline:none;border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.12)}.ap-section-title{font-size:13px;font-weight:850;margin:2px 0 12px;color:#173253}.ap-help{margin:8px 0 0;color:#64748b;font-size:12px;line-height:1.55}.ap-methods{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:14px}.ap-methods label{margin:0!important;padding:10px 12px;border:1px solid #dce5f0;border-radius:9px;font-size:13px}.ap-footer{min-height:52px;border-top:1px solid #dce5f0;background:#fff;color:#64748b;display:flex;align-items:center;justify-content:center;text-align:center;padding:12px 20px;font-size:12px}
@media(max-width:780px){.ap-grid{grid-template-columns:1fr}.ap-form-grid{grid-template-columns:1fr}.ap-page-head{align-items:flex-start;flex-direction:column}.ap-row{grid-template-columns:1fr;gap:4px}}
.ap-application-switcher{display:flex;gap:8px;overflow-x:auto;margin:0 0 18px;padding:5px;border:1px solid #dce5f0;border-radius:12px;background:#fff}.ap-application-switcher a{display:flex;flex-direction:column;gap:2px;min-width:165px;padding:9px 12px;border-radius:8px;color:#455b75;text-decoration:none}.ap-application-switcher a strong{font-size:12px}.ap-application-switcher a span{font-size:10.5px;color:#728196}.ap-application-switcher a.active{background:#eaf2ff;color:#174fa7}.ap-application-switcher a.active span{color:#356ab1}.ap-message.info{background:#eff6ff;border:1px solid #bfdbfe;color:#1e4f91}

/* MAP 2.8.2 CNIC-first public entry */
.ua-apply-form{display:grid;gap:14px;width:100%}.ua-apply-form .ua-field{margin:0}.ua-apply-form .ua-primary,.ua-apply-form button{width:100%;min-height:44px}.ua-apply-note{margin:0;color:#64748b;font-size:12px;line-height:1.5}
.ua-apply-cnic-form{display:grid;gap:14px;width:100%;margin-top:2px}.ua-apply-cnic-form label{display:grid;gap:7px;margin:0;font-size:12px;font-weight:750}.ua-apply-cnic-form input,.ua-apply-continue{width:100%;min-height:44px;border-radius:9px}.ua-apply-cnic-form input{border:1px solid #cbd7e5;padding:9px 12px;font:inherit}.ua-apply-continue{border:1px solid #2563eb;background:#2563eb;color:#fff;font-weight:800;cursor:pointer}.ua-apply-continue:hover{background:#1e57c7;border-color:#1e57c7}.ua-apply-form>p{margin:0 0 6px;color:#64748b;line-height:1.45}

/* MAP 2.8.3 secure Applicant Status completion + next-step layout */
body.ap-shell{min-height:100vh;display:flex;flex-direction:column}.ap-main-grow{flex:1}.ap-status-layout{display:grid;grid-template-columns:minmax(0,1.08fr) minmax(330px,.92fr);gap:18px;align-items:start}.ap-next-step-card{border-color:#cfe0ff}.ap-next-step-message{padding:12px 14px;border-radius:10px;background:#eff6ff;border:1px solid #bfdbfe;color:#234e82;font-size:13px;line-height:1.55}.ap-checklist{display:grid;gap:8px;margin:12px 0 0;padding:0;list-style:none}.ap-checklist li{position:relative;padding-left:22px;font-size:12px;line-height:1.45}.ap-checklist li:before{content:'✓';position:absolute;left:0;top:0;color:#187a44;font-weight:900}.ap-application-completion{margin-top:18px}.ap-application-form{display:grid;gap:18px}.ap-form-section{padding-top:2px}.ap-doc-upload-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.ap-doc-upload{display:grid;gap:7px;padding:12px;border:1px solid #dce5f0;border-radius:10px;background:#fbfdff}.ap-doc-upload strong{font-size:12px}.ap-doc-state{font-size:10.5px;color:#64748b}.ap-doc-status-row{display:flex;justify-content:space-between;gap:10px;align-items:center}.ap-payment-card{margin-top:18px}.ap-footer{margin-top:auto}.ap-main .ap-card+.ap-card{margin-top:0}
@media(max-width:850px){.ap-status-layout,.ap-doc-upload-grid{grid-template-columns:1fr}}

/* MAP 2.8.4 applicant layout polish */
.ap-status-grid{align-items:stretch}.ap-status-grid>.ap-card{height:100%}.ap-card-head{min-height:54px;display:flex;align-items:center;justify-content:space-between;gap:14px}.ap-card-body{padding:18px}.ap-row{display:grid;grid-template-columns:minmax(120px,.7fr) minmax(0,1.4fr);gap:14px;align-items:start;padding:9px 0}.ap-row small{line-height:1.35}.ap-row strong{line-height:1.4}.ap-doc-status-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:14px}.ap-doc-status-row>span{display:grid;gap:4px;padding:11px;border:1px solid #dce5ef;border-radius:9px;background:#f8fafc}.ap-doc-status-row small{color:#64748b}.ap-checklist{display:grid;gap:8px;margin-top:12px;padding:12px;border-radius:9px;background:#eff6ff;border:1px solid #cfe0ff}.ap-checklist label{display:flex;align-items:center;gap:8px;line-height:1.35}.ap-checklist label span{color:#16a34a;font-weight:800}.ap-form-grid{column-gap:14px;row-gap:14px}.ap-form-grid label{display:grid;gap:6px;align-content:start}.ap-form-grid select,.ap-form-grid input{min-height:42px}.ap-completion-summary{margin-top:18px}
@media(max-width:760px){.ap-row{grid-template-columns:1fr;gap:4px}.ap-doc-status-row{grid-template-columns:1fr 1fr}}


/* MAP 2.8.4 live remediation — applicant read-only profile and secure document view */
.ap-readonly-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:18px}.ap-readonly-course{margin-top:18px}.ap-readonly-grid .ap-card{height:100%}.ap-document-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:14px}.ap-document-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px 14px;align-items:center;padding:14px;border:1px solid #dce5ef;border-radius:10px;background:#f8fafc}.ap-document-meta{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}.ap-document-meta>strong{font-size:13px}.ap-document-note{grid-column:1/-1;color:#8a4b16;line-height:1.45}.ap-document-view{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:0 11px;border:1px solid #c7d7ec;border-radius:8px;background:#fff;color:#1759b9;text-decoration:none;font-size:12px;font-weight:800}.ap-document-view:hover{background:#eff6ff;border-color:#9fc0ee}.ap-document-view svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8}.ap-document-missing{font-size:11px;color:#94a3b8}.ap-status:empty{display:none}
@media(max-width:850px){.ap-readonly-grid,.ap-document-grid{grid-template-columns:1fr}}


/* 2026-08-11 Applicant Status alignment polish */
.ap-location-row{align-items:center}.ap-location-row small{align-self:center}.ap-location-row strong{display:flex;align-items:center;justify-content:flex-start}
.ap-next-step-card .ap-checklist{margin:12px 0 12px}.ap-next-step-card .ap-checklist + .ap-message.info{margin-top:0}
/* MAP 3.0 UI hotfix 2026-08-17
   Preserve one consistent 18px vertical rhythm between completed read-only cards.
   This intentionally overrides .ap-main .ap-card + .ap-card { margin-top:0 }. */
.ap-main .ap-card.ap-readonly-course{margin-top:18px}
.ap-main .ap-card.ap-completion-summary{margin-top:18px}

/* MAP 3.0 Application module lock — governed applicant corrections */
.ap-card-head-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}.ap-card-head-actions .ap-btn.compact{min-height:28px;padding:0 10px;font-size:10px}.ap-edit-open{overflow:hidden}.ap-edit-drawer-backdrop{position:fixed;inset:0;z-index:7300;display:flex;justify-content:flex-end;background:rgba(15,23,42,.48);backdrop-filter:blur(2px)}.ap-edit-drawer-backdrop[hidden]{display:none!important}.ap-edit-drawer{width:min(720px,96vw);height:100%;display:flex;flex-direction:column;background:var(--ap-card,#fff);border-left:1px solid var(--ap-border,#dce5ef);box-shadow:-24px 0 60px rgba(15,23,42,.22)}.ap-edit-drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:18px 20px;border-bottom:1px solid var(--ap-border,#dce5ef);background:var(--ap-card,#fff)}.ap-edit-drawer-head h2{margin:3px 0 0;color:var(--ap-text,#0f172a);font-size:20px}.ap-edit-drawer-head p{margin:5px 0 0;color:var(--ap-muted,#64748b);font-size:11px;line-height:1.45}.ap-edit-drawer-close{width:36px;height:36px;display:grid;place-items:center;flex:0 0 36px;border:1px solid var(--ap-border,#dce5ef);border-radius:9px;background:var(--ap-card,#fff);color:var(--ap-text,#0f172a);font-size:22px;cursor:pointer}.ap-edit-drawer-body{flex:1;min-height:0;overflow:auto;padding:18px 20px;background:var(--ap-card,#fff)}.ap-edit-pane{display:grid;gap:14px}.ap-edit-pane[hidden]{display:none!important}.ap-edit-instruction{display:grid;gap:4px;padding:12px 13px;border:1px solid #bfdbfe;border-radius:10px;background:#eff6ff;color:#1e3a8a}.ap-edit-instruction strong{font-size:12px}.ap-edit-instruction span,.ap-edit-instruction small{font-size:10.5px;line-height:1.45}.ap-edit-pane .ap-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.ap-edit-pane .ap-form-grid label{display:grid;gap:6px;color:var(--ap-text,#0f172a);font-size:10.5px;font-weight:750}.ap-edit-pane .ap-form-grid label.full{grid-column:1/-1}.ap-edit-pane .ap-form-grid input,.ap-edit-pane .ap-form-grid select{width:100%;min-height:40px;padding:8px 10px;border:1px solid var(--ap-border,#dce5ef);border-radius:8px;background:var(--ap-card,#fff);color:var(--ap-text,#0f172a)}.ap-edit-actions{grid-column:1/-1;display:flex;justify-content:flex-end;padding-top:4px}.ap-edit-actions .ap-btn{min-width:190px}
@media(max-width:680px){.ap-card-head-actions{justify-content:flex-start}.ap-edit-drawer{width:100%}.ap-edit-drawer-head,.ap-edit-drawer-body{padding-left:14px;padding-right:14px}.ap-edit-pane .ap-form-grid{grid-template-columns:1fr}.ap-edit-pane .ap-form-grid label.full,.ap-edit-actions{grid-column:auto}.ap-edit-actions .ap-btn{width:100%}}
html[data-map-theme="dark"] .ap-edit-drawer-backdrop{background:rgba(2,8,18,.68)}html[data-map-theme="dark"] .ap-edit-drawer,html[data-map-theme="dark"] .ap-edit-drawer-head,html[data-map-theme="dark"] .ap-edit-drawer-body{background:#111c2d!important;border-color:#334155!important;color:#e5edf8!important}html[data-map-theme="dark"] .ap-edit-drawer-close{background:#0d1828;border-color:#3b4c63;color:#dce6f2}html[data-map-theme="dark"] .ap-edit-instruction{background:#10284a;border-color:#346ab1;color:#c7dcff}html[data-map-theme="dark"] .ap-edit-pane .ap-form-grid input,html[data-map-theme="dark"] .ap-edit-pane .ap-form-grid select{background:#0d1828;border-color:#3b4c63;color:#e5edf8}

/* Field captions: .ap-form-grid label is a grid, so every direct child forms its
   own row. Captions are now wrapped in a <span> so the required asterisk stays
   on the caption line instead of becoming a row of its own and pushing the
   inputs out of alignment with the field beside them. justify-content:flex-end
   Inputs are bottom-aligned across a row via align-content so a wrapping
   caption cannot knock its neighbour out of line. */
/* NOTE: this is a GRID container, so justify-content works on the INLINE axis —
   setting it here collapsed every field to its content width and shoved it
   sideways. Bottom-aligning the input is align-content (block axis). */
.ap-form-grid label{align-content:end}
.ap-form-grid label>span{display:block;line-height:1.35}
.ap-form-grid label>span em{font-style:normal;color:#dc2626;margin-left:2px}

/* Centred action rows (apply screens). */
.ua-actions-center{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap}

/* Guidance note above a field group. */
.ap-field-note{grid-column:1/-1;margin:0 0 2px;padding:10px 12px;border:1px solid #cfe0ff;border-radius:9px;background:#eff6ff;color:#1e3a8a;font-size:12px;line-height:1.5}

/* View link inside a document card — sized to its content, not stretched
   across the grid column. */
.ap-doc-upload .ap-document-view{justify-self:start;margin:2px 0}

/* Applicant profile photograph dialog.
   Two steps in one window: confirm the checks, then choose how to provide the
   photograph. Kept deliberately plain — the checklist exists to slow the
   applicant down for a few seconds, not to decorate. */

.ap-modal{position:fixed;inset:0;z-index:7400;display:flex;align-items:center;justify-content:center;padding:20px;background:rgba(15,23,42,.5)}
.ap-modal[hidden]{display:none!important}
.ap-modal-card{width:min(560px,100%);max-height:90vh;display:flex;flex-direction:column;background:#fff;border:1px solid #dce5ef;border-radius:14px;box-shadow:0 24px 60px rgba(15,23,42,.24)}
.ap-modal-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:16px 18px;border-bottom:1px solid #e6ecf3}
.ap-modal-head h2{margin:0;font-size:18px}
.ap-modal-close{width:34px;height:34px;flex:0 0 34px;display:grid;place-items:center;border:1px solid #dce5ef;border-radius:9px;background:#fff;color:#0f172a;font-size:21px;line-height:1;cursor:pointer}
.ap-modal-body{flex:1;min-height:0;overflow:auto;padding:18px}
.ap-modal-body .ap-help{margin:0 0 12px}
.ap-modal-body .ap-btn{width:100%}
body.ap-modal-open{overflow:hidden}

/* The Upload Photo button sits in the document card, so it should not stretch
   the card the way a full-width button would. */
.ap-doc-upload .ap-photo-open{width:auto;align-self:flex-start;margin:2px 0 6px}

/* Exit Application.
   Deliberately NOT red: signing out is routine, not destructive, and a red
   button next to "Send Application Information" would read as a warning. A
   quiet outlined button that turns red only on hover says "leave" without
   competing with the primary action. */
.ap-head-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}

/* Current status sits directly above the Next Step card rather than beside the
   applicant's name — the two belong together: where you are, and what happens next. */
.ap-next-column{display:grid;gap:12px;align-content:start}
.ap-current-status-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 14px;border:1px solid #dce5f0;border-radius:12px;background:#fff}
.ap-current-status-bar small{color:#64748b;font-size:12px;font-weight:700}

/* Footer: Exit on the left, Send on the right. */
.ap-form-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:18px}
.ap-send-btn{width:auto;min-width:240px}
@media(max-width:640px){
  .ap-form-footer{flex-direction:column-reverse;align-items:stretch}
  .ap-form-footer .ap-btn,.ap-form-footer .ap-exit-form{width:100%}
}
.ap-exit-form{margin:0;display:inline-flex}
.ap-exit-btn{width:auto;min-height:38px;padding:0 16px;border:1px solid #cbd7e5;background:#fff;color:#475569;font-weight:800}
.ap-exit-btn:hover{border-color:#fca5a5;background:#fff5f5;color:#b42318}

/* The Upload Photo trigger sits inside a document card — size it to its text
   rather than stretching the card. */
/* .ap-doc-upload is a GRID, so a child stretches across the column unless it
   is justified. align-self acts on the block axis and does nothing here —
   justify-self:start is what stops the button spanning the whole card. */
.ap-doc-upload .ap-photo-open{width:auto;justify-self:start;min-height:38px;padding:0 16px;margin:2px 0 6px}

/* Centre the uploader inside the dialog. .map-pp-widget is a grid, so the
   preview is centred by justifying its items rather than with auto margins. */
.ap-modal-body .map-pp-widget{justify-items:center}
.ap-modal-body .map-pp-preview-wrap{margin:0 auto}
.ap-modal-body .map-pp-widget>*{width:100%}
.ap-modal-body .map-pp-widget>.map-pp-preview-wrap{width:110px}
.ap-modal-body img{max-width:100%;height:auto}

/* Category-change notice. Amber rather than red: it is important and may cost
   the applicant money, but it is not an error or a rejection. */
.ap-category-change{background:#fffbeb;border:1px solid #fde68a;color:#92400e;line-height:1.5}
