/* Shared portal layout. Keep wide tables and design canvases in their own scrollers. */
@media (max-width: 1199.98px) {
    #layout-menu .menu-item:has(> .portal-submenu-toggle) {
        position: relative;
    }

    #layout-menu .portal-submenu-toggle {
        position: absolute;
        inset-inline-end: .5rem;
        top: 0;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: .5rem;
        background: transparent;
        color: inherit;
        font-size: 1.25rem;
        cursor: pointer;
    }

    #layout-menu .menu-item:has(> .portal-submenu-toggle) > .menu-toggle::after {
        display: none;
    }

    #layout-menu .menu-item:has(> .portal-submenu-toggle) > .menu-toggle {
        padding-inline-end: 52px;
    }

    #layout-menu .menu-item.open > .portal-submenu-toggle i {
        transform: rotate(90deg);
    }
}

.portal-content,
.portal-content .row > *,
.portal-content .card,
.portal-content .card-body,
.portal-content .dataTables_wrapper,
.portal-content .dt-container {
    min-width: 0;
}

.portal-content .breadcrumb,
.portal-content .card-title,
.portal-content .client-info,
.portal-content .page-subtitle {
    overflow-wrap: anywhere;
}

.portal-content .table-responsive {
    max-width: 100%;
}

.portal-content .form-actions {
    flex-wrap: wrap;
}

.portal-content .create-grid > *,
.portal-content .field-row > *,
.portal-content .input-with-remove .form-control,
.portal-content .input-with-remove .form-select {
    min-width: 0;
}

.portal-content .back-btn,
.portal-content .btn-remove-field {
    flex-shrink: 0;
}

.inv-canvas-wrap {
    min-width: 0;
}

.inv-canvas-wrap > * {
    flex-shrink: 0;
}

.portal-auth .authentication-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
}

.portal-auth .authentication-inner {
    min-width: 0;
    max-width: 100%;
}

.portal-auth .otp-inputs {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.portal-auth .otp-inputs .form-control {
    width: 100% !important;
    min-width: 0;
    padding-inline: 0 !important;
}

@media (max-width: 991.98px) {
    /* All four builders share these classes. Preserve template dimensions for export. */
    .inv-builder {
        flex-direction: column;
        height: auto;
        margin-inline: 0;
        overflow: visible;
    }

    .inv-builder .inv-sidebar {
        width: 100%;
        min-width: 0;
        max-height: 45vh;
        max-height: 45dvh;
        border-inline: 0;
        border-bottom: 1px solid #e0e0e0;
    }

    .inv-builder .inv-canvas-wrap {
        flex: none;
        width: 100%;
        height: 60vh;
        height: 60dvh;
        min-height: 280px;
        max-height: 640px;
        padding: 12px;
    }
}

@media (max-width: 575.98px) {
    .portal-content .card-header,
    .portal-content .card-body {
        padding: 1rem;
    }

    .portal-content .form-actions > .btn {
        flex: 1 1 100%;
        min-width: 0;
    }

    .portal-content .dataTables_wrapper .dt-buttons,
    .portal-content .dt-container .dt-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: .5rem;
    }

    .portal-content .dataTables_filter label,
    .portal-content .dt-search {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: .5rem;
        max-width: 100%;
    }

    .portal-content .dataTables_filter input,
    .portal-content .dt-search input {
        width: auto;
        min-width: 0;
        max-width: 100%;
        flex: 1 1 8rem;
        margin-inline: 0;
    }

    .portal-content .pagination {
        flex-wrap: wrap;
        gap: .25rem;
    }

    #layout-navbar .dropdown-notifications .dropdown-menu {
        position: fixed;
        top: 64px;
        inset-inline: .5rem;
        width: auto;
        max-width: calc(100vw - 1rem);
    }

    #layout-navbar .dropdown-notifications .dropdown-header {
        flex-wrap: wrap;
        white-space: normal;
    }

    #layout-navbar .dropdown-notifications-list {
        max-height: calc(100dvh - 190px) !important;
    }

    .portal-auth .authentication-wrapper {
        padding-inline: .75rem;
    }

    .portal-auth .card-body {
        padding: 1rem;
        overflow-wrap: anywhere;
    }
}
