/* THEME-003B-R4-2-BOTTOM-PANELS-ONLY */
/* THEME-003B-R3-FAMILY-FINAL-OWNERSHIP — all family cascade owners use canonical theme tokens */
/* THEME-003B-R1-COMPOSER-CANONICAL-SURFACES */
/* CE-UI-001D-COMMERCIAL-COMPOSER-STYLES */

.commercial-composer-workspace {
    width: 100%;
    min-height: calc(100vh - 76px);
    padding: 28px;
    background: var(--ms-theme-surface);
    overflow: auto;

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-composer-workspace[hidden] {
    display: none !important;
}

.commercial-composer-shell {
    display: grid;
    gap: 22px;
    max-width: 1680px;
    margin: 0 auto;
}

.commercial-composer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 28px;
    border: 1px solid rgba(20, 42, 68, 0.10);
    border-radius: 20px;
    background: var(--ms-theme-surface);
    box-shadow: 0 14px 38px rgba(22, 42, 65, 0.08);

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-composer-header h1 {
    margin: 4px 0 8px;
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1.1;
}

.commercial-composer-header p {
    margin: 0;
    color: var(--muted, #64748b);
}

.commercial-composer-eyebrow {
    color: #a97900 !important;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.14em;
}

.commercial-composer-status {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(245, 183, 31, 0.16);
    color: #745300;
    font-size: 13px;
    font-weight: 800;
}

.commercial-composer-status.is-ready {
    background: rgba(26, 156, 104, 0.14);
    color: #117047;
}

.commercial-composer-status.is-error {
    background: rgba(202, 53, 53, 0.12);
    color: #a32121;
}

.commercial-composer-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px) auto;
    gap: 16px;
    align-items: end;
    padding: 20px;
    border-radius: 18px;
    background: var(--ms-theme-surface);
    box-shadow: 0 10px 30px rgba(22, 42, 65, 0.06);

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-composer-toolbar label {
    display: grid;
    gap: 7px;
}

.commercial-composer-toolbar label > span {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.commercial-composer-toolbar input,
.commercial-composer-toolbar select {
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid rgba(20, 42, 68, 0.18);
    border-radius: 11px;
    background: var(--surface, #ffffff);
    color: inherit;
    font: inherit;
}

.commercial-composer-toolbar button {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, #ffd45e, #e3a817);
    color: #142a44;
    font-weight: 900;
    cursor: pointer;
}

.commercial-composer-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 16px;
}

.commercial-composer-summary article {
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    border: 1px solid rgba(20, 42, 68, 0.08);
    border-radius: 16px;
    background: var(--ms-theme-surface);

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-composer-summary span {
    color: var(--muted, #64748b);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.commercial-composer-summary strong {
    font-size: 22px;
}

.commercial-composer-content {
    display: grid;
    grid-template-columns: minmax(210px, 280px) minmax(0, 1fr);
    gap: 18px;
}

.commercial-composer-families,
.commercial-composer-catalog {
    border: 1px solid rgba(20, 42, 68, 0.08);
    border-radius: 18px;
    background: var(--ms-theme-surface);
    overflow: hidden;

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-composer-families header,
.commercial-composer-catalog > header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(20, 42, 68, 0.08);
}

.commercial-composer-families h2,
.commercial-composer-catalog h2 {
    margin: 0;
    font-size: 18px;
}

.commercial-composer-catalog header p {
    margin: 5px 0 0;
    color: var(--muted, #64748b);
}

.commercial-composer-families [data-commercial-composer-family-list] {
    display: grid;
    gap: 5px;
    padding: 12px;
}

.commercial-family-button {
    width: 100%;
    padding: 11px 12px;
    border: 0;
    border-radius: 10px;
    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    text-align: left;
    font-weight: 700;
    cursor: pointer;

    border-color: var(--ms-theme-border);}

.commercial-family-button:hover,
.commercial-family-button.is-active {
    background: rgba(245, 183, 31, 0.16);
    color: #755600;
}

.commercial-composer-loading,
.commercial-composer-error {
    margin: 20px;
    padding: 18px;
    border-radius: 12px;
}

.commercial-composer-loading {
    background: rgba(20, 42, 68, 0.05);
}

.commercial-composer-error {
    background: rgba(202, 53, 53, 0.10);
    color: #a32121;
}

.commercial-composer-table-wrap {
    overflow: auto;
}

.commercial-composer-table-wrap table {
    width: 100%;
    border-collapse: collapse;
}

.commercial-composer-table-wrap th,
.commercial-composer-table-wrap td {
    padding: 13px 15px;
    border-bottom: 1px solid rgba(20, 42, 68, 0.08);
    text-align: left;
    vertical-align: middle;
}

.commercial-composer-table-wrap th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface, #ffffff);
    color: var(--muted, #64748b);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.commercial-composer-table-wrap tbody tr:hover {
    background: rgba(20, 42, 68, 0.035);
}

.commercial-composer-item-code {
    font-weight: 900;
    white-space: nowrap;
}

.commercial-composer-price {
    font-weight: 900;
    white-space: nowrap;
}

@media (max-width: 1100px) {
    .commercial-composer-summary {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }

    .commercial-composer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .commercial-composer-workspace {
        padding: 16px;
    }

    .commercial-composer-header,
    .commercial-composer-toolbar {
        grid-template-columns: 1fr;
        display: grid;
    }

    .commercial-composer-summary {
        grid-template-columns: 1fr;
    }
}

/* CE-UI-001G-R5.1-SURGICAL-LIVE-INTEGRATION */

.commercial-composer-workspace {
    overflow: auto;
    padding: 20px 22px 36px;
}

.commercial-family-panel {
    margin-top: 16px;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    background: var(--ms-theme-surface);
    box-shadow:
        0 18px 42px rgba(15, 23, 42, 0.08);

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-family-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(174px, 1fr));
    gap: 14px;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-family-card {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(108px, 1fr);
    min-height: 166px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 16px;
    background: var(--ms-theme-surface);
    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.07);
    cursor: pointer;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-family-card:hover {
    transform: translateY(-2px);
    border-color: var(--ms-theme-accent);
    box-shadow:
        0 14px 30px rgba(15, 23, 42, 0.12);

    background: var(--ms-theme-surface-soft);
    color: var(--ms-theme-text);}

.commercial-family-card.is-selected {
    border-color: var(--ms-theme-accent);
    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.12),
        0 14px 30px rgba(15, 23, 42, 0.12);

    background: var(--ms-theme-surface-soft);
    color: var(--ms-theme-text);}

.commercial-family-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 46px;
    padding: 11px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    background: var(--ms-theme-surface);

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-family-heading input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #2563eb;
}

.commercial-family-heading strong {
    overflow: hidden;
    color: var(--ms-theme-text);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.commercial-family-heading em {
    color: var(--ms-theme-muted);
    font-style: normal;
}

.commercial-family-visual {
    display: grid;
    place-items: center;
    min-height: 110px;
    padding: 10px;
    background: var(--ms-theme-surface);

    color: var(--ms-theme-text);}

.commercial-family-visual img {
    display: block;
    width: 100%;
    height: 108px;
    object-fit: contain;
    object-position: center;
    filter:
        drop-shadow(
            0 9px 10px rgba(15, 23, 42, 0.16)
        );
}

.commercial-family-visual.is-fallback {
    font-size: 54px;
    line-height: 1;
}

.commercial-products-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 20px;

    background: var(--ms-theme-surface-soft);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-products-toolbar h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0.045em;
}

.commercial-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.commercial-toolbar-actions button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: #1e293b;
    cursor: pointer;
}

.commercial-toolbar-actions button:hover {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(239, 246, 255, 0.96);
}

@media (max-width: 900px) {
    .commercial-products-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .commercial-toolbar-actions {
        justify-content: flex-start;
    }
}

/* END CE-UI-001G-R5.1-SURGICAL-LIVE-INTEGRATION */

/* CE-EDIT-MODE-001 */
.commercial-composer-workspace
    [data-commercial-action="edit"].is-active {
    border-color: rgba(37, 99, 235, 0.72);
    background: rgba(37, 99, 235, 0.14);
    box-shadow:
        inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.commercial-row-code {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.commercial-row-code > input[type="checkbox"] {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: #2563eb;
    cursor: pointer;
}

.commercial-composer-table-wrap td > input,
.commercial-row-code > input[type="text"] {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(37, 99, 235, 0.34);
    border-radius: 8px;
    background: var(--surface, #ffffff);
    color: inherit;
    font: inherit;
}

.commercial-composer-table-wrap td > input:focus,
.commercial-row-code > input[type="text"]:focus {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    border-color: rgba(37, 99, 235, 0.72);
}

.commercial-composer-table-wrap td > input:disabled {
    border-color: transparent;
    background: transparent;
    color: inherit;
    opacity: 1;
    cursor: default;
    -webkit-text-fill-color: currentColor;
}

.commercial-composer-table-wrap
    tbody tr.is-editable {
    background: rgba(37, 99, 235, 0.065);
    box-shadow:
        inset 3px 0 0 rgba(37, 99, 235, 0.72);
}

.commercial-composer-table-wrap
    tbody tr.is-editable:hover {
    background: rgba(37, 99, 235, 0.09);
}

.commercial-separator-row {
    pointer-events: none;
}

/* CE-EDIT-MODE-001A */

/*
 * QUANTITY e DISCOUNT restano sempre modificabili.
 * Le frecce native degli input number vengono mantenute.
 */
.commercial-composer-table-wrap th:nth-child(4),
.commercial-composer-table-wrap th:nth-child(5),
.commercial-composer-table-wrap td:nth-child(4),
.commercial-composer-table-wrap td:nth-child(5),
.commercial-quantity-cell,
.commercial-discount-cell {
    text-align: center;
}

.commercial-quantity-cell,
.commercial-discount-cell {
    vertical-align: middle;
}

.commercial-composer-table-wrap
    .commercial-quantity-input,
.commercial-composer-table-wrap
    .commercial-discount-input {
    display: block;
    box-sizing: border-box;
    width: min(100%, 112px);
    min-width: 76px;
    margin-inline: auto;
    text-align: center;
}

/*
 * Nessuna regola appearance o webkit spin button:
 * gli spinner laterali restano visibili e funzionanti.
 */

/* CE-LIVE-LAYOUT-FINAL-001 */

/* Nasconde la fascia CERCA / FAMIGLIA / Aggiorna catalogo. */
.commercial-composer-toolbar {
    display: none !important;
}

/* Titolo pagina compatto e coerente con MASTER SUITE. */
.commercial-composer-header {
    display: flex !important;
    align-items: center !important;
    min-height: 72px;
    padding: 18px 24px !important;
    border-radius: 16px !important;
}

.commercial-composer-header h1 {
    margin: 0 !important;
    color: var(--text, #172337);
    font-size: clamp(25px, 2.2vw, 34px) !important;
    font-weight: 900;
    line-height: 1.1;
}

/*
 * Le schede delle macchine restano subito sotto il titolo
 * e utilizzano tutta la larghezza disponibile.
 */
.commercial-family-panel {
    margin-top: 0 !important;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-family-grid {
    grid-template-columns:
        repeat(auto-fit, minmax(160px, 1fr)) !important;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-family-visual img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 126px;
    object-fit: contain;
    object-position: center;
}

/* Tabella: nessun taglio di CODE o prezzi. */
.commercial-composer-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: auto;
}

.commercial-composer-table-wrap table {
    width: 100% !important;
    min-width: 960px;
    table-layout: auto !important;
    border-collapse: collapse;
}

.commercial-composer-table-wrap th,
.commercial-composer-table-wrap td {
    box-sizing: border-box;
    overflow: visible !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* CODE sempre visibile. */
.commercial-composer-table-wrap th:nth-child(1),
.commercial-composer-table-wrap td:nth-child(1) {
    width: 15%;
    min-width: 150px;
    text-align: left;
}

.commercial-row-code {
    display: flex !important;
    width: 100%;
    min-width: 0;
    align-items: center;
}

.commercial-row-code strong {
    display: inline-block !important;
    overflow: visible !important;
    color: var(--text, #172337) !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-weight: 900;
    white-space: nowrap;
}

/* DESCRIPTION usa lo spazio residuo. */
.commercial-composer-table-wrap th:nth-child(2),
.commercial-composer-table-wrap td:nth-child(2) {
    width: auto;
    min-width: 300px;
    text-align: left;
}

/* LIST PRICE e NET PRICE sempre visibili. */
.commercial-composer-table-wrap th:nth-child(3),
.commercial-composer-table-wrap td:nth-child(3),
.commercial-composer-table-wrap th:nth-child(6),
.commercial-composer-table-wrap td:nth-child(6) {
    width: 14%;
    min-width: 145px;
    text-align: right;
    white-space: nowrap;
}

.commercial-composer-price,
.commercial-net-price,
.commercial-composer-table-wrap td:nth-child(3),
.commercial-composer-table-wrap td:nth-child(6) {
    display: table-cell;
    overflow: visible !important;
    color: var(--text, #172337) !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

/* QUANTITY e DISCOUNT centrati. */
.commercial-composer-table-wrap th:nth-child(4),
.commercial-composer-table-wrap td:nth-child(4),
.commercial-composer-table-wrap th:nth-child(5),
.commercial-composer-table-wrap td:nth-child(5) {
    width: 11%;
    min-width: 120px;
    text-align: center !important;
}

.commercial-quantity-cell,
.commercial-discount-cell {
    text-align: center !important;
}

.commercial-composer-table-wrap
    .commercial-quantity-input,
.commercial-composer-table-wrap
    .commercial-discount-input {
    display: block !important;
    box-sizing: border-box;
    width: 92px !important;
    min-width: 92px !important;
    height: 36px;
    margin: 0 auto !important;
    padding: 4px 7px;
    text-align: center !important;
    text-indent: 0 !important;
    font-variant-numeric: tabular-nums;
}

/* Centra anche il testo interno in Firefox. */
.commercial-quantity-input::-moz-number-text,
.commercial-discount-input::-moz-number-text {
    text-align: center;
}

/*
 * Conserva le frecce laterali native:
 * nessuna regola appearance o spin-button.
 */

/* Colorazione dinamica della cella DISCOUNT. */
.commercial-discount-cell[data-discount-band="ok"],
.commercial-composer-table-wrap
    td[data-discount-band="ok"] {
    background:
        linear-gradient(
            135deg,
            rgba(34, 197, 94, 0.20),
            rgba(132, 204, 22, 0.15)
        ) !important;
}

.commercial-discount-cell[data-discount-band="warning"],
.commercial-composer-table-wrap
    td[data-discount-band="warning"] {
    background:
        linear-gradient(
            135deg,
            rgba(245, 158, 11, 0.26),
            rgba(234, 179, 8, 0.18)
        ) !important;
}

.commercial-discount-cell[data-discount-band="danger"],
.commercial-composer-table-wrap
    td[data-discount-band="danger"] {
    background:
        linear-gradient(
            135deg,
            rgba(239, 68, 68, 0.24),
            rgba(220, 38, 38, 0.17)
        ) !important;
}

/* Parte inferiore proporzionata. */
.commercial-composer-summary.commercial-live-bottom-grid {
    display: grid !important;
    grid-template-columns:
        repeat(3, minmax(0, 1fr)) !important;
    align-items: stretch;
    gap: 16px !important;
    width: 100%;
    margin-top: 0;
}

.commercial-live-bottom-grid > article {
    box-sizing: border-box;
    width: auto !important;
    min-width: 0;
    min-height: 180px;
    padding: 18px 20px !important;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 16px;
    background: var(--surface, #ffffff);
    box-shadow:
        0 10px 28px rgba(15, 23, 42, 0.065);
}

/*
 * Qualora i totali siano ancora distribuiti in più article,
 * manteniamo dimensioni uniformi e non deformate.
 */
.commercial-live-summary-card {
    align-content: center;
}

.commercial-live-summary-card strong {
    overflow: visible !important;
    color: var(--text, #172337) !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* MASTER %. */
.commercial-master-guide {
    display: grid;
    align-content: start;
    gap: 10px;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-master-guide h3 {
    margin: 0 0 4px;
    color: var(--ms-theme-text);
    font-size: 15px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0.04em;
}

.commercial-master-band {
    display: grid;
    grid-template-columns:
        minmax(82px, auto)
        minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 7px 12px;
    border-radius: 9px;
    color: #ffffff;
}

.commercial-master-band strong {
    color: inherit !important;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.commercial-master-band span {
    color: inherit !important;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.025em;
}

.commercial-master-band.is-ok {
    background:
        linear-gradient(
            135deg,
            #65a30d,
            #84cc16
        );
}

.commercial-master-band.is-warning {
    background:
        linear-gradient(
            135deg,
            #eab308,
            #f59e0b
        );
    color: #3d2b00;
}

.commercial-master-band.is-danger {
    background:
        linear-gradient(
            135deg,
            #dc2626,
            #ef4444
        );
}

/* Non deformare la parte inferiore sugli schermi medi. */
@media (max-width: 1180px) {
    .commercial-composer-summary.commercial-live-bottom-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr)) !important;
    }

    .commercial-master-guide {
        grid-column: 1 / -1;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}
}

@media (max-width: 760px) {
    .commercial-composer-summary.commercial-live-bottom-grid {
        grid-template-columns: 1fr !important;
    }

    .commercial-master-guide {
        grid-column: auto;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}
}

/* CE-LIVE-VISUAL-FIX-003 */

/* Rimuove definitivamente header e toolbar legacy. */
.commercial-composer-header,
.commercial-composer-toolbar {
    display: none !important;
}

/* Header nello stile della pagina Aziende. */
.commercial-visual-header {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 18px;
    padding: 0;
    background: transparent;
}

.commercial-visual-eyebrow {
    margin: 0 0 7px;
    color: #f5b900;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.commercial-visual-header h1 {
    margin: 0 0 8px;
    color: #f8fafc;
    font-size: clamp(28px, 3vw, 38px);
    font-weight: 900;
    line-height: 1.08;
}

.commercial-visual-header p {
    margin: 0;
    color: #aebcd0;
    font-size: 15px;
    line-height: 1.45;
}

/* Pannello famiglie blu, senza contenitore bianco. */
.commercial-family-panel {
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 34px !important;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid rgba(104, 151, 196, 0.28) !important;
    border-radius: 12px !important;
    background: var(--ms-theme-surface);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.18) !important;

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

/* Cinque colonne desktop, come nella configurazione approvata. */
.commercial-family-grid {
    display: grid !important;
    grid-template-columns:
        repeat(5, minmax(0, 1fr)) !important;
    gap: 0 !important;
    width: 100%;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

/* Schede integrate nel pannello, senza riquadro bianco. */
.commercial-family-card {
    position: relative;
    display: grid !important;
    grid-template-rows:
        46px
        minmax(150px, 1fr) !important;
    box-sizing: border-box;
    min-width: 0;
    min-height: 218px !important;
    overflow: hidden;
    border: 0 !important;
    border-right:
        1px solid rgba(117, 154, 191, 0.20) !important;
    border-bottom:
        1px solid rgba(117, 154, 191, 0.20) !important;
    border-radius: 0 !important;
    background: var(--ms-theme-surface);
    box-shadow: none !important;
    cursor: pointer;
    transform: none !important;

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-family-card:hover {
    z-index: 2;
    background: var(--ms-theme-surface-soft);
    box-shadow:
        inset 0 0 0 1px rgba(65, 153, 255, 0.45) !important;

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-accent);}

.commercial-family-card.is-selected {
    z-index: 3;
    background: var(--ms-theme-surface-soft);
    box-shadow:
        inset 0 0 0 2px rgba(65, 153, 255, 0.82),
        inset 0 -4px 0 rgba(65, 153, 255, 0.70) !important;

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-accent);}

/* Intestazione scheda sul blu. */
.commercial-family-heading {
    display: flex !important;
    align-items: center;
    gap: 9px;
    box-sizing: border-box;
    min-height: 46px !important;
    padding: 10px 13px !important;
    border-bottom:
        1px solid rgba(117, 154, 191, 0.19) !important;
    background: var(--ms-theme-surface);

    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-family-heading input {
    flex: 0 0 auto;
    width: 18px !important;
    height: 18px !important;
    margin: 0;
    border-color: rgba(255, 255, 255, 0.60);
    accent-color: #3b82f6;
}

.commercial-family-heading strong {
    overflow: visible !important;
    color: var(--ms-theme-text);
    font-size: 14px !important;
    font-weight: 900 !important;
    letter-spacing: 0.025em;
    text-overflow: clip !important;
    white-space: nowrap;
}

/* XXL resta rosso. */
.commercial-family-heading em {
    color: var(--ms-theme-muted);
    font-style: normal;
}

/* Area immagine interamente trasparente. */
.commercial-family-visual {
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0 !important;
    padding: 12px 15px 16px !important;
    overflow: hidden;
    background: var(--ms-theme-surface);

    color: var(--ms-theme-text);}

/*
 * L’immagine riempie la scheda.
 * Il PNG resta trasparente e non introduce alcuno sfondo.
 */
.commercial-family-visual img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 230px !important;
    max-height: 155px !important;
    object-fit: contain !important;
    object-position: center !important;
    background: transparent !important;
    filter:
        drop-shadow(
            0 10px 11px rgba(0, 0, 0, 0.26)
        );
}

/* PRODUCTS e pulsanti. */
.commercial-products-panel,
.commercial-composer-catalog {
    width: 100%;
    min-width: 0;
    background: transparent !important;
}

.commercial-products-toolbar,
.commercial-action-toolbar {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;

    background: var(--ms-theme-surface-soft);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-products-toolbar button,
.commercial-action-toolbar button,
[data-commercial-action] {
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 10px;
    background:
        linear-gradient(
            180deg,
            #ffffff,
            #f1f5f9
        );
    color: #162033;
    font-weight: 750;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Parte inferiore proporzionata. */
.commercial-bottom-grid,
.commercial-composer-summary.commercial-live-bottom-grid {
    display: grid !important;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr)
        minmax(0, 1fr) !important;
    align-items: stretch;
    gap: 16px !important;
    width: 100%;
    margin-top: 18px;
}

.commercial-bottom-grid > article,
.commercial-composer-summary.commercial-live-bottom-grid > article,
.commercial-totals-card,
.commercial-quick-actions,
.commercial-master-card,
.commercial-master-guide {
    box-sizing: border-box;
    min-width: 0;
    min-height: 190px;
    padding: 18px 20px !important;
    border: 1px solid rgba(104, 151, 196, 0.30) !important;
    border-radius: 13px !important;
    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.18) !important;

    border-color: var(--ms-theme-border);}

/* MASTER % verde, giallo, rosso. */
.commercial-master-band {
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #ffffff !important;
    font-weight: 900;
}

.commercial-master-band.is-ok {
    background:
        linear-gradient(
            135deg,
            #15803d,
            #4ade80
        ) !important;
}

.commercial-master-band.is-warning {
    background:
        linear-gradient(
            135deg,
            #eab308,
            #f59e0b
        ) !important;
    color: #352600 !important;
}

.commercial-master-band.is-danger {
    background:
        linear-gradient(
            135deg,
            #b91c1c,
            #ef4444
        ) !important;
}

/* Responsive. */
@media (max-width: 1250px) {
    .commercial-family-grid {
        grid-template-columns:
            repeat(4, minmax(0, 1fr)) !important;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}
}

@media (max-width: 980px) {
    .commercial-family-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr)) !important;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

    .commercial-bottom-grid,
    .commercial-composer-summary.commercial-live-bottom-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 680px) {
    .commercial-family-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr)) !important;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

    .commercial-bottom-grid,
    .commercial-composer-summary.commercial-live-bottom-grid {
        grid-template-columns: 1fr !important;
    }
}
/* CE-UI-005A-EDITABLE-DISCOUNT-THRESHOLDS */
.commercial-master-range {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    min-width: 100px;
}

.commercial-master-range input {
    box-sizing: border-box;
    width: 62px;
    height: 30px;
    padding: 3px 6px;
    border: 1px solid rgba(255, 255, 255, 0.60);
    border-radius: 7px;
    outline: none;
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
    font: inherit;
    font-weight: 900;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.commercial-master-range input:hover {
    background: rgba(255, 255, 255, 0.26);
}

.commercial-master-range input:focus {
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.34);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

.commercial-master-band.is-warning
    .commercial-master-range input {
    border-color: rgba(53, 38, 0, 0.45);
    background: rgba(255, 255, 255, 0.42);
    color: #352600;
}

.commercial-master-range output,
.commercial-master-range b,
.commercial-master-range i {
    color: inherit;
    font: inherit;
    font-weight: 900;
    font-style: normal;
    font-variant-numeric: tabular-nums;
}
/* CE-UI-005A1-DISCOUNT-INPUT-BACKGROUND-FIX
   Il testo resta sempre nero.
   Cambia esclusivamente lo sfondo dell'input Discount.
*/

.commercial-discount-cell .commercial-discount-input {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    font-weight: 900;
}

.commercial-discount-cell[data-discount-band="ok"]
    .commercial-discount-input {
    background: #bff0ca !important;
    background-color: #bff0ca !important;
    border-color: #55a96b !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
}

.commercial-discount-cell[data-discount-band="warning"]
    .commercial-discount-input {
    background: #ffe39a !important;
    background-color: #ffe39a !important;
    border-color: #d6a629 !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
}

.commercial-discount-cell[data-discount-band="danger"]
    .commercial-discount-input {
    background: #ffc1c1 !important;
    background-color: #ffc1c1 !important;
    border-color: #d95a5a !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
}

.commercial-discount-cell[data-discount-band="ok"]
    .commercial-discount-input:focus {
    background: #bff0ca !important;
    background-color: #bff0ca !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
}

.commercial-discount-cell[data-discount-band="warning"]
    .commercial-discount-input:focus {
    background: #ffe39a !important;
    background-color: #ffe39a !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
}

.commercial-discount-cell[data-discount-band="danger"]
    .commercial-discount-input:focus {
    background: #ffc1c1 !important;
    background-color: #ffc1c1 !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
}
/* CE-UI-005A2-CENTER-QUANTITY-DISCOUNT-R1
   Centratura orizzontale e verticale delle colonne
   Quantity e Discount.
*/

.commercial-composer-enterprise
.commercial-quantity-cell,
.commercial-composer-enterprise
.commercial-discount-cell {
    text-align: center;
    vertical-align: middle;
}

.commercial-composer-enterprise
.commercial-quantity-header,
.commercial-composer-enterprise
.commercial-discount-header {
    text-align: center;
    vertical-align: middle;
}

.commercial-composer-enterprise
.commercial-quantity-input,
.commercial-composer-enterprise
.commercial-discount-input {
    display: block;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.commercial-composer-enterprise
td:has(.commercial-quantity-input),
.commercial-composer-enterprise
td:has(.commercial-discount-input) {
    text-align: center;
    vertical-align: middle;
}

.commercial-composer-enterprise
.commercial-quantity-input:focus,
.commercial-composer-enterprise
.commercial-quantity-input:hover,
.commercial-composer-enterprise
.commercial-discount-input:focus,
.commercial-composer-enterprise
.commercial-discount-input:hover {
    text-align: center;
}


/* CE-UI-005A3-INPUT-TEXT-CENTER
   Centra esclusivamente il testo digitato
   negli input Quantity e Discount.
*/

.commercial-quantity-input,
.commercial-discount-input{
    text-align:center !important;
    font-variant-numeric:tabular-nums;
}

.commercial-quantity-input:focus,
.commercial-discount-input:focus{
    text-align:center !important;
}

/* CE-UI-005A4-PRODUCTS-HEADER-ALIGNMENT
   PRODUCTS allineato completamente a sinistra.
   Toolbar azioni mantenuta completamente a destra.
*/

.commercial-products-toolbar {
    display: flex;
    align-items: center;
    width: 100%;
}

.commercial-products-toolbar h1 {
    margin: 0 auto 0 0;
    text-align: left;
}

.commercial-products-toolbar .commercial-toolbar-actions {
    margin-left: auto;
}

/* CE-UI-005A5-PAGE-TITLE-STYLE
   Titolo principale del Compilatore Offerte.
*/

.commercial-page-heading {
    display: block;
    width: 100%;
    margin: 0 0 18px;
    padding: 0;
    text-align: left;
}

.commercial-page-heading h1 {
    margin: 0;
    padding: 0;
    text-align: left;
    font-size: 28px;
    font-weight: 750;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--commercial-text, #172033);
}

/* COMMERCIAL-COMPOSER-HEADER-001 START */

#commercial-composer-workspace .commercial-composer-page-path {
    display: block;
    margin: 0 0 8px;
    padding: 0;
    color: var(
        --master-suite-accent,
        var(--gold, #f2b400)
    ) !important;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

#commercial-composer-workspace .commercial-composer-page-title {
    margin-top: 0;
    color: var(
        --master-suite-heading,
        #f4f7fb
    ) !important;
    opacity: 1 !important;
    text-shadow: none !important;
    -webkit-text-fill-color: currentColor !important;
}



/* COMMERCIAL-COMPOSER-HEADER-001 END */


/* CE-FAMILY-SELECTION-RULES-001 */
.commercial-family-card.is-disabled {
    opacity: 0.38;
    filter: grayscale(0.72);
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: none;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);
    border-color: var(--ms-theme-border);}

.commercial-family-card.is-disabled:hover {
    transform: none;
    box-shadow: none;
}

.commercial-family-card.is-disabled
input[type="checkbox"] {
    cursor: not-allowed;
}

.commercial-family-card.is-disabled
.commercial-family-visual {
    filter: grayscale(0.85);

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);}

/* CE-PRODUCTS-FLUID-RESPONSIVE-001 */

/*
 * Il modulo prodotti segue sempre la larghezza disponibile
 * del workspace senza imporre dimensioni rigide alla pagina.
 */
.commercial-table-wrap,
.commercial-composer-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    box-sizing: border-box;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

/*
 * La tabella usa tutta la larghezza del contenitore.
 * table-layout fixed permette alle colonne di adattarsi
 * realmente quando cambia la dimensione della finestra.
 */
.commercial-table-wrap table,
.commercial-composer-table-wrap table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
}

/*
 * Tutte le celle possono restringersi senza forzare
 * l'allargamento dell'intero workspace.
 */
.commercial-table-wrap th,
.commercial-table-wrap td,
.commercial-composer-table-wrap th,
.commercial-composer-table-wrap td {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* CODE */
.commercial-table-wrap th:nth-child(1),
.commercial-table-wrap td:nth-child(1),
.commercial-composer-table-wrap th:nth-child(1),
.commercial-composer-table-wrap td:nth-child(1) {
    width: clamp(100px, 12vw, 170px);
}

/*
 * DESCRIPTION assorbe tutto lo spazio residuo.
 * Il vecchio min-width rigido viene neutralizzato.
 */
.commercial-table-wrap th:nth-child(2),
.commercial-table-wrap td:nth-child(2),
.commercial-composer-table-wrap th:nth-child(2),
.commercial-composer-table-wrap td:nth-child(2) {
    width: auto;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}

/* LIST PRICE */
.commercial-table-wrap th:nth-child(3),
.commercial-table-wrap td:nth-child(3),
.commercial-composer-table-wrap th:nth-child(3),
.commercial-composer-table-wrap td:nth-child(3) {
    width: clamp(120px, 13vw, 175px);
    min-width: 0;
}

/* QUANTITY */
.commercial-table-wrap th:nth-child(4),
.commercial-table-wrap td:nth-child(4),
.commercial-composer-table-wrap th:nth-child(4),
.commercial-composer-table-wrap td:nth-child(4) {
    width: clamp(86px, 9vw, 125px);
    min-width: 0;
}

/* DISCOUNT */
.commercial-table-wrap th:nth-child(5),
.commercial-table-wrap td:nth-child(5),
.commercial-composer-table-wrap th:nth-child(5),
.commercial-composer-table-wrap td:nth-child(5) {
    width: clamp(100px, 10vw, 140px);
    min-width: 0;
}

/* NET PRICE */
.commercial-table-wrap th:nth-child(6),
.commercial-table-wrap td:nth-child(6),
.commercial-composer-table-wrap th:nth-child(6),
.commercial-composer-table-wrap td:nth-child(6) {
    width: clamp(120px, 13vw, 175px);
    min-width: 0;
}

/*
 * Gli input seguono la larghezza della propria cella
 * senza fuoriuscire dal modulo.
 */
.commercial-table-wrap input,
.commercial-table-wrap select,
.commercial-composer-table-wrap input,
.commercial-composer-table-wrap select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/*
 * Schermate intermedie: riduciamo spaziatura e testo,
 * continuando a mostrare tutte le colonne.
 */
@media (max-width: 1280px) {
    .commercial-table-wrap th,
    .commercial-table-wrap td,
    .commercial-composer-table-wrap th,
    .commercial-composer-table-wrap td {
        padding-left: 8px;
        padding-right: 8px;
    }

    .commercial-table-wrap th,
    .commercial-composer-table-wrap th {
        font-size: clamp(10px, 0.85vw, 12px);
    }

    .commercial-table-wrap td,
    .commercial-composer-table-wrap td {
        font-size: clamp(11px, 0.95vw, 13px);
    }
}

/*
 * Schermate strette: la tabella conserva una larghezza
 * minima funzionale e scorre solo dentro il proprio modulo.
 * La pagina e la shell non vengono allargate.
 */
@media (max-width: 900px) {
    .commercial-table-wrap table,
    .commercial-composer-table-wrap table {
        min-width: 760px;
    }

    .commercial-table-wrap,
    .commercial-composer-table-wrap {
        overscroll-behavior-inline: contain;
    }
}

/* CE-PRODUCTS-GRID-ITEMS-STYLE-001 */

/*
 * Variabili locali del modulo prodotti.
 * Non modificano il tema globale della Suite.
 */
.commercial-table-wrap,
.commercial-composer-table-wrap {
    --ce-products-grid-line: rgba(30, 41, 59, 0.16);
    --ce-products-grid-line-strong: var(--ms-theme-border);
    --ce-products-header-bg: var(--ms-theme-surface-soft);
    --ce-products-item-bg: var(--ms-theme-surface);
    --ce-products-item-text: var(--ms-theme-text);
}

/*
 * Cornice esterna della griglia.
 */
.commercial-table-wrap table,
.commercial-composer-table-wrap table {
    border: 1px solid var(--ce-products-grid-line-strong);
    border-collapse: collapse;
    border-spacing: 0;
}

/*
 * Ogni cella viene chiaramente delimitata.
 */
.commercial-table-wrap th,
.commercial-table-wrap td,
.commercial-composer-table-wrap th,
.commercial-composer-table-wrap td {
    border: 1px solid var(--ce-products-grid-line);
}

/*
 * Intestazione leggermente distinta dal corpo.
 */
.commercial-table-wrap thead th,
.commercial-composer-table-wrap thead th {
    background: var(--ce-products-header-bg);
    border-color: var(--ce-products-grid-line-strong);
}

/*
 * LIST PRICE e NET PRICE:
 * intestazioni e contenuti centrati.
 */
.commercial-table-wrap th:nth-child(3),
.commercial-table-wrap td:nth-child(3),
.commercial-table-wrap th:nth-child(6),
.commercial-table-wrap td:nth-child(6),
.commercial-composer-table-wrap th:nth-child(3),
.commercial-composer-table-wrap td:nth-child(3),
.commercial-composer-table-wrap th:nth-child(6),
.commercial-composer-table-wrap td:nth-child(6) {
    text-align: center;
    vertical-align: middle;
}

/*
 * Il campo modificabile di LIST PRICE resta centrato
 * anche quando la modalità di modifica è attiva.
 */
.commercial-table-wrap td:nth-child(3) input,
.commercial-composer-table-wrap td:nth-child(3) input,
.commercial-composer-price input {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/*
 * NET PRICE centrato anche attraverso la classe dedicata.
 */
.commercial-net-price,
.commercial-composer-price {
    text-align: center;
}

/*
 * Righe ITEM:
 * fondo circa due tonalità più scuro rispetto
 * alle normali righe prodotto.
 */
.commercial-table-wrap
tbody
tr.commercial-separator-row
td,
.commercial-composer-table-wrap
tbody
tr.commercial-separator-row
td {
    background: var(--ce-products-item-bg);
    color: var(--ce-products-item-text);
    border-color: var(--ce-products-grid-line-strong);
    font-weight: 800;
    letter-spacing: 0.015em;
}

/*
 * Nessun cambio di tonalità al passaggio del mouse:
 * la riga ITEM mantiene sempre la sua funzione visiva.
 */
.commercial-table-wrap
tbody
tr.commercial-separator-row:hover
td,
.commercial-composer-table-wrap
tbody
tr.commercial-separator-row:hover
td {
    background: var(--ce-products-item-bg);
}

/*
 * Mantiene visibile la griglia anche sugli input,
 * senza creare un doppio bordo pesante.
 */
.commercial-table-wrap td input,
.commercial-composer-table-wrap td input {
    border-color: var(--ce-products-grid-line-strong);
}

/*
 * Supporto tema scuro della Suite.
 */
[data-theme="dark"]
.commercial-table-wrap,
[data-theme="dark"]
.commercial-composer-table-wrap,
.theme-dark
.commercial-table-wrap,
.theme-dark
.commercial-composer-table-wrap {
    --ce-products-grid-line: rgba(203, 213, 225, 0.18);
    --ce-products-grid-line-strong: var(--ms-theme-border);
    --ce-products-header-bg: var(--ms-theme-surface-soft);
    --ce-products-item-bg: var(--ms-theme-surface);
    --ce-products-item-text: var(--ms-theme-text);
}


/* CP-005J4R1-BOTTOM-TOTALS-FONT-SIZE */
.commercial-totals-card > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 14px;
}

.commercial-totals-card > div + div {
    margin-top: 12px;
}

.commercial-totals-card span {
    font-size: 16px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: 0.01em;

    color: var(--ms-theme-text);}

.commercial-totals-card strong {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 850;
    white-space: nowrap;

    color: var(--ms-theme-text);}

.commercial-totals-card [data-average-discount] {
    font-size: 18px;
}

/* CP-005J5-FAMILY-IMAGES-EXTRA-RESPONSIVE-REDUCTION */
@media (max-width: 1100px) {
    .commercial-family-visual {
        display: flex;
        align-items: center;
        justify-content: center;

    background: var(--ms-theme-surface);
    color: var(--ms-theme-text);}

    .commercial-family-visual img {
        width: 50%;
        max-width: 50%;
        height: auto;
        max-height: 50%;
        object-fit: contain;
        transition:
            width 180ms ease,
            max-width 180ms ease,
            max-height 180ms ease;
    }
}

@media (max-width: 760px) {
    .commercial-family-visual img {
        width: 45%;
        max-width: 45%;
        max-height: 45%;
    }
}

/* CP-005K2-TOOLBAR-DISCOUNT-RESET */
.commercial-discount-overlay {
    position: fixed;
    inset: 0;
    z-index: 15000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 8, 23, 0.72);
    backdrop-filter: blur(6px);
}

.commercial-discount-overlay[hidden] {
    display: none;
}

.commercial-discount-dialog {
    width: min(390px, 100%);
    padding: 22px;
    border: 1px solid rgba(79, 209, 197, 0.45);
    border-radius: 18px;
    background:
        linear-gradient(
            145deg,
            rgba(15, 23, 42, 0.98),
            rgba(8, 15, 31, 0.98)
        );
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.48),
        0 0 30px rgba(45, 212, 191, 0.08);
}

.commercial-discount-dialog h3 {
    margin: 0;
    color: #f8fafc;
    font-size: 18px;
}

.commercial-discount-dialog p {
    margin: 8px 0 18px;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.45;
}

.commercial-discount-dialog-field {
    display: grid;
    gap: 8px;
}

.commercial-discount-dialog-field span {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.commercial-discount-dialog-field input {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid rgba(45, 212, 191, 0.42);
    border-radius: 10px;
    outline: none;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    font-size: 17px;
    font-weight: 800;
    text-align: center;
}

.commercial-discount-dialog-field input:focus {
    border-color: #2dd4bf;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.14);
}

.commercial-discount-dialog-error {
    display: block;
    margin-top: 8px;
    color: #fca5a5;
    font-size: 12px;
}

.commercial-discount-dialog-error[hidden] {
    display: none;
}

.commercial-discount-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.commercial-discount-dialog-actions button {
    min-width: 94px;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
}

.commercial-discount-dialog-cancel {
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(30, 41, 59, 0.72);
    color: #cbd5e1;
}

.commercial-discount-dialog-save {
    border: 1px solid rgba(45, 212, 191, 0.55);
    background: linear-gradient(135deg, #0f766e, #0d9488);
    color: #ffffff;
}

/* CP-006B2R2-PACKAGING-QUANTITY-FILTER */
.commercial-discount-cell[data-discount-locked="true"] {
    position: relative;
    isolation: isolate;
    cursor: not-allowed;
    background:
        linear-gradient(
            135deg,
            rgba(148, 163, 184, 0.22),
            rgba(100, 116, 139, 0.14)
        ) !important;
}

.commercial-discount-cell[data-discount-locked="true"]
.commercial-discount-input {
    opacity: 0.38 !important;
    filter: grayscale(1);
    pointer-events: none;
    cursor: not-allowed !important;
    border-color: rgba(100, 116, 139, 0.38) !important;
    background: rgba(148, 163, 184, 0.24) !important;
    color: rgba(15, 23, 42, 0.58) !important;
    -webkit-text-fill-color: rgba(15, 23, 42, 0.58) !important;
}

.commercial-discount-cell[data-discount-locked="true"]::after {
    content: "";
    position: absolute;
    inset: 6px;
    z-index: 2;
    border-radius: 8px;
    background:
        repeating-linear-gradient(
            -45deg,
            rgba(148, 163, 184, 0.08) 0,
            rgba(148, 163, 184, 0.08) 6px,
            rgba(100, 116, 139, 0.15) 6px,
            rgba(100, 116, 139, 0.15) 12px
        );
    pointer-events: auto;
    cursor: not-allowed;
}

[data-commercial-action="filter"].is-active {
    border-color: rgba(34, 197, 94, 0.72) !important;
    background:
        linear-gradient(
            135deg,
            rgba(34, 197, 94, 0.24),
            rgba(16, 185, 129, 0.17)
        ) !important;
    box-shadow:
        0 0 0 2px rgba(34, 197, 94, 0.12),
        0 8px 22px rgba(16, 185, 129, 0.16);
}

.commercial-quantity-input {
    cursor: pointer;
}
