.product-association-shell {
    display: grid;
    gap: 16px;
}

.product-association-table table {
    min-width: 1120px;
    table-layout: fixed;
}

.product-association-table th:nth-child(1),
.product-association-table td:nth-child(1) {
    width: 27%;
}

.product-association-table th:nth-child(2),
.product-association-table td:nth-child(2) {
    width: 140px;
}

.product-association-table th:nth-child(3),
.product-association-table td:nth-child(3) {
    width: 168px;
}

.product-association-table td[data-product-category-cell] {
    overflow: hidden;
}

.product-association-table td[data-product-category-cell] .category-badge {
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: break-word;
    text-align: left;
}

.product-association-table th:last-child,
.product-association-table td:last-child {
    width: 104px;
}

.product-association-table tr.is-selected td:first-child {
    box-shadow: inset 3px 0 0 var(--table-row-selected-accent);
}

.product-association-table td strong {
    display: block;
    margin-top: 5px;
}

.table-footnote {
    margin: -4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.association-workspace {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.association-workspace[hidden] {
    display: none;
}

.association-empty {
    display: grid;
    gap: 4px;
    padding: 26px;
    color: var(--muted);
    text-align: center;
}

.association-empty strong {
    color: var(--text);
}

.association-workspace-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line-soft);
}

.association-workspace-head h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
}

.association-workspace-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.association-workspace-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.association-product-edit {
    display: grid;
    gap: 12px;
    padding: 12px;
    margin: -2px 0 14px;
    border: 1px solid #c7d7fe;
    border-radius: var(--radius);
    background: #f5f8ff;
}

.association-edit-grid {
    display: grid;
    grid-template-columns: minmax(100px, .65fr) minmax(220px, 1.5fr) minmax(140px, .8fr) minmax(120px, .7fr) minmax(120px, .7fr);
    gap: 10px;
    align-items: end;
}

.association-edit-grid label {
    gap: 5px;
}

.association-edit-grid input {
    min-height: 38px;
}

.association-edit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.form-inline-message {
    min-width: 0;
    color: var(--success);
    font-size: 13px;
    font-weight: 700;
}

.form-inline-message.is-error {
    color: var(--danger);
}

.supplier-association-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 14px;
}

.supplier-association-panel {
    min-width: 0;
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.supplier-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.supplier-panel-head h3 {
    margin: 0;
    font-size: 17px;
}

.supplier-panel-head [data-panel-actions] {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.association-current {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    background: var(--surface);
}

.association-current.associated {
    border-color: #b7dfca;
}

.association-current.not-sold {
    border-color: #d8dee8;
}

.association-current.suggested {
    border-color: #b8cdfd;
}

.association-current strong,
.association-current small {
    overflow-wrap: anywhere;
}

.association-current small {
    color: var(--muted);
}

.catalog-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.catalog-title-line strong {
    overflow-wrap: anywhere;
}

.catalog-listino-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 2px 7px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    background: #f7fafc;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.catalog-search-field {
    gap: 5px;
}

.catalog-search-field input {
    min-height: 38px;
}

.catalog-candidate-list {
    display: grid;
    gap: 8px;
    max-height: 520px;
    overflow: auto;
    padding-right: 2px;
}

.catalog-candidate {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(112px, max-content);
    gap: 8px 10px;
    align-items: start;
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    background: var(--surface);
}

.catalog-candidate.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(21, 94, 117, .12);
}

.catalog-candidate-main {
    min-width: 0;
    width: 100%;
    min-height: 0;
    display: grid;
    justify-content: stretch;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    white-space: normal;
    cursor: pointer;
}

.catalog-candidate-main:hover strong,
.catalog-candidate-main:focus strong {
    color: var(--primary-strong);
}

.catalog-candidate-title {
    display: grid;
    gap: 2px;
}

.catalog-candidate-title .catalog-title-line,
.catalog-candidate-title strong,
.catalog-candidate-title span,
.catalog-candidate small {
    overflow-wrap: anywhere;
}

.catalog-candidate small {
    color: var(--muted);
    font-size: 12px;
}

.catalog-candidate-side {
    display: grid;
    justify-items: end;
    gap: 6px;
    text-align: right;
}

.catalog-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 26px;
    padding: 3px 7px;
    border-radius: 999px;
    background: #edf2f7;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.catalog-score.strong {
    background: var(--success-bg);
    color: var(--success);
}

.catalog-score.review {
    background: var(--warning-bg);
    color: var(--warning);
}

.catalog-score.weak {
    background: #eef4f6;
    color: var(--primary-strong);
}

.catalog-score.manual {
    min-width: 0;
    color: var(--muted);
}

.match-tags.compact {
    grid-column: 1 / -1;
    gap: 5px;
}

.compact-empty {
    padding: 14px;
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: 6px;
}

.text-danger {
    color: var(--danger) !important;
}
