/* ===================================================================
   JCS. Site stylesheet.

   The look comes from the JCS website: black, charcoal and silver, the
   name in an italic serif, and the black and white lion. The working
   screens stay clean: white cards on a warm off-white page and one
   bronze accent for buttons and links. The variable names still say
   navy and teal, from the template, so every rule follows the values.
   Every colour is a value on :root, so the Light and Dark looks at the
   end of this file are a change of values rather than a second
   stylesheet.

   The menu goes along the top or down the side, navy or white, set as
   a portal default under Configure > Layout. Each person can choose
   their own look, menu position and text size under My Account.
   =================================================================== */

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../lib/fonts/montserrat-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../lib/fonts/montserrat-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Cormorant Garamond, for the JCS name and the page titles. Open Font Licence, see
   lib/fonts/OFL.txt. Kept on the site, so nothing is loaded from Google. */
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: italic;
    font-weight: 300 700;
    font-display: swap;
    src: url('../lib/fonts/cormorant-garamond-italic-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('../lib/fonts/cormorant-garamond-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* JCS: charcoal and silver from the JCS website, bronze accent. */
:root {
    /* --- Charcoal, the brand colour. The bar, table headings and rail. --- */
    --portal-navy:          #1c1c1c;
    --portal-navy-mid:      #262626;
    --portal-navy-soft:     #333333;
    --portal-navy-ink:      #141414;

    /* --- The one accent, bronze. --- */
    --portal-teal:          #94744a;
    --portal-teal-deep:     #74593a;
    --portal-teal-bright:   #b08e5e;
    --portal-teal-glow:     #d4bc90;

    /* --- The silver of the website, for the name on the dark menu and the login panel. --- */
    --portal-silver:        #9a9a9a;

    /* --- Ink, lines and ground. --- */
    --portal-text:          #1f1f1f;
    --portal-text-muted:    #66625b;
    --portal-text-faint:    #9d9890;
    --portal-line:          #e5e1da;
    --portal-line-soft:     #efece6;
    --portal-surface:       #ffffff;
    --portal-canvas:        #f6f5f1;

    /* --- Soft tints for pills and notes. --- */
    --portal-tint-teal:     #f4eee5;
    --portal-tint-amber:    #fdf1e3;
    --portal-tint-violet:   #efecfb;
    --portal-tint-green:    #e7f5ec;
    --portal-tint-red:      #fdecec;
    --portal-tint-slate:    #eef1f5;

    --portal-amber:         #c46a1c;
    --portal-violet:        #6b5bc4;
    --portal-green:         #2f8a55;
    --portal-slate:         #6b7686;
    --portal-danger:        #c9302c;

    /* --- Shape and depth. --- */
    --portal-radius:        10px;
    --portal-radius-sm:     6px;
    --portal-radius-pill:   999px;
    --portal-shadow:        0 1px 2px rgba(28, 28, 28, 0.05), 0 4px 16px rgba(28, 28, 28, 0.07);
    --portal-shadow-hover:  0 2px 4px rgba(28, 28, 28, 0.06), 0 12px 28px rgba(28, 28, 28, 0.13);
    --portal-shadow-lg:     0 18px 50px rgba(28, 28, 28, 0.22);

    /* --- Headings and the words that act as headings. Charcoal, and white in Dark. --- */
    --portal-heading:       var(--portal-navy);

    /* --- Type. --- */
    --portal-font-head:     'Montserrat', 'Segoe UI', Helvetica, Arial, sans-serif;
    --portal-font-body:     'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    --portal-font-brand:    'Cormorant Garamond', Georgia, 'Times New Roman', serif;

    /* --- Short names for the same values, used by a few rules below. --- */
    --accent:           var(--portal-teal);
    --accent-dark:      var(--portal-teal-deep);
    --accent-bright:    var(--portal-teal-glow);
    --accent-soft:      var(--portal-tint-teal);
    --navy:             var(--portal-navy);
    --navy-soft:        var(--portal-navy-soft);
    --ink:              var(--portal-text);
    --ink-soft:         var(--portal-text-muted);
    --ink-faint:        var(--portal-text-faint);
    --line:             var(--portal-line);
    --page:             var(--portal-canvas);

    /* --- Bootstrap follows the theme. --- */
    --bs-body-bg:       var(--portal-canvas);
    --bs-body-color:    var(--portal-text);
    --bs-border-color:  var(--portal-line);
    --bs-primary:       var(--portal-teal);
    --bs-link-color:    var(--portal-teal);
}

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

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

body {
    margin-bottom: 64px;
    font-family: var(--portal-font-body);
    background-color: var(--portal-canvas);
    color: var(--portal-text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--portal-teal);
}

a:hover {
    color: var(--portal-teal-deep);
}

/* --- The bar --- */
/* Charcoal with a faint lift towards the right, like the dark panel on the JCS website. */
.navbar-portal {
    background: linear-gradient(100deg, var(--portal-navy) 0%, var(--portal-navy-mid) 100%);
    padding-top: 0;
    padding-bottom: 0;
    min-height: 58px;
    box-shadow: 0 2px 14px rgba(28, 28, 28, 0.18);
}

.navbar-portal-brand {
    color: #ffffff !important;
    font-family: var(--portal-font-head);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding: 12px 20px 12px 0;
}

.navbar-portal-brand:hover {
    color: var(--portal-teal-glow) !important;
}

.navbar-portal-link {
    color: rgba(255, 255, 255, 0.78) !important;
    font-family: var(--portal-font-head);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 20px 14px !important;
    white-space: nowrap;
    position: relative;
}

.navbar-portal-link:hover,
.navbar-portal-link:focus {
    color: #ffffff !important;
}

/* A bronze rule under the link pointed at, rather than a filled box. */
.navbar-portal-link::before {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 12px;
    height: 2px;
    border-radius: 2px;
    background: var(--portal-teal-glow);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.navbar-portal-link:hover::before,
.navbar-portal-link:focus::before {
    transform: scaleX(1);
}

.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.8%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(--portal-navy);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--portal-radius-sm);
    box-shadow: var(--portal-shadow-lg);
    min-width: 190px;
    padding: 6px 0;
    margin-top: 0 !important;
}

.navbar-portal-dropdown-item {
    color: rgba(255, 255, 255, 0.82) !important;
    font-size: 0.85rem;
    padding: 9px 18px;
}

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

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

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

/* --- Headings --- */
/* The page heading is in the JCS serif, upright, large enough to anchor the page. */
h4 {
    font-family: var(--portal-font-brand);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.15;
    color: var(--portal-heading);
    margin-bottom: 0.5rem;
}

h5 {
    font-family: var(--portal-font-head);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--portal-heading);
}

h6 {
    font-family: var(--portal-font-head);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--portal-heading);
}

/* Under the page heading, a short bronze rule rather than a line across the page. Only the
   rule straight after a page heading gets this. A rule used anywhere else to divide one
   part of a page from the next stays a plain, faint line. */
main hr {
    border: 0;
    border-top: 1px solid var(--portal-line);
    opacity: 1;
    margin: 1.4rem 0;
}

main h4 + hr {
    border-top: 0;
    height: 2px;
    width: 44px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--portal-teal-bright), var(--portal-teal-glow));
    margin: 0 0 1.6rem 0;
}

/* A small spaced label above a heading, as the reference sites do. */
.portal-eyebrow {
    display: block;
    font-family: var(--portal-font-head);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--portal-teal);
    margin-bottom: 4px;
}

/* --- Focus --- */
.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--portal-teal-bright);
    box-shadow: 0 0 0 0.2rem rgba(176, 142, 94, 0.18);
    outline: none;
}

/* --- Buttons --- */
/* One primary button per page, bronze with white words, lifting a little when pointed at.
   Every other button is white with a charcoal line. */
.btn {
    border-radius: var(--portal-radius-sm);
    font-weight: 600;
    transition: all 0.18s ease;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 7px 15px;
}

.btn-primary {
    color: #ffffff;
    background: var(--portal-teal);
    border: 1px solid var(--portal-teal);
    box-shadow: 0 2px 8px rgba(148, 116, 74, 0.28);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    color: #ffffff;
    background: var(--portal-teal-deep);
    border-color: var(--portal-teal-deep);
    box-shadow: 0 4px 14px rgba(148, 116, 74, 0.36);
    transform: translateY(-1px);
}

.btn-secondary {
    color: var(--portal-navy);
    background: var(--portal-surface);
    border: 1px solid var(--portal-navy);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
    color: var(--portal-navy);
    background: var(--portal-tint-teal);
    border-color: var(--portal-navy);
}

.btn-danger {
    color: #ffffff;
    background: var(--portal-danger);
    border: 1px solid var(--portal-danger);
}

.btn-danger:hover,
.btn-danger:focus {
    color: #ffffff;
    background: #a52622;
    border-color: #a52622;
}

