@media (max-width: 1199.98px) {

}

@media (max-width: 991.98px) {

    /* The "body" qualifier isn't semantically needed (.left-sidebar is unique) - it's here purely to
       outrank Bootstrap's own .z-2 utility class stamped on this element in the markup (also
       !important, same specificity as a bare .left-sidebar, so the tiebreak came down to source
       order and Bootstrap was winning). That let .sidebar-overlay (z-index 10) end up ABOVE the open
       mobile menu, silently swallowing every tap on it - the menu looked open but nothing inside it
       was clickable. One extra type-selector qualifier raises this rule's specificity past a plain
       class selector, so it wins outright regardless of !important vs. !important source order. */
    body .left-sidebar {
        position: fixed;
        z-index: 11 !important;
        top: 136px;
        /* height:100% (of the viewport, since position:fixed) plus top:136px pushed the box's
           own bottom edge 136px past the screen - with no scrollbar of its own and page scroll
           locked (body.no-scroll) while open, every link below the fold was simply unreachable.
           Subtracting the top offset keeps the box on-screen; overflow-y is the safety net so a
           tall menu (many groups expanded) scrolls internally instead of overflowing again. */
        height: calc(100% - 136px);
        overflow-y: auto;
        left: -250px;
        /* Transitioning `left` while `position` itself flips (relative -> fixed) at this
           same breakpoint leaves the browser stuck mid-transition -- CSS transitions take
           cascade priority over everything, including !important, while active. Disabling
           it here only affects the mobile slide-in; the desktop collapse animation
           (.layout-fullwidth .left-sidebar in styles.css) is untouched. */
        transition: none;
    }

    body.open .left-sidebar {
        left: 0;
        padding: 24px;
        width: 245px;
        transition: none;
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        z-index: 10;
    }

    body.open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .content-area {
        min-width: 100%;
    }

    /* Page Heading */
    .page-heading .welcome-text p {
        font-size: 14px;
    }

    /* Modules */
    .page-modules .module-item .module-title {
        font-size: 16px;
    }
    .page-modules .module-item .module-box{
        padding: 26px;
    }
}

/* Master-detail pages (a fixed-width sidebar list + a detail pane sharing one flex row - Process
   Expiry Detail, Templates, ...) work fine down to tablet width, but the sidebar's fixed pixel
   width doesn't shrink, squeezing the detail pane into an unusably narrow sliver on a phone.
   Stacking the row (sidebar full-width on top, detail pane below) is the standard responsive
   pattern for this layout shape - !important overrides the pages' own inline `style="width:...px"`,
   which otherwise beats a plain class selector regardless of media query. */
@media (max-width: 767.98px) {
    .master-detail-row {
        flex-direction: column !important;
        overflow: visible !important;
        height: auto !important;
    }

    .master-detail-sidebar {
        width: 100% !important;
        max-height: 220px;
        overflow-y: auto !important;
        border-right: none !important;
        border-bottom: 1px solid var(--bs-border-color, #e5e7eb);
        padding-right: 0 !important;
        padding-bottom: 12px;
        margin-bottom: 12px;
    }
}

@media (max-width: 767.98px) {

    /* Header */
    .header .logo {
        width: 120px;
        padding-right: 16px;
    }

    .header .logo img {
        max-width: 90px;
    }
    .header .logo small{
        font-size: 10px;
        line-height: normal;
    }

    .header .dropdown-menu.notifications {
        width: 300px;
        overflow-y: auto;
    }

    .header .dropdown-menu.notifications a {
        width: 276px;
    }

    .page-breadcrumbs {
        top: 61px;
    }

    .page-breadcrumbs .back-btn {
        min-width: auto;
        padding-right: 16px;
    }
    .page-name{
        font-size: 16px;
    }

    /* Modules */
    .left-sidebar {
        top: 104px;
        height: calc(100% - 104px);
    }
    body.open .left-sidebar {
        width: 280px;
    }
    .left-sidebar .nav-sidebar{
        width: 100%;
    }

    .login-container > .row{
        height: 100vh;
    }

    /* table list and mobile grid view */
    .table-row-grid tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 5px;
        padding: 16px 0;
    }

    .table-row-grid tr td {
        width: 100%;
        text-align: center;
    }

    .event-list tr td img {
        width: 330px !important;
    }
}