/* Hub Achats — réutilise .sh-* / .mh-* ; accent teal achats */

.achat-hub-page.sh-hub-page,
.achat-hub-page .sh-hub {
    --sh-accent: #0f766e;
    --sh-accent-2: #0d9488;
    --sh-accent-dark: #115e59;
    --sh-accent-soft: #ccfbf1;
    --sh-accent-ring: rgba(15, 118, 110, .22);
}

.achat-hub-page .sh-header {
    background:
        radial-gradient(1200px 300px at 85% -60%, rgba(255, 255, 255, .14), transparent 60%),
        linear-gradient(120deg, #134e4a 0%, #0f766e 45%, #14b8a6 100%);
}

.achat-hub-page .mh-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px;
}

.achat-hub-page .mh-type-tab {
    border: 1px solid #99f6e4;
    background: #fff;
    color: #0f766e;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.achat-hub-page .mh-type-tab.is-on {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

.achat-hub-page .ah-bon-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: -4px 0 10px;
}

.achat-hub-page .ah-bon-tab {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.achat-hub-page .ah-bon-tab.is-on {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

.achat-hub-page .ph-filter-bar {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.achat-hub-page .ph-filter-bar .custom-applied-filters-wrap {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.achat-hub-page .ph-filter-bar .custom-filter-btn {
    white-space: nowrap;
}

.achat-hub-page .ph-selection-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    font-size: 12.5px;
    color: #134e4a;
}

.achat-hub-page .ph-selection-count {
    font-size: 15px;
    font-weight: 800;
    color: #0f766e;
}

.achat-hub-page .ph-selection-sep { color: #99f6e4; }
.achat-hub-page .ph-selection-amount {
    font-weight: 700;
    color: #0f766e;
    margin-left: auto;
}

.achat-hub-page .ph-totals-cell {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
}

/* Entité : ne pas absorber toute la largeur restante (colonne link/is-main) */
.achat-hub-page .mh-table th.ph-col-entite,
.achat-hub-page .mh-table td.ph-col-entite {
    width: 110px;
    min-width: 90px;
    max-width: 130px;
}
.achat-hub-page .mh-table td.ph-col-entite a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    max-width: 120px;
    line-height: 1.35;
    font-size: 12.5px;
}

/* Mission : plus étroite, 2 lignes max */
.achat-hub-page .mh-table th.ph-col-missionObject,
.achat-hub-page .mh-table td.ph-col-missionObject {
    max-width: 150px;
    width: 12%;
}
.achat-hub-page .ah-mission-wrap {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    max-width: 150px;
    font-size: 12.5px;
}

/* Fournisseur : resserré */
.achat-hub-page .mh-table th.ph-col-account1,
.achat-hub-page .mh-table td.ph-col-account1 {
    max-width: 130px;
    width: 11%;
}
.achat-hub-page .ah-fournisseur-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    max-width: 140px;
    font-size: 12.5px;
}

.achat-hub-page .ah-fournisseur-wrap > a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
}

.achat-hub-page .ah-conformite-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 5px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: 650;
    line-height: 1.45;
    height: 16px;
    white-space: nowrap;
    max-width: 100%;
}

.achat-hub-page .ah-conformite-badge i {
    font-size: 8px;
    line-height: 1;
}

.achat-hub-page .ah-conformite-badge.is-ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.achat-hub-page .ah-conformite-badge.is-ko {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Contact Demo : filigrane (comme Mission hub) */
.achat-hub-page .mh-table tr.sh-row-demo > td {
    background-color: #f8fafc;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='520' height='56'><text x='12' y='36' fill='rgba(71,85,105,0.18)' font-family='Georgia,serif' font-size='14' font-weight='700' letter-spacing='1.2' transform='rotate(-14 90 28)'>UTILISATEUR DEMONSTRATION</text></svg>");
    background-size: 520px 56px;
    background-repeat: repeat;
    background-attachment: fixed;
}
.achat-hub-page .mh-table tr.sh-row-demo:hover > td {
    background-color: #f1f5f9;
}
.achat-hub-page .mh-table tr.sh-row-demo.sh-row-selected > td {
    background-color: #e2e8f0;
}

/* Paiement : badge 2 lignes, colonne compacte */
.achat-hub-page .mh-table th.ph-col-statutPaiement,
.achat-hub-page .mh-table td.ph-col-statutPaiement {
    width: 92px;
    max-width: 100px;
    white-space: normal;
}
.achat-hub-page .mh-table .sh-badge.sh-badge-2l {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    line-height: 1.15;
    padding: 3px 7px 3px 8px;
    white-space: normal;
    max-width: 100%;
    border-radius: 10px;
}
.achat-hub-page .mh-table .sh-badge.sh-badge-2l .sh-badge-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
}
.achat-hub-page .mh-table .sh-badge.sh-badge-2l .sh-badge-l1,
.achat-hub-page .mh-table .sh-badge.sh-badge-2l .sh-badge-l2 {
    display: block;
    white-space: nowrap;
    font-size: 11.5px;
}

