/* ===================================================================
   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;
    }
}

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;
}

.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. */
.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: 22px 24px;
    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-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.portal-record-head h5 {
    margin: 0;
    font-size: 1.2rem;
    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: 28px;
    row-gap: 16px;
}

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

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

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

.portal-field-label {
    display: block;
    margin-bottom: 5px;
    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: 38px;
}

.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 .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;
}

.portal-restricted {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 6px;
    background-color: var(--rainbow-grey-dark);
    color: var(--portal-text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: 1px;
}

.portal-savebar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 22px -24px -22px;
    padding: 12px 24px;
    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;
}

/* 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;
}

.portal-login {
    background-color: var(--rainbow-grey);
}

.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;
    --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(--portal-text-muted);
}

.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);
}

.portal-shell.portal-rail .portal-side-heading,
.portal-pre-collapsed .portal-layout-side .portal-side-heading {
    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;
}

@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;
}

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.2rem;
    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: 28px;
    row-gap: 16px;
    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: 5px;
    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;
}

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

form.portal-form > .row:has(button[type="submit"]) {
    grid-column: 1 / -1;
    padding-top: 12px;
    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: 12px 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 small laptop (992 to 1279 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. */
@media (min-width: 992px) and (max-width: 1279.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;
    }
}

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

    .portal-quick-top {
        width: 150px;
    }

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