/* ==========================================================================
   Server-rendered pages (Django templates, backend/apps/web).
   Menus open without JavaScript: the portal menu is a <details>, the mobile
   menu opens with #mobileNav (:target).
   ========================================================================== */

/* Portal dropdown */
details.nav-drop > summary { list-style: none; cursor: pointer; }
details.nav-drop > summary::-webkit-details-marker { display: none; }
details.nav-drop[open] .nav-drop-menu { opacity: 1; visibility: visible; transform: none; }
.nav-drop-menu form { margin: 0; }
.nav-drop-menu .drop-btn { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
    background: none; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; }
.nav-drop-menu .drop-btn:hover { background: var(--primary-50); }
.icon-tile.red { background: #FDECEE; color: var(--danger); }

/* Mobile menu */
a.nav-toggle { text-decoration: none; }
.mobile-nav:target { visibility: visible; }
.mobile-nav:target .mn-backdrop { opacity: 1; }
.mobile-nav:target .mn-panel { transform: none; }
a.mn-backdrop { display: block; }

/* Messages under the header */
.flash-wrap { padding-top: 18px; }

/* Login portal switch as links */
.role-switch a.role-btn { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 8px; text-decoration: none; }

/* Programme picker: radio cards */
.prog-option { cursor: pointer; }
.prog-option input { position: absolute; opacity: 0; pointer-events: none; }
.prog-option:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.prog-option:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.prog-option { position: relative; }

/* Option grid on register (two cards side by side) */
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .option-grid { grid-template-columns: 1fr; } }

/* Applicant progress line (same as the portal's) */
.lifecycle { display: flex; gap: 0; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px; }
.lc-step { flex: 1; min-width: 86px; text-align: center; position: relative; font-size: .72rem; font-weight: 600; color: var(--muted-2); }
.lc-step::before { content: ""; position: absolute; top: 13px; left: -50%; right: 50%; height: 2px; background: var(--border); z-index: 0; }
.lc-step:first-child::before { display: none; }
.lc-step .c { width: 28px; height: 28px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; background: #fff; border: 2px solid var(--border-strong); position: relative; z-index: 1; font-size: .65rem; }
.lc-step.done { color: var(--text-2); }
.lc-step.done .c { background: var(--success); border-color: var(--success); color: #fff; }
.lc-step.done::before, .lc-step.current::before { background: var(--success); }
.lc-step.current { color: var(--primary); }
.lc-step.current .c { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(24,70,214,.15); }
.lc-step.bad .c { background: var(--danger); border-color: var(--danger); color: #fff; }

.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--primary-50); color: var(--primary-dark); font-weight: 800; font-family: var(--font-head); }

/* Done wizard steps link back */
.wstep a { color: inherit; text-decoration: none; }
.wstep a:hover strong { text-decoration: underline; }

/* Printable receipt page */
.receipt-page { background: var(--surface-2); }
.receipt-sheet { max-width: 760px; margin: 32px auto; background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 28px 32px; }
.receipt-actions { display: flex; justify-content: space-between; margin-bottom: 18px; }
@media print {
    .no-print { display: none !important; }
    .receipt-page { background: #fff; }
    .receipt-sheet { border: 0; margin: 0; padding: 0; max-width: none; }
}

/* Simple lists (same as the portal's) */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 14px; align-items: center; padding: 12px 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item strong { display: block; font-size: .9rem; color: var(--text); }
.list-item small { color: var(--muted); font-size: .8rem; }

/* ---------- Staff portal (server-rendered shell) ---------- */
.avatar.sm { width: 32px; height: 32px; font-size: .72rem; }
.staff-portal .avatar { background: var(--grad-brand); color: #fff; }
details.dropdown > summary { list-style: none; cursor: pointer; }
details.dropdown > summary::-webkit-details-marker { display: none; }
details.dropdown[open] .dropdown-menu { display: block; animation: dropIn .18s var(--ease); }
.dropdown-menu form { margin: 0; }
.menu-list form button { width: 100%; }
.dm-list form button.notif { width: 100%; border: 0; background: none; text-align: left; font: inherit; color: inherit; }
.dm-list .notif p { margin: 2px 0; font-size: .8rem; color: var(--muted); }
.dm-list .notif small { color: var(--muted-2); font-size: .72rem; }
.sb-soon { opacity: .45; cursor: default; }
.sb-soon .sb-count { background: transparent; color: inherit; font-weight: 600; }
.sb-close, .sb-backdrop { display: none; }
.sb-user form { margin: 0 0 0 auto; }
.tb-search { margin: 0; }
.table-tools { flex-wrap: wrap; }
.pager a { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-2); font-size: .82rem; font-weight: 600; text-decoration: none; }
.pager a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.stat-chip { text-decoration: none; }
.tabs a.tab { text-decoration: none; }
.history { list-style: none; padding: 0; margin: 0; }
@media (max-width: 1024px) {
    .sidebar:target { transform: none; z-index: 130; }
    .sidebar:target ~ .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(9, 18, 48, .45); z-index: 125; }
    .sidebar:target .sb-close { display: grid; place-items: center; margin-left: auto; color: #fff; }
}
@media print {
    .sidebar, .topbar, .bottom-nav, #actions, .actions { display: none !important; }
    .app-shell { display: block; }
}

/* ---------- Public site: pop-ups opened by a link (#p-fullstack), no JS needed ---------- */
.link-modal { display: none; }
.link-modal:target, .link-modal.open { display: flex; opacity: 1; }
.link-modal:target .modal, .link-modal.open .modal { transform: none; }
.link-modal .lm-dismiss { position: absolute; inset: 0; }
.link-modal .modal { position: relative; z-index: 1; }
.link-modal .modal-body { overflow-y: auto; }
a.prog-card { color: inherit; text-decoration: none; }
a.prog-card[hidden] { display: none; }
.tabs a.tab { cursor: pointer; }
/* Pop-ups live inside <main> on these pages: keep their headings as in the old (body-level) pop-ups */
body:not(.portal) main .link-modal h2, body:not(.portal) main .link-modal h3 { text-transform: none; letter-spacing: normal; }
a.modal-close { display: grid; place-items: center; text-decoration: none; }