/* --- Form controls --- */
.form-control,
.form-select {
    border-color: var(--portal-line);
    border-radius: var(--portal-radius-sm);
    font-size: 0.875rem;
    color: var(--portal-text);
    background-color: var(--portal-surface);
}

.form-label,
.col-form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--portal-text);
}

/* The words beside a tick box or a round choice are the same size as the other labels. */
.form-check-label {
    font-size: 0.875rem;
}

/* An empty tick box has a clear edge, so it can be seen on the off-white page. */
.form-check-input {
    border-color: var(--portal-text-faint);
}

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

.form-text {
    color: var(--portal-text-muted);
    font-size: 0.78rem;
}

.text-danger {
    color: var(--portal-danger) !important;
    font-size: 0.8rem;
}

/* A box with a message under it is outlined in red, on every form. */
.form-control.input-validation-error,
.form-select.input-validation-error {
    border-color: var(--portal-danger);
}

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

/* --- Cards --- */
/* A white card that sits on the page with a soft shadow and no border. The heading is
   small, bold and spaced, with a short bronze bar in front of it. */
.portal-card,
.card {
    background: var(--portal-surface);
    border: none;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
}

.portal-card {
    padding: 24px;
    margin-bottom: 16px;
}

.portal-card-heading {
    font-family: var(--portal-font-head);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--portal-heading);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--portal-line);
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-card-heading::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, var(--portal-teal-glow), var(--portal-teal));
    border-radius: var(--portal-radius-pill);
    flex-shrink: 0;
}

/* One field: label, box, message, then any help line. */
.portal-field {
    margin-bottom: 16px;
}

.portal-field > .form-label {
    margin-bottom: 5px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--portal-text-muted);
}

.portal-field .form-text {
    margin-top: 5px;
}

/* The bar under the cards with Save and Cancel on the left and Delete on the right. */
.portal-form-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 16px;
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
}

/* A line of plain fact inside a card: a muted label on the left, the value on the right. */
.portal-rows {
    margin: 0;
}

.portal-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--portal-line-soft);
    font-size: 0.875rem;
}

.portal-row:last-child {
    border-bottom: none;
}

.portal-row-label {
    color: var(--portal-text-muted);
    font-size: 0.8rem;
    flex: 0 0 auto;
}

.portal-row-value {
    font-weight: 600;
    color: var(--portal-text);
    text-align: right;
    overflow-wrap: anywhere;
}

.portal-row-value.is-empty {
    color: var(--portal-text-faint);
    font-weight: 400;
}

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


/* Status as a coloured dot and its name. */
.portal-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--portal-font-head);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--portal-text);
    white-space: nowrap;
}

.portal-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--portal-slate);
    flex-shrink: 0;
}


/* A status as a small coloured pill: green, amber, slate or red, from the tints on :root. */
.portal-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: var(--portal-radius-pill);
    font-family: var(--portal-font-head);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    line-height: 1.6;
}

.portal-pill.is-green { background: var(--portal-tint-green); color: var(--portal-green); }
.portal-pill.is-amber { background: var(--portal-tint-amber); color: var(--portal-amber); }
.portal-pill.is-slate { background: var(--portal-tint-slate); color: var(--portal-slate); }
.portal-pill.is-red   { background: var(--portal-tint-red);   color: var(--portal-danger); }

/* Active and inactive on a list, as a dot and a word. */
.portal-status.is-active::before   { background: var(--portal-green); box-shadow: 0 0 0 3px rgba(47, 138, 85, 0.16); }
.portal-status.is-inactive::before { background: var(--portal-text-faint); }
.portal-status.is-inactive         { color: var(--portal-text-muted); }

/* A dot after a label on a phone card, for example "Plains game" on Lists > Species. */
.booking-card-line .portal-status { margin-left: 8px; }

/* --- Tables --- */
/* A table never scrolls sideways. It takes the width of the page and fits its columns
   to it, cutting a long value with dots instead of pushing the table wider. */
.table-wrapper,
.table-responsive {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
}

.table {
    font-size: 0.85rem;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
    width: 100%;
}

.table.table-fit {
    table-layout: fixed;
}

/* The heading stays at the top of the window while you scroll the page, and the table
   has no scrolling box of its own. */
.table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    /* One flat colour, so the heading reads as one bar with no seam between columns. */
    background: var(--portal-navy);
    color: #ffffff;
    font-family: var(--portal-font-head);
    font-weight: 700;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: none;
    padding: 11px 12px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table thead tr:first-child th:first-child { border-top-left-radius: var(--portal-radius); }
.table thead tr:first-child th:last-child  { border-top-right-radius: var(--portal-radius); }

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

.table tbody td {
    padding: 8px 12px;
    vertical-align: middle;
    border-top: 1px solid var(--portal-line-soft);
    border-bottom: none;
    color: var(--portal-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--portal-surface);
}

.table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--portal-radius); }
.table tbody tr:last-child td:last-child  { border-bottom-right-radius: var(--portal-radius); }

.table tbody td.cell-clip {
    max-width: 220px;
}

.table tbody td.cell-wrap {
    white-space: normal;
}

/* Words in a cell that has no value yet, such as No dates yet. */
.cell-empty {
    color: var(--portal-text-muted);
}

/* A dropdown still on its first choice, such as Choose a PH, shows it in grey. The list
   itself keeps the normal colour. */
.form-select:has(option.select-placeholder:checked) {
    color: var(--portal-text-muted);
}

.form-select option {
    color: var(--portal-text);
}

/* Figures line up down the column. */
.table td.cell-num,
.table th.cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}


/* The Configure lists are plain: the name is in the normal weight and colour, and Active
   or Inactive is not in bold either. */
.table td.cell-name { color: var(--portal-text); }
.config-table .portal-status { font-weight: 500; }

.table-striped > tbody > tr:nth-of-type(odd) > *,
.table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: var(--portal-surface);
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--portal-tint-teal) !important;
    color: var(--portal-text);
}

/* A row you can open. The whole row is the target, so it says so when you point at it. */
.table tbody tr.is-openable {
    cursor: pointer;
}

.table tbody tr.is-openable:hover > td {
    background-color: var(--portal-tint-teal) !important;
}

.table tbody tr.is-openable:hover > td:first-child {
    box-shadow: inset 3px 0 0 var(--portal-teal-bright);
}

.table tbody tr.is-openable:focus-visible > td {
    background-color: var(--portal-tint-teal) !important;
    outline: none;
}

/* --- Sorting --- */
.table.sortable thead th {
    cursor: pointer;
    user-select: none;
    padding-right: 24px;
}

.table.sortable thead th:hover {
    background: var(--portal-navy-soft);
}

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

.sortable th.sort-asc::after {
    content: '\2191';
    opacity: 1;
    color: var(--portal-teal-glow);
}

.sortable th.sort-desc::after {
    content: '\2193';
    opacity: 1;
    color: var(--portal-teal-glow);
}

.table.sortable thead th.no-sort {
    cursor: default;
    padding-right: 12px;
}

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

/* --- Row actions --- */
.table-action-link {
    color: var(--portal-teal);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.8rem;
    white-space: nowrap;
}

.table-action-link:hover {
    color: var(--portal-teal-deep);
    text-decoration: underline;
}

.table-action-delete {
    color: var(--portal-danger);
}

.table-action-delete:hover {
    color: #a52622;
}

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

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

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

.box-shadow {
    box-shadow: var(--portal-shadow);
}

.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    white-space: nowrap;
    line-height: 64px;
    font-size: 0.78rem;
    color: var(--portal-text-faint);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    color: #ffffff;
    background-color: var(--portal-teal);
}

.alert {
    font-size: 0.9rem;
    border-radius: var(--portal-radius-sm);
}

.login-container {
    max-width: 400px;
    margin: 0 auto;
}

/* --- Modals --- */
.modal-content {
    border: none;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow-lg);
}

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

.modal-title {
    font-family: var(--portal-font-head);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--portal-heading);
}

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

/* A window whose form holds the header, the fields and the buttons: the form takes part in
   the window's layout, so on a short screen the fields scroll and the buttons stay on the
   screen. Used by Add Payment, New Client and Upload Signed Contract. */
.modal-dialog-scrollable .modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.modal-dialog-scrollable .modal-content > form > .modal-body {
    overflow-y: auto;
    min-height: 0;
}


/* The PDF window: the PDF fills the window, with Download and Close always in reach. On a
   short screen, such as a phone held sideways, the window keeps its buttons on the screen. */
.portal-pdf-dialog .modal-content {
    height: calc(100vh - 3.5rem);
}

.portal-pdf-body {
    flex: 1 1 auto;
    min-height: 0;
    background: var(--portal-tint-slate);
}

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

.portal-pdf-fallback {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    color: var(--portal-text-muted);
}

.portal-pdf-fallback p {
    margin: 0 0 6px 0;
}

