/* ==========================================================================
   Claverton apply portal — the portal's layer over claverton.css
   --------------------------------------------------------------------------
   Built only from claverton.css tokens and components (design-system/
   MASTER.md). Adds the portal's masthead, cards and sign-in, at the
   readability settings MASTER.md §11 sets: no reading text under 14px, labels
   in sentence case, secondary text at 7:1.

   The AHEE form (main.ap-main--ahee) takes AHEE's tokens from
   design-system/AHEE.md, so everything under the masthead reads as AHEE's:
   indigo and sky, DM Sans headings, no serif. The masthead stays Claverton's.
   ========================================================================== */

/* ------------------------------------------------------------- readability */
body.ap {
  --t-small: 1rem;
  --t-micro: .9375rem;
  --t-label: .875rem;
  --c-muted: #3a4541;
  --c-muted-2: #3f4a46;
  --c-brass-deep: #6b4800;
  --w-portal: 1080px;
  background: var(--c-linen);
  color: var(--c-char);
  display: flex; flex-direction: column; min-height: 100vh;
}
.ap [hidden] { display: none !important; }
.ap-nowrap { white-space: nowrap; }

.ap-wrap { width: 100%; max-width: var(--w-portal); margin-inline: auto; padding-inline: var(--s-6); }
.ap-solo { max-width: 640px; padding-block: var(--s-9) var(--s-10); }

/* ------------------------------------------------- the account strip */
/* The website's own header sits above (v2/layout.js); once signed in, this
   strip under it says who, with the way back to the applications and out. */
.ap-acct { background: var(--c-white); border-bottom: 1px solid var(--c-line); }
.ap-acct__in { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-4); min-height: 52px; padding-block: var(--s-2); font-size: .9375rem; color: var(--c-muted); }
.ap-acct__k { font-weight: 700; color: var(--c-ink); margin-right: auto; }
.ap-acct .ap-linkbtn { font-size: .9375rem; }
.ap-sid {
  flex: none; padding: 4px 12px; border-radius: var(--r-pill);
  background: var(--c-teal-050); color: var(--c-ink);
  font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; white-space: nowrap;
}
.ap-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30ch; }

/* --------------------------------------------------------------- page body */
.ap-main { flex: 1; background: var(--c-linen); }
.ap-checking { padding-block: var(--s-10); color: var(--c-muted); }
.ap-intro { padding-block: var(--s-9) var(--s-6); max-width: 760px; }
.ap-title {
  font-family: var(--f-serif); font-weight: 400; color: var(--c-ink);
  font-size: var(--t-h2); line-height: 1.12; letter-spacing: -.01em; margin: 0 0 var(--s-3);
}
.ap-title:focus { outline: none; }
.ap-lede { font-size: var(--t-lede); color: var(--c-muted); max-width: 62ch; margin: 0; }
.ap-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }

.ap-card {
  background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-md);
  box-shadow: var(--sh-1); padding: var(--s-8) 40px;
}
.ap-solo .ap-card > .ap-lede { margin-bottom: var(--s-7); }
.ap-solo > .ap-lede { margin-bottom: var(--s-7); }
.ap-later { margin-bottom: var(--s-10); }
.ap-after { margin: var(--s-5) var(--s-2) 0; color: var(--c-muted); font-size: 1rem; }

/* Back link and the form's own tag (Claverton crest, or AHEE's mark) */
.ap-back { margin: 0 0 var(--s-5); }
.ap-formtag { display: inline-flex; align-items: center; gap: var(--s-3); margin: 0 0 var(--s-4); font-weight: 700; color: var(--c-ink); }
.ap-formtag__mark { display: inline-flex; }

/* ------------------------------------------------------------------- forms */
.ap .field { gap: 6px; }
.ap .field + .field { margin-top: var(--s-6); }
.ap .field__label { font-size: 1rem; color: var(--c-char); text-transform: none; letter-spacing: .01em; }
.ap .field__hint { font-size: .9375rem; color: var(--c-muted); margin: 0; }
.ap .field__error { display: flex; gap: 6px; align-items: flex-start; font-size: .9375rem; margin: 0; }
.ap .field__error svg { flex: none; margin-top: 3px; }
.ap .field.has-error .field__error:not([hidden]) { display: flex; }
.ap .input { min-height: 48px; font-size: 1rem; }
.ap .input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-teal) 28%, transparent); }
.ap .input[readonly] { background: var(--c-mist); color: var(--c-muted); }
.ap-form .form-status { margin-top: var(--s-5); }
.ap-form .form-status:not([hidden]) { display: block; }
.ap-form .form-status.is-error { background: #fdf3f3; border-color: rgba(156, 47, 47, .3); }
.ap-form .btn--block { margin-top: var(--s-6); }
.ap .btn:focus-visible, .ap-linkbtn:focus-visible, .ap-brand:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--c-teal) 45%, transparent); outline-offset: 2px;
}
.ap .btn[aria-busy="true"] { opacity: .7; cursor: progress; }

