/* styles of the Tabler frame (themes/modern/views/layouts/back_end.php) */

/*
 * Tabler moves the whole page to the right by the width of the page scrollbar (made for centred layouts); with the side menu fixed
 * at the left edge that opened a strip between menu and content on long pages. The page stays at the left edge instead,
 * and the place of the scrollbar is always kept free, so the content has the same width on short and on long pages
 */
:root {
    margin-left: 0;
    scrollbar-gutter: stable;
}
/* while a modal is open the page does not scroll and the place of the scrollbar is dimmed with the rest; the page keeps its width by the same measure as padding
   (the frame script notes it; the modal script itself sees no scrollbar on a short page and would let the page widen) */
:root:has(body.modal-open) {
    scrollbar-gutter: auto;
}
body.modal-open {
    padding-right: var(--page-scrollbar-width, 0) !important;
}

/* the content stands as far from the header as from the side menu and the right edge (Tabler leaves more room on top) */
.page-body {
    margin-top: 1rem;
}

/* loading line at the top of the screen for every Pjax request */
#mcp-pjax-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    opacity: 0;
    background-color: var(--tblr-primary);
    z-index: 100000;
    transition: width 4s ease-out, opacity 0.25s ease-out;
}
#mcp-pjax-progress.mcp-pjax-progress-active {
    width: 90%;
    opacity: 1;
    transition: width 4s ease-out, opacity 0s;
}
#mcp-pjax-progress.mcp-pjax-progress-done {
    width: 100%;
    opacity: 0;
    transition: width 0.2s ease-out, opacity 0.3s ease-out 0.15s;
}
[data-spa-viewport] {
    transition: opacity 0.15s ease;
}

/* side menu: Tabler's own width. Marked important: a part of a page loaded later
   (a tab, a grid) brings Tabler's stylesheet along for a moment, and its width would make the menu shrink and grow back */
:root {
    --tblr-sidebar-width: 16rem !important;
}
/* side menu: a thin line under the company name and between the main items and the account items */
.sidebar-menu > .sidebar-menu-divider {
    width: 80%;
    margin: 6px auto;
    border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}
