/* ===================================================================
   Rainbow Nursery - Site Stylesheet
   Clean, light design with consistent button and table styling.
   =================================================================== */

/* --- Navbar --- */
/* Colours come from the logo and live as variables on :root further down. Dark Mode is the
   blue menu with white words; Light Mode (navbar-portal-light) is white with blue words. */
.navbar-portal {
    background-color: var(--rainbow-blue);
    padding-top: 0;
    padding-bottom: 0;
    min-height: 52px;
}

.navbar-portal-brand {
    color: #ffffff !important;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.3px;
    padding: 8px 16px 8px 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.navbar-portal-brand:hover {
    color: var(--rainbow-blue-tint) !important;
}

/* The logo sits on a small white tile so its blue lettering still reads on the blue menu. */
.navbar-portal-logo,
.portal-side-logo {
    height: 32px;
    width: auto;
    background-color: #ffffff;
    border-radius: 4px;
    padding: 1px 3px;
}

.navbar-portal-link {
    color: rgba(255, 255, 255, 0.88) !important;
    font-size: 0.9rem;
    padding: 15px 12px !important;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}

.navbar-portal-link:hover,
.navbar-portal-link:focus {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.08);
}

/* The page you are on: a red marker under its menu item. */
.navbar-portal-link.active {
    color: #ffffff !important;
    border-bottom-color: var(--rainbow-red);
}

.navbar-portal .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3);
}

.navbar-portal .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-portal-dropdown {
    background-color: var(--rainbow-blue-dark);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    min-width: 180px;
    padding: 4px 0;
    margin-top: 0 !important;
}

.navbar-portal-dropdown-item {
    color: rgba(255, 255, 255, 0.88) !important;
    font-size: 0.875rem;
    padding: 8px 16px;
}

.navbar-portal-dropdown-item:hover,
.navbar-portal-dropdown-item:focus,
.navbar-portal-dropdown-item.active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.12);
}

.navbar-portal-dropdown .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.15);
}

.navbar-portal-dropdown .dropdown-header {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* --- Base --- */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* Lists that pick staff with the staff list's filters (Sprint 3): on a phone the filters fold
   behind one Filters button, each control takes the full width when open, and the page's main
   button sits on its own full width row. Tablets and desktops show the bar as before. */
@media (max-width: 767.98px) {
    .portal-filter-left {
        width: 100%;
    }

    .filter-toggle {
        min-height: 38px;
    }

    .filter-panel.show,
    .filter-panel.collapsing {
        display: flex;
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px;
        margin-top: 8px;
    }

    .filter-panel .form-control,
    .filter-panel .form-select,
    .filter-panel .btn {
        width: 100% !important;
        min-height: 38px;
    }

    .portal-list-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .portal-list-actions .btn-primary {
        flex: 1 1 100%;
        min-height: 38px;
    }
}

/* Questionnaires (Task 3.6): the Request bar above the list, a tick box at the start of each
   row, the name in plain text (the row opens the record) and a small No email badge. */
.portal-filter-tick {
    white-space: nowrap;
}

/* Configure, Users: long usernames, email addresses and nursery names wrap inside their
   columns, and the headings wrap too, so every column stays on the page. */
.portal-users-table td {
    white-space: normal;
    overflow-wrap: anywhere;
}

.portal-users-table thead th {
    white-space: normal;
}

/* Lists with long text (Disciplinary, Task 3.7): the text wraps inside its column, so every
   column stays on the page. */
.portal-wrap-table td {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Task 4.11: their headings wrap too, so Outcome Notes fits beside the dates on the record. */
.table.portal-wrap-table thead th {
    white-space: normal;
}

/* Snag 40: as tables (1200 pixels and wider) the two disciplinary tables keep the dates, outcome
   and actions narrow, so Incident and Outcome notes share the spare width (Snag 48: both are cut
   to the same length). Below 1200 they are cards. */
.portal-disc-table th.disc-date { width: 92px; }
.portal-disc-table th.disc-staff { width: 150px; }
.portal-disc-table th.disc-outcome { width: 120px; }
.portal-disc-table th.disc-actions { width: 64px; }
.portal-disc-table td[data-card="date"] { white-space: nowrap; }

/* Snag 53: report tables marked portal-wrap-table keep the name column wide enough for its note
   on two lines, while the long headings wrap. */
.portal-report-table th.portal-name-col {
    min-width: 170px;
}

/* Below 1200 pixels these wide reports (nine and twelve columns) use smaller type and tighter
   cells, so every column still fits the page on a laptop or a tablet held sideways. */
@media (max-width: 1199.98px) {
    .table.portal-report-table {
        font-size: 0.7rem;
    }

    .table.portal-report-table > thead > tr > th {
        font-size: 0.64rem;
        letter-spacing: 0;
    }

    .table.portal-report-table > :not(caption) > * > * {
        padding-left: 4px;
        padding-right: 4px;
    }

    .portal-report-table th.portal-name-col {
        min-width: 100px;
    }
}

/* Snag 48: as a table the outcome notes are cut like Incident (the whole note is on the entry);
   on a card, below 1200 pixels, the whole note shows. */
.portal-disc-table .disc-full { display: none; }

@media (max-width: 1199.98px) {
    .portal-disc-table .disc-short { display: none; }
    .portal-disc-table .disc-full { display: inline; }
}

.portal-filter-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 0.85rem;
    color: var(--portal-text-muted);
}

.portal-filter-date input {
    width: 150px;
}

/* Snag 52: on a report's filter bar, from a tablet up, the filters wrap inside their own box and
   the PDF and Excel buttons stay on the first line at the right; From and To stay together; the
   lists of tick boxes are a little narrower. On a phone the bar is behind Filters as before. */
@media (min-width: 768px) {
    .portal-report-bar {
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
    }

    .portal-report-bar > .portal-filter-left {
        flex: 1 1 auto;
        min-width: 0;
    }

    .portal-report-bar > .portal-list-actions {
        flex: 0 0 auto;
    }

    .portal-date-pair {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        white-space: nowrap;
    }

    .portal-report-bar .portal-multi-sm .portal-multi-button {
        min-width: 150px;
    }

    .portal-report-bar .portal-filter-date input {
        width: 140px;
    }
}

@media (max-width: 767.98px) {
    .portal-date-pair {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .portal-filter-date {
        display: flex;
        width: 100%;
    }

    .portal-filter-date input {
        flex: 1 1 auto;
        width: auto !important;
    }
}

/* Reports (Sprint 3): the rule a report uses in one line under its filters, group headings,
   subtotals and totals, and the report's figures in a row of three. */
.portal-report-rule {
    margin: 0 0 10px;
    color: var(--portal-text-muted);
    font-size: 0.85rem;
}

.portal-report-title {
    font-weight: 600;
    color: var(--portal-text);
}

/* A report with no filters: what it lists on the left and its export buttons on the right, on
   one line, in place of an empty filter bar. */
.portal-report-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.portal-report-head .portal-report-rule {
    flex: 1 1 auto;
    max-width: 900px;
    margin: 0;
}

.portal-report-head .portal-list-actions {
    flex: 0 0 auto;
}

@media (max-width: 767.98px) {
    .portal-report-head {
        flex-direction: column;
        align-items: stretch;
    }
}

.portal-report-group td {
    background-color: var(--rainbow-blue-tint) !important;
    color: var(--rainbow-blue);
    font-weight: 600;
}

.portal-report-subtotal td,
.portal-report-total td {
    font-weight: 600;
}

.portal-report-total td {
    border-top: 2px solid var(--rainbow-blue);
}

.portal-report-figures {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--portal-text-muted);
}

.portal-report-figure {
    margin-right: 4px;
    color: var(--rainbow-blue);
    font-size: 1.15rem;
    font-weight: 700;
}

/* The Reports menu holds four groups of reports: on a desktop its dropdown has two columns. */
/* The Reports menu's group headings stand out from the links under them: Rainbow yellow on the
   blue menu, Rainbow red on the white one. */
.navbar-portal-dropdown .dropdown-header {
    padding-top: 6px;
    color: var(--rainbow-yellow);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.navbar-portal-light .navbar-portal-dropdown .dropdown-header {
    color: var(--rainbow-blue);
}

@media (min-width: 992px) {
    .portal-reports-menu.show {
        display: grid;
        grid-template-columns: repeat(2, minmax(220px, auto));
        column-gap: 8px;
    }
}

/* A Staff user's Dashboard: one line for each questionnaire asked for and not yet done. */
.portal-dash-request {
    margin-bottom: 10px;
    padding: 10px 14px;
    background-color: var(--rainbow-blue-tint);
    border-left: 4px solid var(--rainbow-blue);
    border-radius: 8px;
    font-weight: 500;
}

.portal-request-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background-color: var(--rainbow-grey);
    border: 1px solid var(--portal-line);
    border-radius: 10px;
}

.portal-request-label {
    font-weight: 600;
    font-size: 0.85rem;
}

.portal-row-tick {
    display: block;
    margin: 0;
    padding: 2px 6px;
    cursor: pointer;
}

.portal-row-name {
    color: inherit;
    text-decoration: none;
}

.portal-no-email {
    margin-left: 6px;
    font-weight: 500;
    color: var(--portal-text-muted);
    border: 1px solid var(--portal-line);
}

@media (max-width: 767.98px) {
    .portal-request-bar .btn {
        flex: 1 1 100%;
        min-height: 38px;
    }

    /* On a phone the first cell is the tap area for the tick, and the box is larger. The tap
       area stops 8 pixels short of the top and bottom of the cell, so the tap areas of two rows
       never touch and a tap near the edge ticks no one (Snag 11). */
    .portal-tick-cell {
        position: relative;
        min-width: 48px;
        padding: 0 !important;
    }

    .portal-tick-cell .portal-row-tick {
        position: absolute;
        inset: 8px 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .portal-tick-cell .form-check-input {
        width: 20px;
        height: 20px;
        margin: 0;
    }
}

/* On a phone, text boxes and dropdowns use 16 pixel text, so the phone does not zoom in when
   one is tapped (Sprint 3). Larger screens are not touched. */
@media (max-width: 767.98px) {
    .form-control,
    .form-select,
    .form-control-sm,
    .form-select-sm {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #ffffff;
    color: var(--portal-text);
}

/* Page headings in the main blue. */
h1, h2, h3, h4, h5 {
    color: var(--rainbow-blue);
}

h4 {
    font-weight: 600;
}

/* --- Links --- */
a {
    color: var(--rainbow-blue);
}

a:hover {
    color: var(--rainbow-blue-dark);
}

/* --- Focus Styles --- */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--rainbow-blue-focus);
}

.form-check-input:checked {
    background-color: var(--rainbow-blue);
    border-color: var(--rainbow-blue);
}

/* --- Buttons --- */
/* Primary button - use for the main action on the page (1 Primary, rest Secondary) */
.btn-primary {
    color: #fff;
    background-color: var(--rainbow-blue);
    border-color: var(--rainbow-blue);
}

.btn-primary:hover {
    color: #fff;
    background-color: var(--rainbow-blue-dark);
    border-color: var(--rainbow-blue-dark);
}

.btn-primary:active, .btn-primary:focus {
    background-color: var(--rainbow-blue-deep);
    border-color: var(--rainbow-blue-deep);
}

/* Secondary button - use for all other actions */
.btn-secondary {
    color: var(--portal-text);
    background-color: var(--rainbow-grey);
    border-color: var(--portal-line-strong);
}

.btn-secondary:hover {
    color: var(--portal-text);
    background-color: var(--rainbow-grey-dark);
    border-color: var(--portal-line-strong);
}

.btn-secondary:active, .btn-secondary:focus {
    color: var(--portal-text);
    background-color: var(--rainbow-grey-dark);
    border-color: var(--portal-text-muted);
}

/* Danger button, for destructive actions only */
.btn-danger {
    color: #fff;
    background-color: var(--rainbow-red);
    border-color: var(--rainbow-red);
}

.btn-danger:hover {
    color: #fff;
    background-color: var(--rainbow-red-dark);
    border-color: var(--rainbow-red-dark);
}

/* Button transition for smooth hover effect */
.btn {
    transition: all 0.2s ease-in-out;
}

/* --- Layout --- */
.border-top {
    border-top: 1px solid var(--portal-line);
}

.border-bottom {
    border-bottom: 1px solid var(--portal-line);
}

.box-shadow {
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    white-space: nowrap;
    line-height: 60px;
    font-size: 0.85rem;
}

/* --- Navbar --- */
.navbar-brand {
    white-space: normal;
    display: flex;
    align-items: center;
}

.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
    color: #fff;
    background-color: var(--rainbow-blue);
    border-color: var(--rainbow-blue);
}

