/* Purpose-built Purchase Order list and detail mobile styling.
   Load after KPSResponsiveCards.css + KPSMobileFoundation.css.
   Scoped exclusively to the purchase-order components. */
.kps-po-orders-page, .kps-po-orders-page > *, .kps-po-orders-mobile,
.kps-po-orders-mobile .kps-r-card, .kps-po-orders-mobile .kps-r-expand {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

    .kps-po-orders-mobile .kps-r-card {
        overflow: hidden;
    }

    .kps-po-orders-mobile .kps-r-title,
    .kps-po-orders-mobile .kps-r-subtitle {
        overflow-wrap: anywhere;
    }

    .kps-po-orders-mobile .kps-r-badge {
        max-width: 45%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .kps-po-orders-mobile .kps-r-field strong {
        overflow-wrap: anywhere;
    }

    .kps-po-orders-mobile .kps-r-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

        .kps-po-orders-mobile .kps-r-actions .k-button {
            flex: 1 1 125px;
            min-height: 43px;
        }

    .kps-po-orders-mobile .kps-r-expand {
        padding: 8px;
        overflow-x: auto;
    }

    .kps-po-orders-mobile .kps-po-order-grandtotal {
        padding: 10px;
        background: #eaf3ff;
        border-radius: 6px;
        grid-column: 1/-1;
    }

        .kps-po-orders-mobile .kps-po-order-grandtotal strong {
            color: #195b91;
            font-size: 17px;
        }

.kps-po-mobile-pages {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin: 14px 0;
    flex-wrap: wrap;
}

.kps-po-mobile-toolbar {
    display: flex;
    flex-wrap: wrap;
}

    .kps-po-mobile-toolbar .kps-r-search {
        flex: 1 1 170px;
        width: auto;
    }

.kps-po-detail-line-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    min-width: 0;
}

.kps-po-detail-line-card {
    min-width: 0;
    border: 1px solid #dce4ed;
    background: white;
    border-radius: 9px;
    padding: 12px;
}

.kps-po-detail-line-title {
    font-size: 15px;
    font-weight: 750;
    color: #26354c;
    overflow-wrap: anywhere;
}

.kps-po-detail-line-sub {
    font-size: 12px;
    color: #65758a;
    margin-top: 5px;
    overflow-wrap: anywhere;
}

.kps-po-detail-line-facts {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
    margin-top: 12px;
}

    .kps-po-detail-line-facts > div {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .kps-po-detail-line-facts small {
        font-size: 11px;
        color: #6a778a;
    }

    .kps-po-detail-line-facts strong {
        font-size: 13px;
        color: #293c4f;
        overflow-wrap: anywhere;
    }

.kps-po-detail-total {
    grid-column: 1/-1;
    padding: 8px;
    background: #eff7eb;
    border-radius: 6px;
}

.kps-po-detail-line-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
}

    .kps-po-detail-line-actions .k-button {
        min-height: 42px;
    }

@media (max-width:767px) {
    .kps-po-orders-page .kps-po-order-filters {
        grid-template-columns: 1fr;
    }
    /* A single row may have 2 field pairs; stack cells in source order. */
    .kps-po-details-form-table, .kps-po-details-form-table tbody {
        display: block;
        width: 100%;
        max-width: 100%;
    }

        .kps-po-details-form-table tr {
            display: grid;
            grid-template-columns: minmax(0,1fr);
            gap: 6px;
            margin-bottom: 12px;
        }

        .kps-po-details-form-table td {
            display: block;
            width: 100% !important;
            min-width: 0;
            max-width: 100%;
            overflow-wrap: anywhere;
        }

            .kps-po-details-form-table td:empty {
                display: none;
            }

        .kps-po-details-form-table .k-input, .kps-po-details-form-table .k-picker,
        .kps-po-details-form-table .k-numerictextbox, .kps-po-details-form-table .k-textarea,
        .kps-po-details-form-table .k-dropdownlist {
            width: 100% !important;
            max-width: 100%;
        }

    .kps-po-orders-mobile .kps-r-fields {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .kps-po-orders-mobile .kps-r-toolbar {
        position: static;
    }
    /* Inline price-change tables inside mobile dialogs are large; scroll in their own container. */
    .kps-po-orders-page .k-window-content {
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width:370px) {
    .kps-po-orders-mobile .kps-r-fields {
        grid-template-columns: 1fr;
    }
}