.portal-pdf-fallback.d-none {
    display: none !important;
}

@media (max-width: 575.98px) {
    .portal-pdf-dialog {
        margin: 0.5rem;
    }

    .portal-pdf-dialog .modal-content {
        height: calc(100vh - 1rem);
    }

    .portal-pdf-dialog .modal-footer .btn {
        flex: 1 1 0;
        min-height: 38px;
    }
}

/* A message about the whole record sits in the column of the boxes, as a line, not a list. */
.validation-summary-errors ul {
    list-style: none;
    padding-left: 0;
    margin: 0 0 0.75rem 0;
}

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

/* Save and Cancel under a form. On a phone they share the row, each easy to tap. */
.portal-form-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 575.98px) {
    .portal-form-buttons .btn {
        flex: 1 1 0;
        min-height: 38px;
    }

    /* In the bar under a long form (the booking form), Save and Cancel take the full width,
       as on the other forms. */
    .portal-form-actions .portal-form-buttons {
        flex: 1 1 100%;
    }
}

/* A list row opens its record on a click anywhere in the row: a pointer, and the row tint. */
.table tbody tr[data-href] {
    cursor: pointer;
}

.table tbody tr[data-href]:hover > td {
    background-color: var(--portal-tint-teal) !important;
}

/* ===================================================================
   Bookings. The list is a table on a tablet or desktop and a card per
   booking on a phone. The form is a set of white cards.
   =================================================================== */
.booking-cards {
    display: none;
}

/* A list that shows as cards on a phone: the table is hidden there, and the cards shown. */
.phone-cards {
    display: none;
}

@media (max-width: 767.98px) {
    .phone-hide {
        display: none;
    }

    .phone-cards {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
}

.booking-card-line {
    font-size: 0.82rem;
    color: var(--portal-text-muted);
    overflow-wrap: anywhere;
}

.booking-card-count {
    font-size: 0.75rem;
    color: var(--portal-text-muted);
    white-space: nowrap;
}

/* Nine columns need room: below about 1100 pixels the table scrolls in its box. The rule
   names table-fit so the general 720 pixel minimum for small screens does not win. */
.booking-table .table,
.booking-table .table.table-fit {
    min-width: 1080px;
}

@media (max-width: 767.98px) {
    .booking-table {
        display: none;
    }

    .booking-cards {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
}

.booking-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    color: var(--portal-text);
    text-decoration: none;
}

.booking-card:hover,
.booking-card:focus-visible {
    color: var(--portal-text);
    background: var(--portal-tint-teal);
}

.booking-card-top,
.booking-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.booking-card-dates {
    font-weight: 700;
}

.booking-card-camp {
    font-family: var(--portal-font-head);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 1px 8px;
    border-radius: var(--portal-radius-pill);
    background: var(--portal-navy);
    color: #ffffff;
}

.booking-card-hunters {
    font-size: 0.9rem;
}

.booking-card-species {
    font-size: 0.82rem;
    color: var(--portal-text-muted);
}

/* The booking form: one card per part, with its rows under a small heading. */
.booking-form .portal-card {
    padding: 18px 20px;
}

.booking-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.booking-row {
    display: grid;
    gap: 8px;
    align-items: center;
}

.booking-row.is-hunter   { grid-template-columns: minmax(0, 1fr) auto auto; }
.booking-row.is-observer { grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) auto; }
.booking-row.is-ph       { grid-template-columns: minmax(0, 1fr) auto; }
.booking-row.is-species  { grid-template-columns: minmax(0, 1fr) 120px auto auto; }

/* The booking's place in the species' queue, beside the quantity. */
.booking-place {
    font-size: 0.8rem;
    color: var(--portal-text-muted);
    white-space: nowrap;
}
.booking-row.is-extra    { grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr) auto; }

/* A quantity box with a small Qty in front of it. */
.booking-qty {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.booking-qty span {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--portal-text-muted);
}

.booking-qty .form-control {
    min-width: 0;
}

.booking-row .form-check {
    margin: 0;
    white-space: nowrap;
}

.booking-add {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

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

/* On a phone each row becomes a small card of its own, its boxes one under the other. */
@media (max-width: 767.98px) {
    .booking-row,
    .booking-row.is-hunter,
    .booking-row.is-observer,
    .booking-row.is-ph,
    .booking-row.is-species,
    .booking-row.is-extra {
        grid-template-columns: 1fr;
        padding: 10px;
        border: 1px solid var(--portal-line);
        border-radius: var(--portal-radius-sm);
    }

    .booking-row .table-action-link {
        justify-self: end;
    }

    /* A PH row is one line: the PH and Remove. A hunter row is the name and Remove, with
       Main hunter under the name on the left. */
    .booking-row.is-ph {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .booking-row.is-hunter {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name remove"
            "main main";
        row-gap: 6px;
    }

    .booking-row.is-hunter > .typeahead       { grid-area: name; }
    .booking-row.is-hunter > .form-check      { grid-area: main; }
    .booking-row.is-hunter > .table-action-link { grid-area: remove; }

    /* A species row is one line: the species, the quantity and Remove. An extra row is the
       extra, then the quantity, the notes and Remove on the line under it. */
    .booking-row.is-species {
        grid-template-columns: minmax(0, 1fr) 96px auto;
    }

    /* On a phone the place sits on its own line under the species. */
    .booking-row.is-species .booking-place {
        grid-column: 1 / -1;
        order: 5;
    }

    .booking-row.is-species .booking-place:empty {
        display: none;
    }

    .booking-row.is-extra {
        grid-template-columns: 96px minmax(0, 1fr) auto;
    }

    .booking-row.is-extra > select {
        grid-column: 1 / -1;
    }

    .booking-row .table-action-link {
        align-self: center;
    }

    /* Delete sits on its own line under the buttons, away from Save. */
    .portal-form-actions .portal-form-delete {
        width: 100%;
        padding-top: 12px;
        border-top: 1px solid var(--portal-line);
    }
}

/* The hunt year on a booking with an arrival date follows the arrival and cannot be picked. */
.form-select.is-locked {
    pointer-events: none;
    background-color: var(--portal-tint-slate);
    color: var(--portal-text-muted);
}

/* The type-ahead list under a hunter's name box. */
.typeahead {
    position: relative;
}

.typeahead-list {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 30;
    margin: 2px 0 0 0;
    padding: 4px;
    list-style: none;
    background: var(--portal-surface);
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius-sm);
    box-shadow: var(--portal-shadow-lg);
    max-height: 240px;
    overflow-y: auto;
}

.typeahead-list li {
    padding: 7px 10px;
    border-radius: var(--portal-radius-sm);
    cursor: pointer;
}

.typeahead-list li:hover,
.typeahead-list li.is-current {
    background: var(--portal-tint-teal);
}

.typeahead-list small {
    color: var(--portal-text-muted);
    margin-left: 6px;
}

/* ===================================================================
   The quota. Plains game codes are green, as on the booking sheet. Left
   shows amber at 0 and red, with Over, below 0.
   =================================================================== */
.species-code {
    font-weight: 700;
}

.species-code.is-plains {
    display: inline-block;
    padding: 0 6px;
    border-radius: var(--portal-radius-sm);
    background: var(--portal-tint-green);
    color: var(--portal-green);
}

.quota-left {
    font-weight: 700;
}

.quota-left.is-none {
    color: var(--portal-amber);
}

.quota-left.is-over {
    color: var(--portal-danger);
}

.quota-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.quota-input {
    max-width: 110px;
    margin-left: auto;
    text-align: right;
}

.quota-table {
    max-width: 760px;
}

/* A species row opens its queue on a click: a pointer, and the row tint. */
.quota-table tbody tr.quota-row {
    cursor: pointer;
}

.quota-table tbody tr.quota-row:hover > td {
    background-color: var(--portal-tint-teal);
}

/* The queue window: places after the quota are red with Over. */
.queue-over td,
.booking-card.queue-over .booking-card-dates,
.queue-over-word {
    color: var(--portal-danger);
}

.queue-over-word {
    font-weight: 700;
}

.queue-note {
    margin: 12px 0 0;
    font-size: 0.85rem;
    color: var(--portal-text-muted);
}

/* The Waiting list heading under the queue, in the style of a card heading. */
.queue-heading {
    font-family: var(--portal-font-head);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--portal-heading);
    margin: 24px 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--portal-line);
}

/* A hint under a card on the booking form, for example on a waiting list with no species. */
.booking-hint {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--portal-text-muted);
}

/* The toolbar is as wide as the quota table, so Save sits above the table's right edge. */
.quota-toolbar {
    max-width: 760px;
}

/* On a phone the five columns stay, narrow, and the quota box fills its cell. */
@media (max-width: 767.98px) {
    .quota-table .table th,
    .quota-table .table td {
        padding-left: 6px;
        padding-right: 6px;
    }

    .quota-table .table thead th.cell-num {
        padding-right: 6px;
    }

    .quota-input {
        max-width: none;
        width: 100%;
        min-width: 56px;
    }
}

