/* Shared LIFE layout for phones and narrow tablets. */
@media (max-width: 850px) {
    .shell > main,
    .shell > main > header > div,
    .shell .header-actions,
    .shell .form-grid > *,
    .shell .panel,
    .shell .card {
        min-width: 0;
    }

    .shell .header-actions,
    .shell main > header,
    .shell .customer-header .actions {
        flex-wrap: wrap;
    }

    .shell .header-actions .button,
    .shell .customer-header .actions .button {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .shell .table-wrap,
    .shell .table-scroll,
    .ir-page .ir-workspace .table {
        max-width: 100%;
        overflow-x: auto;
    }

    .sales-shell .row {
        grid-template-columns: minmax(0, 1fr);
    }

    .sales-shell .row > div {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .sales-shell .row .actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .ir-page.ir-nav-open .shell > .sidebar {
        inset-inline: auto;
        max-height: 70dvh;
        overflow-y: auto;
        overscroll-behavior-y: contain;
    }

    .ir-page.ir-nav-open .sidebar nav {
        overflow: visible;
    }
}

@media (max-width: 720px) {
    .shell main > header {
        column-gap: 10px;
        row-gap: 8px;
    }

    .shell main > header .header-actions {
        max-width: 100%;
    }

    .shell button.menu-button {
        min-width: 44px;
        min-height: 44px;
    }

    body:not(.ir-page) .shell > .sidebar.open {
        position: fixed;
        z-index: 70;
        inset-block: 0;
        inset-inline: 0 auto;
        width: min(290px, calc(100vw - 38px));
        height: auto;
        max-height: 100dvh;
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior-y: contain;
    }

    body:not(.ir-page) .shell > .sidebar.open nav {
        flex: 1 1 auto;
        min-height: 0;
    }

    dialog:not(.kd-float-dialog) {
        max-width: calc(100% - 20px);
        max-height: calc(100dvh - 20px);
    }

    dialog .modal-card,
    dialog.modal-card {
        padding: clamp(10px, 4vw, 20px);
    }

    dialog .modal-card > header,
    dialog .modal-card > footer {
        flex-wrap: wrap;
    }

    dialog .form-grid > *,
    dialog input:not([type=checkbox]):not([type=radio]),
    dialog select,
    dialog textarea {
        min-width: 0;
        max-width: 100%;
    }

    dialog input:not([type=checkbox]):not([type=radio]),
    dialog select,
    dialog textarea {
        font-size: max(16px, 1em);
    }

    #quoteModal .quote-scroll {
        padding-inline: 12px;
    }

    .mail-shell .bulk-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mail-shell .message-content,
    .warehouse-shell .warehouse-row,
    .import-shell .mapping-row {
        overflow-wrap: anywhere;
    }
}

.kd-mobile-sidebar-close {
    display: none;
}

@media (max-width: 720px) {
    .shell > .sidebar.open > .kd-mobile-sidebar-close {
        display: block;
    }
}

@media (max-width: 850px) {
    .ir-page.ir-nav-open .shell > .sidebar > .kd-mobile-sidebar-close {
        display: block;
    }
}

.kd-mobile-sidebar-close {
    align-self: flex-end;
    min-height: 44px;
    margin-bottom: 8px;
    padding: 6px 12px;
    border: 1px solid currentColor;
    border-radius: 8px;
    color: inherit;
    background: transparent;
    font: inherit;
}