.ap-sent {
  display: flex; gap: var(--s-3); align-items: flex-start; margin: 0 0 var(--s-6);
  padding: var(--s-4) var(--s-5); border-radius: var(--r-sm);
  background: var(--c-teal-050); color: var(--c-char); font-size: 1rem;
}
.ap-sent svg { flex: none; margin-top: 3px; color: var(--c-teal); }
.ap-sent b { overflow-wrap: anywhere; }

.ap-form__links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-5); margin: var(--s-5) 0 0; }
.ap-wait { color: var(--c-muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.ap-linkbtn {
  background: none; border: 0; padding: 0; font: inherit; font-size: 1rem; font-weight: 700;
  color: var(--c-teal); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; border-radius: 4px;
}
.ap-linkbtn:disabled { color: var(--c-muted); text-decoration: none; cursor: default; }
.ap-noscript { margin-top: var(--s-6); }

/* ------------------------------------------------------- the field grid */
/* Six columns: full, half (3) and third (2); all full width under 560px. */
.ap-narrow { max-width: 820px; padding-bottom: var(--s-10); }
.ap-h2 { font-family: var(--f-serif); font-weight: 400; color: var(--c-ink); font-size: var(--t-h3); line-height: 1.2; margin: 0 0 var(--s-2); }
.ap-blurb { color: var(--c-muted); margin: 0; max-width: 64ch; }
.ap-reqnote { color: var(--c-muted); font-size: .9375rem; margin: var(--s-3) 0 0; }
.ap .req { color: var(--c-danger); }
.ap-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: var(--s-5); row-gap: var(--s-6); margin-top: var(--s-7); }
.ap-fields > * { grid-column: span 6; min-width: 0; }
.ap-fields > .ap-f--half { grid-column: span 3; }
.ap-fields > .ap-f--third { grid-column: span 2; }
.ap-fields .field + .field { margin-top: 0; }
/* Fields side by side start at the top: a taller neighbour (a hint, a
   "Same as mobile number" link) no longer stretches this one's box. */
.ap-fields > .field { align-content: start; }
.ap-fields--next { margin-top: var(--s-6); }

/* A password box with its Show button inside the right edge. */
.ap-pass { position: relative; }
.ap-pass .input { padding-right: 4.75rem; }
.ap-pass__show { position: absolute; top: 50%; right: var(--s-3); transform: translateY(-50%); }
fieldset.ap-f { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.ap-f > legend { padding: 0; margin-bottom: 6px; }
fieldset.ap-f > .field__hint { margin-bottom: var(--s-2); }
.ap-hint-after { margin-top: 2px !important; }
.ap-sub { grid-column: span 6; font-family: var(--f-serif); font-weight: 400; color: var(--c-ink); font-size: var(--t-h4); margin: var(--s-3) 0 -8px; padding-top: var(--s-5); border-top: 1px solid var(--c-line); }
.ap-fields > .ap-sub:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.ap-note { margin: 0; padding: var(--s-4) var(--s-5); border-radius: var(--r-sm); background: var(--c-teal-050); }

/* +91 prefix */
.ap-tel { display: flex; }
.ap-tel__pre {
  display: flex; align-items: center; padding: 0 var(--s-3); flex: none;
  border: 1px solid var(--c-line); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm);
  background: var(--c-mist); color: var(--c-muted); font-variant-numeric: tabular-nums;
}
.ap-tel .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.ap-under { margin: 4px 0 0; }
.ap-under .ap-linkbtn { font-size: .9375rem; }
.ap-other { margin-top: var(--s-2); }

/* Option cards: full-width, tappable, in a grid (min 170px) */
.ap-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s-2); }
.ap-opts--one { grid-template-columns: 1fr; }
.ap-opt {
  display: flex; align-items: flex-start; gap: 10px; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-white);
  line-height: 1.4; cursor: pointer; transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.ap-opt input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--c-teal); }
.ap-opt:hover { border-color: var(--c-teal); }
.ap-opt:has(input:checked) { border-color: var(--c-teal); background: var(--c-teal-050); }
.ap-opt:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-teal) 28%, transparent); }
.ap-opt--consent { padding: var(--s-4); }
.ap .field.has-error .ap-opt, .ap .field.has-error .ap-tel__pre { border-color: var(--c-danger); }
.ap .field.has-error .ap-other[aria-invalid="true"] { border-color: var(--c-danger); background: #fdf7f7; }

/* The count above the buttons, and the buttons */
.ap-banner {
  margin: var(--s-7) 0 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm);
  background: #fdf3f3; border: 1px solid rgba(156, 47, 47, .3); color: var(--c-danger); font-weight: 500;
}
.ap-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-7); padding-top: var(--s-6); border-top: 1px solid var(--c-line); }