/* --- Tables --- */
.table {
    font-size: 0.8rem;
    border-collapse: collapse;
    margin-bottom: 0;
}

/* Table header: the main blue, bold, tight */
.table thead th {
    background-color: var(--rainbow-blue);
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: none;
    padding: 8px 10px;
    vertical-align: middle;
    white-space: nowrap;
}

.table thead th a {
    color: #fff;
    text-decoration: none;
}

.table thead th a:hover {
    color: var(--rainbow-blue-tint);
    text-decoration: underline;
}

/* Body rows: compact, clean */
.table tbody td {
    padding: 5px 10px;
    vertical-align: middle;
    border-top: 1px solid var(--portal-line);
    border-bottom: none;
    color: var(--portal-text);
}

/* Stripe: disabled, all rows white */
.table-striped > tbody > tr:nth-of-type(odd) > *,
.table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: #ffffff;
}

/* Hover: a light blue tint */
.table-hover > tbody > tr:hover > * {
    background-color: var(--rainbow-blue-tint) !important;
    color: var(--portal-text);
}

/* Wrap the table for a card-like border */
.table-responsive,
.table-wrapper {
    border: 1px solid var(--portal-line-strong);
    border-radius: 4px;
    overflow: hidden;
}

/* Sortable table styles */
.sortable th {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.sortable th:hover {
    background-color: var(--rainbow-blue-dark);
}

.sortable th::after {
    content: '\2195';
    position: absolute;
    right: 8px;
    opacity: 0.35;
    font-size: 0.7rem;
}

.sortable th.sort-asc::after {
    content: '\2191';
    opacity: 1;
}

.sortable th.sort-desc::after {
    content: '\2193';
    opacity: 1;
}

/* No-sort column: hide the sort indicator */
.sortable th.no-sort {
    cursor: default;
}

.sortable th.no-sort::after {
    content: '';
}

/* --- Action Links in Tables --- */
.table-action-link {
    color: var(--rainbow-blue);
    text-decoration: none;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* A person's name on a report: a blue link at the row's own size (Snag 28). */
.table-action-link.portal-name-link {
    font-size: inherit;
    white-space: normal;
}

.table-action-link:hover {
    color: var(--rainbow-blue-dark);
    text-decoration: underline;
}

.table-action-delete {
    color: var(--rainbow-red);
}

.table-action-delete:hover {
    color: var(--rainbow-red-dark);
}

/* --- Action Icons in Tables --- */
.action-icon {
    width: 18px;
    height: 18px;
    margin: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.action-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* --- Cards --- */
.card {
    border: 1px solid var(--portal-line);
    border-radius: 6px;
}

/* --- Status badges --- */
/* Red for Expired and Late, yellow for Due soon and counts, a blue tint for In date and
   Done, grey for anything without a date. Small, never a background for a block of text. */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.status-expired,
.status-late {
    background-color: var(--rainbow-red);
    color: #ffffff;
}

.status-due {
    background-color: var(--rainbow-yellow);
    color: var(--portal-text);
}

.status-ok {
    background-color: var(--rainbow-blue-tint-strong);
    color: var(--rainbow-blue-deep);
}

.status-none {
    background-color: var(--rainbow-grey-dark);
    color: var(--portal-text-muted);
}

.count-badge {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 10px;
    background-color: var(--rainbow-yellow);
    color: var(--portal-text);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
}

/* --- Switch user, for testing: the choices at the top of the name menu. The user you are
   now is marked and cannot be picked again. --- */
.portal-switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    text-align: left;
    border: 0;
    background: none;
}

.portal-switch-item:disabled {
    cursor: default;
    opacity: 1;
}

.portal-switch-note {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.75;
}

.portal-side-menu .dropdown-header {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.portal-menu-light .portal-side-menu .dropdown-header {
    color: var(--portal-text-muted);
}

/* --- The staff record --- */
/* A blue header with the person's initials and key facts, the parts of the record listed down
   the left (a row you can swipe on a phone), and the open part in a white card with its fields
   in two columns and Save always in reach at the foot. */
/* The link back to the report a staff record was opened from, above the record's header. */
.portal-back-link {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.portal-back-link:hover {
    text-decoration: underline;
}

.portal-person {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 20px 24px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--rainbow-blue) 0%, var(--rainbow-blue-deep) 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(2, 43, 83, 0.18);
}

.portal-person-avatar {
    flex: 0 0 auto;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    color: var(--rainbow-blue);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 0 0 3px var(--rainbow-yellow);
}

.portal-person-main {
    flex: 1 1 220px;
    min-width: 0;
}

.portal-person-name {
    margin: 0;
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
}

.portal-person-sub {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.92rem;
}

.portal-person-facts {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.portal-person-fact {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 96px;
    padding: 8px 12px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.9rem;
    font-weight: 600;
}

.portal-person-fact-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.72);
}

.portal-person-fact .status-badge {
    align-self: flex-start;
}

.portal-record {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 20px;
    margin-top: 20px;
    align-items: start;
}

.portal-record-nav {
    position: sticky;
    top: 16px;
    padding: 8px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

.portal-record-nav-group {
    padding: 10px 12px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--portal-text-muted);
}

.portal-record-nav-link {
    display: block;
    padding: 8px 12px;
    border-radius: 9px;
    color: var(--portal-text);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.portal-record-nav-link:hover {
    background-color: var(--rainbow-blue-tint);
    color: var(--rainbow-blue);
}

.portal-record-nav-link.active {
    background-color: var(--rainbow-blue);
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--rainbow-red);
}

.portal-record-body {
    min-width: 0;
    padding: 18px 22px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

/* While another tab is being fetched, the current one fades so the click is seen to work. */
.portal-record-body.portal-record-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease-in 0.1s;
}

.portal-record-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.portal-record-head h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.portal-record-hint {
    color: var(--portal-text-muted);
    font-size: 0.85rem;
}

.portal-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
    row-gap: 10px;
}

.portal-field {
    min-width: 0;
}

.portal-field.wide,
.portal-fields-group {
    grid-column: 1 / -1;
}

.portal-fields-group {
    margin-top: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--portal-line);
    color: var(--rainbow-blue);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.portal-field-label {
    display: block;
    margin-bottom: 3px;
    color: var(--portal-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.portal-field-value {
    color: var(--portal-text);
    font-size: 0.95rem;
    min-height: 1.4em;
}

.portal-field-value.empty {
    color: #a0a8b5;
    font-style: italic;
    font-size: 0.88rem;
}

.portal-field-switch {
    display: flex;
    align-items: center;
    min-height: 32px;
}

.portal-field-switch .form-check-input {
    cursor: pointer;
}

.portal-record-body .form-control,
.portal-record-body .form-select {
    border-radius: 9px;
    border-color: #d5dbe3;
}

.portal-record-body .input-group-text {
    border-color: #d5dbe3;
}

.portal-record-body .form-control:focus,
.portal-record-body .form-select:focus {
    border-color: var(--rainbow-blue-focus);
    box-shadow: 0 0 0 3px var(--rainbow-blue-tint-strong);
}

.portal-input-short {
    max-width: 220px;
}

/* --- The staff record laid out as RaSta's screens --- */
/* Personal and Employment: two columns side by side, as on RaSta, each one field under
   another; anything across the whole width (Information) follows underneath. */
.portal-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
    align-items: start;
}

.portal-fields.portal-fields-one {
    grid-template-columns: minmax(0, 1fr);
}

.portal-split-foot {
    margin-top: 10px;
}

/* Leaving and Closure: one question under another, in order, at a readable width. */
.portal-fields-list {
    max-width: 760px;
}

.portal-fields-divider {
    grid-column: 1 / -1;
    border-top: 1px solid var(--portal-line);
    margin-top: 4px;
}

/* Fields RaSta puts on one line, such as the DBS row or a tick with its notes. */
.portal-field-row {
    grid-column: 1 / -1;
    min-width: 0;
}

.portal-field-row-label {
    margin-bottom: 3px;
    color: var(--portal-text);
    font-size: 0.85rem;
    font-weight: 600;
}

.portal-field-row-items {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    column-gap: 14px;
    row-gap: 8px;
}

.portal-field-row-items > .portal-item-date {
    flex: 0 0 170px;
}

.portal-field-row-items > .portal-item-number {
    flex: 0 0 140px;
}

.portal-field-row-items > .portal-item-tick {
    flex: 0 0 auto;
    min-width: 150px;
}

.portal-field-row-items > .portal-item-text {
    flex: 1 1 200px;
}

/* Dropdowns in a row hold short answers (Sex, Yes or No), so they start narrower. */
.portal-field-row-items > .portal-item-list {
    flex: 1 1 120px;
}

.portal-field-row-items .portal-input-short {
    max-width: none;
}

/* RaSta's guidance on the record: small grey lines under a heading or a box. Those that
   were links on RaSta still are, with a small mark after the words. */
.portal-field-hint {
    margin-top: 4px;
    color: var(--portal-text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.portal-field-lines {
    grid-column: 1 / -1;
    margin-top: -6px;
}

.portal-field-lines .portal-field-hint {
    margin-top: 2px;
}

/* A tab's outside guidance, such as the gov.uk pages on Suitability Checks: one line of
   short links at the top of the tab, each with a small mark to show it opens a new tab. */
.portal-external-links {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 16px;
    row-gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--portal-line);
    border-radius: 6px;
    background-color: var(--rainbow-blue-tint);
    font-size: 0.8rem;
}

.portal-external-links-label {
    color: var(--portal-text-muted);
    font-weight: 600;
}

.portal-external-links a {
    color: var(--rainbow-blue);
    text-decoration: none;
}

.portal-external-links a:hover {
    color: var(--rainbow-blue-dark);
    text-decoration: underline;
}

.portal-link-mark {
    width: 0.85em;
    height: 0.85em;
    margin-left: 3px;
    vertical-align: -1px;
}

/* An address box with its Open link beside it. */
.portal-field-linkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-field-open {
    flex: none;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.portal-field-value .portal-field-open {
    margin-left: 8px;
}

/* A box the portal fills in, such as holiday hours: it reads as a value, not as a box to type in. */
.portal-record-body .form-control[readonly],
.portal-form .form-control[readonly] {
    background-color: var(--rainbow-grey);
    color: var(--portal-text);
    cursor: default;
}

/* The key training on Training / Qualifications: RaSta's grid, read from the training record. */
.portal-keytraining,
.portal-keytraining-more {
    grid-column: 1 / -1;
}

.portal-keytraining {
    margin-bottom: 0;
}

/* Both tables share their column widths, so Key training and Special responsibilities line up. */
.portal-keytraining table {
    table-layout: fixed;
    min-width: 640px;
}

.portal-keytraining-more {
    margin-top: -6px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* RaSta's ID documents: three columns headed Group 1, Group 2a and Group 2b docs. */
.portal-idgrid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.portal-idgrid-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.portal-idgrid-head {
    color: var(--portal-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .portal-split,
    .portal-idgrid {
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-split > .portal-fields + .portal-fields {
        margin-top: 16px;
    }

    .portal-field-row-items > .portal-item-date,
    .portal-field-row-items > .portal-item-number,
    .portal-field-row-items > .portal-item-text {
        flex: 1 1 100%;
    }
}

.portal-savebar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px -22px -18px;
    padding: 10px 22px;
    background-color: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--portal-line);
    border-radius: 0 0 14px 14px;
    backdrop-filter: blur(4px);
}

@media (max-width: 991.98px) {
    .portal-record {
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-record-nav {
        position: static;
        display: flex;
        gap: 4px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .portal-record-nav-group {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .portal-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-person {
        padding: 16px;
    }

    .portal-record-body {
        padding: 18px 16px;
    }

    .portal-savebar {
        margin: 18px -16px -18px;
        padding: 12px 16px;
    }
}

.portal-record-fields {
    font-size: 0.9rem;
    max-width: 900px;
}

.portal-record-fields dt:not(.portal-record-group) {
    font-weight: 400;
    color: var(--portal-text-muted);
}

.portal-record-fields dd {
    min-height: 1.4em;
    overflow-wrap: anywhere;
}

.portal-record-group {
    color: var(--rainbow-blue);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--portal-line);
    padding-bottom: 4px;
    margin: 14px 0 8px 0;
}

.portal-memo {
    white-space: pre-wrap;
}

/* Task 3.8: an L2/3 childcare qualification that counts as unqualified while paediatric first
   aid has lapsed, on the Training / Qualifications tab and the qualification reports. */
.portal-unqualified {
    margin-top: 4px;
    color: var(--rainbow-red);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Task 3.12: a staff list cell on several lines, such as an address. */
.portal-lines {
    white-space: pre-line;
    min-width: 130px;
}

.portal-staff-list .portal-unqualified {
    white-space: normal;
}

/* The lists have many columns, so their headings wrap to fit the page. */
.portal-staff-list thead th {
    white-space: normal;
    vertical-align: middle;
}

/* The previous names table on the Personal tab, below Familiar name. */
.portal-previous-names .table-wrapper {
    margin-bottom: 4px;
}

.portal-previous-names .table {
    margin-bottom: 0;
}

.portal-previous-names-add {
    display: inline-block;
    font-size: 0.85rem;
    padding: 2px 0;
}

/* A Disciplinary or File Notes entry shown read only. */
.portal-entry dt {
    color: var(--portal-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.portal-entry dd {
    margin-bottom: 12px;
}

/* A heading row inside a table, for a group of rows. */
.table tbody tr.portal-group-row > td {
    background-color: var(--rainbow-grey);
    color: var(--rainbow-blue);
    font-weight: 700;
    border-top: 2px solid var(--portal-line-strong);
}

/* A light grey band for a section of a page. */
.portal-section {
    background-color: var(--rainbow-grey);
    border: 1px solid var(--portal-line);
    border-radius: 6px;
    padding: 14px 16px;
}

/* --- Forms --- */
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* --- Alerts --- */
.alert {
    font-size: 0.9rem;
}

/* --- Login Page --- */
.login-container {
    max-width: 400px;
    margin: 0 auto;
}

/* The login and password pages: a sky with rainbows, balloons and building blocks behind the
   card (wwwroot/images/login-background.svg), and a light footer that reads over it. */
.portal-login {
    background: var(--rainbow-grey) url("../images/login-background.svg") center / cover no-repeat fixed;
}

.portal-login .footer {
    background-color: rgba(255, 255, 255, 0.75);
}

.login-logo {
    max-width: 160px;
    width: 100%;
    height: auto;
}

/* ===================================================================
   Menu Layout: dark or light, along the top or down the side.
   One setting for everyone, chosen under Configure > Layout. The body
   carries portal-menu-dark/portal-menu-light and portal-layout-top/
   portal-layout-side, and everything below hangs off those.
   =================================================================== */

:root {
    /* The colours of the logo. Blue is the main colour, red the accent used sparingly,
       yellow only for small highlights. Use these variables, never the hex values. */
    --rainbow-blue: #044484;
    --rainbow-blue-dark: #03386c;
    --rainbow-blue-deep: #022b53;
    --rainbow-blue-focus: #5b8fc4;
    --rainbow-blue-tint: #eaf1f9;
    --rainbow-blue-tint-strong: #d3e2f2;
    --rainbow-red: #B40420;
    --rainbow-red-dark: #8c0319;
    --rainbow-yellow: #F0D404;
    --rainbow-grey: #f5f6f8;
    --rainbow-grey-dark: #e6e9ed;
    /* Chart colours (Task 3.14), checked for colour blindness against the white page. */
    --chart-starters: #2a6fb8;
    --chart-leavers: #B40420;
    --portal-line: #dee2e6;
    --portal-line-strong: #cdd2d8;
    --portal-text: #212529;
    --portal-text-muted: #5a6472;
    --portal-side-w: 250px;
    --portal-rail-w: 66px;
}

/* --- Light Mode, the bar along the top --- */
/* White, with a shadow under it so the page can see where the menu ends, and blue words. */
.navbar-portal.navbar-portal-light {
    background-color: #ffffff;
    box-shadow: 0 1px 0 var(--portal-line), 0 4px 18px rgba(4, 68, 132, 0.09);
}

.navbar-portal-light .navbar-portal-brand {
    color: var(--rainbow-blue) !important;
}

.navbar-portal-light .navbar-portal-brand:hover {
    color: var(--rainbow-blue-dark) !important;
}

.navbar-portal-light .navbar-portal-link {
    color: var(--rainbow-blue) !important;
}

.navbar-portal-light .navbar-portal-link:hover,
.navbar-portal-light .navbar-portal-link:focus {
    color: var(--rainbow-blue-dark) !important;
    background-color: rgba(4, 68, 132, 0.06);
}

.navbar-portal-light .navbar-portal-link.active {
    color: var(--rainbow-blue) !important;
}

.navbar-portal-light .navbar-toggler {
    border-color: var(--portal-line);
}

.navbar-portal-light .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%284, 68, 132, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-portal-light .navbar-portal-dropdown {
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    box-shadow: 0 6px 18px rgba(4, 68, 132, 0.12);
}

.navbar-portal-light .navbar-portal-dropdown-item {
    color: var(--portal-text) !important;
}

.navbar-portal-light .navbar-portal-dropdown-item:hover,
.navbar-portal-light .navbar-portal-dropdown-item:focus,
.navbar-portal-light .navbar-portal-dropdown-item.active {
    color: var(--rainbow-blue) !important;
    background-color: var(--rainbow-blue-tint);
}

.navbar-portal-light .navbar-portal-dropdown .dropdown-header {
    color: var(--rainbow-red);
}

.navbar-portal-light .navbar-portal-dropdown .dropdown-divider {
    border-color: var(--portal-line);
}

/* --- Side Layout, the frame --- */
/* The footer is normally pinned to the bottom of the page, which would run under the menu
   down the side. Here the page is a column instead, and the footer sits at its foot. */
body.portal-layout-side {
    margin-bottom: 0;
}

.portal-layout-side .portal-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.portal-layout-side .portal-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.portal-layout-side .portal-main > .container {
    flex: 1 0 auto;
    padding-top: 1rem;
}

.portal-layout-side .footer {
    position: static;
    width: auto;
}

/* --- The menu down the side --- */
.portal-sidebar {
    flex: 0 0 var(--portal-side-w);
    width: var(--portal-side-w);
    background-color: var(--rainbow-blue);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    /* Visible, so the Configure and name menus can open out of the foot. The list of
       items scrolls on its own. */
    overflow: visible;
    z-index: 1020;
    transition: flex-basis 0.15s ease, width 0.15s ease;
}

.portal-side-brand-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 10px 10px 14px;
    position: relative;
}

.portal-side-brand-row::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.12);
}

.portal-side-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    text-decoration: none;
    color: #ffffff;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.2px;
}

.portal-side-brand:hover {
    color: var(--rainbow-blue-tint);
}

.portal-side-logo {
    height: 26px;
    width: auto;
    flex: 0 0 auto;
}

.portal-side-brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-rail-toggle {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 4px;
    background-color: transparent;
    color: rgba(255, 255, 255, 0.7);
}

.portal-rail-toggle:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.portal-rail-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform 0.15s ease;
}

.portal-side-nav {
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.portal-menu-light .portal-side-nav {
    scrollbar-color: rgba(4, 68, 132, 0.2) transparent;
}

.portal-side-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 5px;
    background-color: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
}

.portal-side-item:hover,
.portal-side-item:focus-visible {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.portal-side-item.active,
.portal-side-item.active:hover {
    background-color: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--rainbow-red);
}

.portal-side-item.active .portal-side-icon {
    color: #ffffff;
}

.portal-side-icon {
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
    color: rgba(255, 255, 255, 0.72);
}

/* A small heading over a group of side menu items. Hidden when the menu is folded. */
.portal-side-heading {
    padding: 12px 10px 4px 10px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
}

.portal-menu-light .portal-side-heading {
    color: var(--portal-text-muted);
}

/* The Reports groups in the side menu (Sprint 3): a small heading over each group. */
.portal-side-subheading {
    padding: 6px 10px 2px 14px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--rainbow-yellow);
    white-space: nowrap;
}

.portal-menu-light .portal-side-subheading {
    color: var(--rainbow-red);
}

.portal-shell.portal-rail .portal-side-heading,
.portal-pre-collapsed .portal-layout-side .portal-side-heading,
.portal-shell.portal-rail .portal-side-subheading,
.portal-pre-collapsed .portal-layout-side .portal-side-subheading {
    display: none;
}

.portal-side-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-side-caret {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    opacity: 0.7;
}

.portal-side-foot {
    padding: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.portal-side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: 5px;
    background-color: transparent;
    color: #ffffff;
    text-align: left;
}

.portal-side-user:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.portal-avatar {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #ffffff;
    color: var(--rainbow-blue);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.portal-side-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.portal-side-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-side-user-role {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
}

/* The menus that open upward out of the foot. */
.portal-side-menu {
    background-color: var(--rainbow-blue-dark);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 5px;
    min-width: 190px;
    padding: 4px 0;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.3);
}

.portal-side-menu .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.86rem;
    padding: 7px 14px;
}

.portal-side-menu .dropdown-item:hover,
.portal-side-menu .dropdown-item:focus {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.portal-side-menu .dropdown-item.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.16);
}

.portal-side-menu .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.15);
}

