/* Achat list — KPI workbench (aligné Report CRA / rent-workbench) */
.achat-workbench.achat-stats-wrapper {
    --rent-bg: #F5F8FA;
    --rent-text: #33475B;
    --rent-muted: #506E91;
    --rent-border: #E5EBF0;
    --rent-card: #FFFFFF;
    --rent-shadow: 0 1px 3px rgba(15, 32, 61, .08);
    display: block;
    margin: 10px 0 12px;
    padding: 12px 12px 8px;
    background: var(--rent-bg);
    border: 1px solid var(--rent-border);
    border-radius: 8px;
    color: var(--rent-text);
    font-size: 13px;
}

.achat-workbench .rent-wb-kpis.achat-all-kpis-row,
.achat-workbench .rent-wb-kpis[data-name="achat-kpi-row"] {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
    overflow-x: auto;
}

.achat-workbench.has-echeance-kpi .rent-wb-kpis.achat-all-kpis-row,
.achat-workbench.has-echeance-kpi .rent-wb-kpis[data-name="achat-kpi-row"] {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.achat-workbench .rent-wb-kpi {
    background: var(--rent-card);
    border: 1px solid var(--rent-border);
    border-radius: 6px;
    padding: 12px 14px;
    box-shadow: var(--rent-shadow);
    position: relative;
    overflow: hidden;
}

.achat-workbench .rent-wb-kpi .label {
    font-size: 10.5px;
    color: var(--rent-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 6px;
}

.achat-workbench .rent-wb-kpi .value {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--rent-text);
}

.achat-workbench .rent-wb-kpi .sub {
    font-size: 10.5px;
    color: var(--rent-muted);
    margin-top: 4px;
}

.achat-workbench .rent-wb-kpi .tag {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    background: #FEF3C7;
    color: #92400E;
}

.achat-workbench .achat-kpi-type-divider {
    box-shadow: inset 2px 0 0 #D1D9E0;
}

.achat-type-service-kpi .label {
    font-size: 10.5px;
}

.achat-type-service-kpi .value {
    font-size: 18px;
}

.achat-type-service-kpi .sub {
    font-size: 10.5px;
}

@media (max-width: 1400px) {
    .achat-workbench .rent-wb-kpis[data-name="achat-kpi-row"] {
        grid-template-columns: repeat(7, minmax(112px, 1fr));
    }
    .achat-workbench.has-echeance-kpi .rent-wb-kpis[data-name="achat-kpi-row"] {
        grid-template-columns: repeat(8, minmax(100px, 1fr));
    }
}

@media (max-width: 900px) {
    .achat-workbench .rent-wb-kpis[data-name="achat-kpi-row"] {
        grid-template-columns: repeat(7, minmax(100px, 1fr));
    }
    .achat-workbench.has-echeance-kpi .rent-wb-kpis[data-name="achat-kpi-row"] {
        grid-template-columns: repeat(8, minmax(92px, 1fr));
    }
}

.achat-workbench .rent-wb-kpi-clickable {
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.achat-workbench .rent-wb-kpi-clickable:hover {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.achat-workbench .rent-wb-kpi-clickable.active {
    box-shadow: 0 0 0 2px #2563EB;
}

.achat-workbench .rent-wb-kpi.accent-total { border-top: 3px solid #0091AE; }
.achat-workbench .rent-wb-kpi.accent-unpaid { border-top: 3px solid #DC2626; }
.achat-workbench .rent-wb-kpi.accent-partial { border-top: 3px solid #F59E0B; }
.achat-workbench .rent-wb-kpi.accent-paid { border-top: 3px solid #10B981; }
.achat-workbench .rent-wb-kpi.accent-invoice { border-top: 3px solid #7C3AED; }
.achat-workbench .rent-wb-kpi.accent-echeance { border-top: 3px solid #EA580C; }
.achat-workbench .rent-wb-kpi.accent-echeance.alert {
    background: linear-gradient(135deg, #FFF7ED 0%, #fff 100%);
    border-color: #FED7AA;
}

.achat-workbench .rent-wb-kpi.alert {
    background: linear-gradient(135deg, #FEF2F2 0%, #fff 100%);
    border-color: #FECACA;
}

.achat-workbench .rent-wb-kpi .label i {
    margin-right: 4px;
}

.achat-workbench .rent-wb-cra-progress {
    height: 5px;
    background: #FEE2E2;
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.achat-workbench .rent-wb-cra-progress > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #10B981, #34D399);
    border-radius: 3px;
}

.achat-kpi-progress-unpaid > span {
    background: linear-gradient(90deg, #DC2626, #F87171);
}

.achat-workbench .achat-wb-period-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-right: 4px;
}

.achat-workbench .achat-wb-period-nav .btn-link {
    font-size: 11px;
    padding: 2px 6px;
}

.achat-workbench .rent-wb-search-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--rent-border);
    border-radius: 3px;
    padding: 4px 10px;
    background: var(--rent-card);
    min-width: 160px;
}

.achat-type-service-kpi .sub.achat-ts-sub {
    margin-top: 6px;
}

.achat-type-service-kpi .tag {
    top: 8px;
    right: 10px;
}

.achat-type-service-kpi .achat-ts-select {
    position: absolute;
    top: 8px;
    left: 10px;
    margin: 0;
    z-index: 2;
    cursor: pointer;
}

.achat-type-service-kpi .achat-ts-checkbox {
    margin: 0;
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.achat-type-service-kpi.achat-ts-selected {
    box-shadow: inset 0 0 0 1px #93C5FD;
}

.achat-type-service-kpi .label {
    padding-left: 18px;
}

.achat-ts-split {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.achat-ts-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 3px 6px;
    border: 1px solid var(--rent-border);
    border-radius: 4px;
    background: #F8FAFC;
    font-size: 10px;
    line-height: 1.25;
    color: var(--rent-text);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.achat-ts-pill:hover {
    background: #EFF6FF;
    border-color: #BFDBFE;
}

.achat-ts-pill.active {
    background: #DBEAFE;
    border-color: #2563EB;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.achat-ts-pill-label {
    color: var(--rent-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.achat-ts-pill-label i {
    margin-right: 3px;
    font-size: 9px;
}

.achat-ts-pill-value {
    font-weight: 600;
    color: var(--rent-text);
    flex-shrink: 0;
}

.achat-ts-pill-ok .achat-ts-pill-value {
    color: #047857;
}

.achat-ts-pill-warn .achat-ts-pill-value {
    color: #B45309;
}

/* Ancien lien « Voir le détail » / icône liste — masqué (filtre direct au clic sur la pill) */
.achat-ts-open-list,
.achat-echeance-detail,
[data-action="achat-echeance-detail"] {
    display: none !important;
}

.achat-echeance-period {
    color: var(--rent-muted);
    font-weight: 500;
}