/* ---------------------------------------------------------- privacy notice */
.ap-notice {
  margin: 0 0 var(--s-6); padding: var(--s-6) var(--s-7);
  background: var(--c-white); border: 1px solid var(--c-line); border-left: 4px solid var(--c-teal);
  border-radius: var(--r-md);
}
.ap-notice__title { font-family: var(--f-sans); font-weight: 700; font-size: 1.125rem; color: var(--c-ink); margin: 0 0 var(--s-4); }
.ap-notice__list { margin: 0; display: grid; gap: var(--s-3); }
.ap-notice__list > div { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: var(--s-4); }
.ap-notice__list dt { font-weight: 700; color: var(--c-char); }
.ap-notice__list dd { margin: 0; color: var(--c-muted); }
.ap-notice__more { margin: var(--s-4) 0 0; color: var(--c-muted); font-size: .9375rem; }

/* ------------------------------------------------------ confirmation screen */
.ap-done { max-width: 640px; margin-top: var(--s-9); }
.ap-tick { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--c-teal-050); color: var(--c-teal); margin-bottom: var(--s-5); }
.ap-done__title { font-family: var(--f-serif); font-weight: 400; color: var(--c-ink); font-size: var(--t-h2); line-height: 1.12; margin: 0 0 var(--s-5); }
.ap-done__title:focus { outline: none; }
.ap-done__k { margin: 0; font-weight: 700; color: var(--c-muted); }
.ap-refno { margin: 2px 0 var(--s-5); font-family: var(--f-serif); font-size: var(--t-h2); line-height: 1.1; letter-spacing: .04em; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.ap-done__p { color: var(--c-muted); margin: 0; }
.ap-done__p b { color: var(--c-char); overflow-wrap: anywhere; }
.ap-done__p + .ap-done__p { margin-top: var(--s-3); }
.ap-done--form { margin: var(--s-9) 0 var(--s-10); }
.ap-subnote { margin: var(--s-4) 0 0; padding: var(--s-4) var(--s-5); border-radius: var(--r-sm); background: var(--c-teal-050); border-left: 4px solid var(--c-teal); color: var(--c-char); max-width: 70ch; }

/* ------------------------------------------------------ applications home */
.ap-idcard {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap;
  margin: 0 0 var(--s-6); padding: var(--s-5) var(--s-6);
  background: var(--c-white); border: 1px solid var(--c-line); border-left: 4px solid var(--c-brass);
  border-radius: var(--r-md);
}
.ap-idcard p { margin: 0; }
.ap-idcard__k { font-weight: 700; color: var(--c-muted); }
.ap-idcard__id { font-family: var(--f-serif); font-size: var(--t-h3); line-height: 1.15; letter-spacing: .04em; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.ap-idcard__meta { color: var(--c-muted); font-size: .9375rem; }

.ap-forms { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); }
.ap-fcard {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-4) var(--s-6); align-items: center;
  padding: var(--s-6); background: var(--c-white); border: 1px solid var(--c-line);
  border-top: 4px solid var(--c-ink); border-radius: var(--r-md); box-shadow: var(--sh-1); color: var(--c-char);
}
.ap-fcard__main { display: flex; gap: var(--s-4); align-items: flex-start; min-width: 0; }
.ap-fcard__mark { display: inline-flex; flex: none; margin-top: 2px; }
.ap-fcard__title { font-family: var(--f-serif); font-weight: 400; font-size: var(--t-h4); line-height: 1.25; color: var(--c-ink); margin: 0 0 4px; }
.ap-fcard__desc { margin: 0; color: var(--c-muted); }
.ap-fcard__side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-3); text-align: right; }
.ap-fcard__state { margin: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ap-fcard__when { color: var(--c-muted); font-size: .9375rem; }
.ap-fcard__side .btn { min-width: 132px; }
.ap-fcard__note { grid-column: 1 / -1; margin: 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); background: var(--c-mist); color: var(--c-char); font-size: .9375rem; }

/* Status pills: the shared functional colours (MASTER.md §2), so a state
   reads the same on Claverton's card and on AHEE's. Always a word, never
   colour alone. */
.ap-pill { display: inline-block; padding: 4px 12px; border-radius: var(--r-pill); font-size: .9375rem; font-weight: 700; background: var(--c-mist); color: var(--c-muted); white-space: nowrap; }
.ap-pill--draft, .ap-pill--changes-not-submitted { background: #fbefdc; color: #7a4510; }
.ap-pill--submitted { background: #e3f1ea; color: #135a3f; }

.ap-demo__row + .ap-demo__row { margin-top: var(--s-2); }

/* ---------------------------------------------------------- the form page */
.ap-guide { margin-top: var(--s-5); background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-sm); padding: 0 var(--s-5); }
.ap-guide summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: var(--s-4) 0; font-weight: 700; color: var(--c-ink); }
.ap-guide summary::-webkit-details-marker { display: none; }
.ap-guide__chev { flex: none; transition: transform .2s var(--ease); }
.ap-guide[open] .ap-guide__chev { transform: rotate(90deg); }
.ap-guide ul { margin: 0 0 var(--s-4); padding-left: var(--s-5); color: var(--c-muted); }
.ap-guide li + li { margin-top: 4px; }
.ap-guide summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-teal) 45%, transparent); outline-offset: 2px; border-radius: 4px; }