/* ===================================================================
   The Booking Sheet. A white card per month with a grid: the camp column,
   then two grid columns per day, so a hunt can run from the middle of its
   arrival day to the middle of its departure day. From 1366 pixels a whole
   month fits; below that the grid scrolls in its card and the camp column
   stays where it is. On a phone there is no grid: a list of cards.
   =================================================================== */
.portal-wide {
    max-width: 1720px;
    padding-left: 24px;
    padding-right: 24px;
}

:root {
    --sheet-label: 46px;
    --sheet-half: 16px;
}

/* The quota tiles. They wrap on a desktop and scroll sideways in one row on a phone. */
.sheet-quota {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.sheet-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.sheet-tile {
    min-width: 86px;
    padding: 8px 10px;
    background: var(--portal-surface);
    border-radius: var(--portal-radius-sm);
    box-shadow: var(--portal-shadow);
    line-height: 1.2;
}

.sheet-tile-code {
    font-family: var(--portal-font-head);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--portal-heading);
}

.sheet-tile-code.is-plains {
    color: var(--portal-green);
}

.sheet-tile-left {
    font-weight: 700;
    font-size: 0.85rem;
}

.sheet-tile.is-none .sheet-tile-left { color: var(--portal-amber); }
.sheet-tile.is-over .sheet-tile-left { color: var(--portal-danger); }

.sheet-tile-small {
    font-size: 0.7rem;
    color: var(--portal-text-muted);
    white-space: nowrap;
}

/* The months, with No Dates Yet and the Waiting List after December, or beside the months
   on a wide screen. */
.sheet-layout {
    display: block;
}

.sheet-side {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0 16px;
}

@media (min-width: 1700px) {
    .sheet-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 16px;
        align-items: start;
    }

    .sheet-side {
        display: block;
        position: sticky;
        top: 16px;
    }
}

.sheet-month {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    padding: 12px;
    margin-bottom: 16px;
}

.sheet-month-head {
    font-family: var(--portal-font-head);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--portal-heading);
    padding: 2px 2px 10px;
}

.sheet-scroll {
    overflow-x: auto;
}

.sheet-grid {
    display: grid;
    min-width: calc(var(--sheet-label) + 62 * var(--sheet-half));
    position: relative;
}

/* The camp column stays in place while the days scroll. */
.sheet-corner,
.sheet-label {
    position: sticky;
    left: 0;
    z-index: 4;
    background: var(--portal-surface);
}

.sheet-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--portal-font-head);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--portal-heading);
    border-top: 1px solid var(--portal-line);
    border-right: 1px solid var(--portal-line);
}

.sheet-label.is-shows {
    font-size: 0.56rem;
    font-weight: 600;
    color: var(--portal-text-muted);
    border-top: none;
}

.sheet-dayhead {
    text-align: center;
    font-size: 0.62rem;
    line-height: 1.15;
    color: var(--portal-text-muted);
    padding: 2px 0 4px;
    border-bottom: 3px solid transparent;
}

.sheet-dayhead b {
    display: block;
    font-size: 0.74rem;
    color: var(--portal-text);
}

.sheet-dayhead.is-weekend,
.sheet-cell.is-weekend {
    background: var(--portal-tint-slate);
}

.sheet-dayhead.is-today {
    border-bottom-color: var(--portal-teal);
}

.sheet-band {
    height: 20px;
}

.sheet-cell {
    display: block;
    min-height: 46px;
    border-top: 1px solid var(--portal-line);
    border-left: 1px solid var(--portal-line-soft);
}

.sheet-cell:hover {
    background: var(--portal-tint-teal);
}

/* A hunt. Confirmed: the bronze tint with a bronze edge. Provisional: a dashed amber line
   and the words To confirm. */
.sheet-bar {
    z-index: 2;
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 5px 1px;
    padding: 2px 6px;
    border-radius: var(--portal-radius-sm);
    font-size: 0.7rem;
    line-height: 1.2;
    color: var(--portal-text);
    text-decoration: none;
    overflow: hidden;
    position: relative;
}

.sheet-bar:hover,
.sheet-bar:focus-visible {
    color: var(--portal-text);
    box-shadow: var(--portal-shadow-hover);
}

.sheet-bar.is-confirmed {
    background: var(--portal-tint-teal);
    border-left: 3px solid var(--portal-teal);
}

.sheet-bar.is-provisional {
    background: var(--portal-surface);
    border: 1.5px dashed var(--portal-amber);
}

.sheet-bar-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.sheet-bar.continues-before {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding-left: 12px;
}

.sheet-bar.continues-after {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding-right: 12px;
}

/* A small arrow at the edge where a hunt or show carries on into the next or last month. */
.sheet-bar.continues-before::before,
.sheet-bar.continues-after::after,
.sheet-show.continues-before::before,
.sheet-show.continues-after::after {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    color: var(--portal-teal);
}

.sheet-bar.continues-before::before,
.sheet-show.continues-before::before {
    content: "\25C0";
    left: 2px;
}

.sheet-bar.continues-after::after,
.sheet-show.continues-after::after {
    content: "\25B6";
    right: 2px;
}

.sheet-hunters {
    font-weight: 700;
}

.sheet-confirm {
    font-weight: 700;
    color: var(--portal-amber);
    margin-right: 4px;
}

.sheet-code {
    display: inline-block;
    margin-left: 4px;
    font-weight: 700;
}

.sheet-code.is-plains {
    padding: 0 4px;
    border-radius: 3px;
    background: var(--portal-tint-green);
    color: var(--portal-green);
}

.sheet-ph,
.sheet-invoice {
    margin-left: 6px;
    color: var(--portal-text-muted);
}

.sheet-show {
    z-index: 2;
    margin: 2px 1px;
    padding: 0 6px;
    height: 16px;
    border-radius: var(--portal-radius-pill);
    background: var(--portal-tint-amber);
    color: var(--portal-amber);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    position: relative;
}

/* The name of a short show runs on to the right, as it does on the paper sheet. */
.sheet-show {
    justify-self: start;
    min-width: calc(100% - 2px);
    width: max-content;
    max-width: 180px;
}

.sheet-show:hover {
    color: var(--portal-amber);
    box-shadow: var(--portal-shadow);
}

/* The box of detail beside a hunt. */
.sheet-tip {
    position: fixed;
    z-index: 1300;
    display: none;
    flex-direction: column;
    gap: 2px;
    max-width: 320px;
    padding: 10px 12px;
    background: var(--portal-surface);
    color: var(--portal-text);
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius-sm);
    box-shadow: var(--portal-shadow-lg);
    font-size: 0.8rem;
}

.sheet-tip.show {
    display: flex;
}

/* No Dates Yet and the Waiting List. */
.sheet-side-list {
    display: flex;
    flex-direction: column;
}

.sheet-side-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 6px;
    border-top: 1px solid var(--portal-line-soft);
    color: var(--portal-text);
    text-decoration: none;
    font-size: 0.85rem;
}

.sheet-side-item:hover {
    background: var(--portal-tint-teal);
    color: var(--portal-text);
}

.sheet-side-item .sheet-code:first-child {
    margin-left: 0;
}

.sheet-side-item small {
    color: var(--portal-text-muted);
}

.sheet-list,
.sheet-list-empty {
    font-size: 0.85rem;
}

.sheet-list {
    display: none;
}

.sheet-list-empty {
    color: var(--portal-text-muted);
    padding: 4px 2px;
}

@media (max-width: 767.98px) {
    .portal-wide {
        padding-left: 12px;
        padding-right: 12px;
    }

    .sheet-quota {
        align-items: flex-start;
    }

    .sheet-tiles {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .sheet-tile {
        flex: 0 0 auto;
    }

    .sheet-scroll {
        display: none;
    }

    .sheet-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .sheet-list .booking-card {
        box-shadow: none;
        border: 1px solid var(--portal-line);
    }

    .sheet-month {
        padding: 10px;
    }
}

/* A row action that changes data is a posted button, not a link. It is made to look
   exactly like the text links beside it so the row still reads as one line of actions. */
.table-action-button {
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent);
    font-size: 0.78rem;
    white-space: nowrap;
    cursor: pointer;
}

.table-action-button:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

.table-action-button.table-action-delete {
    color: #c9302c;
}


/* ===================================================================
   Layout, set under Configure, Layout: the menu dark or light, along
   the top or down the side. The body carries portal-menu-dark or
   portal-menu-light, and portal-layout-top or portal-layout-side.
   =================================================================== */

