/* ==========================================================================
   Public job application form (apply/{token}).
   One white sheet, sections divided by hairlines, nothing boxed inside anything else.
   Mobile first: single column on phones; a section list beside the form from 992px.
   Colours and type come from the tokens in custom-css.css; the fallbacks keep the page right without it.
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.ap-body { margin: 0; background: var(--neutral-100, #F1F5F9); color: var(--text-primary, #1E293B); font-family: var(--font, "Inter", system-ui, sans-serif); -webkit-text-size-adjust: 100%; }

/* The colour tokens sit on the body as well as on .ap, so every public page uses them: the access page (email + PIN)
   and the "already submitted" page have no .ap wrapper, and without the tokens their inputs and buttons lost their borders and colour. */
.ap, .ap-body {
  --ap-brand: var(--brand-700, #1A3591);
  --ap-brand-hover: var(--brand-800, #172C77);
  --ap-ink: var(--neutral-900, #0F172A);
  --ap-text: var(--neutral-700, #334155);
  --ap-muted: var(--text-muted, #5A6678);
  --ap-line: var(--neutral-200, #E2E8F0);
  --ap-line-strong: var(--neutral-300, #CBD5E1);
  --ap-danger: #B42318;
  --ap-ok: #187A3E;
  --ap-bar: 60px;      /* height of the fixed heading bar; the section list and anchors sit below it */
}
.ap { padding-bottom: 64px; font-size: 15px; line-height: 1.5; }
.ap-body { font-size: 15px; line-height: 1.5; }
.ap *, .ap *::before, .ap *::after, .ap-body *, .ap-body *::before, .ap-body *::after { box-sizing: border-box; }
.ap [hidden], .ap-body [hidden] { display: none !important; }
/* :where() keeps the reset at zero specificity so the single-class margins below still win. */
.ap :where(h1, h2, h3, p, ul, ol) { margin: 0; padding: 0; }
.ap-body .ap-bar :where(h1, p) { margin: 0; } /* the bar on the access page (no .ap wrapper) */
.ap :where(ul, ol) { list-style: none; }

/* ── Heading bar: stays at the top of the page while the form scrolls ── */
.ap-bar { position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid var(--ap-line); }
.ap-bar__in { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.ap-bar__id { display: flex; align-items: center; gap: 12px; height: var(--ap-bar); }
.ap-bar__logo { width: 36px; height: 36px; object-fit: contain; flex: none; }
.ap-bar__text { min-width: 0; }
.ap-bar__title { font-size: 1.05rem; line-height: 1.25; font-weight: 700; letter-spacing: -.005em; color: var(--ap-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-bar__ref { font-size: 13px; line-height: 1.3; color: var(--ap-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-bar__ref strong { color: var(--ap-text); font-weight: 600; }
.ap-bar__org { display: none; }
@media (min-width: 640px) { .ap-bar__org { display: inline; } .ap-bar__title { font-size: 1.15rem; } }

/* Phones and tablets: where they are in the form, under the heading. */
.ap-topbar { padding-bottom: 0; }
.ap-topbar__row { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 7px; font-size: 13px; color: var(--ap-muted); }
.ap-topbar__where { color: var(--ap-ink); font-weight: 600; }
.ap-topbar .ap-meter { margin: 0 -16px; }

.ap-meter { height: 3px; background: var(--ap-line); }
.ap-meter > span { display: block; height: 100%; width: 0; background: var(--ap-brand); transition: width .3s ease; }

.ap-wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.ap-intro { margin: 16px 0 16px; font-size: 14px; color: var(--ap-muted); }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.ap-alert { margin-bottom: 16px; padding: 12px 16px; border: 1px solid; border-radius: 8px; font-size: 14px; }
.ap-alert strong { display: block; }
.ap-alert ul { margin-top: 4px; padding-left: 18px; list-style: disc; }
.ap-alert__note { margin-top: 8px; }
.ap-alert--danger { background: #FEF3F2; border-color: #FECDCA; color: #7A271A; }
.ap-alert--success { background: #ECFDF3; border-color: #ABEFC6; color: #074D31; }
.ap-alert--info { background: var(--brand-50, #EFF4FF); border-color: var(--brand-200, #BCD0FB); color: var(--brand-900, #12235E); }

/* ── Layout ───────────────────────────────────────────────────────────── */
.ap-layout { display: block; }
.ap-side { display: none; }
@media (min-width: 992px) {
  .ap-topbar { display: none; }
  .ap-layout { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 36px; align-items: start; }
  .ap-side { display: block; position: sticky; top: calc(var(--ap-bar) + 20px); }
}

/* Section list: plain text, the current one marked by a rule, finished ones by a tick. */
.ap-steps { border-left: 1px solid var(--ap-line-strong); }
.ap-steps a { display: flex; justify-content: space-between; gap: 8px; margin-left: -1px; padding: 6px 4px 6px 14px; border-left: 2px solid transparent; color: var(--ap-muted); font-size: 14px; text-decoration: none; }
.ap-steps a:hover { color: var(--ap-ink); }
.ap-steps a.is-active { border-left-color: var(--ap-brand); color: var(--ap-ink); font-weight: 600; }
.ap-steps a.is-done::after { content: "\2713"; color: var(--ap-ok); font-weight: 700; }
.ap-side__sub { margin: 14px 0 0 14px; font-size: 12.5px; color: var(--ap-muted); }

/* ── The sheet and its sections ───────────────────────────────────────── */
.ap-form { min-width: 0; padding: 0 16px; background: #fff; border: 1px solid var(--ap-line); border-radius: 10px; }
@media (min-width: 640px) { .ap-form { padding: 0 32px; } }

.ap-sec { scroll-margin-top: calc(var(--ap-bar) + 48px); padding: 26px 0 28px; border-top: 1px solid var(--ap-line); container-type: inline-size; }
.ap-sec[data-section="1"] { border-top: 0; }
@media (min-width: 992px) { .ap-sec { scroll-margin-top: calc(var(--ap-bar) + 16px); } }

/* Wide screens (a big monitor, or the browser zoomed out): the sections run in two columns instead of leaving the sides empty.
   Below this width the two column wrappers simply dissolve and the sections stack as one. */
.ap-col { display: contents; }
@media (min-width: 1500px) {
  .ap-bar__in, .ap-wrap { max-width: min(2200px, 100%); }
  .ap-form { padding: 0 44px; }
  .ap-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ap-col { display: block; min-width: 0; }
  .ap-col:first-child { padding-right: 44px; }
  .ap-col + .ap-col { padding-left: 44px; border-left: 1px solid var(--ap-line); }
  .ap-sec[data-section="7"] { border-top: 0; }
}
.ap-sec__title { font-size: 1.1rem; line-height: 1.3; font-weight: 700; letter-spacing: -.005em; color: var(--ap-ink); }
.ap-sec__n { margin-right: 8px; font-weight: 500; color: var(--ap-muted); font-variant-numeric: tabular-nums; }
.ap-sec__sub { margin-top: 3px; font-size: 14px; color: var(--ap-muted); }
.ap-sec__head { margin-bottom: 16px; }

/* ── Fields ───────────────────────────────────────────────────────────── */
.ap-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 16px; }
.ap-field { grid-column: span 12; min-width: 0; }
/* Spans follow the width of the section they sit in (a column on a wide screen is narrower than the window). */
@container (min-width: 460px) {
  .ap-span-3 { grid-column: span 3; } .ap-span-4 { grid-column: span 4; } .ap-span-5 { grid-column: span 5; }
  .ap-span-6 { grid-column: span 6; } .ap-span-8 { grid-column: span 8; } .ap-span-12 { grid-column: span 12; }
}
/* Where the narrowest field would be cramped, it takes half. */
@container (min-width: 460px) and (max-width: 719px) { .ap-span-3 { grid-column: span 6; } }

.ap-label { display: block; margin: 0 0 5px; font-size: 14px; font-weight: 500; color: var(--ap-ink); }
.ap-req { color: var(--ap-danger); }

.ap-input {
  display: block; width: 100%; min-height: 44px; padding: 8px 12px;
  font: inherit; font-size: 16px; /* 16px stops iOS zooming in on focus */ color: var(--ap-ink);
  background: #fff; border: 1px solid var(--ap-line-strong); border-radius: 6px;
  appearance: none; -webkit-appearance: none;
  transition: border-color .12s, box-shadow .12s;
}
@media (min-width: 992px) { .ap-input { min-height: 40px; padding: 7px 11px; font-size: 15px; } }
select.ap-input { padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2364748B' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center; }
textarea.ap-input { min-height: 88px; resize: vertical; }
.ap-input::placeholder { color: #8795A8; }
.ap-input:hover { border-color: #94A3B8; }
.ap-input:focus { outline: 0; border-color: var(--ap-brand); box-shadow: 0 0 0 3px rgba(26, 53, 145, .15); }
.ap-input.is-invalid { border-color: var(--ap-danger); }
.ap-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, .15); }
.ap-input[data-uppercase] { text-transform: uppercase; }
.ap-input[data-uppercase]::placeholder { text-transform: none; }

.ap-input-group { display: flex; }
.ap-input-group .ap-input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ap-prefix { display: grid; place-items: center; padding: 0 12px; font-size: 14px; color: var(--ap-muted); background: var(--neutral-50, #F8FAFC); border: 1px solid var(--ap-line-strong); border-right: 0; border-radius: 6px 0 0 6px; }

.ap-hint { margin-top: 4px; font-size: 13px; color: var(--ap-muted); }
.ap-error { margin-top: 4px; font-size: 13px; color: var(--ap-danger); }
.ap-error:empty { display: none; }

/* ── Pick-one: plain radios ───────────────────────────────────────────── */
.ap-choices { display: flex; flex-wrap: wrap; gap: 0 28px; }
.ap-choice { position: relative; display: inline-flex; align-items: center; gap: 9px; min-height: 40px; margin: 0; cursor: pointer; font-size: 15px; color: var(--ap-text); }
.ap-choice input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ap-choice span::before { content: ""; display: inline-block; vertical-align: -4px; width: 20px; height: 20px; margin-right: 9px; border-radius: 50%; border: 1.5px solid #8795A8; background: #fff; transition: border-color .12s, box-shadow .12s; }
.ap-choice:hover span::before { border-color: var(--ap-brand); }
.ap-choice input:checked + span { color: var(--ap-ink); }
.ap-choice input:checked + span::before { border-color: var(--ap-brand); background: var(--ap-brand); box-shadow: inset 0 0 0 4px #fff; }
.ap-choice input:focus-visible + span::before { outline: 3px solid rgba(26, 53, 145, .3); outline-offset: 2px; }
[role=radiogroup].is-invalid .ap-choice span::before { border-color: var(--ap-danger); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.ap-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 8px 16px; font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1.2; border-radius: 6px; border: 1px solid transparent; cursor: pointer; transition: background .12s, border-color .12s; }
.ap-btn:focus-visible { outline: 3px solid rgba(26, 53, 145, .35); outline-offset: 2px; }
.ap-btn--soft { color: var(--ap-brand); background: #fff; border-color: var(--ap-line-strong); }
.ap-btn--soft:hover { border-color: var(--ap-brand); background: var(--brand-50, #EFF4FF); }
.ap-btn--primary { color: #fff; background: var(--ap-brand); }
.ap-btn--primary:hover { background: var(--ap-brand-hover); }
.ap-btn--primary[disabled] { opacity: .7; cursor: progress; }
.ap-btn--lg { min-height: 48px; padding: 11px 28px; font-size: 16px; width: 100%; }
@media (min-width: 640px) { .ap-btn--lg { width: auto; } }

.ap-link-btn { padding: 4px 0; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ap-muted); background: none; border: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ap-link-btn:hover { color: var(--ap-danger); }

/* ── Repeating entries (jobs, qualifications, referees): hairlines, no boxes ── */
.ap-row { padding: 18px 0; border-top: 1px solid var(--ap-line); }
.ap-row:first-child { padding-top: 0; border-top: 0; }
.ap-row__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.ap-row__title { font-size: 14px; font-weight: 600; color: var(--ap-ink); }
/* The only entry can't be removed: there is always one to fill in, or leave empty. */
.ap-rep__list > .ap-row:only-child [data-remove] { display: none; }
.ap-rep__list > .ap-row:last-child { padding-bottom: 14px; }
.ap-rep .ap-btn { margin-top: 2px; }

.ap-subsection { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--ap-line); }
.ap-subsection__title { font-size: 1rem; font-weight: 600; color: var(--ap-ink); }
.ap-subsection__sub { margin: 2px 0 14px; font-size: 14px; color: var(--ap-muted); }

/* ── Documents ────────────────────────────────────────────────────────── */
.ap-docs { padding: 18px 0; border-top: 1px solid var(--ap-line); transition: background .12s; }
.ap-docs:first-of-type { padding-top: 0; border-top: 0; }
.ap-docs.is-drag { background: var(--brand-50, #EFF4FF); box-shadow: -12px 0 0 var(--brand-50, #EFF4FF), 12px 0 0 var(--brand-50, #EFF4FF); }
.ap-docs.is-invalid { box-shadow: -10px 0 0 #fff, -12px 0 0 var(--ap-danger); }
.ap-docs__title { font-size: 15px; font-weight: 600; color: var(--ap-ink); }
.ap-docs__tag { margin-left: 6px; font-size: 13px; font-weight: 400; color: var(--ap-muted); }
.ap-docs__tag--req { color: var(--ap-danger); }
.ap-docs__help { margin-top: 1px; font-size: 14px; color: var(--ap-muted); }
.ap-docs__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ap-docs__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; }
.ap-docs__hint { font-size: 13px; color: var(--ap-muted); }
.ap-docs__total { margin-top: 4px; font-size: 13px; color: var(--ap-muted); }
.ap-docs__total.is-over { color: var(--ap-danger); }

.ap-files { margin-top: 10px; }
.ap-files:empty { display: none; }
.ap-files li { display: flex; align-items: baseline; gap: 12px; min-width: 0; padding: 7px 0; border-bottom: 1px solid var(--ap-line); font-size: 14.5px; }
.ap-files li:first-child { border-top: 1px solid var(--ap-line); }
.ap-files__name { flex: 1; min-width: 0; color: var(--ap-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-files__name a { color: inherit; }
.ap-files__size { flex: none; font-size: 13px; color: var(--ap-muted); font-variant-numeric: tabular-nums; }

/* ── Submit ───────────────────────────────────────────────────────────── */
.ap-submit { padding: 24px 0 28px; border-top: 1px solid var(--ap-line); display: grid; gap: 12px; justify-items: start; }
.ap-submit .ap-alert { width: 100%; margin: 0; }
.ap-submit__note { font-size: 14px; color: var(--ap-muted); }
.ap-submit__wait { display: flex; gap: 9px; align-items: center; font-size: 14px; color: var(--ap-text); }
.ap-spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--ap-line-strong); border-top-color: var(--ap-brand); animation: ap-spin .7s linear infinite; }
@keyframes ap-spin { to { transform: rotate(360deg); } }
@media (max-width: 639px) { .ap-submit { justify-items: stretch; } }

@media (prefers-reduced-motion: reduce) {
  .ap *, .ap *::before, .ap *::after { animation: none !important; transition: none !important; }
}

/* Access page (start / continue with email + PIN) and draft saving (Nov 2026) */
.ap-access { max-width: 560px; padding-top: 24px; padding-bottom: 48px; }
/* The access page (email + PIN) reads like a job advert: the post on the left, "Apply for this post" on the right.
   Phones get one column in the order facts → apply → duties, so nobody scrolls past the whole advert to start. */
.ap-access--wide { max-width: 1120px; }
.ap-body > .ap-bar .ap-bar__in { max-width: 1120px; } /* the heading bar lines up with the page below it */
.ap-access__layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "facts" "apply" "role"; }
.ap-facts { grid-area: facts; }
.ap-access__role { grid-area: role; min-width: 0; }
.ap-access__apply { grid-area: apply; min-width: 0; }
@media (min-width: 992px) {
  .ap-access__layout { grid-template-columns: minmax(0, 1fr) 400px; gap: 20px 32px; grid-template-areas: "facts apply" "role apply"; grid-template-rows: auto 1fr; align-items: start; }
  .ap-access__apply .ap-jump { display: none; }
  .ap-access__apply { position: sticky; top: 20px; }
}
.ap-facts { display: flex; flex-wrap: wrap; gap: 0; margin: 0; background: #fff; border: 1px solid var(--ap-line); border-radius: 10px; }
.ap-facts__item { flex: 1 1 150px; padding: 12px 16px; }
.ap-facts__item + .ap-facts__item { border-left: 1px solid var(--ap-line); }
.ap-facts dt { font-size: 12.5px; font-weight: 500; color: var(--ap-muted); }
.ap-facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; color: var(--ap-ink); }
.ap-access__heading { margin: 0 0 8px; font-size: 1.2rem; font-weight: 700; color: var(--ap-ink); }
.ap-how { margin: 0 0 14px; padding-left: 1.3em; font-size: 14px; line-height: 1.55; color: var(--ap-text); list-style: decimal; }
.ap-how li { margin: 0 0 6px; padding-left: 2px; }
.ap-how strong { color: var(--ap-ink); font-weight: 600; }
.ap-jump { display: inline-block; margin: 0 0 12px; font-size: 14px; font-weight: 500; color: var(--ap-brand); }
.ap-access__role { scroll-margin-top: 16px; }
.ap-access--wide .ap-about { margin: 0 0 16px; }
.ap-access--wide .ap-about__body { font-size: 15px; line-height: 1.7; }
/* The bar is not sticky-height-critical here (no section list), so a long job title wraps instead of being cut off. */
.ap-body > .ap-bar .ap-bar__id { height: auto; min-height: var(--ap-bar); padding: 10px 0; }
.ap-body > .ap-bar .ap-bar__title { white-space: normal; }
.ap-access__card { background: #fff; border: 1px solid var(--ap-line); border-radius: 10px; overflow: hidden; }
.ap-access__tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--ap-line); }
.ap-access__tab { padding: 14px 12px; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--ap-muted); background: var(--neutral-50, #F8FAFC); border: 0; cursor: pointer; }
.ap-access__tab + .ap-access__tab { border-left: 1px solid var(--ap-line); }
.ap-access__tab.is-on { color: var(--ap-ink); background: #fff; box-shadow: inset 0 -2px 0 var(--ap-brand); }
.ap-access__panel { padding: 22px 20px 24px; }
.ap-access__lead { margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; color: var(--ap-text); }
.ap-access__forgot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--ap-line); font-size: 14px; }
.ap-access__forgot > summary { cursor: pointer; color: var(--ap-brand); font-weight: 500; }
.ap-access__note { margin-top: 14px; font-size: 13px; color: var(--ap-muted); }
.ap-input--pin { font-size: 20px; letter-spacing: .3em; font-variant-numeric: tabular-nums; max-width: 240px; }
.ap-draftbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 16px 0; padding: 10px 14px; background: #fff; border: 1px solid var(--ap-line); border-radius: 8px; font-size: 14px; }
.ap-draftbar__who { color: var(--ap-muted); }
.ap-draftbar__who strong { color: var(--ap-ink); }
.ap-save { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ap-muted); }
.ap-save[data-state="saving"] { color: var(--ap-text); }
.ap-save[data-state="error"] { color: var(--ap-danger); }
.ap-save[data-state="saved"]::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #12B76A; }
.ap-draftbar__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-files__open { flex: none; font-size: 13px; }
.ap-docs.is-uploading { opacity: .7; }
/* A file name is a button that opens the in-app preview */
.ap-files__open { padding: 0; border: 0; background: none; font: inherit; text-align: left; color: var(--ap-brand); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ap-files__open:hover { color: var(--ap-ink); }

/* The access page: the post's duties and the application guidelines (formatted text from the opening), above the PIN card. */
.ap-about { margin: 0 0 12px; background: #fff; border: 1px solid var(--ap-line); border-radius: 10px; }
.ap-about__title { cursor: pointer; padding: 12px 16px; font-size: 15px; font-weight: 600; color: var(--ap-ink); }
.ap-about[open] .ap-about__title { border-bottom: 1px solid var(--ap-line); }
.ap-about__body { padding: 14px 16px 16px; font-size: 14.5px; line-height: 1.65; color: var(--ap-text); overflow-wrap: anywhere; }
.ap-about__body > :first-child { margin-top: 0; }
.ap-about__body > :last-child { margin-bottom: 0; }
.ap-about__body p, .ap-about__body ul, .ap-about__body ol, .ap-about__body blockquote { margin: 0 0 .6em; }
.ap-about__body ul, .ap-about__body ol { padding-left: 1.4em; }
.ap-about__body h1, .ap-about__body h2, .ap-about__body h3, .ap-about__body h4 { margin: 1em 0 .4em; font-weight: 700; line-height: 1.3; color: var(--ap-ink); }
.ap-about__body h1 { font-size: 1.35em; } .ap-about__body h2 { font-size: 1.2em; } .ap-about__body h3, .ap-about__body h4 { font-size: 1.05em; }
.ap-about__body blockquote { padding-left: 1em; border-left: 3px solid var(--ap-line-strong); color: var(--ap-muted); }
.ap-about__body a { color: var(--ap-brand); }
