html .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

@media screen and (max-width: 890px) {
    body {
        min-height: 100vh;
        min-height: 100dvh;
    }

    :where(.container, main, section, .card, .card-body, .drawer-content,
           .form-control, .stats, .stat, .flex, .grid, .overflow-x-auto, .table-responsive) {
        min-width: 0;
        max-width: 100%;
    }

    :where(.flex, .grid, .card-body) > * {
        min-width: 0;
    }

    :where(h1, h2, h3, h4, p, address, dd, .card-body, .stat) {
        overflow-wrap: anywhere;
    }

    html .container {
        padding: 16px;
    }

    .form-control :where(.input, .select, .textarea, .file-input) {
        width: 100%;
    }

    :where(.input, .select, .textarea, .file-input, input[type="search"]) {
        min-width: 0;
        max-width: 100%;
        font-size: 16px;
    }

    body :where(button, .btn, .menu a, .menu button, .tab, input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select),
    .btn.btn-sm, .btn.btn-xs, .select.select-sm {
        min-height: 44px;
    }

    body button {
        min-width: 44px;
    }

    .btn {
        height: auto;
        white-space: normal;
        padding-top: 8px;
        padding-bottom: 8px;
        overflow-wrap: anywhere;
    }

    .badge {
        height: auto;
        min-height: 20px;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        flex-shrink: 0;
    }

    .stat :where(.stat-title, .stat-value, .stat-desc) {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    :is(.stat, .card-body) .truncate {
        overflow: visible;
        white-space: normal;
    }

    .invoice-fields > div {
        display: grid;
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
        gap: 12px;
    }

    .site-navbar .navbar-start {
        width: auto;
        flex: 1;
    }

    .site-navbar .navbar-end {
        width: auto;
        flex-shrink: 0;
    }

    .site-navbar .site-logo {
        min-width: 0;
        max-width: 100%;
    }

    .site-logo img {
        max-width: 100%;
    }

    .site-navbar .dropdown-content {
        z-index: 50;
        max-width: calc(100vw - 24px);
        max-height: calc(100dvh - 80px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .drawer-side {
        z-index: 40;
    }

    .drawer-side > .menu {
        max-width: calc(100vw - 48px);
    }

    .modal {
        padding: 12px;
    }

    .modal-box {
        width: 100%;
        max-width: min(64rem, calc(100vw - 24px));
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .modal-action {
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-action > .btn {
        margin-left: 0;
    }

    :where(#labelImage, #modal-image) {
        max-height: 60dvh;
        object-fit: contain;
    }

    .mobile-bottom-action {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .mobile-action-content {
        padding-bottom: calc(112px + env(safe-area-inset-bottom));
    }

    .sticky-paybar {
        z-index: 40;
    }

    .sticky-paybar .container {
        padding: 0;
    }

    /* Keep the table DOM and its controls intact while displaying rows as cards. */
    table.responsive-table {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .responsive-table > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .responsive-table > :where(tbody, tfoot) {
        display: block;
        width: 100%;
    }

    .responsive-table > tbody > tr:not(.hidden):not([hidden]) {
        display: block;
        margin: 12px 0;
        padding: 8px;
        border: 1px solid hsl(var(--bc, 215 28% 17%) / 0.15);
        border-radius: 8px;
    }

    .responsive-table > tbody > tr > :where(td, th) {
        display: grid;
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
        gap: 12px;
        width: 100%;
        min-width: 0;
        padding: 8px;
        white-space: normal;
        text-align: left;
        overflow-wrap: anywhere;
    }

    .responsive-table > tbody > tr > [data-label]::before {
        content: attr(data-label);
        font-weight: 600;
    }

    .responsive-cell-value {
        min-width: 0;
        max-width: 100%;
    }

    .responsive-cell-value :where(.flex, .btn) {
        max-width: 100%;
    }

    .responsive-table > tbody > tr > [colspan] {
        display: block;
    }

    .responsive-table > tfoot > tr {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .responsive-table > tfoot > tr > td {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .product-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .product-tabs > .tab {
        grid-row: auto;
        width: 100%;
        height: auto;
        padding: 12px 8px;
        white-space: normal;
        --tab-border: 0;
    }

    .product-tabs > .tab-content {
        grid-row: 4;
        grid-column: 1 / -1;
        min-width: 0;
        padding: 16px;
    }

    .product-status {
        display: grid;
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .product-status .stat {
        padding: 16px;
    }

    .product-dimensions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .signature-box {
        max-width: 640px;
    }

    #signatureCanvas {
        display: block;
        height: clamp(160px, 38dvh, 320px);
    }
}

@media screen and (max-width: 599px) {
    html .container {
        padding: 12px;
    }

    .card-body {
        padding: 16px;
    }

    .modal-action > .btn {
        flex: 1;
    }
}