:root {
    --portal-side-w: 236px;
    --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 dark words. */
.navbar-portal.navbar-portal-light {
    background: #ffffff;
    box-shadow: 0 1px 0 var(--portal-line), 0 4px 18px rgba(28, 28, 28, 0.09);
}

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

.navbar-portal-light .navbar-portal-link:hover,
.navbar-portal-light .navbar-portal-link:focus {
    color: var(--portal-navy) !important;
}

.navbar-portal-light .navbar-portal-link::before {
    background: var(--portal-teal);
}

.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%2828, 28, 28, 0.8%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);
}

.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 {
    color: var(--portal-teal-deep) !important;
    background-color: var(--portal-tint-teal);
}

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

/* --- Side Layout, the frame --- */
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;
    margin-left: var(--portal-side-w);
    position: relative;
    min-height: 100vh;
    padding-top: 1.5rem;
    padding-bottom: 64px;
    transition: margin-left 0.2s ease;
}

/* --- The side menu, Dark Mode first --- */
.portal-sidebar {
    width: var(--portal-side-w);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background: linear-gradient(170deg, var(--portal-navy) 0%, var(--portal-navy-mid) 100%);
    box-shadow: 2px 0 14px rgba(28, 28, 28, 0.18);
    /* Visible, so the Configure and name menus can open out of the foot. The list of
       items scrolls on its own. */
    overflow: visible;
    transition: width 0.2s ease;
}

.portal-side-brand-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 64px;
    padding: 12px 12px 12px 16px;
    flex-shrink: 0;
    position: relative;
}

.portal-side-brand-row::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--portal-teal-glow), transparent);
    opacity: 0.55;
}

.portal-side-brand {
    flex: 1;
    min-width: 0;
    padding: 0;
    text-decoration: none;
}

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

.portal-rail-toggle {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: var(--portal-radius-sm);
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    transition: background 0.15s ease, color 0.15s ease;
}

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

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

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

.portal-side-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 10px;
    margin-bottom: 2px;
    border: none;
    border-radius: var(--portal-radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--portal-font-head);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

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

/* On charcoal the page in use turns white, as it does in the Daveng portal. */
.portal-side-item.active,
.portal-side-item.active:hover {
    background: #ffffff;
    color: var(--portal-navy);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.portal-side-item.active .portal-side-icon {
    color: var(--portal-teal);
    opacity: 1;
}

.portal-side-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    opacity: 0.85;
}

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

.portal-side-caret {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform 0.18s ease;
}

[aria-expanded="true"] > .portal-side-caret {
    transform: rotate(180deg);
}

/* A group such as Reports, and the entries under it, one step in. */
.portal-side-group.is-current {
    color: #ffffff;
}

.portal-menu-light .portal-side-group.is-current {
    color: var(--portal-navy);
}

.portal-side-sub {
    padding-left: 18px;
    font-size: 0.68rem;
    letter-spacing: 0.07em;
}

.portal-shell.portal-rail .portal-side-sub,
.portal-pre-collapsed .portal-side-sub {
    padding-left: 0;
}

/* The entries under Lists in the side menu: a small letter in place of an icon, so they can
   still be told apart when the menu is folded to its icons. */
.portal-side-dot {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0;
    opacity: 0.8;
}

.portal-side-foot {
    flex-shrink: 0;
    padding: 8px 10px 12px;
}

.portal-side-configure {
    margin-bottom: 8px;
}

.portal-side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 8px;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    text-align: left;
    white-space: nowrap;
    transition: background 0.15s ease;
}

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

.portal-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--portal-teal-bright), var(--portal-navy-soft));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--portal-font-head);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.portal-side-user-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.portal-side-user-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-side-user-role {
    display: block;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.65);
}

/* The menus that open upward out of the foot. .portal-side-dropup has no rule of its own on
   purpose: Bootstrap keeps it position: relative, so each menu opens against its button.
   Made static, the menus would open off the top of the window, because the sidebar is fixed. */
.portal-side-menu {
    min-width: 220px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow-lg);
    padding: 8px;
}

.portal-side-menu-head {
    font-family: var(--portal-font-head);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--portal-text-muted);
    padding: 4px 10px 8px;
}

.portal-side-menu .dropdown-item {
    border-radius: var(--portal-radius-sm);
    font-size: 0.85rem;
    padding: 8px 10px;
    color: var(--portal-text);
}

.portal-side-menu .dropdown-item:hover,
.portal-side-menu .dropdown-item:focus,
.portal-side-menu .dropdown-item.active {
    background: var(--portal-tint-teal);
    color: var(--portal-teal-deep);
}

.portal-side-menu .dropdown-item.active {
    font-weight: 600;
}

/* --- The side menu in Light Mode --- */
/* White, with a shadow down its edge and dark words. */
.portal-menu-light .portal-sidebar {
    background: #ffffff;
    box-shadow: 1px 0 0 var(--portal-line), 4px 0 18px rgba(28, 28, 28, 0.08);
}

.portal-menu-light .portal-side-brand-row::after {
    background: linear-gradient(90deg, var(--portal-teal), transparent);
    opacity: 0.35;
}

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

.portal-menu-light .portal-rail-toggle:hover {
    background: var(--portal-line);
    color: var(--portal-navy);
}

.portal-menu-light .portal-side-nav {
    scrollbar-color: rgba(28, 28, 28, 0.16) transparent;
}

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

.portal-menu-light .portal-side-item:hover,
.portal-menu-light .portal-side-item:focus-visible {
    background: var(--portal-tint-slate);
    color: var(--portal-navy);
}

.portal-menu-light .portal-side-item.active,
.portal-menu-light .portal-side-item.active:hover {
    background: var(--portal-tint-teal);
    color: var(--portal-teal-deep);
    box-shadow: inset 3px 0 0 var(--portal-teal);
}

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

.portal-menu-light .portal-side-user:hover {
    background: var(--portal-tint-slate);
}

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

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

/* --- Folded to its icons --- */
.portal-shell.portal-rail .portal-sidebar,
.portal-pre-collapsed .portal-sidebar {
    width: var(--portal-rail-w);
}

.portal-layout-side .portal-shell.portal-rail .portal-main,
.portal-pre-collapsed .portal-layout-side .portal-main {
    margin-left: var(--portal-rail-w);
}

.portal-shell.portal-rail .portal-side-brand .portal-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-side-brand .portal-brand-text,
.portal-pre-collapsed .portal-side-label,
.portal-pre-collapsed .portal-side-caret,
.portal-pre-collapsed .portal-side-user-text {
    display: none;
}

.portal-shell.portal-rail .portal-side-brand-row,
.portal-pre-collapsed .portal-side-brand-row {
    flex-direction: column;
    gap: 10px;
    padding: 14px 8px 12px;
}

.portal-shell.portal-rail .portal-side-brand-row::after,
.portal-pre-collapsed .portal-side-brand-row::after {
    left: 12px;
    right: 12px;
}

.portal-shell.portal-rail .portal-side-brand,
.portal-pre-collapsed .portal-side-brand {
    flex: none;
    justify-content: center;
}

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

.portal-shell.portal-rail .portal-side-nav,
.portal-shell.portal-rail .portal-side-foot,
.portal-pre-collapsed .portal-side-nav,
.portal-pre-collapsed .portal-side-foot {
    padding-left: 8px;
    padding-right: 8px;
}

.portal-shell.portal-rail .portal-side-item,
.portal-shell.portal-rail .portal-side-user,
.portal-pre-collapsed .portal-side-item,
.portal-pre-collapsed .portal-side-user {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
}

/* Folded, each icon names itself on hover. Placed by site.js against the window. */
.portal-rail-tip {
    position: fixed;
    transform: translateY(-50%);
    background: var(--portal-navy);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 11px;
    border-radius: var(--portal-radius-sm);
    box-shadow: var(--portal-shadow-lg);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
    z-index: 1200;
}

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

/* --- The bar that opens the side menu on a phone or tablet --- */
.portal-appbar,
.portal-scrim {
    display: none;
}

