/*
   Laptop screens: 1366 x 633 and 1280 x 665 browser viewports (1366 x 768 / 1280 x 800 screens).
   Loaded on every page after the other stylesheets. Wider and taller screens are not affected: every rule sits in
   a max-width / max-height media query, apart from the filter pop-up fit (it only acts when a pop-up would be cut off).
*/

/* ------------------------------------------------------------------------------------------------ pop-ups */
/* A pop-up taller than the screen scrolls inside, so its title and Save / Cancel buttons stay reachable. */
@media (max-height: 800px) {
    .modal-dialog {
        margin-top: 8px;
        margin-bottom: 8px;
    }

    .modal-dialog:not(.modal-fullscreen) .modal-content {
        max-height: calc(100vh - 16px);
    }

    /* a pop-up built without a .modal-body (Call Details on Call Logs) scrolls as a whole instead of spilling its
       lower sections and buttons out of the box */
    .modal-dialog:not(.modal-fullscreen) .modal-content:not(:has(> .modal-body)) {
        overflow-y: auto;
    }

    .modal-dialog:not(.modal-fullscreen) .modal-content:not(:has(> .modal-body)) > * {
        flex-shrink: 0;
    }

    .modal-dialog:not(.modal-fullscreen) .modal-body {
        overflow-y: auto;
        min-height: 0;
    }

    .modal-dialog-centered {
        min-height: calc(100% - 16px);
    }

    .e-dialog:not(.e-dlg-fullscreen) {
        max-height: calc(100vh - 16px) !important;
    }

    .e-dialog .e-dlg-content {
        overflow-y: auto;
    }

    .swal2-popup {
        max-height: calc(100vh - 16px);
        overflow-y: auto;
    }
}

/* ------------------------------------------------------------------------------------------------ page chrome */
/* Short screens: less padding around the page so more rows fit. */
@media (max-height: 700px) {
    .dashboard__content {
        padding-top: 8px !important;
    }

    .dashboard__tableHead {
        margin-bottom: 6px !important;
    }

    .cis-grid-note {
        margin-bottom: 4px;
        padding: 3px 8px;
    }
}

/* Narrow laptop screens: header actions and page toolbars wrap instead of pushing the page sideways. */
@media (max-width: 1366px) {
    .dashboard__header .dashboard__headerTitle {
        font-size: 1.25rem;
    }

    .dashboard__tableHead {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .e-grid .e-toolbar .e-toolbar-items {
        flex-wrap: wrap;
    }
}

/* ------------------------------------------------------------------------------------------------ dashboards */
@media (max-height: 760px) {
    .kd .kd-head {
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .kd .kd-title {
        font-size: 20px;
    }

    .kd .kd-sticky {
        padding-bottom: 8px;
    }

    .kd .kd-kpi {
        padding: 10px 12px;
    }
}

@media (max-width: 1366px) {
    .kd .kd-head__actions {
        gap: 6px;
    }

    .kd .kd-head__actions .kd-btn {
        padding-left: 10px;
        padding-right: 10px;
    }

    .kd .kd-kpis {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }
}