/* the line under the company name is thicker and ends level with the bottom edge of the header */
.sidebar-menu > .sidebar-menu-divider:first-child {
    margin-top: -8px;
    border-top-width: 2px;
}
.navbar-vertical .navbar-brand {
    flex-shrink: 0;
    height: 3.375rem;
    position: relative;
}
/* the gradient covers the line on the right edge of the side menu, so the block draws its own: as thick as the line under the company name and 70% of the block high */
.navbar-vertical .navbar-brand::after {
    content: "";
    position: absolute;
    top: 15%;
    right: 0;
    height: 70%;
    border-right: 2px solid color-mix(in srgb, currentColor 15%, transparent);
}
/* side menu: the current page is marked with a lighter background next to the line on the left, its icon and name in the accent colour */
.sidebar-menu > .nav-item.active {
    background-color: color-mix(in srgb, currentColor 8%, transparent);
}
.sidebar-menu > .nav-item.active > .nav-link,
.sidebar-menu > .nav-item.active > .nav-link .nav-link-icon {
    color: var(--tblr-primary);
    font-weight: 600;
}
/* in the dark theme the accent is too dark to read as text, so the current menu item and the tab in use take a lighter shade of it */
[data-bs-theme="dark"] .sidebar-menu > .nav-item.active > .nav-link,
[data-bs-theme="dark"] .sidebar-menu > .nav-item.active > .nav-link .nav-link-icon,
[data-bs-theme="dark"] .card-header-tabs .nav-link.active {
    color: oklch(from var(--tblr-primary) calc(l + .2) c h);
}
/* side menu: a long item text is cut instead of pushing its icon out of the line of the other icons */
.sidebar-menu .nav-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}
.sidebar-menu .nav-link-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* side menu: the arrow of an item with a submenu points to the right, where its popup opens */
.sidebar-menu .dropdown-toggle:after {
    transform: rotate(-135deg);
}
.sidebar-collapsed-brand {
    display: none;
}
/* side menu on narrow screens: no popups, the submenu links stand under their item */
@media (max-width: 991.98px) {
    .sidebar-menu > .dropdown > .dropdown-menu {
        display: block;
    }
    .navbar-vertical.navbar-expand-lg .navbar-collapse .sidebar-menu .sidebar-popup-heading {
        display: none;
    }
}
@media (min-width: 992px) {
    /* side menu: it scrolls without a scrollbar, so the items reach its edge and the mouse gets from an item into its popup without leaving the item */
    .navbar-vertical.navbar-expand-lg,
    .navbar-vertical.navbar-expand-lg .navbar-collapse {
        scrollbar-width: none;
        overflow-x: hidden;
    }
    /* collapsing and expanding the side menu slides, in the time and pace of the Classic theme: the menu, the page beside it and the item names */
    .navbar-vertical.navbar-expand-lg {
        transition: width 0.3s ease-in-out;
    }
    .navbar-vertical.navbar-expand-lg ~ .navbar,
    .navbar-vertical.navbar-expand-lg ~ .page-wrapper {
        transition: margin-left 0.3s ease-in-out;
    }
    .navbar-vertical.navbar-expand-lg .navbar-collapse .sidebar-menu .nav-link {
        transition: padding-left 0.3s ease-in-out;
    }
    .sidebar-menu .nav-link-title,
    .sidebar-menu .dropdown-toggle:after {
        transition: opacity 0.3s ease-in-out;
    }
    /* side menu: while the mouse is over an item with a submenu, the submenu is a popup right next to the item, over the page */
    .navbar-vertical.navbar-expand-lg .navbar-collapse .sidebar-menu > .nav-item > .dropdown-menu {
        position: fixed;
        padding: 0 0 0 10px;
        animation: sidebar-popup-fade-in 0.3s;
    }
    .sidebar-menu > .dropdown:hover > .dropdown-menu,
    .sidebar-collapse .sidebar-menu > .nav-item:hover > .dropdown-menu {
        display: block;
    }
    @keyframes sidebar-popup-fade-in {
        from {
            opacity: 0;
        }
    }
    /* the item stays highlighted while its popup is open */
    .sidebar-menu > .nav-item:hover > .nav-link {
        background-color: color-mix(in srgb, currentColor 6%, transparent);
        color: var(--tblr-navbar-active-color);
    }
    .sidebar-popup {
        position: relative;
        min-width: 15rem;
        padding: 0.25rem 0;
        /* see-through like the popup of the Classic theme (opacity 0.85), but only the background, so the text stays sharp */
        background: color-mix(in srgb, var(--tblr-bg-surface) 85%, transparent);
        border: 1px solid var(--tblr-border-color);
        border-radius: var(--tblr-border-radius);
        box-shadow: var(--tblr-dropdown-box-shadow);
    }
    /* the pointer of the popup, towards its item */
    .sidebar-popup::before {
        content: "";
        position: absolute;
        top: 14px;
        left: -6px;
        width: 10px;
        height: 10px;
        background: inherit;
        border-left: inherit;
        border-bottom: inherit;
        transform: rotate(45deg);
    }
    .navbar-vertical.navbar-expand-lg .navbar-collapse .sidebar-menu .sidebar-popup > .dropdown-item {
        padding-left: 1rem;
    }
    /* a small circle marks every submenu link and fills while the mouse is over the link */
    .sidebar-popup > .dropdown-item:not(.sidebar-popup-heading)::before {
        content: "";
        flex-shrink: 0;
        width: 10px;
        height: 10px;
        margin-right: 10px;
        border: 2px solid var(--tblr-secondary);
        border-radius: 50%;
    }
    .sidebar-popup > .dropdown-item:hover::before {
        border-color: var(--tblr-primary);
        background-color: var(--tblr-primary);
    }
    /* the name of the item heads its popup only in the collapsed side menu, where the name is not in the menu itself */
    .navbar-vertical.navbar-expand-lg .navbar-collapse .sidebar-menu .sidebar-popup-heading {
        display: none;
        font-weight: 600;
    }
    .sidebar-collapse .navbar-vertical.navbar-expand-lg .navbar-collapse .sidebar-menu .sidebar-popup-heading {
        display: flex;
    }
    /* collapsed side menu: a narrow strip with the icons, the page takes the freed width */
    .sidebar-collapse .navbar-vertical.navbar-expand-lg {
        width: 4rem;
    }
    .sidebar-collapse .navbar-vertical.navbar-expand-lg ~ .navbar,
    .sidebar-collapse .navbar-vertical.navbar-expand-lg ~ .page-wrapper {
        margin-left: 4rem;
    }
    .sidebar-collapse .sidebar-menu .nav-link-title,
    .sidebar-collapse .sidebar-menu .dropdown-toggle:after {
        opacity: 0;
    }
    .sidebar-collapse .sidebar-expanded-brand {
        display: none;
    }
    .sidebar-collapse .sidebar-collapsed-brand {
        display: inline;
    }
    .sidebar-collapse .navbar-vertical.navbar-expand-lg .navbar-brand {
        padding-left: 0 !important;
        padding-right: 0 !important;
        text-align: center !important;
        text-overflow: clip;
    }
    /* the icons stand in the middle of the strip */
    .sidebar-collapse .navbar-vertical.navbar-expand-lg .navbar-collapse .sidebar-menu .nav-link {
        padding-left: 0.75rem;
    }
}