@media (max-width: 991.98px) {
    .portal-appbar {
        display: flex;
        align-items: center;
        gap: 14px;
        min-height: 58px;
        padding: 0 16px;
        background: linear-gradient(100deg, var(--portal-navy) 0%, var(--portal-navy-mid) 100%);
        box-shadow: 0 2px 14px rgba(28, 28, 28, 0.18);
    }

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

    .portal-appbar .portal-brand {
        text-decoration: none;
        padding: 0;
    }

    .portal-hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 34px;
        flex-shrink: 0;
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: var(--portal-radius-sm);
        color: #ffffff;
    }

    .portal-menu-light .portal-hamburger {
        border-color: var(--portal-line);
        color: var(--portal-navy);
    }

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

    .portal-scrim {
        position: fixed;
        inset: 0;
        background: rgba(28, 28, 28, 0.5);
        z-index: 1035;
    }

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

    /* The menu slides in over the page, always at full width. Folding is a desktop idea. */
    .portal-sidebar,
    .portal-shell.portal-rail .portal-sidebar,
    .portal-pre-collapsed .portal-sidebar {
        width: var(--portal-side-w);
        transform: translateX(-100%);
        transition: transform 0.22s ease-in-out;
        box-shadow: var(--portal-shadow-lg);
    }

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

    .portal-rail-toggle {
        display: none;
    }

    .portal-shell.portal-rail .portal-side-brand .portal-brand-text,
    .portal-pre-collapsed .portal-side-brand .portal-brand-text {
        display: flex;
    }

    .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-side-label,
    .portal-pre-collapsed .portal-side-caret,
    .portal-pre-collapsed .portal-side-user-text {
        display: block;
    }

    .portal-shell.portal-rail .portal-side-brand-row,
    .portal-pre-collapsed .portal-side-brand-row {
        flex-direction: row;
        padding: 12px 12px 12px 16px;
    }

    .portal-shell.portal-rail .portal-side-brand,
    .portal-pre-collapsed .portal-side-brand {
        flex: 1;
        justify-content: flex-start;
    }

    .portal-shell.portal-rail .portal-side-item,
    .portal-shell.portal-rail .portal-side-user,
    .portal-pre-collapsed .portal-side-item,
    .portal-pre-collapsed .portal-side-user {
        justify-content: flex-start;
        gap: 11px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .portal-layout-side .portal-main,
    .portal-layout-side .portal-shell.portal-rail .portal-main,
    .portal-pre-collapsed .portal-layout-side .portal-main {
        margin-left: 0;
        padding-top: 0;
    }

    .portal-layout-side .portal-main > .container {
        margin-top: 1.25rem;
    }

    .portal-shell.portal-rail .portal-side-sub,
    .portal-pre-collapsed .portal-side-sub {
        padding-left: 18px;
    }
}

@media print {
    .portal-sidebar,
    .portal-appbar,
    .portal-scrim {
        display: none !important;
    }

    .portal-layout-side .portal-main {
        margin-left: 0 !important;
    }
}


/* --- The choices on the Layout page --- */
.portal-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 575.98px) {
    .portal-choice-grid {
        grid-template-columns: 1fr;
    }
}

.portal-choice-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.portal-choice {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--portal-line);
    border-radius: var(--portal-radius);
    background: var(--portal-surface);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.portal-choice:hover {
    border-color: var(--portal-teal-bright);
}

.portal-choice-input:checked + .portal-choice {
    border-color: var(--portal-teal);
    box-shadow: 0 0 0 3px rgba(148, 116, 74, 0.16);
}

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

.portal-choice-name {
    font-family: var(--portal-font-head);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--portal-heading);
    margin-top: 6px;
}

.portal-choice-input:checked + .portal-choice .portal-choice-name::after {
    content: ' \2713';
    color: var(--portal-teal);
}

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

/* The small picture: a page with the menu drawn on it, across the top or down the side,
   charcoal or white. */
.portal-choice-picture {
    position: relative;
    display: block;
    height: 92px;
    border-radius: var(--portal-radius-sm);
    /* The standard page colour written out, so each picture shows its own look whatever
       look the page around it is in. */
    background: #f6f5f1;
    border: 1px solid var(--portal-line);
    overflow: hidden;
}

.portal-choice-menu {
    position: absolute;
    background: linear-gradient(170deg, var(--portal-navy), var(--portal-navy-mid));
}

.portal-choice-picture.is-light .portal-choice-menu {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(28, 28, 28, 0.16);
}

.portal-choice-picture.is-top .portal-choice-menu {
    left: 0;
    right: 0;
    top: 0;
    height: 18px;
}

.portal-choice-picture.is-side .portal-choice-menu {
    left: 0;
    top: 0;
    bottom: 0;
    width: 34px;
}

/* A white card on the page, standing for the content. */
.portal-choice-page {
    position: absolute;
    background: #ffffff;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(28, 28, 28, 0.1);
}

.portal-choice-picture.is-top .portal-choice-page {
    left: 14px;
    right: 14px;
    top: 30px;
    bottom: 10px;
}

.portal-choice-picture.is-side .portal-choice-page {
    left: 46px;
    right: 12px;
    top: 12px;
    bottom: 10px;
}


/* A box that cannot be typed in looks it: a grey ground and softer text, so a locked box
   is never mistaken for an open one. */
.form-control[readonly] {
    background-color: var(--portal-tint-slate);
    color: var(--portal-text-muted);
    cursor: default;
}

.form-control[readonly]:focus {
    background-color: var(--portal-tint-slate);
    border-color: var(--portal-line);
    box-shadow: none;
}

/* The toolbar above every list: search and filters on the left, the PDF and Excel icons and
   the one primary button on the right. It wraps rather than running off the page. */
.portal-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.portal-toolbar .filter-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.portal-toolbar .portal-search {
    width: 220px;
}

.portal-toolbar .portal-filter-select {
    width: auto;
    min-width: 130px;
}

.portal-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Below a wide desktop a table scrolls sideways inside its own box, never the whole page. */
@media (max-width: 1365.98px) {
    .table-wrapper {
        overflow-x: auto;
    }
}

/* A table with set column widths keeps a readable width on a phone or small tablet, and
   scrolls in its box rather than squeezing every column. */
@media (max-width: 991.98px) {
    .table.table-fit {
        min-width: 720px;
    }
}

/* Below a wide desktop the columns take the width their words need, so nothing is cut
   with "...", and the table scrolls in its box when it is wider than the screen. */
@media (max-width: 1365.98px) {
    .table.table-fit {
        table-layout: auto;
    }
}

/* A list's filters sit behind one Filters button on a phone. A tap opens them and a tap
   closes them. On a tablet or a desktop the filters are always shown and the button is not. */
.filter-toggle {
    display: none;
}

@media (min-width: 768px) {
    .portal-toolbar .filter-panel.collapse:not(.show) {
        display: flex;
    }
}

@media (max-width: 767.98px) {
    .filter-toggle {
        display: block;
        width: 100%;
        min-height: 38px;
    }

    .portal-toolbar .filter-panel.collapse:not(.show) {
        display: none;
    }

    /* Inside the Filters panel every box and button is full width, one under the other.
       A list with only a search box keeps the box and the Filter button on one row. */
    .portal-toolbar .filter-panel {
        width: 100%;
    }

    .portal-toolbar .filter-panel.collapse {
        flex-direction: column;
        align-items: stretch;
    }

    .portal-toolbar .filter-panel.collapse > *,
    .portal-toolbar .filter-panel.collapse .portal-search,
    .portal-toolbar .filter-panel.collapse .portal-filter-select {
        width: 100%;
        min-height: 38px;
    }

    .portal-toolbar .filter-panel:not(.collapse) .portal-search {
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* With one dropdown as well, the search box takes its own row, and the dropdown and the
       Filter button share the next. */
    .portal-toolbar .filter-panel:not(.collapse):has(select) .portal-search {
        flex-basis: 100%;
    }

    .portal-toolbar .filter-panel:not(.collapse) .portal-filter-select {
        flex: 1 1 auto;
        width: auto;
        min-height: 38px;
    }

    .portal-toolbar .filter-panel .btn {
        min-height: 38px;
    }

    /* The print, Excel and Add buttons keep their own row, with Add easy to reach. */
    .portal-toolbar .portal-toolbar-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .portal-toolbar .portal-toolbar-actions .btn {
        min-height: 38px;
        min-width: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Text of 16 pixels in every box on a phone, so tapping a box does not zoom the page. */
    .form-control,
    .form-select,
    .form-control-sm,
    .form-select-sm,
    .portal-tags-input {
        font-size: 16px;
    }
}

/* ===================================================================
   The brand in the menus: the JCS lion and Johan Calitz Safaris in the
   brand serif, italic. Silver words and a white lion on the charcoal
   menu, charcoal words and a black lion on the white menu. On a phone,
   and on the side menu folded to its icons, the lion and JCS only.
   =================================================================== */
.portal-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
}

.portal-brand-lion {
    height: 30px;
    width: auto;
    flex-shrink: 0;
    display: block;
}

.portal-brand-text,
.portal-brand-short {
    font-family: var(--portal-font-brand);
    font-style: italic;
    font-weight: 600;
    font-size: 1.4rem;
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--portal-silver);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-brand-short {
    display: none;
}

.portal-brand:hover .portal-brand-text,
.portal-brand:hover .portal-brand-short {
    color: var(--portal-teal-glow);
}

.portal-menu-light .portal-brand-text,
.portal-menu-light .portal-brand-short,
.navbar-portal-light .portal-brand-text,
.navbar-portal-light .portal-brand-short {
    color: var(--portal-navy);
}

.portal-menu-light .portal-brand:hover .portal-brand-text,
.portal-menu-light .portal-brand:hover .portal-brand-short,
.navbar-portal-light .portal-brand:hover .portal-brand-text,
.navbar-portal-light .portal-brand:hover .portal-brand-short {
    color: var(--portal-teal);
}

/* The side menu is narrow, so the name is a little smaller there. */
.portal-side-brand {
    gap: 8px;
}

.portal-side-brand .portal-brand-text {
    font-size: 1.12rem;
}

/* Folded to its icons, the side menu shows the lion with JCS under it. */
.portal-shell.portal-rail .portal-side-brand,
.portal-pre-collapsed .portal-side-brand {
    flex-direction: column;
    gap: 4px;
}

.portal-shell.portal-rail .portal-side-brand .portal-brand-short,
.portal-pre-collapsed .portal-side-brand .portal-brand-short {
    display: block;
    font-size: 1rem;
}

@media (max-width: 991.98px) {
    .portal-shell.portal-rail .portal-side-brand,
    .portal-pre-collapsed .portal-side-brand {
        flex-direction: row;
        gap: 10px;
    }

    .portal-shell.portal-rail .portal-side-brand .portal-brand-short,
    .portal-pre-collapsed .portal-side-brand .portal-brand-short {
        display: none;
    }
}

/* On a phone, the lion and JCS only. */
@media (max-width: 767.98px) {
    .portal-brand .portal-brand-text,
    .portal-shell.portal-rail .portal-side-brand .portal-brand-text,
    .portal-pre-collapsed .portal-side-brand .portal-brand-text {
        display: none;
    }

    .portal-brand .portal-brand-short,
    .portal-shell.portal-rail .portal-side-brand .portal-brand-short,
    .portal-pre-collapsed .portal-side-brand .portal-brand-short {
        display: block;
        font-size: 1.4rem;
    }
}

/* ===================================================================
   The sign in, Forgot Password and Reset Password pages. On a tablet
   or a desktop the page is split in two: the charcoal panel with the
   lion and the name, and the card on the off-white page. On a phone
   the panel is a band at the top and the card sits under it.
   =================================================================== */
body.portal-login-body {
    margin-bottom: 0;
    background: var(--portal-canvas);
}

.portal-login {
    display: flex;
    min-height: 100vh;
}

.portal-login-panel {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: var(--portal-navy-soft);
    color: var(--portal-silver);
    text-align: center;
}

.portal-login-lion {
    width: min(240px, 60%);
    height: auto;
    margin-bottom: 28px;
}

.portal-login-name {
    font-family: var(--portal-font-brand);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    line-height: 1.05;
    color: var(--portal-silver);
}

.portal-login-sub {
    margin-top: 14px;
    font-family: var(--portal-font-head);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--portal-silver);
}

