.article-cell strong,
.quote-cell strong,
.money-cell strong,
.source-cell span,
td.positive strong,
td.negative strong {
    display: block;
}

.quote-cell strong,
.money-cell strong,
td.positive strong,
td.negative strong {
    font-size: 15px;
}

.source-cell {
    min-width: 145px;
}

.nowrap {
    white-space: nowrap;
}

.status,
.line-state {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    white-space: nowrap;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    background: #edf2f7;
    color: var(--text-soft);
}

.muted {
    color: var(--muted);
}

.status.finalizzato,
.status.valid,
.line-state.valid {
    background: var(--success-bg);
    color: var(--success);
}

.status.bozza,
.status.missing_competitor,
.line-state.missing_competitor {
    background: var(--warning-bg);
    color: var(--warning);
}

.status.not_convenient,
.line-state.not_convenient {
    background: var(--danger-bg);
    color: var(--danger);
}

.status.validato,
.status.associato,
.status.auto_associated,
.status.accepted,
.status.active,
.status.created,
.status.backfilled,
.status.price_changed,
.status.unit_changed,
.status.review_confirmed,
.status.success,
.status.resolved {
    background: var(--success-bg);
    color: var(--success);
}

.status.archiviato,
.status.ignorato,
.status.not_sold,
.status.unavailable,
.status.superato,
.status.history_only {
    background: #edf2f7;
    color: var(--muted);
}

.status.da_associare {
    background: var(--warning-bg);
    color: var(--warning);
}

.status.suggested {
    background: #eaf2ff;
    color: #175cd3;
}

.status.review,
.status.needs_review,
.status.suspended_review,
.status.removed_candidate,
.status.unprocessed,
.status.queued,
.status.running {
    background: var(--warning-bg);
    color: var(--warning);
}

.status.rejected,
.status.review_rejected,
.status.failed {
    background: var(--danger-bg);
    color: var(--danger);
}

.supplier-price-review-section {
    display: grid;
    gap: 12px;
}

.review-toolbar {
    position: sticky;
    top: 122px;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) repeat(4, minmax(140px, .85fr)) auto;
    align-items: end;
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
}

.review-toolbar label {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.review-filter-count {
    align-self: center;
    justify-self: end;
    white-space: nowrap;
    min-height: 34px;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 0.82rem;
    font-weight: 800;
}

.review-list {
    display: grid;
    gap: 8px;
}

.review-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--warning);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 1px 1px rgba(16, 24, 40, .03);
}

.review-card[data-review-risk="identity"] {
    border-left-color: var(--danger);
}