/* --- The menu down the side, in Light Mode --- */
.portal-menu-light .portal-sidebar {
    background-color: #ffffff;
    box-shadow: 1px 0 0 var(--portal-line), 4px 0 18px rgba(4, 68, 132, 0.07);
}

.portal-menu-light .portal-side-brand {
    color: var(--rainbow-blue);
}

.portal-menu-light .portal-side-brand:hover {
    color: var(--rainbow-blue-dark);
}

.portal-menu-light .portal-side-brand-row::after {
    background-color: var(--portal-line);
}

.portal-menu-light .portal-rail-toggle {
    color: var(--portal-text-muted);
}

.portal-menu-light .portal-rail-toggle:hover {
    background-color: rgba(4, 68, 132, 0.07);
    color: var(--rainbow-blue);
}

.portal-menu-light .portal-side-item {
    color: var(--rainbow-blue);
}

.portal-menu-light .portal-side-icon {
    color: var(--rainbow-blue);
}

.portal-menu-light .portal-side-item:hover,
.portal-menu-light .portal-side-item:focus-visible {
    background-color: rgba(4, 68, 132, 0.06);
    color: var(--rainbow-blue);
}

.portal-menu-light .portal-side-item.active,
.portal-menu-light .portal-side-item.active:hover {
    background-color: var(--rainbow-blue-tint-strong);
    color: var(--rainbow-blue);
}