.portal-login-side {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.portal-login-main {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.portal-login-card {
    width: 100%;
    max-width: 380px;
}

.portal-login-card .card-body {
    padding: 32px;
}

.portal-login-heading {
    margin-bottom: 1.25rem;
}

.portal-login-footer {
    padding: 16px 24px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--portal-text-faint);
}

@media (max-width: 767.98px) {
    .portal-login {
        flex-direction: column;
    }

    .portal-login-panel {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 14px;
        padding: 18px 16px;
    }

    .portal-login-lion {
        width: auto;
        height: 56px;
        margin-bottom: 0;
    }

    .portal-login-name {
        font-size: 1.8rem;
        text-align: left;
    }

    .portal-login-sub {
        display: none;
    }

    .portal-login-main {
        align-items: flex-start;
        padding: 24px 16px;
    }

    .portal-login-card .card-body {
        padding: 24px 20px;
    }
}

/* ===================================================================
   Standard, Light and Dark, the way the Daveng portal does it. Each
   person chooses theirs under My Account; there is no portal default
   look, so anyone who has not chosen has Standard. _Layout.cshtml writes
   data-portal-theme on <html>; Standard writes nothing, so the values
   above are the standard look and are not changed here.

   Dark: the page and every card fully dark charcoal, the words white or
   near white, the lines a soft grey, the accent a light bronze. The
   menu is charcoal. Light: a pure white
   page with black words and no grey tints, and a thin line round each
   card so it still stands off the page. The menu is white.
   =================================================================== */
html[data-portal-theme="dark"] {
    color-scheme: dark;

    --portal-heading:     #ffffff;
    --portal-text:        #f7f8fa;
    --portal-text-muted:  #cfcac2;
    --portal-text-faint:  #948f87;
    --portal-line:        #3d3a36;
    --portal-line-soft:   #2a2826;
    --portal-surface:     #1c1b1a;
    --portal-canvas:      #111111;

    --portal-teal:        #d4bc90;
    --portal-teal-deep:   #e8d9bd;

    --portal-tint-teal:   #3a3024;
    --portal-tint-amber:  #3b2b0c;
    --portal-tint-violet: #262347;
    --portal-tint-green:  #1e3517;
    --portal-tint-red:    #401616;
    --portal-tint-slate:  #252321;

    --portal-shadow:       0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.45);
    --portal-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.45), 0 12px 28px rgba(0, 0, 0, 0.55);
    --portal-shadow-lg:    0 16px 48px rgba(0, 0, 0, 0.6);

    --bs-body-color:      #f7f8fa;
    --bs-body-bg:         #111111;
    --bs-border-color:    #3d3a36;
    --bs-link-color:      #d4bc90;
    --bs-link-hover-color: #e8d9bd;
    --bs-emphasis-color:  #ffffff;
    --bs-secondary-color: rgba(247, 248, 250, 0.78);
    --bs-secondary-bg:    #252321;
    --bs-tertiary-bg:     #201f1d;
}

/* The few places a colour is written out rather than read from a value above. */
/* The primary button keeps the deeper bronze in Dark, so its white words stay easy to read. */
html[data-portal-theme="dark"] .btn-primary {
    color: #ffffff;
    background: #94744a;
    border-color: #94744a;
}

html[data-portal-theme="dark"] .btn-primary:hover,
html[data-portal-theme="dark"] .btn-primary:focus,
html[data-portal-theme="dark"] .btn-primary:active {
    background: #74593a;
    border-color: #74593a;
}

/* A secondary button in Dark: the dark card colour with a light line and light words. */
html[data-portal-theme="dark"] .btn-secondary {
    color: var(--portal-text);
    border-color: var(--portal-text-faint);
}

html[data-portal-theme="dark"] .btn-secondary:hover,
html[data-portal-theme="dark"] .btn-secondary:focus,
html[data-portal-theme="dark"] .btn-secondary:active {
    color: var(--portal-text);
    border-color: var(--portal-teal);
}

html[data-portal-theme="dark"] .nav-pills .nav-link.active,
html[data-portal-theme="dark"] .nav-pills .show > .nav-link,
html[data-portal-theme="dark"] .form-check-input:checked {
    background-color: #94744a;
    border-color: #94744a;
}

/* On charcoal the page in use turns white, so its icon keeps the deeper bronze. */
html[data-portal-theme="dark"] .portal-side-item.active .portal-side-icon {
    color: #94744a;
}

/* In Dark the table heading is a lighter charcoal, so it stands off the dark card. */
html[data-portal-theme="dark"] .table thead th {
    background: var(--portal-navy-soft);
}

html[data-portal-theme="dark"] .form-control::placeholder {
    color: #9d9890;
}

html[data-portal-theme="dark"] .form-check-input {
    border-color: #6b6660;
}

html[data-portal-theme="light"] {
    --portal-text:        #000000;
    --portal-text-muted:  #333333;
    --portal-text-faint:  #6b6b6b;
    --portal-line:        #d4d4d4;
    --portal-line-soft:   #ebebeb;
    --portal-surface:     #ffffff;
    --portal-canvas:      #ffffff;
    --portal-tint-slate:  #f4f4f4;

    --portal-shadow:      0 1px 2px rgba(0, 0, 0, 0.06);

    --bs-body-color:      #000000;
    --bs-body-bg:         #ffffff;
    --bs-border-color:    #d4d4d4;
}

html[data-portal-theme="light"] .card,
html[data-portal-theme="light"] .portal-card,
html[data-portal-theme="light"] .portal-form-actions,
html[data-portal-theme="light"] .table-wrapper,
html[data-portal-theme="light"] .table-responsive {
    border: 1px solid #b5b5b5;
}

/* ===================================================================
   Text size, chosen by each person under My Account: Small, Standard
   or Large. _Layout.cshtml writes data-portal-text on <html>, and
   Standard writes nothing. Everything is sized in rem, so it all
   follows the size set here. Boxes on a phone stay at 16 pixels
   whatever the size, so tapping one never zooms the page.

   Standard is 14 pixels on a phone and 15 from 768 pixels wide (the
   html rule near the top). Small and Large are two or three pixels
   either side, so each is clearly different from Standard.
   =================================================================== */
html[data-portal-text="small"] {
    font-size: 12px;
}

html[data-portal-text="large"] {
    font-size: 16px;
}

@media (min-width: 768px) {
    html[data-portal-text="small"] {
        font-size: 13px;
    }

    html[data-portal-text="large"] {
        font-size: 18px;
    }
}

