/* Stop the browser's pull-to-refresh gesture while preserving normal scrolling. */
@media (any-pointer: coarse), (max-width: 960px) {
    html,
    body {
        overscroll-behavior-y: none;
    }
}

/* Shared cart presentation for mobile orders, loadings and unloadings. */
.mobile-document-detail.page {
    background: #fbfbfc;
}

.mobile-document-detail .scroll-area > .card {
    border-radius: 22px;
    border-color: #f0f1f3;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .06);
}

.mobile-document-lines {
    font-size: 16px;
}

.mobile-document-lines .card {
    margin: .6rem .9rem;
    padding: 1rem;
    background: var(--sap-surface, #fff);
    border: 1px solid var(--sap-border, #e5e7eb);
    border-radius: var(--sap-radius, 14px);
    box-shadow: var(--sap-shadow, 0 1px 2px rgba(0,0,0,.06));
}

.mobile-document-lines .ctitle {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: 15px;
    font-weight: 900;
    color: var(--sap-text, #1f2937);
    text-transform: uppercase;
}

.mobile-document-lines .list {
    display: grid;
    gap: 20px;
    margin: 12px 14px 20px;
}

.mobile-document-lines .row {
    display: grid;
    grid-template-columns: clamp(76px, 22vw, 104px) minmax(0, 1fr) 128px;
    grid-template-areas: "image content quantity" "details details details" "summary summary summary";
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 14px;
    background: var(--sap-surface, #fff);
    border: 1px solid #f0f1f3;
    border-radius: 24px;
    box-shadow: 0 5px 18px rgba(0,0,0,.08);
}

.mobile-document-lines .thumb {
    grid-area: image;
    width: 100%;
    height: 124px;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: #fff;
}

.mobile-document-lines .line-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mobile-document-lines .lcontent {
    grid-area: content;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.mobile-document-lines .article-code {
    display: inline-block;
    max-width: 100%;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef9fe;
    color: #239dcc;
    font-size: 14px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.mobile-document-lines .ltitle {
    min-width: 0;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 500;
    color: var(--sap-text, #1f2937);
    white-space: normal;
    overflow-wrap: anywhere;
}

.mobile-document-lines .lsub {
    grid-area: details;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 14px;
}

.mobile-document-lines .pill,
.mobile-document-lines .pill-approved,
.mobile-document-lines .pill-uom {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--sap-border, #e5e7eb);
    border-radius: 12px;
    background: #f8fafc;
    color: #374151;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
    white-space: normal;
    overflow-wrap: anywhere;
}

.mobile-document-lines .pill-approved {
    border-color: rgba(34,197,94,.35);
    background: rgba(34,197,94,.08);
    color: #166534;
}

.mobile-document-lines .lsub .mud-chip {
    height: auto;
    min-height: 28px;
    max-width: 100%;
    font-size: 14px;
}

.mobile-document-lines .lsub .mud-chip-content {
    white-space: normal;
    overflow-wrap: anywhere;
}

.mobile-document-lines .line-summary {
    grid-area: summary;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding-top: 10px;
    border-top: 1px solid #eef0f2;
}

.mobile-document-lines .line-metric {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}

.mobile-document-lines .metric-label {
    color: #667085;
    font-size: 12px;
    font-weight: 500;
}

.mobile-document-lines .metric-value {
    font-size: 14px;
    line-height: 1.4;
    font-weight: 600;
    color: #333;
    white-space: normal;
    overflow-wrap: anywhere;
}

.mobile-document-lines .line-summary .mud-icon-button {
    width: 44px;
    height: 44px;
}

.mobile-document-lines .lsub:empty {
    display: none;
}

.mobile-document-lines .search-wrap {
    margin: 8px 14px;
}

:is(.mobile-document-lines, .picker-page) .quantity-stepper {
    grid-area: quantity;
    min-width: 0;
    width: 128px;
    text-align: center;
}

:is(.mobile-document-lines, .picker-page) .quantity-label {
    display: block;
    margin-bottom: 4px;
    color: #667085;
    font-size: 11px;
    line-height: 1.3;
}

:is(.mobile-document-lines, .picker-page) .quantity-rail {
    display: grid;
    justify-items: center;
    border: 1px solid #ddd;
    border-radius: 28px;
    padding: 3px;
    background: #fff;
}

:is(.mobile-document-lines, .picker-page) .quantity-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 6px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}

:is(.mobile-document-lines, .picker-page) .quantity-button span {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #599fad;
    color: #fff;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
}

:is(.mobile-document-lines, .picker-page) .quantity-button:disabled {
    opacity: .35;
    cursor: default;
}

:is(.mobile-document-lines, .picker-page) .quantity-button:focus-visible {
    outline: 2px solid #287e90;
    outline-offset: 2px;
}

:is(.mobile-document-lines, .picker-page) .quantity-value,
:is(.mobile-document-lines, .picker-page) .quantity-value .mud-input-control-input-container {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
}

:is(.mobile-document-lines, .picker-page) .quantity-value .mud-input {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

:is(.mobile-document-lines, .picker-page) .quantity-value input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    height: 48px;
    padding: 4px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #17243a;
    -webkit-text-fill-color: #17243a;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

:is(.mobile-document-lines, .picker-page) .quantity-value input:focus {
    outline: 2px solid #0874c9;
    outline-offset: 1px;
    background: #f0f8ff;
}

:is(.mobile-document-lines, .picker-page) .quantity-value input:disabled {
    color: #333;
    -webkit-text-fill-color: #333;
    opacity: 1;
}

:is(.mobile-document-lines, .picker-page) .quantity-readonly {
    display: block;
    min-height: 38px;
    line-height: 38px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    overflow-wrap: anywhere;
}

@media (max-width: 480px) {
    .mobile-document-lines .row {
        grid-template-columns: 68px minmax(0, 1fr);
        grid-template-areas: "image content" "quantity quantity" "details details" "summary summary";
    }

    .mobile-document-lines .quantity-stepper {
        width: 100%;
    }

    .mobile-document-lines .quantity-rail {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        align-items: center;
        gap: 8px;
        padding: 5px;
    }

    .mobile-document-lines .quantity-button:first-child { grid-area: 1 / 3; }
    .mobile-document-lines .quantity-button:last-child { grid-area: 1 / 1; }
    .mobile-document-lines .quantity-value,
    .mobile-document-lines .quantity-readonly { grid-area: 1 / 2; }
}

@media (max-width: 359px) {
    .mobile-document-lines .row {
        gap: 8px;
        padding: 12px;
        grid-template-columns: 60px minmax(0, 1fr);
    }

    .mobile-document-lines .thumb {
        height: 110px;
    }
}