.review-card-main {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.review-card-header,
.review-card-badges,
.review-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-card-header {
    justify-content: space-between;
    min-width: 0;
}

.review-card-id {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.review-card-id strong {
    font-size: 1rem;
    line-height: 1.2;
}

.review-card-id span,
.review-card-grid small {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-card-badges {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.review-product-title {
    margin: 0;
    color: var(--text);
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
}

.review-risk {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 800;
}

.review-risk.identity {
    background: #fff7f6;
    color: var(--danger);
    border: 1px solid #ffd9d6;
}

.review-risk.simple {
    background: #fffaf0;
    color: var(--warning);
    border: 1px solid #fde5b5;
}

.review-card-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 150px 150px;
    gap: 8px;
    padding: 7px 0;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
}

.review-card-grid > div {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding-right: 10px;
    border-right: 1px solid var(--line-soft);
}

.review-card-grid > div:last-child {
    border-right: 0;
    padding-right: 0;
}

.review-card-grid span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.review-card-grid strong,
.review-change-before,
.review-change-after {
    overflow-wrap: anywhere;
}

.review-change-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.review-change {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 36px;
    padding: 6px 9px;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    background: #fbfcfd;
}

.review-change.identity {
    border-color: #ffd9d6;
    background: #fff9f8;
}

.review-change-label {
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 800;
}

.review-change-before,
.review-change-after {
    display: grid;
    gap: 1px;
    min-width: 0;
    font-size: 0.84rem;
    line-height: 1.25;
}

.review-change-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-change-before small,
.review-change-after small {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.review-change-before {
    color: var(--muted);
}

.review-change-after {
    color: var(--text);
    font-weight: 800;
}

.review-change-arrow {
    color: var(--muted);
    font-weight: 800;
}

.review-reason {
    margin: 0;
    padding: 10px;
    border-radius: 8px;
    background: var(--warning-bg);
    color: var(--warning);
    font-weight: 700;
}

.review-card-actions {
    flex-direction: column;
    justify-content: center;
    min-width: 94px;
}

.review-card-actions form,
.review-card-actions button {
    width: 100%;
}

.review-card-actions .button {
    min-height: 30px;
    padding: 5px 9px;
}

.review-empty {
    margin: 0;
}

.price-history-event-table td[data-label="Evento"] .status,
.price-history-event-table td[data-label="Revisione"] .status {
    margin-bottom: 4px;
}

.price-history-event-table td[data-label="Revisione"] a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.price-history-event-table td[data-label="Revisione"] a:hover,
.price-history-event-table td[data-label="Revisione"] a:focus {
    text-decoration: underline;
}

.price-history-event-table td[data-label="Data"],
.price-history-event-table td[data-label="Prezzo"] {
    white-space: nowrap;
}

.price-history-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.price-history-source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.price-history-source-card {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.price-history-source-card > div:first-child {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.price-history-source-card strong {
    font-size: 20px;
    line-height: 1.15;
    white-space: nowrap;
}

.price-history-source-card small {
    min-width: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.price-history-source-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.price-history-table th:nth-child(1),
.price-history-table td:nth-child(1) {
    width: 130px;
}

.price-history-table th:nth-child(2),
.price-history-table td:nth-child(2) {
    width: 150px;
}

.price-history-table th:nth-child(5),
.price-history-table td:nth-child(5),
.price-history-table th:nth-child(6),
.price-history-table td:nth-child(6),
.price-history-table th:nth-child(7),
.price-history-table td:nth-child(7) {
    width: 150px;
}

.price-delta {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 25px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #edf2f7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.price-delta.is-up,
.price-delta.is-risk {
    background: var(--danger-bg);
    color: var(--danger);
}

.price-delta.is-down,
.price-delta.is-favorable {
    background: var(--success-bg);
    color: var(--success);
}

.price-delta.is-flat {
    background: var(--surface-muted);
    color: var(--text-soft);
}

.category-badge {
    --category-color: #64748b;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    white-space: nowrap;
    border: 1px solid #d8dee8;
    border-color: color-mix(in srgb, var(--category-color) 42%, #d8dee8);
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
    color: var(--category-color);
    background: #f8fafc;
    background: color-mix(in srgb, var(--category-color) 10%, #ffffff);
}

.category-badge-empty {
    color: var(--muted);
    background: #f8fafc;
}

.taxonomy-tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 18px;
}

.taxonomy-tab {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 13px;
    color: var(--muted);
    background: #fff;
    font-weight: 700;
}

.taxonomy-tab.active {
    color: var(--primary);
    border-color: #bfdbfe;
    background: #eff6ff;
}

.taxonomy-create-form {
    align-items: end;
}

.taxonomy-list {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.taxonomy-item {
    --taxonomy-row-bg: var(--table-row-base);
    background: var(--taxonomy-row-bg);
    border-bottom: 1px solid var(--line-soft);
}

.taxonomy-item:nth-child(even) {
    --taxonomy-row-bg: var(--table-row-alt);
}

.taxonomy-item:last-child {
    border-bottom: 0;
}

.taxonomy-item[open] {
    background: #ffffff;
}

.taxonomy-item-summary {
    display: grid;
    grid-template-columns: minmax(170px, .85fr) minmax(220px, 1.35fr) minmax(180px, .95fr) auto;
    gap: 16px;
    align-items: start;
    padding: 14px 16px;
    background: var(--taxonomy-row-bg);
    cursor: pointer;
    list-style: none;
}

.taxonomy-item-summary--category {
    grid-template-columns: minmax(170px, .75fr) minmax(220px, 1.2fr) minmax(190px, .9fr) minmax(150px, .75fr) auto;
}

.taxonomy-item-summary:hover {
    background: var(--table-row-hover);
}

.taxonomy-item-summary::-webkit-details-marker {
    display: none;
}

.taxonomy-summary-main,
.taxonomy-summary-preview,
.taxonomy-summary-usage {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.taxonomy-summary-main strong {
    overflow-wrap: anywhere;
}

.taxonomy-summary-main small,
.taxonomy-summary-preview small,
.taxonomy-summary-usage small,
.taxonomy-section-heading small {
    color: var(--muted);
}

.taxonomy-summary-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.taxonomy-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.taxonomy-summary-line {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.taxonomy-summary-usage {
    color: var(--text);
}

.taxonomy-summary-usage strong {
    font-size: 17px;
    line-height: 1.2;
}

.taxonomy-summary-usage span {
    color: var(--text-soft);
}

.taxonomy-summary-action {
    align-self: center;
    min-width: 72px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    text-align: right;
}

.taxonomy-summary-action::after {
    content: " +";
}

.taxonomy-item[open] .taxonomy-summary-action::after {
    content: " -";
}

.taxonomy-detail {
    padding: 14px 16px 16px;
    border-top: 1px solid var(--line-soft);
}

.taxonomy-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(210px, 1fr));
    gap: 18px;
}

.taxonomy-detail-grid--category {
    grid-template-columns: minmax(260px, .85fr) minmax(320px, 1fr);
}

.taxonomy-detail-section {
    min-width: 0;
}

.taxonomy-detail-section--wide {
    grid-column: 1 / -1;
}

.taxonomy-section-heading {
    display: grid;
    gap: 2px;
    margin-bottom: 10px;
}

.taxonomy-section-heading h3 {
    margin: 0;
    font-size: 15px;
}

.taxonomy-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.taxonomy-chip-form {
    margin: 0;
}

.taxonomy-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 8px;
    color: var(--text);
    background: #f8fafc;
    font-size: 12px;
    font-weight: 700;
}

.taxonomy-chip-muted {
    color: var(--muted);
    background: #ffffff;
}

.taxonomy-chip button {
    border: 0;
    padding: 0;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 900;
}

.taxonomy-inline-add,
.taxonomy-edit-form,
.taxonomy-rule-form,
.taxonomy-delete-form {
    display: grid;
    gap: 8px;
    margin: 0;
}

.taxonomy-inline-add {
    grid-template-columns: minmax(120px, 1fr) auto;
}

.taxonomy-edit-form {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: end;
}

.taxonomy-rule-list {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.taxonomy-rule-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #f8fafb;
}

.taxonomy-rule-form {
    grid-template-columns: minmax(170px, 1.25fr) minmax(120px, .7fr) 88px minmax(86px, .55fr) minmax(150px, 1fr) auto;
    align-items: end;
}

.taxonomy-delete-form {
    align-self: end;
}

.taxonomy-edit-form input[readonly] {
    color: var(--muted);
    background: #f8fafc;
}

.taxonomy-color-field {
    min-width: 0;
}

.taxonomy-color-control {
    min-height: 37px;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.taxonomy-color-control input[type="color"] {
    width: 48px;
    min-width: 48px;
    height: 37px;
    padding: 3px;
}

.taxonomy-color-control span {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.taxonomy-empty-inline,
.taxonomy-empty-note {
    color: var(--muted);
    font-size: 13px;
}

.taxonomy-empty-note {
    margin: 0;
}

.positive {
    color: var(--success);
    font-weight: 700;
}

.negative {
    color: var(--danger);
    font-weight: 700;
}

.flash {
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.flash.success {
    border-color: #b7e1d4;
    background: var(--success-bg);
}

.flash.error {
    border-color: #f2b8b5;
    background: var(--danger-bg);
}

.flash.warning {
    border-color: #f0cf87;
    background: var(--warning-bg);
}

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fbfc;
    color: var(--text-soft);
    line-height: 1.45;
}

.notice.warning {
    border-color: #f0cf87;
    background: var(--warning-bg);
    color: var(--warning);
}