.ap-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--s-8); align-items: start; padding-bottom: var(--s-10); }

/* The rail: the site's route (MASTER.md §6). Current stop marigold, done
   stops forest with a tick, the rest outlined; always a number and a label. */
.ap-rail { position: sticky; top: var(--s-6); }
.ap-rail__list { list-style: none; margin: 0; padding: 0; }
.ap-rail__item { position: relative; }
.ap-rail__item:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 40px; bottom: -4px; width: 2px; background: var(--c-line); }
.ap-rail__item.is-reached:not(:last-child)::after { background: var(--c-ink); }
.ap-rail__item button {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: 4px 0 20px;
  background: none; border: 0; text-align: left; font: inherit; color: var(--c-muted); cursor: pointer; border-radius: var(--r-sm);
}
.ap-rail__item button:disabled { cursor: default; }
.ap-rail__dot {
  position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--c-line); background: var(--c-white); color: var(--c-muted); font-weight: 700; font-size: .9375rem; font-variant-numeric: tabular-nums;
}
.ap-rail__dot svg { display: none; }
.ap-rail__item.is-current .ap-rail__dot { background: var(--c-brass); border-color: var(--c-brass); color: var(--c-ink); }
.ap-rail__item.is-current button { color: var(--c-ink); font-weight: 700; }
.ap-rail__item.is-done .ap-rail__dot { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-white); }
.ap-rail__item.is-done .ap-rail__n { display: none; }
.ap-rail__item.is-done .ap-rail__dot svg { display: block; }
.ap-rail__item.is-done button { color: var(--c-char); }
.ap-rail__item.is-done button:hover .ap-rail__label { text-decoration: underline; text-underline-offset: 3px; }
.ap-rail__item button:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-teal) 45%, transparent); outline-offset: 2px; }
/* Draft status and Clear form */
.ap-draftbox { margin-top: var(--s-2); padding-top: var(--s-4); border-top: 1px solid var(--c-line); }
.ap-draftbox__note { margin: 0 0 var(--s-2); color: var(--c-muted); font-size: .9375rem; }
.ap-draftbox--m { display: none; margin-top: var(--s-6); }
.ap-confirm { margin-top: var(--s-3); padding: var(--s-4); border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-white); }
.ap-confirm__q { margin: 0 0 var(--s-3); font-size: .9375rem; color: var(--c-char); }
.ap-confirm__a { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }

.ap-formcard { min-width: 0; }
.ap-mprog { display: none; margin-bottom: var(--s-5); }
.ap-mprog p { margin: 0 0 var(--s-2); color: var(--c-muted); font-size: .9375rem; }
.ap-bar { height: 6px; border-radius: var(--r-pill); background: var(--c-mist); overflow: hidden; }
.ap-bar span { display: block; height: 100%; width: 0; border-radius: var(--r-pill); background: var(--c-ink); transition: width .3s var(--ease); }
.ap-step.is-entering { animation: apStepIn .15s var(--ease) both; }
@keyframes apStepIn { from { opacity: 0; } to { opacity: 1; } }
.ap-step > .ap-h2:focus { outline: none; }
.ap-saved { margin-left: auto; color: var(--c-muted); font-size: .9375rem; }
.ap-nav [data-next] { min-width: 150px; }

/* Score: "Scored" / "Out of" with a slash between */
.ap-score { display: flex; align-items: center; gap: var(--s-2); }
.ap-score--fixed .input { max-width: 9rem; }
.ap-score--fixed .ap-score__of { white-space: nowrap; font-weight: 600; color: var(--c-muted); }
/* Shown, never typed in: the student ID's details and the worked-out percentage. */
.ap-f .input[readonly] { background: var(--c-mist); color: var(--c-char); cursor: default; }
.ap-score .input { min-width: 0; }
.ap-score__of { flex: none; color: var(--c-muted); font-size: 1.25rem; }