/* header: an item stays hidden until its counter has something to show, the shared notifications code shows it then */
#navbar-right-menu > li {
    display: none;
}
/* header: the dark / light switch and the thin lines beside it are always shown (the other items wait for their counter) */
#navbar-right-menu > li.vr,
#navbar-right-menu > li.confetti-button,
#navbar-right-menu > li.color-mode-switch {
    display: block;
}
#navbar-right-menu > li.vr {
    width: 2px;
    min-height: 1.5rem;
    align-self: center;
    opacity: 0.4;
}
/* header: the small arrow after a counter and after the user name, as in the Classic header */
#navbar-right-menu > li > .nav-link > .header-list-arrow {
    margin-left: 0.25rem;
    font-size: 0.875rem;
}
/* header: the item under the mouse, and the one whose list is open, is marked */
#navbar-right-menu > li.dropdown:hover > .nav-link,
#navbar-right-menu > li.dropdown.open > .nav-link {
    background-color: color-mix(in srgb, currentColor 8%, transparent);
}

/* header counters: the badge stands in the line of the label instead of floating over it */
#navbar-right-menu > li > .nav-link > .badge {
    position: static;
    transform: none;
}
#navbar-right-menu > li > .nav-link > .ti {
    font-size: 1.25rem;
    vertical-align: middle;
}
/* counter lists: the measures, the order and the behaviour of the Classic lists, in Tabler colours */
#navbar-right-menu > li > .dropdown-menu {
    top: 100%;
    right: 0;
    left: auto;
    width: 17.5rem;
    padding: 0;
    opacity: 0.95;
}
#navbar-right-menu > li > .dropdown-menu > li.header {
    padding: 0.4375rem 0.625rem;
    border-bottom: 1px solid var(--tblr-border-color);
}
/* the row under a counter list and the footer of the page are named "footer" too, which the Classic stylesheet paints as a light grey bar */
#navbar-right-menu > li > .dropdown-menu > li.footer,
footer.footer {
    height: auto;
    background-color: transparent;
}
footer.footer {
    padding: 1rem 0;
    border-top: 1px solid var(--tblr-border-color);
}
#navbar-right-menu > li > .dropdown-menu > li.footer {
    padding: 0;
}
#navbar-right-menu > li > .dropdown-menu > li.footer > a {
    display: block;
    padding: 0.4375rem 0.625rem;
    color: inherit;
    font-size: 0.75rem;
    text-align: center;
    text-decoration: none;
}
/* a counter row that is coloured by its urgency keeps its light colour in the dark look, so its text stays dark */
#navbar-right-menu ul.menu > li[style*="background"] > a,
#navbar-right-menu ul.menu > li[style*="background"] > a > h4 {
    color: #1f2937;
}
#navbar-right-menu ul.menu {
    max-height: 600px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}