/* ===================================================================
   The choices on Configure > Layout and My Account
   =================================================================== */
.portal-choice-grid.is-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* On Manage Account the cards sit in the same column as the boxes. Below a desktop that
   column is too narrow for three cards side by side, so they stack. */
@media (max-width: 991.98px) {
    .portal-choice-grid.is-three {
        grid-template-columns: 1fr;
    }
}

.portal-choice-grid.is-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

@media (max-width: 575.98px) {
    .portal-choice-grid.is-three,
    .portal-choice-grid.is-four {
        grid-template-columns: 1fr;
    }
}

/* The small picture of each look: the page, its menu and a card on it. */
.portal-choice-picture.is-theme-light {
    background: #ffffff;
}

.portal-choice-picture.is-theme-light .portal-choice-page {
    box-shadow: 0 0 0 1px #b5b5b5;
}

.portal-choice-picture.is-theme-dark {
    background: #111111;
    border-color: #3d3a36;
}

.portal-choice-picture.is-theme-dark .portal-choice-page {
    background: #1c1b1a;
}

/* The text size choices show the size itself rather than a picture. */
.portal-choice-sample {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 92px;
    border-radius: var(--portal-radius-sm);
    background: var(--portal-canvas);
    border: 1px solid var(--portal-line);
    font-family: var(--portal-font-head);
    font-weight: 700;
    color: var(--portal-heading);
}

.portal-choice-sample.is-small    { font-size: 1.1rem; }
.portal-choice-sample.is-standard { font-size: 1.45rem; }
.portal-choice-sample.is-large    { font-size: 1.85rem; }

/* A message with more than one line, for example the waiting list lines after a booking is
   saved, keeps its line breaks. */
.portal-message-text {
    white-space: pre-line;
}

/* Lists > Price List: the fee boxes sit on the right of their cells, as the quota boxes do. */
.price-input {
    max-width: 140px;
    margin-left: auto;
    text-align: right;
}

.price-fees {
    max-width: 760px;
}

@media (max-width: 767.98px) {
    .price-input {
        max-width: none;
        width: 100%;
        min-width: 80px;
    }

    /* The fee headings wrap, so the three columns fit a phone. */
    .price-fees .table th {
        white-space: normal;
        padding-left: 6px;
        padding-right: 6px;
    }

    .price-fees .table td {
        padding-left: 6px;
        padding-right: 6px;
    }
}

/* --- The invoice page (/Invoices/Invoice/<BookingID>) --- */
.invoice-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.invoice-title h4 {
    margin-bottom: 0;
}

.invoice-back {
    margin: -6px 0 14px;
}

/* The hunt, as label and value pairs, two to a row on a wide screen. */
.invoice-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 24px;
    margin: 0;
}

.invoice-facts > div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 8px;
}

.invoice-facts dt {
    font-weight: 600;
    color: var(--portal-text-muted);
}

.invoice-facts dd {
    margin: 0;
    color: var(--portal-text);
}

.invoice-number {
    font-weight: 700;
}

.invoice-lines {
    table-layout: fixed;
    width: 100%;
}

.invoice-lines td {
    vertical-align: top;
}

.invoice-num {
    text-align: right;
    max-width: 130px;
    margin-left: auto;
}

/* On a phone and a tablet held upright each line stacks: the description across the top,
   then Qty, Rate and Amount side by side, each with its own small heading, and Remove under
   them, so every figure shows in full. */
@media (max-width: 991.98px) {
    .invoice-lines thead {
        display: none;
    }

    .invoice-lines,
    .invoice-lines tbody {
        display: block;
    }

    .invoice-lines tr.invoice-line {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px 8px;
        padding: 10px 0;
        border-bottom: 1px solid var(--portal-line-soft);
    }

    .invoice-lines tr.invoice-line > td {
        display: block;
        border: 0;
        padding: 0 !important;
    }

    .invoice-lines tr.invoice-line > td:first-child {
        grid-column: 1 / -1;
    }

    .invoice-lines tr.invoice-line > td:last-child:not(.invoice-amount) {
        grid-column: 1 / -1;
        text-align: right;
    }

    .invoice-lines tr.invoice-line > td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.75rem;
        color: var(--portal-text-muted);
        text-align: left;
        margin-bottom: 2px;
    }

    .invoice-lines .invoice-amount {
        text-align: right;
    }

    .invoice-lines .invoice-num {
        max-width: none;
    }

    .invoice-lines-wrap {
        overflow: visible;
    }
}

.invoice-amount {
    padding-top: 10px !important;
    white-space: nowrap;
}

/* What a package includes, small, under its line. */
.invoice-includes {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--portal-text-muted);
}

.invoice-totals {
    width: 100%;
    max-width: 520px;
    margin-left: auto;
    border-collapse: collapse;
}

.invoice-totals th,
.invoice-totals td {
    padding: 6px 0;
    border-bottom: 1px solid var(--portal-line-soft);
}

.invoice-totals th {
    font-weight: 500;
    color: var(--portal-text);
}

.invoice-totals td {
    text-align: right;
    white-space: nowrap;
    padding-left: 16px;
}

.invoice-totals .invoice-total th,
.invoice-totals .invoice-total td {
    font-weight: 700;
    color: var(--portal-heading);
}

.invoice-to {
    display: block;
    font-size: 0.8rem;
    color: var(--portal-text-muted);
}

.invoice-buttons {
    margin: 8px 0 16px;
}

.invoice-danger {
    margin-bottom: 16px;
}

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

    .invoice-facts > div {
        grid-template-columns: 130px minmax(0, 1fr);
    }

    .invoice-num {
        max-width: none;
        min-width: 70px;
    }

    .invoice-totals {
        max-width: none;
    }

    .invoice-buttons .btn {
        flex: 1 1 100%;
    }
}

/* --- Payments on the booking form and the invoice page --- */
.payments-list {
    margin-top: 18px;
}

.payments-heading {
    font-weight: 700;
    color: var(--portal-heading);
    margin-bottom: 8px;
}

/* A payment opens on a click: a pointer, and the row tint. */
tr.payment-row {
    cursor: pointer;
}

tr.payment-row:hover > td {
    background-color: var(--portal-tint-teal);
}

/* On the invoice page the payments have their own card, so the list's own heading is not needed. */
.invoice-payments .payments-list {
    margin-top: 0;
}

.invoice-payments .payments-heading {
    display: none;
}

/* A version opens its PDF on a click: a pointer, and the row tint. */
tr.version-row {
    cursor: pointer;
}

tr.version-row:hover > td {
    background-color: var(--portal-tint-teal);
}

/* --- The Invoices menu: the list, Deposits and Balances Due --- */

/* The total row under a list, in bold, apart from the rows above. */
.table tfoot tr.list-total td {
    font-weight: 700;
    color: var(--portal-heading);
    border-top: 2px solid var(--portal-line);
    background: var(--portal-surface);
}

.list-total-card {
    font-weight: 700;
    color: var(--portal-heading);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* The three figures at the top of Deposits. */
.report-figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.report-figure {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 0;
}

.report-figure span {
    font-size: 0.8rem;
    color: var(--portal-text-muted);
}

.report-figure strong {
    font-size: 1.15rem;
    color: var(--portal-heading);
}

/* Past its due date with money still due: red with Overdue. */
.report-overdue .report-due,
.report-overdue-word {
    color: var(--portal-danger);
}

.report-overdue-word {
    font-weight: 700;
}

@media (max-width: 767.98px) {
    .report-figures {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }
}

/* The Invoices list and the two reports: their headings wrap and the cells have less padding,
   so the money columns keep to their figures and the name columns get the room. Every
   column shows without a sideways scroll down to a tablet. */
.report-table .table thead th {
    white-space: normal;
    line-height: 1.3;
    padding-left: 7px;
    padding-right: 7px;
}

.report-table .table tbody td,
.report-table .table tfoot td {
    padding-left: 7px;
    padding-right: 7px;
}

@media (max-width: 991.98px) {
    .report-table .table {
        font-size: 0.8rem;
    }

    .report-table .table thead th,
    .report-table .table tbody td,
    .report-table .table tfoot td {
        padding-left: 5px;
        padding-right: 5px;
    }

    .report-table .portal-pill {
        padding: 2px 6px;
    }
}

@media (max-width: 767.98px) {
    .report-figure {
        padding: 12px 16px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

/* A row that opens its file on a click: a pointer, and the row tint. */
tr.pdf-row {
    cursor: pointer;
}

tr.pdf-row:hover > td {
    background-color: var(--portal-tint-teal);
}

/* The file box on Configure > Terms and Conditions. */
.terms-upload {
    flex: 1 1 320px;
    max-width: 520px;
}

/* The Contract card on the booking form. */
.contract-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

@media (max-width: 767.98px) {
    .terms-upload {
        max-width: none;
    }

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