/* File upload */
.ap-files { position: relative; }
.ap-file__in { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ap-dz {
  display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); cursor: pointer;
  border: 1.5px dashed var(--c-muted-2); border-radius: var(--r-sm); background: var(--c-white);
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.ap-dz:hover, .ap-dz.is-over { border-color: var(--c-teal); background: var(--c-teal-050); }
.ap-file__in:focus-visible + .ap-dz { border-color: var(--c-teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-teal) 28%, transparent); }
.ap-dz__ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--c-teal-050); color: var(--c-teal); }
.ap-dz strong { color: var(--c-teal); text-decoration: underline; text-underline-offset: 3px; }
.ap-dz small { display: block; color: var(--c-muted); font-size: .9375rem; }
.ap-files.is-busy .ap-dz { opacity: .6; pointer-events: none; }
.ap .field.has-error .ap-dz { border-color: var(--c-danger); }
.ap-chips { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: grid; gap: 6px; }
.ap-chip { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-3); border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-mist); }
.ap-chip svg { flex: none; color: var(--c-muted); }
.ap-chip__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-chip__size { color: var(--c-muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.ap-chip .ap-linkbtn { font-size: .9375rem; }
.ap-file__status { margin: 6px 0 0; color: var(--c-muted); font-size: .9375rem; }
.ap-file__status.is-error { color: var(--c-danger); font-weight: 500; }

/* Payment panel */
.ap-payqr { grid-column: span 6; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-5); padding: var(--s-5); border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-mist); }
.ap-qrbox { flex: none; width: 140px; height: 140px; display: grid; place-items: center; align-content: center; gap: 6px; border: 1.5px dashed var(--c-muted-2); border-radius: var(--r-sm); background: var(--c-white); color: var(--c-muted); font-size: .9375rem; }
.ap-qrbox img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--r-sm); }
.ap-qrbox--img { border-style: solid; border-color: var(--c-line); padding: 6px; }
.ap-payee { margin: 0 0 var(--s-2); color: var(--c-char); }
.ap-paytext { flex: 1; min-width: 200px; }
.ap-paylbl { margin: 0; color: var(--c-muted); }
.ap-payamt { margin: 2px 0 var(--s-2); font-family: var(--f-serif); font-size: var(--t-h4); color: var(--c-ink); }

/* ------------------------------------------------------------ staff view */
.ap-wide { padding-bottom: var(--s-10); }
.ap-tabs { display: flex; flex-wrap: wrap; gap: var(--s-1); border-bottom: 1px solid var(--c-line); margin-bottom: var(--s-6); }
.ap-tab {
  background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px;
  padding: var(--s-3) var(--s-4); font: inherit; font-weight: 700; color: var(--c-muted); cursor: pointer;
}
.ap-tab[aria-selected="true"] { color: var(--c-ink); border-bottom-color: var(--c-brass); }
.ap-tab:hover { color: var(--c-ink); }
.ap-tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-teal) 45%, transparent); outline-offset: -3px; border-radius: var(--r-xs); }

.ap-filters {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-4) var(--s-4); align-items: end;
  padding: var(--s-5); background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-md);
}
.ap-filters .field + .field { margin-top: 0; }
.ap-filters__q { grid-column: span 3; }
.ap-filters__checks { grid-column: span 3; border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ap-filters__checks .ap-opt { min-height: 44px; padding: 10px 14px; }
.ap-filters__reset { grid-column: span 1; margin: 0; justify-self: end; align-self: center; }
.ap-pill--under-review { background: var(--c-teal-050); color: var(--c-ink); }
.ap-pill--needs-documents { background: #fbefdc; color: #7a4510; }
.ap-pill--complete { background: #e3f1ea; color: #135a3f; }
.ap-solo-search { max-width: 420px; margin-bottom: var(--s-4); }
.ap-listbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); margin: var(--s-5) 0 var(--s-3); }
.ap-count { margin: 0; color: var(--c-muted); }
.ap-empty { color: var(--c-muted); margin: var(--s-4) 0; }
.ap-more { margin: var(--s-4) 0 0; }

.ap-tablewrap { overflow-x: auto; background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-md); }
.ap-tablewrap:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-teal) 45%, transparent); outline-offset: 2px; }
.ap-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 1rem; }
.ap-table th, .ap-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--c-line-soft); vertical-align: middle; }
.ap-table th { font-size: .9375rem; color: var(--c-ink); background: var(--c-mist); font-weight: 700; white-space: nowrap; }
.ap-table tbody tr:last-child td { border-bottom: 0; }
.ap-table tbody tr:hover { background: var(--c-linen); }
.ap-num { text-align: right !important; font-variant-numeric: tabular-nums; }