#navbar-right-menu ul.menu > li > a {
    display: block;
    padding: 0.625rem;
    overflow: hidden;
    border-bottom: 1px solid var(--tblr-border-color);
    color: inherit;
    text-decoration: none;
}
#navbar-right-menu ul.menu > li > a:hover,
#navbar-right-menu > li > .dropdown-menu > li.footer > a:hover {
    background-color: color-mix(in srgb, currentColor 6%, transparent);
}
/* the time stands in the top right corner of the row, the title starts on the left */
#navbar-right-menu ul.menu > li > a > h4 {
    position: relative;
    margin: 0;
    color: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.1;
}
#navbar-right-menu ul.menu > li > a > h4 > small {
    position: absolute;
    top: 0;
    right: 0;
    color: var(--tblr-secondary);
    font-size: 0.625rem;
    font-weight: normal;
}
#navbar-right-menu ul.menu > li > a > p {
    margin: 0;
    overflow: hidden;
    color: var(--tblr-secondary);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/*
 * Tabs. The pages still write tabs the Bootstrap 3 way (ul.nav-tabs > li[.active] > a, panes .tab-pane[.active.in]),
 * here that markup gets the look of Tabler tabs
 */
.nav-tabs > li > a {
    display: block;
    padding: var(--tblr-nav-link-padding-y) var(--tblr-nav-link-padding-x);
    margin-bottom: calc(-1 * var(--tblr-nav-tabs-border-width));
    border: var(--tblr-nav-tabs-border-width) solid transparent;
    border-top-left-radius: var(--tblr-nav-tabs-border-radius);
    border-top-right-radius: var(--tblr-nav-tabs-border-radius);
    color: var(--tblr-secondary);
    text-decoration: none;
    cursor: pointer;
}
.nav-tabs > li > a:hover {
    border-color: var(--tblr-nav-tabs-link-hover-border-color);
    color: var(--tblr-body-color);
}
.nav-tabs > li.active > a {
    border-color: var(--tblr-nav-tabs-link-active-border-color);
    border-bottom-color: transparent;
    background: var(--tblr-bg-surface);
    color: var(--tblr-nav-tabs-link-active-color);
    font-weight: 600;
}
/* a button at the end of the tab row */
.nav-tabs > li.pull-right {
    margin-left: auto;
}
.tab-pane.fade.in {
    opacity: 1;
}
/* kartik tabs repeat the names of the tabs above the panes, for printing only */
@media screen {
    .tab-content > .visible-print-block {
        display: none;
    }
}
/* tabs standing on the left of their content (kartik tabs) */
.tabs-left > .nav-tabs {
    flex-direction: column;
    border-right: var(--tblr-nav-tabs-border-width) solid var(--tblr-nav-tabs-border-color);
}
.tabs-left > .nav-tabs > li > a {
    margin: 0 calc(-1 * var(--tblr-nav-tabs-border-width)) 2px 0;
    border-radius: var(--tblr-nav-tabs-border-radius) 0 0 var(--tblr-nav-tabs-border-radius);
}
.tabs-left > .nav-tabs > li > a:hover {
    border-color: var(--tblr-nav-tabs-border-color) transparent var(--tblr-nav-tabs-border-color) var(--tblr-nav-tabs-border-color) !important;
}
.tabs-left > .nav-tabs > li.active > a,
.tabs-left > .nav-tabs > li.active > a:hover {
    border-color: var(--tblr-nav-tabs-border-color) var(--tblr-bg-surface) var(--tblr-nav-tabs-border-color) var(--tblr-nav-tabs-border-color) !important;
}
.tabs-left > .tab-content {
    border-left: 0;
    padding-left: 1rem;
}

