/**
 * LogisticsProductCard — общие стили (optimize корзина/каталог + BOM inspector catalog-item).
 * Канон: public/logistics/js/sidebar/product-card.js
 */

.lw-pm-product-card {
    display: flex;
    gap: calc(10px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: calc(10px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    background: #fff;
}

.lw-pm-product-thumb {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 6px;
    color: var(--ui-muted, #94a3b8);
    overflow: hidden;
}

.lw-pm-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lw-pm-product-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: calc(4px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
}

.lw-pm-product-title {
    font-size: calc(13px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    font-weight: clamp(100, calc(600 + var(--ui-weight-offset, 0)), 900);
    color: #1e40af;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.lw-pm-product-title a {
    color: inherit;
    text-decoration: none;
}

.lw-pm-product-title a:hover {
    text-decoration: underline;
}

.lw-pm-product-specs {
    font-size: calc(12px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    color: var(--ui-muted, #64748b);
    display: flex;
    align-items: center;
    gap: calc(4px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    flex-wrap: wrap;
}

.lw-pm-spec-sep {
    color: #cbd5e1;
}

.lw-pm-product-meta {
    font-size: calc(11px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    color: var(--ui-muted, #94a3b8);
}

.lw-pm-product-actions {
    display: flex;
    gap: calc(6px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    align-items: center;
    margin-top: auto;
}

.lw-pm-card-qty {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
    flex: 0 0 90px;
    padding: calc(4px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1)) calc(6px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    font-size: calc(13px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
}

.lw-pm-card-add {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
}

.lw-pm-card-added {
    display: inline-flex;
    align-items: center;
    gap: calc(6px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    background: #16a34a;
    border-color: #16a34a;
    color: var(--ui-on-action, #fff);
    padding: calc(4px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1)) calc(10px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    height: 32px;
    white-space: nowrap;
}

.lw-pm-card-added:hover {
    background: #15803d;
    border-color: #15803d;
    color: var(--ui-on-action, #fff);
}

.lw-pm-product-card.is-in-cart {
    border-color: #86efac;
    box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.2);
}

/* The cart has its own plan/assignment row; catalog and inspector cards stay compact. */
.lw-cart-card-slot .lw-pm-product-card.is-cart-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    column-gap: calc(8px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    row-gap: calc(4px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    border-color: #cbd5e1;
    box-shadow: none;
}

.lw-cart-card-slot .is-cart-row .lw-pm-product-body { display: contents; }
.lw-cart-card-slot .is-cart-row .lw-pm-product-thumb { grid-column: 1; grid-row: 1 / span 3; }
.lw-cart-card-slot .is-cart-row .lw-pm-product-title,
.lw-cart-card-slot .is-cart-row .lw-pm-product-specs,
.lw-cart-card-slot .is-cart-row .lw-pm-product-meta { grid-column: 2; }

.lw-cart-card-slot .is-cart-row .lw-pm-product-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-end;
    flex-wrap: nowrap;
    gap: calc(8px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    margin-top: calc(6px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
}

.lw-pm-cart-quantity { flex: 1; min-width: 0; }
.lw-pm-cart-quantity-label { display: block; margin-bottom: calc(4px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1)); font-size: calc(13px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px)); color: var(--ui-ink, #475569); }
.lw-pm-cart-quantity-values { display: flex; align-items: center; gap: calc(8px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1)); font-size: calc(14px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px)); }
.lw-pm-quantity-unit { display: inline-block; width: 4rem; min-width: 4rem; flex: 0 0 4rem; color: var(--ui-muted,#64748b); overflow-wrap: normal; }

.lw-cart-card-slot .is-cart-row .lw-pm-card-qty {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
    flex: 0 0 auto;
    min-height: 34px;
    height: 34px;
    padding: calc(4px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1)) calc(8px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    font-size: calc(14px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    box-sizing: border-box;
}

.lw-cart-card-slot .is-cart-row .lw-pm-card-added {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
}

.lw-pm-cart-fact { font-weight: clamp(100, calc(600 + var(--ui-weight-offset, 0)), 900); overflow-wrap: normal; }
.lw-pm-cart-progress-note { grid-column: 1 / -1; font-size: calc(13px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px)); line-height: calc(1.35 * var(--ui-leading-scale, 1)); color: var(--ui-muted, #64748b); }
.lw-cart-card-slot .is-cart-row[data-plan-progress="complete"] { border-color: #86cba9; }
.lw-cart-card-slot .is-cart-row[data-plan-progress="partial"] { border-color: #edc86c; }
.lw-cart-card-slot .is-cart-row[data-plan-progress="empty"],
.lw-cart-card-slot .is-cart-row[data-plan-progress="excess"] { border-color: #eaa7a7; }
.is-cart-row[data-plan-progress="complete"] .lw-pm-cart-fact,
.is-cart-row[data-plan-progress="complete"] .lw-pm-cart-progress-note { color: #15803d; }
.is-cart-row[data-plan-progress="partial"] .lw-pm-cart-fact,
.is-cart-row[data-plan-progress="partial"] .lw-pm-cart-progress-note { color: #946000; }
.is-cart-row[data-plan-progress="empty"] .lw-pm-cart-fact,
.is-cart-row[data-plan-progress="empty"] .lw-pm-cart-progress-note,
.is-cart-row[data-plan-progress="excess"] .lw-pm-cart-fact,
.is-cart-row[data-plan-progress="excess"] .lw-pm-cart-progress-note { color: #b42318; }

.lw-cart-plan-progress {
    margin-bottom: calc(10px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
    border-left: 3px solid #c58c00;
    border-radius: 4px;
    padding: calc(7px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1)) calc(10px * var(--ui-space-scale, 1) * var(--ui-padding-scale, 1));
    background: #fff8df;
    color: #785100;
    font-size: calc(14px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    line-height: calc(1.4 * var(--ui-leading-scale, 1));
}
.lw-cart-plan-progress[data-state="pending"] { border-color: #94a3b8; background: #f1f5f9; color: var(--ui-ink, #475569); }
.lw-cart-plan-progress[hidden] { display: none; }

/* BOM line inspector (catalog-item-edit) — поля под карточкой */
.lw-pm-bom-line-fields {
    display: flex;
    flex-direction: column;
    gap: calc(8px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    margin-top: calc(4px * var(--ui-space-scale, 1) * var(--ui-margin-scale, 1));
}

.lw-pm-bom-line-fields .ds-form-label {
    font-size: calc(11px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
}

.lw-pm-bom-line-fields-row {
    display: flex;
    gap: calc(8px * var(--ui-space-scale, 1) * var(--ui-gap-scale, 1));
    flex-wrap: wrap;
}

.lw-pm-bom-line-fields-row .ds-form-field {
    flex: 1;
    min-width: 72px;
    margin: 0;
}

.lw-pm-bom-line-fields .ds-input {
    font-size: calc(13px * var(--ui-type-scale, 1) + var(--ui-type-offset, 0px));
    min-height: 32px;
}

.lw-pm-bom-opt-wrap {
    margin: 0;
}