/* The detail page */
.ap-dhead { margin-bottom: var(--s-6); }
.ap-dmeta { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-7); margin: var(--s-4) 0 0; }
.ap-dmeta dt { font-size: .9375rem; color: var(--c-muted); }
.ap-dmeta dd { margin: 2px 0 0; font-weight: 700; color: var(--c-char); overflow-wrap: anywhere; }
.ap-dgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-6); align-items: start; }
.ap-dmain { display: grid; gap: var(--s-4); min-width: 0; }
.ap-dside { display: grid; gap: var(--s-4); position: sticky; top: var(--s-6); }
.ap-dsec { padding: var(--s-6); }
.ap-dsec__h { font-family: var(--f-serif); font-weight: 400; color: var(--c-ink); font-size: var(--t-h4); margin: 0 0 var(--s-4); }
.ap-dl { margin: 0; display: grid; gap: 0; }
.ap-dl > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--s-4); padding: 10px 0; border-top: 1px solid var(--c-line-soft); }
.ap-dl > div:first-child { border-top: 0; }
.ap-dl dt { color: var(--c-muted); }
.ap-dl dd { margin: 0; color: var(--c-char); overflow-wrap: anywhere; white-space: pre-line; }
.ap-dfiles { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.ap-dfiles li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.ap-dfiles .ap-chip__name { flex: 1 1 160px; }
.ap-dfiles__msg { flex-basis: 100%; color: var(--c-danger); font-size: .9375rem; }
.ap-dfiles__msg:empty { display: none; }
.ap-dcard { padding: var(--s-5); }
.ap-dcard__h { font-family: var(--f-sans); font-weight: 700; font-size: 1.125rem; color: var(--c-ink); margin: 0 0 var(--s-3); }
.ap-dcard__act { margin: var(--s-3) 0 0; }
.ap-dcard__msg { margin: var(--s-2) 0 0; color: var(--c-muted); font-size: .9375rem; }
.ap-dcard__msg:empty { display: none; }
.ap .select:disabled, .ap .textarea[readonly] { background: var(--c-mist); color: var(--c-char); }
.ap-dhist { border-top: 1px solid var(--c-line-soft); padding: var(--s-2) 0; }
.ap-dhist summary { cursor: pointer; font-weight: 700; color: var(--c-teal); padding: var(--s-2) 0; }
.ap-dhist .ap-dsec { padding: var(--s-4) 0 0; border: 0; box-shadow: none; }
.ap-dhist .ap-dsec__h { font-size: 1rem; font-family: var(--f-sans); font-weight: 700; margin-bottom: var(--s-2); }

/* --------------------------------------- review build: the email preview */
.ap-mail { margin-bottom: var(--s-9); }
.ap-mail__subject { margin: 0 0 var(--s-3); padding: var(--s-3) var(--s-4); background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-sm); font-weight: 700; }
.ap-mail__subject span { display: inline-block; min-width: 72px; color: var(--c-muted); font-weight: 400; }
.ap-mail__html { border: 1px solid var(--c-line); border-radius: var(--r-sm); overflow: hidden; }
.ap-mail__text { margin-top: var(--s-3); }
.ap-mail__text summary { cursor: pointer; font-weight: 700; color: var(--c-teal); }
.ap-mail__text pre { white-space: pre-wrap; font: .9375rem/1.6 ui-monospace, Menlo, Consolas, monospace; background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-sm); padding: var(--s-4); }

/* ------------------------------------------------------------------ footer */
.ap-foot { background: var(--c-white); border-top: 1px solid var(--c-line); color: var(--c-muted); font-size: .9375rem; }
.ap-foot__in { padding-block: var(--s-6) var(--s-7); }
.ap-foot p { margin: 0; }
.ap-foot p + p { margin-top: var(--s-2); }

/* ------------------------------------------------------- review build bar */
.ap-reviewbar {
  margin: 0; padding: 10px var(--s-6); text-align: center;
  background: #fde7f3; color: #6b1240; font-size: .9375rem; font-weight: 500;
}
.ap-demo {
  margin-top: var(--s-6); padding: var(--s-5); border: 1px dashed #c2477f; border-radius: var(--r-sm);
  background: #fff7fb; color: #4a0d2c; font-size: .9375rem;
}
.ap-demo p { margin: 0 0 var(--s-3); }
.ap-demo .ap-linkbtn { color: #8a1550; }
.ap-demo__row { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); }

/* ---------------------------------------------- the AHEE form: AHEE's tokens */
/* design-system/AHEE.md §2, the same values as ahee.css: the whole page of
   the AHEE form, and the AHEE card on the applications home. */