.portal-menu-light .portal-side-item.active .portal-side-icon {
    color: var(--rainbow-blue);
}

.portal-menu-light .portal-side-foot {
    border-top-color: var(--portal-line);
}

.portal-menu-light .portal-side-user {
    color: var(--rainbow-blue);
}

.portal-menu-light .portal-side-user:hover {
    background-color: rgba(4, 68, 132, 0.06);
}

.portal-menu-light .portal-side-user-name {
    color: var(--rainbow-blue);
}

.portal-menu-light .portal-avatar {
    background-color: var(--rainbow-blue);
    color: #ffffff;
}

.portal-menu-light .portal-side-user-role {
    color: var(--portal-text-muted);
}

.portal-menu-light .portal-side-menu {
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    box-shadow: 0 -6px 20px rgba(4, 68, 132, 0.14);
}

.portal-menu-light .portal-side-menu .dropdown-item {
    color: var(--portal-text);
}

.portal-menu-light .portal-side-menu .dropdown-item:hover,
.portal-menu-light .portal-side-menu .dropdown-item:focus {
    color: var(--rainbow-blue);
    background-color: var(--rainbow-blue-tint);
}

.portal-menu-light .portal-side-menu .dropdown-item.active {
    color: var(--rainbow-blue);
    background-color: var(--rainbow-blue-tint-strong);
}

.portal-menu-light .portal-side-menu .dropdown-divider {
    border-color: var(--portal-line);
}

/* --- Folded to its icons --- */
/* portal-pre-collapsed is put on <html> before the page is drawn, so a folded menu never
   opens wide and then snaps shut. */
.portal-shell.portal-rail .portal-sidebar,
.portal-pre-collapsed .portal-layout-side .portal-sidebar {
    flex-basis: var(--portal-rail-w);
    width: var(--portal-rail-w);
}

.portal-shell.portal-rail .portal-side-brand-text,
.portal-shell.portal-rail .portal-side-label,
.portal-shell.portal-rail .portal-side-caret,
.portal-shell.portal-rail .portal-side-user-text,
.portal-pre-collapsed .portal-layout-side .portal-side-brand-text,
.portal-pre-collapsed .portal-layout-side .portal-side-label,
.portal-pre-collapsed .portal-layout-side .portal-side-caret,
.portal-pre-collapsed .portal-layout-side .portal-side-user-text {
    display: none;
}

.portal-shell.portal-rail .portal-rail-toggle svg {
    transform: rotate(180deg);
}

.portal-shell.portal-rail .portal-side-brand-row {
    padding: 10px 6px;
    flex-direction: column;
    gap: 6px;
}

.portal-shell.portal-rail .portal-side-item,
.portal-shell.portal-rail .portal-side-user {
    justify-content: center;
}

/* The name of an icon on hover while folded. Drawn against the window rather than inside
   the menu, which scrolls and would cut it off. */
.portal-rail-tip {
    position: fixed;
    z-index: 1080;
    transform: translateY(-50%);
    padding: 4px 9px;
    border-radius: 4px;
    background-color: var(--rainbow-blue-deep);
    color: #ffffff;
    font-size: 0.78rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.portal-rail-tip.show {
    opacity: 1;
}

/* --- The bar at the top on a small screen, and the drawer it opens --- */
.portal-appbar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background-color: var(--rainbow-blue);
    margin-bottom: 1rem;
}

.portal-menu-light .portal-appbar {
    background-color: #ffffff;
    box-shadow: 0 1px 0 var(--portal-line), 0 4px 18px rgba(4, 68, 132, 0.09);
}

.portal-hamburger {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 4px;
    background-color: transparent;
    color: rgba(255, 255, 255, 0.85);
}

.portal-hamburger svg {
    width: 21px;
    height: 21px;
}

.portal-menu-light .portal-hamburger {
    color: var(--portal-text-muted);
}

.portal-appbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.4px;
}

.portal-menu-light .portal-appbar-brand {
    color: var(--rainbow-blue);
}

.portal-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1030;
    background-color: rgba(0, 0, 0, 0.45);
}

@media (max-width: 575.98px) {
    .portal-layout-side .portal-appbar {
        display: flex;
    }

    /* Off to the left until the button in the bar slides it in. */
    .portal-layout-side .portal-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1040;
        height: 100vh;
        flex-basis: var(--portal-side-w);
        width: var(--portal-side-w);
        transform: translateX(-100%);
        transition: transform 0.18s ease;
    }

    /* Folding belongs to the wide menu: on a phone the drawer is always full width. */
    .portal-shell.portal-rail .portal-sidebar {
        flex-basis: var(--portal-side-w);
        width: var(--portal-side-w);
    }

    .portal-shell.portal-rail .portal-side-brand-text,
    .portal-shell.portal-rail .portal-side-label,
    .portal-shell.portal-rail .portal-side-caret,
    .portal-shell.portal-rail .portal-side-user-text {
        display: initial;
    }

    .portal-shell.portal-rail .portal-side-brand-row {
        padding: 10px 10px 10px 14px;
        flex-direction: row;
    }

    .portal-shell.portal-rail .portal-side-item,
    .portal-shell.portal-rail .portal-side-user {
        justify-content: flex-start;
    }

    .portal-shell.portal-drawer-open .portal-sidebar {
        transform: translateX(0);
    }

    .portal-shell.portal-drawer-open .portal-scrim {
        display: block;
    }
}

/* ===================================================================
   Configure > Layout: the choices, each with a small picture of what
   it does.
   =================================================================== */

.portal-choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* The radio itself is hidden; its label is the card. Kept reachable by keyboard, so the
   focus ring below is what shows when it is tabbed to. */
.portal-choice-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.portal-choice {
    flex: 1 1 180px;
    min-width: 160px;
    display: block;
    padding: 12px;
    border: 2px solid var(--portal-line);
    border-radius: 6px;
    background-color: #ffffff;
    cursor: pointer;
}

