/*
 * The backend's part of the application shell (the shared part is in
 * common/templates/app-shell/app-shell.css). Loaded after custom.css, so it wins over it.
 */

/* ---- footer: a quiet line under the page, not a website footer ---------------------------- */
.backend-admin-footer {
    padding: .55rem 1.1rem;
    font-size: .78rem;
    border-top-color: rgba(188, 201, 213, .4);
}

.backend-admin-footer strong {
    font-weight: 600;
}

@media (max-width: 767.98px) {
    /* the bottom bar takes the place of the footer */
    .backend-admin-footer {
        display: none;
    }

    /* Bootstrap keeps a navbar on one line (.navbar > .container-fluid inherits nowrap), so the
       quick tools (search, notifications, account) ran off the right edge when opened. They are
       meant to drop to a row of their own under the header (custom.css), as they now do. */
    .backend-admin-header > .backend-admin-header-bar {
        flex-wrap: wrap;
    }

    /* the name stays its full width beside the menu button */
    .backend-admin-header-brand-item {
        flex: 0 0 auto;
        margin-right: .25rem;
    }

    .backend-admin-header-brand {
        display: flex;
        align-items: center;
        gap: .45rem;
        max-width: 9rem;
        color: var(--admin-shell-heading, #173f65);
        font-weight: 700;
    }

    .backend-admin-header-brand img {
        width: 1.9rem;
        height: 1.9rem;
        object-fit: contain;
    }

    .backend-admin-header-brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ---- phones: give the width to the content (see common app-shell.css) -------------------- */
@media (max-width: 575.98px) {
    .backend-admin-theme .tabs-x > .tab-content,
    .backend-admin-theme .app-tabs-widget.nav-tabs + .tab-content {
        padding: .75rem .5rem;
    }

    .backend-admin-module-surface,
    .backend-admin-filter-card {
        padding-left: .5rem;
        padding-right: .5rem;
    }

    .backend-admin-module-surface > .backend-admin-filter-head {
        padding-left: .35rem;
        padding-right: .35rem;
    }

    .backend-admin-theme .workspace-surface,
    .backend-admin-theme .process-step-panel {
        padding-left: .6rem;
        padding-right: .6rem;
    }

    .dashboard-panel-item {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    .process-instance-stage-summary {
        padding-left: .5rem;
        padding-right: .5rem;
    }

    /* A tab body inside a panel: the panel already gives the side space, so the content lines up
       with the tab strip. This is how a review's tabs hold a whole step view on a phone. */
    .backend-admin-theme .process-step-panel .tabs-x > .tab-content,
    .backend-admin-theme .process-step-panel .app-tabs-widget.nav-tabs + .tab-content {
        padding-left: 0;
        padding-right: 0;
    }

    /* the step view's panel only groups its sections (custom.css): it stays flat on a phone too,
       instead of taking the side padding of the panels above */
    .backend-admin-theme .process-step-panel.process-view-panel {
        padding-left: 0;
        padding-right: 0;
    }
}

/* A review's tabs hold a whole step view, whose sections are cards already. The review panel only
   groups them, as the step view's own panel does (custom.css), so no card is drawn around those
   cards and they line up with the cards above the review. */
.backend-admin-theme .process-step-panel.review-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    overflow: visible;
}

.backend-admin-theme .review-panel .tabs-x > .tab-content {
    padding-left: 0;
    padding-right: 0;
}

/* custom.css gives only the first three sections of a step view an extra 20px margin and padding
   (with !important): the open section then starts with an empty band, unlike the sections after */
#collapse0,
#collapse1,
#collapse2 {
    margin: 0 !important;
    padding: 0 !important;
}

/* a form's fields are table rows split into label and value with Bootstrap's .row and .col-*
   (viewField.php); the row's negative gutter pushed each row 12px past the table on both sides */
.backend-admin-theme table > tbody > tr.row {
    margin-left: 0;
    margin-right: 0;
}

/* the main column keeps a gutter on its right for the side column; stacked, there is none */
@media (max-width: 767.98px) {
    .process-content > .process-main-content {
        padding-right: 0;
    }
}

/* ---- section labels above titles are quiet grey text, not an accent colour ----------------
 * (app-plain.css already took off their capitals and tracking) */
[class*="-kicker"],
[class*="-eyebrow"] {
    color: #64748b !important;
    font-weight: 600;
}

/* ---- one header: menu, office, shortcuts, then search, notifications and account ------------
 * The shortcuts used to sit in a bar of their own under the header, two thirds of it empty. */
.backend-admin-header-bar {
    min-height: 60px;
    gap: .5rem;
}

.backend-admin-brand .brand-link {
    min-height: 60px;
}

.backend-admin-header-office {
    align-items: center;
    gap: .45rem;
    min-width: 0;
    max-width: 22rem;
    margin-left: .25rem;
    color: var(--admin-shell-heading, #173f65);
    font-size: .875rem;
    font-weight: 600;
}

.backend-admin-header-office > i {
    color: var(--admin-shell-muted, #64748b);
}

.backend-admin-header-office-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.backend-admin-header-office-role {
    flex: 0 0 auto;
    padding: .1rem .45rem;
    border-radius: .375rem;
    background: #eef3f8;
    color: #475569;
    font-size: .75rem;
    font-weight: 500;
}

.backend-admin-header-shortcuts {
    align-items: center;
    gap: .25rem;
    margin-left: auto;
}

/* the shortcuts take the right-hand side; the tools follow them after a divider */
.backend-admin-header-shortcuts + .backend-admin-header-tools {
    margin-left: .25rem !important;
    padding-left: .5rem;
    border-left: 1px solid var(--admin-shell-border, #dbe4ee);
}

.backend-admin-shortcut {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    height: 2.25rem;
    padding: 0 .75rem;
    border: 1px solid transparent;
    border-radius: .5rem;
    color: var(--admin-shell-heading, #173f65);
    font-size: .875rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.backend-admin-shortcut:hover,
.backend-admin-shortcut:focus-visible {
    background: #eef3f8;
    color: var(--admin-shell-heading, #173f65);
}

.backend-admin-shortcut.is-active {
    background: #e7eff7;
    color: #1d5a94;
}

.backend-admin-shortcut.is-danger > i {
    color: #c9302c;
}

/* the one action among the shortcuts: it starts something */
.backend-admin-shortcut.is-primary {
    border-color: #1d5a94;
    color: #1d5a94;
}

.backend-admin-shortcut.is-primary:hover,
.backend-admin-shortcut.is-primary:focus-visible {
    background: #1d5a94;
    color: #fff;
}

.backend-admin-shortcut-badge {
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 .35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #1d5a94;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1;
}

.backend-admin-shortcut.is-danger .backend-admin-shortcut-badge {
    background: #dc3545;
}

/* tablets and small laptops: the shortcuts keep their icons and counts, the names show on hover */
@media (min-width: 768px) and (max-width: 1279.98px) {
    .backend-admin-shortcut-label {
        display: none;
    }

    .backend-admin-shortcut {
        padding: 0 .6rem;
    }

    .backend-admin-header-office {
        max-width: 14rem;
    }

    .backend-admin-header-office-role {
        display: none;
    }
}

/* the office in the account menu, for the screens where the header has no room for it */
.backend-admin-user-menu-office {
    display: grid;
    gap: .1rem;
    color: var(--admin-shell-heading, #173f65);
    font-weight: 600;
    white-space: normal;
}

.backend-admin-user-menu-office small {
    color: #64748b;
    font-weight: 500;
}

/* ---- page header: title and actions on the page, not in a box of their own ---------------- */
.backend-page-head {
    align-items: flex-end;
    padding: .25rem .15rem 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.backend-page-title {
    font-size: clamp(1.3rem, 1.6vw, 1.6rem);
}

.backend-page-breadcrumbs .breadcrumb {
    font-size: .8125rem;
    font-weight: 500;
}

.backend-page-actions {
    gap: .5rem;
}

.backend-page-actions > .btn,
.backend-page-actions > a.btn,
.backend-page-actions .btn-group > .btn {
    min-height: 2.25rem;
    padding: .375rem .85rem;
    font-size: .875rem;
    font-weight: 600;
}

/* ---- the stage's row: who holds it and where, then what can be done ------------------------
 * (process-instance-stage-action-bar.php) One filled button, the main action, at the right end;
 * the everyday actions beside it; the rest in "More". */
.stage-actions {
    margin-bottom: .75rem;
    padding: .5rem .75rem;
    border: 1px solid var(--admin-shell-border, #dbe4ee);
    border-radius: .625rem;
    background: #fff;
}

.stage-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
}

.stage-actions-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem 1.25rem;
    min-width: 0;
    color: #64748b;
    font-size: .875rem;
}

.stage-actions-status strong,
.stage-actions-edit {
    color: var(--admin-shell-heading, #173f65);
    font-weight: 600;
}

.stage-actions-status > span > .fa {
    margin-right: .2rem;
}

.stage-actions-edit {
    text-decoration: none;
    border-bottom: 1px dashed #b6c4d3;
}

.stage-actions-edit:hover,
.stage-actions-edit:focus-visible {
    color: #1d5a94;
    border-bottom-color: currentColor;
}

.stage-actions-edit .bi {
    margin-left: .15rem;
    color: #64748b;
    font-size: .8em;
}

.stage-actions-buttons {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}

.stage-actions-buttons > .btn,
.stage-actions-more > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    height: 2.25rem;
    padding: 0 .85rem;
    font-size: .875rem;
    font-weight: 600;
    white-space: nowrap;
}

/* the menu: a small square of three dots at the end of the row, after the main action */
.stage-actions-more > .btn {
    width: 2.25rem;
    padding: 0;
    color: #475569;
    border-color: #cbd5e1;
}

.stage-actions-more > .btn::after {
    display: none;
}

.stage-actions-more > .btn .bi {
    font-size: 1.1rem;
}

.stage-actions-more .dropdown-menu,
.page-actions-more .dropdown-menu {
    min-width: 13rem;
    font-size: .875rem;
}

.stage-actions-more .dropdown-item,
.page-actions-more .dropdown-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .45rem .9rem;
}

.stage-actions-more .dropdown-item > .fa,
.page-actions-more .dropdown-item > .fa {
    width: 1rem;
    color: #64748b;
    text-align: center;
}

.page-actions-more .dropdown-item.text-danger > .fa {
    color: inherit;
}

/* the due line under the row (_stage_due.php); a box of its own when the row is not shown */
.stage-due {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem .75rem;
    margin-bottom: .75rem;
    padding: .5rem .75rem;
    border: 1px solid var(--admin-shell-border, #dbe4ee);
    border-radius: .625rem;
    background: #fff;
    font-size: .875rem;
}

.stage-actions > .stage-due {
    margin: .5rem 0 0;
    padding: .5rem 0 0;
    border: 0;
    border-top: 1px solid #edf1f5;
    border-radius: 0;
}

.stage-due > .badge.bg-light {
    padding: 0;
    border: 0 !important;
    background: none !important;
    color: #64748b !important;
    font-size: .875rem !important;
    font-weight: 500;
}

.stage-due > .badge.bg-light strong {
    color: var(--admin-shell-heading, #173f65);
    font-weight: 600;
}

/* AdminLTE's overflow:auto on the main area, which never scrolls itself, would hold the bar in
   place; clip cuts what is too wide as before without being a scroller */
body.is-process-layout .app-main,
body.is-process-layout.layout-fixed .app-main {
    overflow-x: clip;
    overflow-y: visible;
}

/* the stage page starts close under the header */
body.is-process-layout .backend-admin-content-inner {
    padding-top: .5rem;
}

/* the stage page's step bar: smaller, so the work starts higher */
body.is-process-layout .process-page-card .process-widget .md-step {
    padding: .35rem .75rem;
}

body.is-process-layout .process-page-card .process-widget .md-step .md-step-circle {
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 12px;
}

body.is-process-layout .process-page-card .process-widget .md-step .md-step-bar-left,
body.is-process-layout .process-page-card .process-widget .md-step .md-step-bar-right {
    top: calc(.35rem + 11px);
}

body.is-process-layout .process-page-card .process-widget .md-step .md-step-title {
    margin-top: .2rem;
}

/* the process tree under the side panels, spaced like them */
.process-sidebar-hierarchy > .process-hierarchy {
    margin: .75rem 0 0;
}

/* the side column is too narrow for label | value: each label sits above its value */
.process-sidebar-hierarchy .process-hierarchy-step,
.process-sidebar-hierarchy .process-view-accordion-body {
    min-width: 0;
}

.process-sidebar-hierarchy .process-view-accordion-body {
    padding: .5rem .6rem;
}

.process-sidebar-hierarchy .detail-view,
.process-sidebar-hierarchy .detail-view > tbody,
.process-sidebar-hierarchy .detail-view > tbody > tr,
.process-sidebar-hierarchy .detail-view > tbody > tr > th,
.process-sidebar-hierarchy .detail-view > tbody > tr > td {
    display: block;
    width: auto !important;
    max-width: 100%;
}

.process-sidebar-hierarchy .detail-view > tbody > tr > th {
    padding: .5rem .5rem 0;
    border: 0;
    color: #6c757d;
    font-size: .75rem;
    font-weight: 600;
    text-align: left !important;
    white-space: normal;
}

.process-sidebar-hierarchy .detail-view > tbody > tr > td {
    padding: .1rem .5rem .5rem;
    overflow-wrap: anywhere;
}

/* a table value (references, requirements) scrolls inside its own box */
.process-sidebar-hierarchy .detail-view > tbody > tr > td .kv-attribute {
    overflow-x: auto;
}

.process-sidebar-hierarchy .process-hierarchy-step .process-view-accordion-title {
    overflow-wrap: break-word;
}

/* less indent per level, and "You are here" on its own line under the step's name */
.process-sidebar-hierarchy .process-hierarchy-step {
    margin-left: calc(var(--hierarchy-level, 0) * .9rem);
}

.process-sidebar-hierarchy .process-hierarchy-current {
    flex-wrap: wrap;
    padding: .75rem;
}

.process-sidebar-hierarchy .process-hierarchy-current .process-view-accordion-copy {
    flex: 1 1 calc(100% - 3rem);
}

.process-sidebar-hierarchy .process-hierarchy-here {
    margin-left: 2.6rem;
}

/* phones: the main action across the width with the menu beside it */
@media (max-width: 767.98px) {
    .stage-actions {
        padding: .5rem .6rem;
    }

    /* without a main action the menu stays beside the status */
    .stage-actions-status {
        flex: 1 1 9rem;
    }

    .stage-actions-buttons.has-main {
        width: 100%;
        margin-left: 0;
    }

    /* a long stage name wraps rather than being cut */
    .stage-actions-buttons > .btn:not(.d-none) {
        flex: 1 1 auto;
        min-width: 0;
        height: auto;
        min-height: 2.5rem;
        padding: .35rem .75rem;
        white-space: normal;
    }

    .stage-actions-more {
        flex: 0 0 auto;
        margin-left: auto;
    }

    .stage-actions-more > .btn {
        width: 2.75rem;
        height: 2.5rem;
    }
}

/* ---- stage page header on phones ------------------------------------------------------------
 * the timing badges (time taken, due date, status) stacked one per line at full width; they
 * share a line as far as it goes */
@media (max-width: 576px) {
    .process-page-title-bar .timing-badges-row {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: .4rem;
        margin-left: 0;
    }

    .process-page-title-bar .timing-badge {
        width: auto;
    }
}

/* the page actions above the stage row line up with the row's edges, not past them */
@media (max-width: 575.98px) {
    .process-main-content .card-header-primary {
        padding: .5rem 1rem;
    }
}

/* the blocks of a page are flex items of the content column: left at min-width auto, a stage
 * page (title bar, steps, two columns) would not shrink below its content, and on a 1024px
 * screen with the menu open ran past the right edge, cut off */
.backend-admin-content-inner > * {
    min-width: 0;
}

/* ---- decision dialogs (approve, return, reject, non-regulated, inspection submit/report) -----
 * The dialog's title already names the decision, so the body has no heading of its own: one
 * sentence on what happens, a coloured note where there is a consequence to weigh, the fields,
 * and the button at the foot on the right. No card inside the dialog's own box. */
.decision-dialog {
    color: #1f2937;
    font-size: .9375rem;
}

.decision-dialog-lead {
    margin: 0 0 1rem;
    color: #374151;
    line-height: 1.55;
}

.decision-dialog-callout {
    margin: 0 0 1rem;
    padding: .75rem .9rem;
    border: 1px solid #e5e7eb;
    border-left-width: 3px;
    border-radius: .375rem;
    background: #f9fafb;
    color: #374151;
    font-size: .875rem;
    line-height: 1.5;
}

.decision-dialog-callout.is-warning {
    border-color: #f5e0b8;
    border-left-color: #c27c0e;
    background: #fffaf0;
    color: #6b4207;
}

.decision-dialog-callout.is-danger {
    border-color: #f3d0cd;
    border-left-color: #c0392b;
    background: #fdf5f4;
    color: #7a1f16;
}

.decision-dialog-callout ul {
    margin: .4rem 0 0;
    padding-left: 1.1rem;
}

.decision-dialog-callout-aside {
    margin-top: .35rem;
    color: #6b7280;
}

.decision-dialog-callout .form-check {
    margin-bottom: 0;
}

.decision-dialog-list {
    margin: 0;
    padding-left: 1.1rem;
    color: #374151;
    font-size: .875rem;
    line-height: 1.6;
}

.decision-dialog-list ul {
    padding-left: 1.1rem;
    color: #6b7280;
}

.decision-dialog .form-label,
.decision-dialog .control-label,
.decision-dialog label:not(.form-check-label) {
    margin-bottom: .35rem;
    color: #374151;
    font-size: .875rem;
    font-weight: 600;
}

.decision-dialog textarea.form-control {
    min-height: 6.5rem;
    font-size: .9375rem;
}

.decision-dialog-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #eef1f4;
}

@media (max-width: 575.98px) {
    .decision-dialog-foot > .btn {
        flex: 1 1 auto;
    }
}

/* the dialog's own Close sits beside the decision, so the frame's footer (Close alone) goes */
#mainModal .modal-content:has(.decision-dialog-foot) > .modal-footer {
    display: none;
}

.modal-body .decision-dialog-foot {
    margin-bottom: -.25rem;
}

/* buttons made elsewhere with margins of their own (the basic stage's m-2) line up in the row */
.decision-dialog-foot > .btn {
    margin: 0 !important;
}

/* fees not set up on a payment: a short lead, then the items listed under their laboratory */
.payment-fees-missing > p { margin: 0; }
.payment-fees-missing-lead .fa { margin-right: .35rem; }
.payment-fees-missing-office {
    margin-top: .65rem;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    opacity: .8;
}
.payment-fees-missing-list {
    margin: .3rem 0 0;
    padding-left: 1.25rem;
    columns: 2 16rem;
    column-gap: 2rem;
}
.payment-fees-missing-list > li { break-inside: avoid; padding: .1rem 0; }
.payment-fees-missing-foot { margin-top: .65rem !important; font-size: .875rem; }

/* the count and the page buttons under a table: side by side while they fit, on phones the count
 * on a line of its own above the buttons, which wrap instead of running off the card */
.backend-table-foot {
    flex-wrap: wrap;
    gap: .5rem .75rem;
}

.backend-table-widget .pagination {
    flex-wrap: wrap;
}

.backend-table-foot .pagination {
    margin: 0;
}

@media (max-width: 575.98px) {
    .backend-table-foot {
        flex-direction: column;
        align-items: center !important;
    }

    .backend-table-foot .pagination {
        justify-content: center;
    }
}

/* ---- focus mode on the stage page (layouts/process.php) ---------------------------------------
 * whoever works on a stage can leave only its work on the page: the menu, the header, the steps and
 * the side column go, and the side column opens over the work from "Details". The class is on <html>,
 * put there before the page is drawn (the choice is kept in the browser). */
.stage-focus-tools {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}

.stage-focus-tools .btn {
    white-space: nowrap;
}

.stage-focus-on,
.stage-focus-details-toggle,
.stage-focus-details-head {
    display: none;
}

html.stage-focus .stage-focus-off {
    display: none;
}

html.stage-focus .stage-focus-on,
html.stage-focus .stage-focus-details-toggle {
    display: inline-block;
}

html.stage-focus .app-sidebar,
html.stage-focus .backend-admin-sidebar-overlay,
html.stage-focus .app-header,
html.stage-focus .app-footer,
html.stage-focus .app-bottom-nav,
html.stage-focus .backend-admin-banner-slim,
html.stage-focus .process-stage-steps {
    display: none !important;
}

/* the room of the menu goes with it */
html.stage-focus .app-wrapper {
    display: block;
}

html.stage-focus .app-main-wrapper {
    margin-left: 0 !important;
    padding-bottom: 0;
}

html.stage-focus .process-content > .process-main-content {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
    padding-right: 0;
}

/* the side column waits beside the page and comes over the work when asked for */
html.stage-focus .process-side-column {
    position: fixed;
    top: 0;
    bottom: 0;
    right: -27rem;
    z-index: 1040;
    width: min(26rem, 92vw);
    max-width: none;
    padding: 0 .85rem 1rem;
    overflow-y: auto;
    background: #fff;
    border-left: 1px solid var(--admin-shell-border, #dbe4ee);
    box-shadow: -12px 0 28px -16px rgba(15, 23, 42, .35);
    visibility: hidden;
    transition: right .2s ease, visibility 0s linear .2s;
}

html.stage-focus.stage-focus-details .process-side-column {
    right: 0;
    visibility: visible;
    transition: right .2s ease;
}

html.stage-focus .stage-focus-details-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -.85rem .5rem;
    padding: .7rem .85rem;
    background: #fff;
    border-bottom: 1px solid var(--admin-shell-border, #dbe4ee);
    font-weight: 600;
    color: var(--admin-shell-heading, #173f65);
}

@media (prefers-reduced-motion: reduce) {
    html.stage-focus .process-side-column {
        transition: none;
    }
}

@media print {
    .stage-focus-tools {
        display: none;
    }
}

/* no header to stay under: the worksheet's bar holds at the top of the screen */
html.stage-focus .app-main .results-worksheet-toolbar {
    top: 0;
}
/* ---- stage dates behind the header's timing badges (layouts/process.php) ---------------------
 * the badges open the started / picked up / due line and any reasons for delay, kept off the stage card */
.process-page-title-bar .timing-badges-menu {
    margin-left: auto;
    flex-shrink: 0;
}

.process-page-title-bar .timing-badges-menu > .timing-badges-row {
    margin-left: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
}

.process-page-title-bar .timing-badges-menu > button.timing-badges-row {
    cursor: pointer;
    border-radius: .375rem;
}

.process-page-title-bar .timing-badges-menu > button.timing-badges-row:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.timing-badges-caret {
    color: #64748b;
    font-size: .75rem;
    transition: transform .15s;
}

.timing-badges-row[aria-expanded="true"] .timing-badges-caret {
    transform: rotate(180deg);
}

.timing-badges-dates {
    width: min(26rem, calc(100vw - 2rem));
    padding: .75rem .9rem;
}

.timing-badges-dates .stage-due {
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

@media (max-width: 768px) {
    .process-page-title-bar .timing-badges-menu {
        flex-basis: 100%;
        margin-left: 0;
    }
}

/* ---- sidebar and drawer alignment ---------------------------------------------------------- */

/* The header is a 60px bar inside AdminLTE's .5rem navbar padding. */
.backend-admin-shell {
    --backend-admin-header-height: calc(60px + 1rem);
    --backend-admin-rail-width: 5.4rem;
}

/* The menu button and the search icon at the size of the bell beside them (they were 14px). */
.backend-admin-header [data-lte-toggle="sidebar"] > i {
    font-size: 1.25rem;
    line-height: 1;
}

.backend-admin-header-tools .nav-link > .bi-search {
    font-size: 1.1rem;
}

/* AdminLTE adds a backdrop of its own to .app-wrapper. The staff system has its own
   (#backend-admin-sidebar-overlay), so the two darkened the page twice, and AdminLTE's one,
   absolute and page-tall, was also a stray grid item on wide screens. */
.backend-admin-shell > .sidebar-overlay {
    display: none;
}

@media (min-width: 992px) {
    /* The brand row is as tall as the header, so their bottom lines meet. It was AdminLTE's
       3.5rem with overflow hidden, which also clipped the 60px brand link in it. */
    .backend-admin-sidebar {
        display: flex;
        flex-direction: column;
    }

    .backend-admin-sidebar .sidebar-brand.backend-admin-brand {
        flex: 0 0 auto;
        height: var(--backend-admin-header-height);
        padding-top: 0;
        padding-bottom: 0;
    }

    .backend-admin-sidebar .backend-admin-brand .brand-link {
        min-height: 0;
        height: 100%;
        align-items: center;
    }

    /* the menu takes the rest of the height and scrolls in it */
    .backend-admin-sidebar .sidebar-wrapper {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
    }

    /* Collapsed rail. AdminLTE keeps every link 3.6rem wide but the menu had only 34px between
       the wrapper's and the nav's padding, so links ran past the rail's edge and icons sat off
       centre. The rail is now as wide as puts each icon where it is in the open sidebar
       (wrapper 8px + nav .7rem + link .75rem + half the 24px icon), so nothing moves on hover. */
    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar {
        min-width: var(--backend-admin-rail-width);
        max-width: var(--backend-admin-rail-width);
    }

    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar:not(:hover) .backend-admin-nav {
        padding-left: 0;
        padding-right: 0;
    }

    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar:not(:hover) .sidebar-menu .nav-link {
        width: 3rem;
        margin-left: auto;
        margin-right: auto;
        padding-left: 0;
        padding-right: 0;
        justify-content: center;
    }

    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar:not(:hover) .sidebar-menu .nav-link > .nav-icon {
        margin: 0;
    }

    /* the hidden label kept its 8px padding and pulled the icon off the link's centre */
    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar:not(:hover) .sidebar-menu .nav-link > p {
        display: none;
    }

    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar:not(:hover) .backend-admin-pin-toggle {
        display: none;
    }

    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar:not(:hover) .backend-admin-brand .brand-link {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
        justify-content: center;
    }

    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar:not(:hover) .backend-admin-brand .brand-image {
        margin: 0;
    }

    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar:not(:hover) .backend-admin-brand .brand-text {
        display: none;
    }

    /* Pointing at the rail opens it over the page. The sidebar is a grid item, so it used to
       widen its column and push the whole page right and back on every pass of the mouse;
       the negative margin keeps the column at the rail's width. */
    body.sidebar-mini.sidebar-collapse .backend-admin-sidebar:hover {
        margin-right: calc(var(--backend-admin-rail-width) - var(--lte-sidebar-width, 250px));
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.25);
        /* over the demo banner (1050), as the phone drawer is */
        z-index: 1052;
    }
}

/* Where the shortcuts are in "More", the divider that followed them has nothing to divide, and
   the tools keep to the right end on their own. */
@media (max-width: 1279.98px) {
    .backend-admin-header-shortcuts + .backend-admin-header-tools {
        margin-left: auto !important;
        padding-left: 0;
        border-left: 0;
    }
}

@media (max-width: 767.98px) {
    /* the account is its round icon alone: the caret beside it took room from the name */
    .backend-admin-user-menu > .dropdown-toggle::after {
        display: none;
    }

    /* the 56px phone bar custom.css meant, not the desktop 60px */
    .backend-admin-header-bar {
        min-height: 56px;
    }

    /* The name takes the room beside the menu button; it was cut at 9rem ("ZBS iSQ…")
       with half the bar empty. The quick tools button stays at the right end. */
    .backend-admin-header-bar > .backend-admin-header-nav:first-child {
        flex: 1 1 auto;
        min-width: 0;
    }

    .backend-admin-header-brand-item {
        flex: 1 1 auto;
        min-width: 0;
    }

    .backend-admin-header-brand {
        max-width: 100%;
        min-width: 0;
    }

    /* The bell and the account stay in the bar, beside "More" (search, help). They used to sit
       with search and help in a second row behind a grid button, so a new notification was
       out of sight. */
    .backend-admin-header > .backend-admin-header-bar {
        flex-wrap: nowrap;
    }

    .backend-admin-header .backend-admin-mobile-tools {
        flex: 0 0 auto;
        width: auto;
        max-height: none;
        overflow: visible;
        opacity: 1;
        padding-top: 0;
        border-top: 0;
        gap: .1rem;
    }

    .backend-admin-header .backend-admin-mobile-tools .nav-link {
        padding-left: .5rem;
        padding-right: .5rem;
    }
}

@media (max-width: 399.98px) {
    .backend-admin-header .backend-admin-mobile-tools .nav-link {
        padding-left: .35rem;
        padding-right: .35rem;
    }
}