.ap-main--ahee, .ap-theme--ahee {
  --c-ink:        #1d2b5c;
  --c-navy:       #131d42;
  --c-navy-600:   #2b3b76;
  --c-navy-400:   #5061a6;
  --c-brass:      #48b9f6;
  --c-brass-600:  #2aa3e6;
  --c-brass-deep: #074f78;
  --c-brass-300:  #86d3fb;
  --c-brass-050:  #e4f5fe;
  --c-teal:       #2446a8;
  --c-teal-300:   #7d93d6;
  --c-teal-050:   #e8edfa;
  --c-sky:        #e1e8f8;
  --c-char:       #1a2135;
  --c-linen:      #f5f7fc;
  --c-mist:       #eef2fa;
  --c-cloud:      #dfe6f6;
  --c-line:       #dde3ef;
  --c-line-soft:  #edf0f7;
  --c-muted:      #3d4459;
  --c-muted-2:    #3d4459;
  --f-serif:      var(--f-sans);
  --sh-1: 0 1px 2px rgba(29, 43, 92, .05), 0 1px 3px rgba(29, 43, 92, .04);
  --sh-2: 0 2px 6px rgba(29, 43, 92, .05), 0 12px 28px -16px rgba(29, 43, 92, .24);
  color: var(--c-char);
}
/* AHEE's headings: DM Sans 700, set tight (AHEE.md §3). */
.ap-main--ahee :is(.ap-title, .ap-h2, .ap-sub, .ap-done__title, .ap-refno, .ap-payamt), .ap-theme--ahee .ap-fcard__title { font-weight: 700; letter-spacing: -.021em; }
.ap-main--ahee .ap-lede { color: #39425a; }
/* AHEE's mark: white strokes on an indigo tile, the tick in sky (AHEE.md §4). */
.ahee-mark__bg { fill: #1d2b5c; }
.ahee-mark__a { stroke: #fff; }
.ahee-mark__tick { stroke: #48b9f6; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .ap-dgrid { grid-template-columns: 1fr; }
  .ap-dside { position: static; }
  .ap-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-filters__q, .ap-filters__checks { grid-column: span 2; }
  .ap-filters__reset { grid-column: span 2; justify-self: start; }
}
@media (max-width: 860px) {
  .ap-layout { grid-template-columns: 1fr; gap: 0; }
  .ap-rail { display: none; }
  .ap-mprog { display: block; }
  .ap-draftbox--m { display: block; }
  .ap-wrap { padding-inline: var(--s-4); }
  .ap-card { padding: var(--s-6) var(--s-5); border-radius: var(--r-sm); }
  .ap-intro { padding-block: var(--s-7) var(--s-5); }
  .ap-solo { padding-block: var(--s-7) var(--s-9); }
}
@media (max-width: 720px) {
  .ap-fcard { grid-template-columns: 1fr; }
  .ap-fcard__side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; text-align: left; }
  .ap-fcard__state { align-items: flex-start; }
  .ap-notice { padding: var(--s-5); }
  .ap-notice__list > div { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 560px) {
  .ap-filters { grid-template-columns: 1fr; }
  .ap-filters > * { grid-column: span 1 !important; }
  .ap-dl > div { grid-template-columns: 1fr; gap: 2px; }
  .ap-fields > .ap-f--half, .ap-fields > .ap-f--third { grid-column: span 6; }
  .ap-nav .btn { flex: 1 1 40%; }
  .ap-nav [data-next] { flex-basis: 100%; order: 3; }
  .ap-saved { order: -1; flex-basis: 100%; margin: 0; }
  .ap-head__in { flex-wrap: wrap; }
  .ap-who { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .ap-email { max-width: 100%; flex: 1 1 auto; }
  .ap-brand__name { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ap * { transition: none !important; animation: none !important; }
}

/* AHEE registration on the Claverton site (/apply/ahee/, 31 October 2026):
   AHEE's own form markup (src/ahee/portal.js), with the few layout rules
   it needs from ahee.css, under the AHEE theme above. ahee.css itself is
   never loaded here: it re-colours the whole page. */
.ah-progress { display: flex; gap: var(--s-2); margin-bottom: var(--s-7); counter-reset: none; flex-wrap: wrap; }
.ah-progress li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: var(--r-pill); background: var(--c-mist); font-size: .84rem; font-weight: 500; color: var(--c-muted); }
.ah-progress li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--c-white); border: 1px solid var(--c-line); font-size: .76rem; font-weight: 700; }
.ah-progress li.is-current { background: var(--c-ink); color: var(--c-white); }
.ah-progress li.is-current span { background: var(--c-brass); border-color: var(--c-brass); color: var(--c-ink); }
.ah-progress li.is-done span { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-white); }
.ah-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
.ah-form__intro { font-size: .94rem; color: var(--c-muted); line-height: 1.55; }
.ah-form__intro b { color: var(--c-ink); }
.ah-form__foot { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--c-line-soft); font-size: .92rem; color: var(--c-muted); }
.ah-fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); min-width: 0; }
.ah-form .select, .ah-form .input { max-width: 100%; min-width: 0; }
.ah-fieldset + .ah-fieldset { padding-top: var(--s-5); border-top: 1px solid var(--c-line-soft); }
.ah-fieldset legend { padding: 0; margin-bottom: var(--s-4); font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--c-brass-deep); }
.ah-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.ah-pass { position: relative; }
.ah-pass .input { padding-right: 4.75rem; }
.ah-pass__show { position: absolute; top: 50%; right: var(--s-3); transform: translateY(-50%); }
.ah-linkbtn { padding: 0; font-size: .88rem; font-weight: 700; color: var(--c-teal); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(36, 70, 168, .35); }
.ah-linkbtn:hover { text-decoration-color: currentColor; }
.ah-linkbtn:disabled { color: var(--c-muted-2); text-decoration: none; cursor: default; }
.ah-form .btn, .ah-done .btn { white-space: normal; height: auto; min-height: 54px; padding-block: 12px; text-align: center; line-height: 1.3; }
.ah-done:focus { outline: none; }
.ah-done__ok { display: flex; align-items: center; gap: 10px; padding: var(--s-4) var(--s-5); border-radius: var(--r-sm); background: rgba(23, 105, 74, .08); border: 1px solid rgba(23, 105, 74, .26); color: var(--c-success); font-weight: 500; }
.ah-done__ok b { color: var(--c-ink); }
.ah-admit { margin: var(--s-6) 0 0; border: 1px solid var(--c-line); border-radius: var(--r-sm); overflow: hidden; background: var(--c-mist); max-width: 520px; }
.ah-admit img { display: block; width: 100%; height: auto; }
.ap-main--ahee .form-status { margin-top: var(--s-5); }
.ap-main--ahee .form-status:empty { display: none; }
.ap-aheefee { margin-top: var(--s-5); }
/* Side-by-side fields start at the top, as on aheetest.com (.ahee .ah-row). */
.ah-row { align-items: start; }
.ah-form .field { align-content: start; }
.ah-row > .field + .field, .ah-fieldset > .field + .field { margin-top: 0; }
@media (max-width: 640px) { .ah-row { grid-template-columns: minmax(0, 1fr); } }