/* footer breadcrumb: the items come without the Bootstrap 5 class, so the separator is added here */
.breadcrumb > li + li::before {
    content: "/";
    padding: 0 0.5rem;
    color: var(--tblr-secondary);
}

/* modals: as wide as in the Classic theme (600px, large 900px), the page behind dimmed and slightly blurred as there */
.modal {
    --tblr-modal-width: 600px;
}
@media (min-width: 992px) {
    .modal-lg {
        --tblr-modal-width: 900px;
    }
}
/* the colour and the blur belong to the backdrop in every state, so only its opacity changes while it fades in and out */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(1px);
}
.modal-backdrop.show {
    opacity: 1;
}
.modal-content {
    box-shadow: var(--tblr-shadow-dropdown);
}
/* confirmation modals come with the buttons of the Classic theme: the one marked for the left (Cancel, Close) stands on the left as in the forms, wherever it is in the row, and the action button on the right */
.modal-footer > .pull-left {
    order: -1;
    margin-right: auto;
}
/* the footer of a modal is as tall as its header: the buttons keep their size and their own margin, the footer gives up most of its padding */
.modal-footer {
    padding-block: .1875rem;
}
/* the icon of a footer button is drawn as tall as a capital letter of its text */
.modal-footer .btn .ti {
    font-size: 1.25rem;
}

/* settings: a time field is wide enough for the longest form the browser shows ("08:00 AM" and the clock) */
#time-from,
#time-to {
    min-width: 7.5rem;
}

/* help: the icons of the chapter list are as large as the icons of the side menu */
#help-spa .list-group-item > .ti {
    font-size: 1.25rem;
    vertical-align: middle;
    margin-right: 0.25rem;
}

/* help: the chapter in use and the title of the page are bold grey, not black */
#help-spa .list-group-item.active,
#help-spa .card-header .card-title {
    color: var(--tblr-secondary);
    font-weight: 700;
}

/* header and the block with the company name above the side menu: a soft tint of the main colour that fades out from top to bottom, in both colour modes */
header.navbar,
.navbar-vertical .navbar-brand {
    background: linear-gradient(to bottom, color-mix(in srgb, var(--tblr-primary) 16%, var(--tblr-bg-surface)) 10%, var(--tblr-bg-surface));
}

/* modal: the closing x is light red, gets a round grey background under the mouse and turns dark red while pressed */
.modal-header .btn-close {
    width: 2rem;
    height: 2rem;
    padding: 0;
    margin: 0;
    top: 0.75rem;
    inset-inline-end: 0.75rem;
    color: color-mix(in srgb, var(--tblr-red) 60%, var(--tblr-bg-surface));
    background-color: transparent;
    border-radius: 50%;
    opacity: 1;
    mask: none;
    transition: background-color 0.15s, color 0.15s;
}
.modal-header .btn-close::before {
    content: "";
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    background-color: currentColor;
    transform: none;
    mask: var(--tblr-btn-close-bg) no-repeat center / 0.875rem;
}
.modal-header .btn-close:hover {
    background-color: color-mix(in srgb, var(--tblr-body-color) 12%, transparent);
    opacity: 1;
}
.modal-header .btn-close:active {
    color: color-mix(in srgb, var(--tblr-red) 80%, black);
}

/* Customize: text size. Tabler measures text, spacing, buttons and fields from the size set here, so all of them follow */
[data-bs-theme-font-size="small"] {
    font-size: 87.5%;
}

[data-bs-theme-font-size="larger"] {
    font-size: 106.25%;
}

[data-bs-theme-font-size="large"] {
    font-size: 112.5%;
}