.portal-choice:hover {
    border-color: var(--rainbow-blue-focus);
}

.portal-choice-input:checked + .portal-choice {
    border-color: var(--rainbow-blue);
    box-shadow: 0 0 0 1px var(--rainbow-blue);
}

.portal-choice-input:focus-visible + .portal-choice {
    outline: 2px solid var(--rainbow-blue-focus);
    outline-offset: 2px;
}

.portal-choice-name {
    display: block;
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--portal-text);
}

.portal-choice-note {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--portal-text-muted);
}

/* The picture: a menu block and a page block, arranged the way the choice would arrange
   them, and coloured the way the other choice is currently set. */
.portal-choice-picture {
    display: flex;
    width: 100%;
    height: 68px;
    border: 1px solid var(--portal-line);
    border-radius: 4px;
    overflow: hidden;
    background-color: var(--rainbow-grey);
}

.portal-choice-picture.is-top {
    flex-direction: column;
}

.portal-choice-picture.is-side {
    flex-direction: row;
}

.portal-choice-menu {
    flex: 0 0 auto;
    background-color: var(--rainbow-blue);
}

.portal-choice-picture.is-light .portal-choice-menu {
    background-color: #ffffff;
    box-shadow: inset 0 0 0 1px var(--portal-line);
}

.portal-choice-picture.is-top .portal-choice-menu {
    height: 14px;
}

.portal-choice-picture.is-side .portal-choice-menu {
    width: 30px;
}

.portal-choice-page {
    flex: 1 1 auto;
    background-color: var(--rainbow-grey);
    background-image: linear-gradient(to bottom, var(--rainbow-grey-dark) 0 3px, transparent 3px 11px);
    background-size: 100% 11px;
    background-repeat: repeat-y;
    background-position: 8px 8px;
}

/* --- Quick search (Task 1.19): on the Dashboard and in both menus --- */
.portal-quick-search {
    position: relative;
}

.portal-quick-results {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 100%;
    width: 300px;
    max-width: calc(100vw - 32px);
    max-height: 360px;
    overflow-y: auto;
    z-index: 1060;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.portal-quick-results a {
    display: block;
    padding: 6px 10px;
    color: #212529;
    text-decoration: none;
    border-bottom: 1px solid var(--rainbow-grey-dark);
}

.portal-quick-results a:last-child {
    border-bottom: 0;
}

.portal-quick-results a:hover,
.portal-quick-results a.active {
    background-color: var(--rainbow-blue-tint);
}

.portal-quick-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.portal-quick-more {
    display: block;
    font-size: 0.78rem;
    color: #6c757d;
}

.portal-quick-none {
    padding: 8px 10px;
    font-size: 0.85rem;
    color: #6c757d;
}

.portal-quick-top {
    width: 220px;
    margin: 0 12px;
    align-self: center;
}

.portal-quick-top .portal-quick-results {
    right: 0;
    left: auto;
}

.portal-quick-side {
    margin: 6px 10px 10px;
}

.portal-shell.portal-rail .portal-quick-side,
.portal-pre-collapsed .portal-layout-side .portal-quick-side {
    display: none;
}

@media (max-width: 991.98px) {
    .portal-quick-top {
        width: 100%;
        margin: 8px 0;
    }
}

/* --- Dashboard (Task 1.19) --- */
/* The same blue band as the staff record, with the greeting and the search; six figure cards
   that turn red or yellow when they need attention; and shortcut cards with icons. */
.portal-dash-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding: 26px 28px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--rainbow-blue) 0%, var(--rainbow-blue-deep) 100%);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(2, 43, 83, 0.18);
}

.portal-dash-date {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rainbow-yellow);
}

.portal-dash-greeting {
    margin: 4px 0 2px;
    color: #ffffff;
    font-size: 1.65rem;
    font-weight: 700;
}

.portal-dash-lead {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.95rem;
}

.portal-dash-search {
    flex: 0 1 380px;
    min-width: 240px;
}

.portal-dash-search .portal-quick-input {
    height: 44px;
    padding-left: 14px;
    border: 0;
    border-radius: 10px;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.portal-dash-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.portal-dash-tile {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 18px 14px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-top: 4px solid var(--rainbow-blue);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
    color: var(--portal-text);
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.portal-dash-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.10);
    color: var(--portal-text);
}

.portal-dash-tile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.portal-dash-tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background-color: var(--rainbow-blue-tint);
    color: var(--rainbow-blue);
}

.portal-dash-icon {
    width: 20px;
    height: 20px;
}

.portal-dash-tile-count {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--rainbow-blue);
}

.portal-dash-tile-label {
    font-size: 0.95rem;
    font-weight: 600;
}

.portal-dash-tile-note {
    font-size: 0.8rem;
    color: var(--portal-text-muted);
}

.portal-dash-tile-go {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    padding-top: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--rainbow-blue);
}

.portal-dash-go-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.12s ease;
}

.portal-dash-tile:hover .portal-dash-go-icon {
    transform: translateX(3px);
}

.portal-dash-tile.tone-alert {
    border-top-color: var(--rainbow-red);
}

.portal-dash-tile.tone-alert .portal-dash-tile-count,
.portal-dash-tile.tone-alert .portal-dash-tile-icon {
    color: var(--rainbow-red);
}

.portal-dash-tile.tone-alert .portal-dash-tile-icon {
    background-color: #fbe9ec;
}

.portal-dash-tile.tone-warn {
    border-top-color: var(--rainbow-yellow);
}

.portal-dash-tile.tone-warn .portal-dash-tile-icon {
    background-color: #fdf8d6;
    color: #8a7a00;
}

.portal-dash-heading {
    margin: 30px 0 12px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--portal-text-muted);
}

.portal-dash-shortcuts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.portal-dash-shortcut {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 12px;
    color: var(--portal-text);
    text-decoration: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.portal-dash-shortcut:hover {
    border-color: var(--rainbow-blue-focus);
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
    color: var(--portal-text);
}

.portal-dash-shortcut-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: var(--rainbow-blue-tint);
    color: var(--rainbow-blue);
}

.portal-dash-shortcut-label {
    display: block;
    font-weight: 600;
    font-size: 0.93rem;
}

.portal-dash-shortcut-note {
    display: block;
    font-size: 0.78rem;
    color: var(--portal-text-muted);
}

.portal-dash-shortcut.primary {
    background-color: var(--rainbow-blue);
    border-color: var(--rainbow-blue);
    color: #ffffff;
}

.portal-dash-shortcut.primary:hover {
    background-color: var(--rainbow-blue-dark);
    color: #ffffff;
}

.portal-dash-shortcut.primary .portal-dash-shortcut-icon {
    background-color: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.portal-dash-shortcut.primary .portal-dash-shortcut-note {
    color: rgba(255, 255, 255, 0.78);
}

.portal-dash-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
}

.portal-dash-panel {
    padding: 18px 20px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

.portal-dash-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 1.05rem;
    font-weight: 700;
}

.portal-dash-panel-title .portal-dash-icon {
    color: var(--rainbow-blue);
}

.portal-dash-empty {
    margin: 0;
    color: var(--portal-text-muted);
    font-size: 0.9rem;
}

.portal-dash-shortcuts + .portal-dash-panels,
.portal-dash-hero + .portal-dash-shortcuts {
    margin-top: 22px;
}

/* A questionnaire asked for, under the greeting, for every role. */
.portal-dash-hero + .portal-dash-request {
    margin-top: 20px;
}

.portal-dash-request + .portal-dash-shortcuts {
    margin-top: 14px;
}