/* A new password's rules, ticked as they are met (4 November 2026). The
   AHEE form on this site uses the same list with its own class. */
.ap-pwrules, .ah-pwrules {
  list-style: none; margin: var(--s-2) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2px var(--s-4);
  font-size: .875rem; color: var(--c-muted);
}
.ap-pwrules li, .ah-pwrules li { position: relative; padding-left: 1.4em; }
.ap-pwrules li::before, .ah-pwrules li::before {
  content: ''; position: absolute; left: .15em; top: .45em; width: .55em; height: .55em;
  border: 1.5px solid currentColor; border-radius: 50%;
}
.ap-pwrules li.is-met, .ah-pwrules li.is-met { color: var(--c-success); }
.ap-pwrules li.is-met::before, .ah-pwrules li.is-met::before {
  border: 0; border-radius: 0; width: .7em; height: .38em; top: .38em; left: .1em;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
}

/* The AHEE page: log in with an AHEE roll number, and the registration it
   shows (4 November 2026). */
.ah-already { margin: 0 0 var(--s-6); padding: 0 0 var(--s-5); border-bottom: 1px solid var(--c-line); }
.ah-already__q { margin: 0; color: var(--c-muted); }
.ah-already .ah-form { margin-top: var(--s-5); }
.ah-status:focus { outline: none; }
.ah-status .deflist { max-width: 620px; }

/* ------------------------------------------------------------------------
   Templates in the Documents step (11 November 2026): forms to download,
   print and sign, such as the anti-ragging undertaking. Links only.
   ------------------------------------------------------------------------ */
.ap-tpl { grid-column: span 6; }
.ap-tpl .ap-sub { border-top: 0; padding-top: 0; margin: 0 0 var(--s-2); }
.ap-tpl__p { margin: 0 0 var(--s-3); color: var(--c-muted); }
.ap-tpl__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.ap-tpl__a {
  display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5);
  background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-sm);
  color: var(--c-char); text-decoration: none;
}
.ap-tpl__a:hover { border-color: var(--c-ink); }
.ap-tpl__a:focus-visible { outline: 3px solid var(--c-brass); outline-offset: 2px; }
.ap-tpl__a strong { display: block; color: var(--c-ink); }
.ap-tpl__a small { display: block; color: var(--c-muted); font-size: .9375rem; }
.ap-tpl__ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c-teal-050); color: var(--c-ink); }
.ap-tpl__go { margin-left: auto; font-weight: 600; color: var(--c-ink); text-decoration: underline; text-underline-offset: .2em; }

/* Your applications: the documents sent with the submitted registration
   form, listed by name (opening them comes with the next backend release). */
.ap-docs { margin-top: var(--s-8); padding: var(--s-6); background: var(--c-white); border: 1px solid var(--c-line); border-radius: var(--r-md); }
.ap-docs__p { margin: 0 0 var(--s-4); color: var(--c-muted); }
.ap-docs__p:last-child { margin: var(--s-4) 0 0; }
.ap-docs__list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--c-line); }
.ap-docs__item { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) auto; gap: var(--s-2) var(--s-4); padding: var(--s-3) 0; border-bottom: 1px solid var(--c-line); }
.ap-docs__k { font-weight: 600; color: var(--c-ink); }
.ap-docs__v { overflow-wrap: anywhere; }
.ap-docs__m { color: var(--c-muted); white-space: nowrap; }
@media (max-width: 560px) {
  .ap-tpl__a { flex-wrap: wrap; }
  .ap-docs__item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