/* Customize: Inter and JetBrains Mono, served from the project so they look the same on every computer (latin letters, all weights in one file) */
@font-face {
    font-family: "Inter";
    src: url("../tabler/fonts/inter.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("../tabler/fonts/jetbrains-mono.woff2") format("woff2");
    font-weight: 100 800;
    font-display: swap;
}

[data-bs-theme-font="inter"],
.font-inter {
    --tblr-body-font-family: "Inter", var(--tblr-font-sans-serif);
    font-family: var(--tblr-body-font-family);
}

[data-bs-theme-font="jetbrains-mono"],
.font-jetbrains-mono {
    --tblr-body-font-family: "JetBrains Mono", var(--tblr-font-monospace);
    font-family: var(--tblr-body-font-family);
}

/* pictures of the old views carry a class name that Tabler uses for a box of fixed proportions; without this an empty space stood above them (the signature on a service order) */
img.img-responsive {
    padding-top: 0;
}

/* notices (setSiteWideAlert in _back_end_frame_js.php): Tabler's dismissible alerts in the top right corner, below the header and above modals */
#site-wide-alerts {
    z-index: 1090;
    width: 24rem;
    max-width: 100%;
}

/* buttons: every coloured button is Tabler's outline button (the values are those of its .btn-outline-* classes), on converted and
   not yet converted pages alike, in the pages and in the modals */
.btn:is(.btn-primary, .btn-info, .btn-success, .btn-danger, .btn-warning, .btn-secondary) {
    --tblr-btn-color: var(--tblr-btn-variant);
    --tblr-btn-bg: transparent;
    --tblr-btn-border-color: var(--tblr-btn-variant);
    --tblr-btn-hover-color: var(--tblr-btn-variant-fg);
    --tblr-btn-hover-border-color: transparent;
    --tblr-btn-hover-bg: var(--tblr-btn-variant);
    --tblr-btn-active-color: var(--tblr-btn-variant-fg);
    --tblr-btn-active-bg: var(--tblr-btn-variant-darken);
    --tblr-btn-active-border-color: var(--tblr-btn-variant-darken);
    --tblr-btn-disabled-color: var(--tblr-btn-variant);
    --tblr-btn-disabled-bg: transparent;
    --tblr-btn-disabled-border-color: var(--tblr-btn-variant);
    --tblr-btn-gradient: none;
    --tblr-btn-box-shadow: none;
}

/* a click on a button is seen: the button under the mouse is already filled, so the pressed one gets darker (above, and here for
   Tabler's own outline classes) and gives way a little */
.btn[class*="btn-outline-"] {
    --tblr-btn-active-bg: var(--tblr-btn-variant-darken);
    --tblr-btn-active-border-color: var(--tblr-btn-variant-darken);
}
.btn:active {
    transform: scale(.96);
}

/* user menu: the three dots under the last logins (link to all activity) have the size and the see-through grey hover they have in Classic */
#user-menu .btn-ghost-secondary {
    --tblr-btn-hover-bg: color-mix(in srgb, var(--tblr-secondary) 20%, transparent);
    --tblr-btn-hover-color: var(--tblr-btn-color);
    --tblr-btn-active-bg: color-mix(in srgb, var(--tblr-secondary) 35%, transparent);
    --tblr-btn-active-color: var(--tblr-btn-color);
    width: 78px;
    height: 23px;
    min-height: 0;
    padding: 0;
    font-size: 1.25rem;
}

/* tabs: the tabs of one row are all as wide as the widest of them (not the rows that also hold buttons or a search field, nor the tabs standing in a column);
   on a narrow screen they keep their own widths, so the row can wrap */
@media (min-width: 768px) {
    .nav-tabs:not(:has(> li > :not(a)), :has(> .pull-right), .tabs-left > *) {
        display: grid;
        grid-auto-columns: 1fr;
        grid-auto-flow: column;
        flex: none;
        width: max-content;
        max-width: 100%;
    }
    .nav-tabs:not(:has(> li > :not(a)), :has(> .pull-right), .tabs-left > *) > li > a {
        justify-content: center;
        text-align: center;
    }
}

/* the ISO icon of the MyCal+ icon font, written as any Tabler icon: ti ti-iso */
.ti.ti-iso {
    font-family: "mycalplus-icons" !important;
}
.ti-iso::before {
    content: "\e903";
}
