.ps-category-chain {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ps-category-chain .ps-category-level {
    margin: 0;
}

.product-supply-table td {
    vertical-align: middle;
}

.ps-actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.ps-credit-badge {
    color: #f97316;
    margin-top: 4px;
}

.ps-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.ps-status--ordered {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.ps-status--received {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.ps-status--cancelled {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}

#product-supply-modal .product-supply-modal-dialog {
    max-width: min(860px, 94vw);
    width: min(94vw, 860px);
}

#product-supply-modal .field-group {
    margin-bottom: 16px;
    min-width: 0;
}

#product-supply-modal .field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 0;
    align-items: start;
}

#product-supply-modal .field-row .field-group {
    margin-bottom: 16px;
}

#product-supply-modal .field-group.half {
    margin-bottom: 16px;
}

#product-supply-modal .modern-input,
#product-supply-modal .ps-category-chain .modern-input,
#product-supply-modal .ps-category-chain select.modern-input {
    width: 100%;
    min-height: 44px;
    height: 44px;
    box-sizing: border-box;
    line-height: 1.25;
}

#product-supply-modal select.modern-input,
#product-supply-modal .ps-category-select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 38px;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

#product-supply-modal .ps-category-chain {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#product-supply-modal .ps-category-level {
    margin: 0 0 16px;
}

#product-supply-modal .ps-supplier-payment-row {
    grid-template-columns: minmax(0, 1.15fr) minmax(240px, 1fr);
    align-items: end;
}

#product-supply-modal .ps-supplier-payment-row:has(#ps-payment-mode-wrap[style*="display: none"]) {
    grid-template-columns: 1fr;
}

#product-supply-modal .ps-supplier-hint {
    margin: -4px 0 12px;
}

#product-supply-modal .ps-payment-switch {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 0;
    min-height: 44px;
    padding: 4px;
    box-sizing: border-box;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-control, 8px);
}

#product-supply-modal .ps-payment-switch-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#product-supply-modal .ps-payment-switch-option {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    margin: 0;
    padding: 0 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

#product-supply-modal .ps-payment-switch-option:has(.ps-payment-switch-input:checked) {
    color: var(--text-main);
}

#product-supply-modal .ps-payment-switch-thumb {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    border-radius: calc(var(--radius-control, 8px) - 2px);
    background: var(--bg-main);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
    transition: transform 0.22s ease;
    z-index: 1;
    pointer-events: none;
}

#product-supply-modal .ps-payment-switch:has(#ps-payment-credit:checked) .ps-payment-switch-thumb {
    transform: translateX(100%);
}

body.dark-theme #product-supply-modal .ps-payment-switch-thumb {
    background: rgba(40, 45, 65, 0.95);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

#product-supply-modal .btn-submit {
    min-height: 44px;
    margin-top: 4px;
}

@media (max-width: 720px) {
    #product-supply-modal .field-row {
        grid-template-columns: 1fr;
    }

    #product-supply-modal .ps-supplier-payment-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    #productSupply .glass-table-container {
        overflow: visible;
        background: transparent;
        border: none;
        border-radius: 0;
        backdrop-filter: none;
        box-shadow: none;
    }

    .product-supply-table {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .product-supply-table thead {
        display: none;
    }

    .product-supply-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .product-supply-table tbody tr[data-order-id] {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0 10px;
        padding: 14px;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-widget, 12px);
        box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .product-supply-table tbody tr[data-order-id]:hover td {
        background: transparent;
    }

    .product-supply-table tbody tr[data-order-id] td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 7px 0;
        border-bottom: none;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        text-align: right;
        word-break: break-word;
    }

    .product-supply-table tbody tr[data-order-id] td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        max-width: 42%;
        font-size: 0.78rem;
        font-weight: 500;
        color: var(--text-muted);
        text-align: left;
        text-transform: none;
        letter-spacing: normal;
        line-height: 1.3;
    }

    .product-supply-table .wh-card-value {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
        min-width: 0;
        text-align: right;
    }

    .product-supply-table .wh-card-date {
        grid-row: 1;
        grid-column: 1;
        padding-bottom: 0;
        font-size: 0.82rem;
        color: var(--text-muted);
        justify-content: flex-start;
    }

    .product-supply-table .wh-card-date::before {
        display: none;
    }

    .product-supply-table .wh-card-status {
        grid-row: 1;
        grid-column: 2;
        padding-bottom: 0;
        justify-content: flex-end;
    }

    .product-supply-table .wh-card-status::before {
        display: none;
    }

    .product-supply-table .wh-card-title {
        grid-row: 2;
        grid-column: 1 / -1;
        display: block;
        padding-top: 12px;
        margin-top: 8px;
        border-top: 1px solid var(--glass-border);
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.35;
        text-align: left;
        color: var(--text-main);
    }

    .product-supply-table .wh-card-title::before {
        display: none;
    }

    .product-supply-table .wh-card-title strong {
        font-weight: 600;
    }

    .product-supply-table .ps-card-sku {
        margin-top: 4px;
        font-size: 0.82rem;
    }

    .product-supply-table .wh-card-supplier {
        grid-row: 3;
        grid-column: 1 / -1;
    }

    .product-supply-table .wh-card-qty {
        grid-row: 4;
        grid-column: 1 / -1;
    }

    .product-supply-table .wh-card-purchase {
        grid-row: 5;
        grid-column: 1 / -1;
    }

    .product-supply-table .wh-card-total {
        grid-row: 6;
        grid-column: 1 / -1;
    }

    .product-supply-table .wh-card-price-sale {
        font-family: var(--font-head);
        font-weight: 700;
        color: var(--primary);
    }

    .product-supply-table .wh-card-actions {
        grid-row: 7;
        grid-column: 1 / -1;
        padding-top: 10px;
        margin-top: 4px;
        border-top: 1px solid var(--glass-border);
        justify-content: flex-start;
    }

    .product-supply-table .wh-card-actions::before {
        display: none;
    }

    .product-supply-table .ps-actions-cell {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
    }

    .product-supply-table .ps-actions-cell .btn-sm {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .product-supply-table tbody tr:not([data-order-id]) {
        display: block;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        padding: 20px 16px;
        text-align: center;
    }

    .product-supply-table tbody tr:not([data-order-id]) td {
        display: block;
        padding: 0;
        border: none;
        text-align: center;
    }

    .product-supply-table tbody tr:not([data-order-id]) td::before {
        display: none;
    }

    body.dark-theme .product-supply-table tbody tr[data-order-id] {
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    }
}