@media (max-width: 991.98px) {
    .portal-dash-shortcuts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .portal-dash-shortcuts {
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-dash-hero {
        padding: 20px 18px;
    }

    .portal-dash-search {
        flex-basis: 100%;
    }
}

/* --- Clickable table rows (see site.js) --- */
tr.portal-row-link {
    cursor: pointer;
}

/* --- Codes, such as enrolment codes, in the Rainbow blue rather than Bootstrap's pink --- */
code {
    color: var(--rainbow-blue-deep);
}

/* --- The portal look, across every signed-in page --- */
/* A light grey page with the content on white cards: the page title with a short red bar under
   it, the filter bar above a list, the list itself and every add or edit form each sit on a
   card with soft corners, so every page matches the Dashboard and the staff record. The sign in
   pages use _LoginLayout, whose body has no portal-layout class, and are not touched. */
body[class*="portal-layout-"] {
    background-color: #f4f6f9;
}

body[class*="portal-layout-"] main > h4 {
    margin: 6px 0 0;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

body[class*="portal-layout-"] main > hr {
    width: 44px;
    height: 3px;
    margin: 10px 0 22px;
    border: 0;
    border-radius: 2px;
    background-color: var(--rainbow-red);
    opacity: 1;
}

/* The person or thing a page is about, under its heading (Views/Shared/_PageSubject.cshtml). */
.portal-page-subject {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
    margin-top: 4px;
}

.portal-page-subject-name {
    color: var(--portal-text);
    font-size: 1.05rem;
    font-weight: 600;
}

.portal-page-subject-detail {
    color: var(--portal-text-muted);
    font-size: 0.9rem;
}

body[class*="portal-layout-"] main > p {
    max-width: 900px;
}

/* Filter bars above lists. */
body[class*="portal-layout-"] main > form[method="get"] {
    margin-bottom: 16px;
    padding: 12px 14px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

body[class*="portal-layout-"] main > form[method="get"] > .mb-3 {
    margin-bottom: 0 !important;
}

body[class*="portal-layout-"] main > form[method="get"] > .d-flex.justify-content-between > div:last-child:not(:first-child) {
    margin-left: auto;
}

body[class*="portal-layout-"] main > form[method="get"] > .d-flex.justify-content-between,
body[class*="portal-layout-"] main > form[method="get"] > .d-flex.justify-content-between > .d-flex {
    flex-wrap: wrap;
    gap: 8px;
}

body[class*="portal-layout-"] main > form[method="get"] .btn {
    white-space: nowrap;
}

/* Add and edit forms. */
body[class*="portal-layout-"] main > form[method="post"] {
    max-width: 1100px;
    margin-bottom: 20px;
    padding: 24px 24px 10px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

/* Lists. */
.table-responsive,
.table-wrapper {
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

.table {
    font-size: 0.84rem;
}

.table thead th {
    padding: 10px 12px;
    font-size: 0.74rem;
    letter-spacing: 0.05em;
}

/* Room on the right of a sortable heading for its arrow, so the arrow never sits on the words. */
.sortable thead th:not(.no-sort) {
    padding-right: 24px;
}

.table tbody td {
    padding: 8px 12px;
}

/* Sections inside a page, such as a job role's required training or a template's steps. */
.portal-section {
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

/* Boxes and buttons with soft corners. */
.form-control,
.form-select {
    border-color: #d5dbe3;
    border-radius: 9px;
}

.form-control-sm,
.form-select-sm {
    border-radius: 8px;
}

.btn {
    border-radius: 9px;
    font-weight: 500;
}

.btn-sm {
    border-radius: 8px;
    padding: 0.3rem 0.8rem;
}

.btn-sm.p-1 {
    padding: 0.3rem !important;
}

.status-badge {
    border-radius: 999px;
    padding: 2px 9px;
}

.footer {
    background-color: #ffffff;
}

/* Print Record, in the staff record's blue header. */
.portal-person-print {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    background-color: #ffffff;
    color: var(--rainbow-blue);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.portal-person-print:hover {
    background-color: var(--rainbow-blue-tint);
    color: var(--rainbow-blue-deep);
}

.portal-person-print svg {
    width: 16px;
    height: 16px;
}

/* The line under a filter bar saying which advanced settings are in use. */
.portal-filter-note {
    margin: -6px 0 2px;
    font-size: 0.82rem;
    color: var(--portal-text-muted);
}

/* Pop ups, such as Advanced search, in the portal look. */
.portal-modal {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(2, 43, 83, 0.25);
}

.portal-modal .modal-header {
    border-bottom: 1px solid var(--portal-line);
}

.portal-modal .modal-title {
    font-weight: 700;
}

.portal-modal .modal-footer {
    border-top: 1px solid var(--portal-line);
}

/* Headings on every part of the staff record match: Training, Plan, Login and History as well. */
.portal-record-body h5 {
    font-size: 1.1rem;
    font-weight: 700;
}

/* A yes or no switch beside a normal field lines up with that field's box, not its label. */
.portal-field-switch {
    align-items: flex-end;
    padding-bottom: 7px;
}

/* Wide lists, such as Key Qualifications, scroll sideways inside their card instead of being cut off. */
.table-responsive,
.table-wrapper {
    overflow-x: auto;
}

/* --- Add and edit forms in the staff record's look --- */
/* Every add or edit form marked portal-form lays its label-and-box rows out like the staff
   record: two columns, labels above the boxes, long text across the full width, tick boxes as
   switches lined up with the boxes beside them, and Save, Cancel and Delete in a bar at the
   foot of the card that stays in reach while you scroll. Below 768 pixels it is one column. */
form.portal-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
    row-gap: 10px;
    align-items: start;
}

form.portal-form > * {
    grid-column: 1 / -1;
}

form.portal-form > .validation-summary-valid {
    display: none;
}

form.portal-form > .row {
    grid-column: auto;
    display: block;
    margin: 0 !important;
}

form.portal-form > .row > * {
    width: 100%;
    max-width: 100%;
    margin-left: 0 !important;
    padding-left: 0;
    padding-right: 0;
    flex: none;
}

form.portal-form > .row > [class*="col-"]:empty {
    display: none;
}

form.portal-form > .row > .col-form-label {
    display: block;
    padding: 0;
    margin-bottom: 3px;
    text-align: left !important;
    color: var(--portal-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

form.portal-form > .row:has(textarea),
form.portal-form > .row.wide {
    grid-column: 1 / -1;
}

form.portal-form > .row:has(.form-check):not(:has(.col-form-label)) {
    align-self: end;
    padding-bottom: 7px;
}

/* A switch that sits beside a box with a hint under it lines up with the box, not the hint. */
form.portal-form > .row.portal-form-switch-top:has(.form-check) {
    align-self: start;
    padding-top: 26px;
    padding-bottom: 0;
}

form.portal-form .form-check-input {
    cursor: pointer;
}

form.portal-form > .row:has(button[type="submit"]) {
    grid-column: 1 / -1;
    padding-top: 10px;
    border-top: 1px solid var(--portal-line);
}

form.portal-form > .row:has(button[type="submit"]) > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* On a form that is the page's card, the button bar runs to the card's edges and stays at the foot. */
body[class*="portal-layout-"] main > form.portal-form {
    padding-bottom: 0;
}

body[class*="portal-layout-"] main > form.portal-form > .row:has(button[type="submit"]) {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 6px -24px 0 !important;
    padding: 10px 24px;
    background-color: rgba(255, 255, 255, 0.96);
    border-radius: 0 0 14px 14px;
    backdrop-filter: blur(4px);
}

@media (max-width: 767.98px) {
    form.portal-form {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Six dashboard tiles sit in one row on a wide screen, two rows of three in the middle, and
   three rows of two on a phone. */
@media (min-width: 1400px) {
    .portal-dash-tiles {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .portal-dash-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Button rows wrap on a narrow screen rather than squeezing a button onto two lines. */
form.portal-form > .row:has(button[type="submit"]) > div,
.portal-savebar {
    flex-wrap: wrap;
}

form.portal-form > .row:has(button[type="submit"]) .btn,
.portal-savebar .btn {
    white-space: nowrap;
}

/* The full top menu bar from 992 pixels: on a laptop (992 to 1439 pixels, such as a 1366
   pixel screen at 125% scaling) the links and the quick search close up a little so the whole
   bar still fits on one line. From Sprint 3, with My Suitability in the menu too, this runs up
   to 1439 pixels. */
@media (min-width: 992px) and (max-width: 1439.98px) {
    .navbar-portal-brand {
        padding-right: 10px;
    }

    .navbar-portal-link {
        padding: 15px 8px !important;
        font-size: 0.86rem;
    }

    .portal-quick-top {
        width: 170px;
        margin: 0 8px;
    }

    /* With My Medical and My Suitability in the menu the bar no longer fits at these
       widths, so the logo stands alone without its words. */
    .navbar-portal-brand-text {
        display: none;
    }
}

@media (min-width: 992px) and (max-width: 1099.98px) {
    .navbar-portal-link {
        padding: 15px 5px !important;
        font-size: 0.83rem;
    }

    .portal-quick-top {
        width: 120px;
        margin: 0 6px;
    }

    #userDropdown {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* --- Medical questionnaires (Sprint 2) --- */
/* A white card for My Medical, a single version and the questionnaire form. */
.portal-card-plain {
    padding: 18px 22px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

/* One question: its words, then Yes and the notes side by side (one under the other on a phone). */
.portal-medical-question {
    padding: 10px 0;
    border-top: 1px solid var(--portal-line);
}

.portal-medical-text {
    margin-bottom: 6px;
    font-size: 0.92rem;
}

.portal-medical-number {
    color: var(--portal-text-muted);
    font-weight: 600;
}

.portal-medical-reply {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.portal-medical-reply .form-check {
    flex: none;
    min-width: 70px;
    margin-top: 4px;
}

.portal-medical-reply textarea {
    flex: 1 1 auto;
}

.portal-medical-form .portal-savebar {
    margin: 16px -22px -18px;
}

/* The health declaration (Sprint 3): each details box has its own small label; the medication
   and hospital tables, the alcohol box, Further information and the declaration sit between
   the questions as the form has them. */
.portal-medical-details {
    /* Snag 63: every details box fills the row, however long its small label is. */
    flex: 1 1 0;
    min-width: 0;
}

.portal-medical-details-label {
    display: block;
    margin-bottom: 2px;
    color: var(--portal-text-muted);
    font-size: 0.75rem;
}

.portal-medical-section {
    padding: 10px 0 12px;
    border-top: 1px solid var(--portal-line);
}

.portal-medical-section-title {
    margin-bottom: 6px;
    color: var(--rainbow-blue);
    font-size: 0.85rem;
    font-weight: 600;
}

.portal-medical-rows input {
    min-width: 110px;
}

.portal-medical-rows td {
    vertical-align: middle;
}

.portal-medical-add {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.85rem;
}

.portal-medical-declaration {
    padding: 12px 0 4px;
    border-top: 1px solid var(--portal-line);
}

/* The suitability declaration's five statements, confirmed with one tick (Task 3.5). */
.portal-suitability-statements {
    padding-left: 18px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.portal-suitability-statements li {
    margin-bottom: 4px;
}

.portal-medical-section-row > td {
    background-color: var(--rainbow-grey);
}

.portal-medical-subtable {
    margin: 0;
    background-color: #ffffff;
}

@media (max-width: 575.98px) {
    .portal-medical-reply {
        flex-direction: column;
        gap: 6px;
    }

    /* Snag 63: stacked on a phone, every details box is full width, whatever its label. */
    .portal-medical-details {
        align-self: stretch;
    }

    .portal-card-plain,
    .portal-medical-form .portal-savebar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .portal-medical-form .portal-savebar {
        margin: 16px -16px -18px;
    }
}

/* --- The PDF viewer pop up (Sprint 2) --- */
/* The PDF fills the pop up's body: most of the window's height, the full width of a large pop up. */
.portal-pdf-modal .modal-body {
    position: relative;
    height: calc(100vh - 190px);
    min-height: 320px;
    background-color: var(--rainbow-grey);
}

.portal-pdf-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.portal-pdf-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--portal-text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.portal-pdf-loading[hidden],
.portal-pdf-frame[hidden],
.portal-pdf-pages[hidden],
#pdfViewerPrint[hidden] {
    display: none;
}

/* A phone held sideways: the PDF area shrinks so Download and Close stay on the screen. */
@media (max-height: 500px) {
    .portal-pdf-modal .modal-body {
        min-height: 140px;
        height: calc(100vh - 150px);
    }
}

/* On a phone the PDF's pages are drawn one under another and scroll inside the pop up. */
.portal-pdf-pages {
    height: 100%;
    overflow-y: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
}

.portal-pdf-pages canvas {
    display: block;
    margin: 0 auto 8px auto;
    max-width: 100%;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* --- Compact boxes on forms (Sprint 2) --- */
/* Mark found the fields "a little over spacious". From 768 pixels, boxes on the staff record
   and on every add or edit form are only as tall as their text needs. Phones keep Bootstrap's
   taller boxes, so they stay easy to tap. */
@media (min-width: 768px) {
    .portal-record-body .form-control,
    .portal-record-body .form-select,
    form.portal-form .form-control,
    form.portal-form .form-select {
        padding-top: 0.28rem;
        padding-bottom: 0.28rem;
        font-size: 0.92rem;
        line-height: 1.4;
    }

    /* Snag 47: the £ before a money box is as tall as the box, so it lines up with the boxes beside it. */
    .portal-record-body .input-group-text,
    form.portal-form .input-group-text {
        padding-top: 0.28rem;
        padding-bottom: 0.28rem;
        font-size: 0.92rem;
        line-height: 1.4;
    }

    .portal-record-body .form-select,
    form.portal-form .form-select {
        background-position: right 0.6rem center;
    }

    .portal-record-body textarea.form-control,
    form.portal-form textarea.form-control {
        min-height: 0;
    }
}
/* On a phone, a table marked portal-card-table shows each row as a small card (Snag 13): the
   date, the title and the badge (such as the outcome) on the first line, then each long field
   under its own small label. The card opens the record, the same as the row. */
@media (max-width: 767.98px) {
    .portal-card-table thead {
        display: none;
    }

    .portal-card-table,
    .portal-card-table tbody {
        display: block;
        width: 100%;
    }

    .portal-card-table tbody tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        column-gap: 10px;
        row-gap: 6px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--portal-line);
    }

    .portal-card-table tbody td {
        display: block;
        border: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .portal-card-table td[data-card="date"] {
        grid-column: 1;
        grid-row: 1;
        font-weight: 600;
        white-space: nowrap;
    }

    .portal-card-table td[data-card="title"] {
        grid-column: 2;
        grid-row: 1;
        font-weight: 600;
    }

    .portal-card-table td[data-card="badge"] {
        grid-column: 3;
        grid-row: 1;
        text-align: right;
        font-weight: 600;
        color: var(--rainbow-blue);
    }

    .portal-card-table td[data-card="wide"] {
        grid-column: 1 / -1;
    }

    .portal-card-table td[data-card="wide"]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        color: var(--portal-text-muted);
    }

    .portal-card-table td[data-card="wide"]:empty,
    .portal-card-table td[data-card="actions"] {
        display: none;
    }
}

/* Snag 40: below 1200 pixels the page is too narrow for the two disciplinary tables' text
   columns, so a long outcome note ran down a thin column. Their rows are cards there too, the
   same cards as on a phone (the rules above, for these two tables only), with the note across
   the full width. From 1200 up they are tables. */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .portal-card-table.portal-disc-table thead {
        display: none;
    }

    .portal-card-table.portal-disc-table,
    .portal-card-table.portal-disc-table tbody {
        display: block;
        width: 100%;
    }

    .portal-card-table.portal-disc-table tbody tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        column-gap: 10px;
        row-gap: 6px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--portal-line);
    }

    .portal-card-table.portal-disc-table tbody td {
        display: block;
        border: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .portal-card-table.portal-disc-table td[data-card="date"] {
        grid-column: 1;
        grid-row: 1;
        font-weight: 600;
        white-space: nowrap;
    }

    .portal-card-table.portal-disc-table td[data-card="title"] {
        grid-column: 2;
        grid-row: 1;
        font-weight: 600;
    }

    .portal-card-table.portal-disc-table td[data-card="badge"] {
        grid-column: 3;
        grid-row: 1;
        text-align: right;
        font-weight: 600;
        color: var(--rainbow-blue);
    }

    .portal-card-table.portal-disc-table td[data-card="wide"] {
        grid-column: 1 / -1;
    }

    .portal-card-table.portal-disc-table td[data-card="wide"]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        color: var(--portal-text-muted);
    }

    .portal-card-table.portal-disc-table td[data-card="wide"]:empty,
    .portal-card-table.portal-disc-table td[data-card="actions"] {
        display: none;
    }

    .portal-card-table.portal-disc-table tbody td:not([data-card]) {
        grid-column: 1 / -1;
    }
}

/* The staff record's Letter and Print Record buttons side by side (Task 3.9), and the Letter
   list: each template, with the fields it will not fill under it. */
.portal-person-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.portal-letter-menu {
    min-width: 260px;
    max-width: 360px;
}

.portal-letter-menu .dropdown-item {
    white-space: normal;
}

.portal-letter-note {
    display: block;
    font-size: 0.75rem;
    color: var(--portal-text-muted);
}

@media (max-width: 767.98px) {
    .portal-person-print {
        min-height: 38px;
    }
}

/* On a phone the staff lists most often read in a hurry, Emergency Contacts and Phone List, show
   each person as a card (Snag 18): the name on the first line, then each number on its own line
   with its label. A group heading, such as the contract type, runs across the full width. */
@media (max-width: 767.98px) {
    .portal-card-table td[data-card="line"] {
        grid-column: 1 / -1;
    }

    .portal-card-table td[data-card="line"]::before {
        content: attr(data-label) ": ";
        font-size: 0.78rem;
        color: var(--portal-text-muted);
    }

    .portal-card-table td[data-card="line"]:empty,
    .portal-card-table td[data-card="hide"] {
        display: none;
    }

    .portal-card-table tbody td:not([data-card]) {
        grid-column: 1 / -1;
    }

    .portal-card-table tbody tr.portal-report-group td {
        font-weight: 600;
    }

    .portal-card-table tfoot,
    .portal-card-table tfoot tr,
    .portal-card-table tfoot td {
        display: block;
    }
}

/* The Dashboard's starters and leavers chart (Task 3.14). */
.portal-dash-chart {
    margin: 22px 0 24px;
    padding: 16px 18px;
    background-color: #ffffff;
    border: 1px solid var(--portal-line);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}

.portal-dash-chart-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.portal-dash-chart-link {
    font-size: 0.85rem;
}

.portal-dash-chart-box {
    position: relative;
    height: 260px;
}

@media (max-width: 767.98px) {
    .portal-dash-chart-box {
        height: 220px;
    }
}

/* The eight HR tiles sit as two rows of four on a wide screen (Task 3.14). */
@media (min-width: 1200px) {
    .portal-dash-tiles.portal-dash-tiles-hr {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* The five training tiles fill their row on a wide screen (Snag 22). */
@media (min-width: 1200px) {
    .portal-dash-tiles.portal-dash-tiles-training {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* The staff dashboard: shortcuts in a column on the left, the figures beside them. Below 992
   pixels it is one column, with the figures first and the shortcuts under them. */
.portal-dash-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.portal-dash-main > .portal-dash-tiles:first-child {
    margin-top: 0;
}

.portal-dash-side {
    order: 2;
}

.portal-dash-heading.portal-dash-side-heading {
    margin-top: 0;
}

@media (min-width: 992px) {
    .portal-dash-layout {
        grid-template-columns: 230px minmax(0, 1fr);
        align-items: start;
    }

    .portal-dash-side {
        order: 0;
    }

    .portal-dash-shortcuts.portal-dash-shortcuts-side {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    .portal-dash-shortcuts-side .portal-dash-shortcut {
        gap: 10px;
        padding: 9px 12px;
    }

    .portal-dash-shortcuts-side .portal-dash-shortcut-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .portal-dash-shortcuts-side .portal-dash-shortcut-label {
        font-size: 0.88rem;
    }

    .portal-dash-shortcuts-side .portal-dash-shortcut-note {
        font-size: 0.74rem;
    }
}

/* Smaller tiles, so the figures take less room. The whole tile opens its report. */
.portal-dash-layout .portal-dash-tiles {
    gap: 10px;
}

.portal-dash-layout .portal-dash-tile {
    padding: 10px 12px;
    border-top-width: 3px;
    border-radius: 10px;
}

.portal-dash-layout .portal-dash-tile-top {
    margin-bottom: 4px;
}

.portal-dash-layout .portal-dash-tile-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.portal-dash-layout .portal-dash-tile-icon .portal-dash-icon {
    width: 16px;
    height: 16px;
}

.portal-dash-layout .portal-dash-tile-count {
    font-size: 1.45rem;
}

.portal-dash-layout .portal-dash-tile-label {
    font-size: 0.86rem;
    line-height: 1.25;
}

.portal-dash-layout .portal-dash-tile-note {
    font-size: 0.74rem;
    line-height: 1.25;
}

.portal-dash-layout .portal-dash-chart {
    margin: 16px 0 0;
    padding: 12px 16px;
}

.portal-dash-layout .portal-dash-chart-box {
    height: 220px;
}

.portal-dash-layout .portal-dash-main > .portal-dash-heading {
    margin-top: 20px;
}

/* Four HR tiles a row from tablet width up; the five training tiles share a row only when
   there is room for them. */
@media (min-width: 768px) {
    .portal-dash-layout .portal-dash-tiles.portal-dash-tiles-hr {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
    .portal-dash-layout .portal-dash-tiles.portal-dash-tiles-training {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* --- The multi select (Task 4.3): a button that opens a list of tick boxes --- */
.portal-multi {
    display: inline-block;
    min-width: 0;
}

.portal-multi-button {
    width: 100%;
    min-width: 180px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-multi-menu {
    min-width: 100%;
    max-width: min(360px, calc(100vw - 32px));
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 0 0;
}

.portal-multi-item {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: normal;
    cursor: pointer;
}

.portal-multi-item .form-check-input {
    margin: 0;
    flex: 0 0 auto;
}

.portal-multi-item:active {
    color: inherit;
    background-color: var(--rainbow-blue-tint);
}

.portal-multi-foot {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background-color: #fff;
    border-top: 1px solid var(--portal-line);
}

.portal-form .portal-multi,
.portal-modal .portal-multi {
    display: block;
}

@media (max-width: 767.98px) {
    .portal-multi {
        display: block;
        width: 100%;
    }

    .portal-multi-button {
        font-size: 16px;
        min-height: 38px;
    }

    .portal-multi-item {
        min-height: 40px;
    }

    .portal-multi-item .form-check-input {
        width: 1.25em;
        height: 1.25em;
    }
}

/* Snag 30: Edit Role's Required Training table fits a phone, with Remove in view. */
@media (max-width: 767.98px) {
    .portal-requirements .table th,
    .portal-requirements .table td {
        white-space: normal;
    }

    .portal-requirements .table th:last-child {
        width: 72px !important;
    }
}

/* Task 4.5: a form with every field in one column, such as Add Training. */
/* A one-column add or edit form (Add / Edit Training). From a tablet up the labels sit to the left
   of the boxes, right aligned, and every box is the same width; the card is narrower so the form
   reads as one block (Leon, 14 November 2026). On a phone the labels sit above, as on every form. */
form.portal-form.portal-form-one {
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    body[class*="portal-layout-"] main > form.portal-form.portal-form-one {
        max-width: 760px;
    }

    form.portal-form.portal-form-one > .row {
        display: grid;
        grid-template-columns: 210px minmax(0, 1fr);
        column-gap: 16px;
        align-items: start;
    }

    form.portal-form.portal-form-one > .row > .col-form-label {
        grid-column: 1;
        white-space: normal;
        padding-top: 0.42rem;
        margin-bottom: 0;
        text-align: right !important;
        font-size: 0.85rem;
    }

    form.portal-form.portal-form-one > .row > [class*="col-"]:not(.col-form-label) {
        grid-column: 2;
    }

    form.portal-form.portal-form-one > .row > [class*="col-"]:empty {
        display: none;
    }
}

.portal-module-facts {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--portal-text-muted);
}

/* An expired date on the Training tab reads in red. */
.portal-date-expired,
.table td.portal-date-expired {
    /* Snag 43: the table rule is needed, as Bootstrap's own colour for table cells won over the plain class. */
    color: var(--rainbow-red);
    font-weight: 600;
}

/* Snag 57: on the record a switch beside its notes box (SENCO, keycarer, discount, sick pay)
   takes one width, so the notes boxes start on one line. On a phone the worked out boxes are
   full width like every other box. */
.portal-field-row-items > .portal-item-tick {
    flex: 0 0 200px;
}

@media (max-width: 767.98px) {
    .portal-record-body .portal-input-short {
        max-width: none;
    }
}

/* Snag 60: in a phone card a right aligned number reads from the left, like the other lines. */
@media (max-width: 767.98px) {
    .portal-card-table td[data-card="line"].text-end {
        text-align: left !important;
    }
}

/* Snag 56: page links under a long list (Configure, Training Modules) in the Rainbow blue, easy
   to tap on a phone. */
.pagination {
    --bs-pagination-color: var(--rainbow-blue);
    --bs-pagination-hover-color: var(--rainbow-blue-dark);
    --bs-pagination-focus-color: var(--rainbow-blue-dark);
    --bs-pagination-active-bg: var(--rainbow-blue);
    --bs-pagination-active-border-color: var(--rainbow-blue);
    flex-wrap: wrap;
}

@media (max-width: 767.98px) {
    .portal-pager-bar {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .pagination-sm .page-link {
        min-width: 38px;
        min-height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Snags 66 and 68: a list with too many columns for a tablet held upright (Training Modules,
   Current Childcare Staff) is marked portal-tablet-cards. From 768 to 1023 pixels its rows are
   cards, the same cards as on a phone: the name, then each column on its own labelled line, the
   card opening the record. From 1024 up it is a table. */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .portal-card-table.portal-tablet-cards thead {
        display: none;
    }

    .portal-card-table.portal-tablet-cards,
    .portal-card-table.portal-tablet-cards tbody {
        display: block;
        width: 100%;
    }

    .portal-card-table.portal-tablet-cards tbody tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        column-gap: 10px;
        row-gap: 6px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--portal-line);
    }

    .portal-card-table.portal-tablet-cards tbody td {
        display: block;
        border: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .portal-card-table.portal-tablet-cards td[data-card="date"] {
        grid-column: 1;
        grid-row: 1;
        font-weight: 600;
        white-space: nowrap;
    }

    .portal-card-table.portal-tablet-cards td[data-card="title"] {
        grid-column: 2;
        grid-row: 1;
        font-weight: 600;
    }

    .portal-card-table.portal-tablet-cards td[data-card="badge"] {
        grid-column: 3;
        grid-row: 1;
        text-align: right;
        font-weight: 600;
    }

    .portal-card-table.portal-tablet-cards td[data-card="wide"] {
        grid-column: 1 / -1;
    }

    .portal-card-table.portal-tablet-cards td[data-card="wide"]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        color: var(--portal-text-muted);
    }

    .portal-card-table.portal-tablet-cards td[data-card="line"].text-end {
        text-align: left !important;
    }

    .portal-card-table.portal-tablet-cards td[data-card="line"] {
        grid-column: 1 / -1;
    }

    .portal-card-table.portal-tablet-cards td[data-card="line"]::before {
        content: attr(data-label) ": ";
        font-size: 0.78rem;
        color: var(--portal-text-muted);
    }

    .portal-card-table.portal-tablet-cards td[data-card="line"]:empty,
    .portal-card-table.portal-tablet-cards td[data-card="actions"] {
        display: none;
    }

    .portal-card-table.portal-tablet-cards tbody td:not([data-card]) {
        grid-column: 1 / -1;
    }
}

/* Task 5.8: the wrapper around a report's three narrowing filters takes no space of its own, so
   the three lists sit in the filter bar as before. */
.portal-narrow-inline {
    display: contents;
}

/* Snag 69: Staff, Questionnaires keeps its select all tick above the cards on a phone, with its
   words; on a tablet and laptop only the tick shows in the header. */
.portal-tick-all-text {
    display: none;
}

@media (max-width: 767.98px) {
    .portal-card-table.portal-questionnaire-table thead {
        display: block;
    }

    .portal-card-table.portal-questionnaire-table thead tr {
        display: flex;
    }

    .portal-card-table.portal-questionnaire-table thead th {
        display: none;
    }

    .portal-card-table.portal-questionnaire-table thead th.portal-tick-cell {
        display: block;
        width: 100% !important;
    }

    .portal-card-table.portal-questionnaire-table thead th.portal-tick-cell .portal-row-tick {
        position: static;
        justify-content: flex-start;
        padding: 10px 12px;
    }

    .portal-questionnaire-table .portal-tick-all-text {
        display: inline;
        margin-left: 8px;
    }

    /* The tick in a card sits beside the name, easy to hit. */
    /* Snag 74: the tick sits level with the name on the card's first line, with no gap under it. */
    .portal-card-table.portal-questionnaire-table td.portal-tick-cell {
        min-height: 28px;
        min-width: 36px;
        align-self: start;
    }

    .portal-card-table.portal-questionnaire-table td.portal-tick-cell .portal-row-tick {
        inset: 0;
    }

    .portal-card-table.portal-questionnaire-table td[data-card="title"] {
        align-self: center;
    }

    /* A question's card: the medical sub tables inside it read as cards too, without a frame. */
    .portal-card-table .portal-medical-subtable tbody tr {
        padding: 6px 0;
    }
}

/* Snag 72: on the Employment tab, a refused holiday allowance's message ("Between 5.6 and 7.6
   weeks.") stays on one line under the Weeks box, and Weeks and Hours stay level at the top. */
.portal-holiday-row .portal-field-row-items {
    align-items: flex-start;
}

.portal-holiday-row .portal-field-row-items .text-danger {
    display: block;
    white-space: nowrap;
}

/* Snag 73: a table inside the staff record (the Training Plan steps) has the record's tab list
   beside it, so its room is narrower: marked portal-wide-cards, its rows are cards up to 1199
   pixels, as the Disciplinary tables are. From 1200 up it is a table. */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .portal-card-table.portal-wide-cards thead {
        display: none;
    }

    .portal-card-table.portal-wide-cards,
    .portal-card-table.portal-wide-cards tbody {
        display: block;
        width: 100%;
    }

    .portal-card-table.portal-wide-cards tbody tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        column-gap: 10px;
        row-gap: 6px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--portal-line);
    }

    .portal-card-table.portal-wide-cards tbody td {
        display: block;
        border: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .portal-card-table.portal-wide-cards td[data-card="date"] {
        grid-column: 1;
        grid-row: 1;
        font-weight: 600;
        white-space: nowrap;
    }

    .portal-card-table.portal-wide-cards td[data-card="title"] {
        grid-column: 2;
        grid-row: 1;
        font-weight: 600;
    }

    .portal-card-table.portal-wide-cards td[data-card="badge"] {
        grid-column: 3;
        grid-row: 1;
        text-align: right;
        font-weight: 600;
    }

    .portal-card-table.portal-wide-cards td[data-card="wide"] {
        grid-column: 1 / -1;
    }

    .portal-card-table.portal-wide-cards td[data-card="wide"]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        color: var(--portal-text-muted);
    }

    .portal-card-table.portal-wide-cards td[data-card="line"].text-end {
        text-align: left !important;
    }

    .portal-card-table.portal-wide-cards td[data-card="line"] {
        grid-column: 1 / -1;
    }

    .portal-card-table.portal-wide-cards td[data-card="line"]::before {
        content: attr(data-label) ": ";
        font-size: 0.78rem;
        color: var(--portal-text-muted);
    }

    .portal-card-table.portal-wide-cards td[data-card="line"]:empty,
    .portal-card-table.portal-wide-cards td[data-card="actions"] {
        display: none;
    }

    .portal-card-table.portal-wide-cards tbody td:not([data-card]) {
        grid-column: 1 / -1;
    }
}

/* Snag 84: on a phone every list's toolbar works the same way: the search and filters, then the
   export icons, then the main button (Add, Upload) on its own full width row, as on Group Emails
   and Training Modules. Tablets and laptops are unchanged. */
@media (max-width: 767.98px) {
    main form[method="get"] > .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 8px;
    }

    main form[method="get"] > .d-flex.justify-content-between > .d-flex:has(> .btn-primary) {
        width: 100%;
        flex-wrap: wrap;
    }

    main form[method="get"] > .d-flex.justify-content-between > .d-flex:has(> .btn-primary) > .btn-primary {
        flex: 1 1 100%;
        min-height: 38px;
    }
}

/* Snag 89: a card's first line is the date (when the row has one), the title and the badge. On a
   card with no date the empty first column still kept its gap, so the title sat 10 pixels further
   in than the labelled lines under it. With no date the title starts in the first column, so the
   card has one left edge. This only places the cell while the row is a card (phone, tablet and
   wide cards); as a table the rule has no effect. */
.portal-card-table tbody tr:not(:has(> td[data-card="date"])) > td[data-card="title"] {
    grid-column: 1 / 3;
}