/* Bon à payer : pastille texte lisible */
.achat-hub-page .ah-bon-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.achat-hub-page .ah-bon-pill.is-ok {
    background: #dcfce7;
    color: #166534;
}
.achat-hub-page .ah-bon-pill.is-no {
    background: #fee2e2;
    color: #991b1b;
}

/* Cartes KPI hub = même style que la liste classique (achat-workbench.css) */
.achat-hub-page .ah-kpi-col {
    width: 100%;
}
.achat-hub-page .ah-kpi-wrap {
    margin: 0 0 4px;
    padding: 8px;
}
.achat-hub-page .ah-kpi-wrap .rent-wb-kpis.achat-all-kpis-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 8px;
    margin: 0;
}
.achat-hub-page .ah-kpi-wrap .rent-wb-kpi {
    cursor: pointer;
}
.achat-hub-page .ah-kpi-wrap .achat-ts-select {
    display: none;
}

.achat-hub-page .mh-table th.ph-col-facture,
.achat-hub-page .mh-table td.ph-col-facture {
    width: 180px;
    min-width: 160px;
    max-width: none;
}
.achat-hub-page .ah-facture-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: none;
    white-space: nowrap;
    vertical-align: bottom;
    color: #0f766e;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}
.achat-hub-page .ah-facture-link:hover {
    color: #115e59;
    text-decoration: underline;
}
.achat-hub-page .ah-facture-link .fa-file-pdf {
    color: #dc2626;
    flex: none;
}

.achat-hub-page .ah-facture-comp {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.achat-hub-page .ah-facture-comp .ah-facture-link {
    color: #6d28d9;
    font-weight: 600;
}

.achat-hub-page .ah-facture-comp-badge {
    display: inline-block;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.5;
    background: #ede9fe;
    color: #5b21b6;
    white-space: nowrap;
}

.achat-hub-page .ah-facture-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.achat-hub-page .ah-escompte-label {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    color: #0369a1;
    white-space: nowrap;
}

.achat-hub-page .ah-paiement-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
}

.achat-hub-page .ah-payee-le {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    color: #166534;
    white-space: nowrap;
}

.achat-hub-page .ah-paiement-badge-btn {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    line-height: 1;
}

.achat-hub-page .ah-paiement-badge-btn:hover .sh-badge {
    filter: brightness(0.96);
}

.achat-hub-page .ah-reste-label {
    display: inline-block;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    color: #b45309;
    white-space: nowrap;
    cursor: pointer;
}

.achat-hub-page .ah-reste-label:hover {
    text-decoration: underline;
    color: #92400e;
}

.achat-hub-page .mh-table th.ph-col-joursTravailles,
.achat-hub-page .mh-table td.ph-col-joursTravailles,
.achat-hub-page .mh-table th.ph-col-period,
.achat-hub-page .mh-table td.ph-col-period {
    width: 70px;
    white-space: nowrap;
}

.achat-hub-page .mh-table th.ph-col-bonAPayer,
.achat-hub-page .mh-table td.ph-col-bonAPayer {
    width: 100px;
    white-space: nowrap;
}

.achat-hub-page .mh-table th.ph-col-total,
.achat-hub-page .mh-table td.ph-col-total,
.achat-hub-page .mh-table th.ph-col-ttc,
.achat-hub-page .mh-table td.ph-col-ttc,
.achat-hub-page .mh-table th.ph-col-dateEcheance,
.achat-hub-page .mh-table td.ph-col-dateEcheance {
    white-space: nowrap;
}
