/* Hub Préfactures — réutilise .sh-* / .mh-* ; accent bleu Prepa */

.prepa-hub-page.sh-hub-page,
.prepa-hub-page .sh-hub {
    --sh-accent: #0b90ce;
    --sh-accent-2: #0284c7;
    --sh-accent-dark: #0369a1;
    --sh-accent-soft: #e0f2fe;
    --sh-accent-ring: rgba(11, 144, 206, .22);
}

.prepa-hub-page .sh-header {
    background:
        radial-gradient(1200px 300px at 85% -60%, rgba(255, 255, 255, .14), transparent 60%),
        linear-gradient(120deg, #0c4a6e 0%, #0369a1 45%, #0b90ce 100%);
}

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

.prepa-hub-page .mh-type-tab {
    border: 1px solid #dbeafe;
    background: #fff;
    color: #0369a1;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

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

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

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

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

.prepa-hub-page tr.sh-row.is-fusionne td {
    text-decoration: line-through;
    opacity: .72;
}

.prepa-hub-page .ph-alerte {
    color: #dc2626;
    font-weight: 700;
}

.prepa-hub-page .ph-pdf-link {
    display: inline-block;
    color: #dc3545;
    font-size: 16px;
    line-height: 1;
    text-decoration: none;
    vertical-align: middle;
}

.prepa-hub-page .ph-pdf-link:hover {
    color: #b02a37;
}

/* ModernTheme ajoute ::after (lien externe) sur a[target=_blank] — masquer ici. */
.prepa-hub-page .ph-pdf-link::after,
.prepa-hub-page a.ph-pdf-link[target="_blank"]::after,
.prepa-hub-page .mh-table a[target="_blank"]::after {
    display: none !important;
    content: none !important;
}

/* ---- Grille : colonnes critiques lisibles (écrase mh-col-date/status/num) ---- */
.prepa-hub-page .sh-table-wrap {
    overflow-x: auto;
}

.prepa-hub-page .mh-table {
    table-layout: fixed;
    width: 100%;
    min-width: 1100px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.35;
}

.prepa-hub-page .mh-table th,
.prepa-hub-page .mh-table td {
    padding: 7px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    font-size: 14px;
}

.prepa-hub-page .mh-table th {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .01em;
}

.prepa-hub-page .sh-check-cell {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    padding-left: 4px !important;
    padding-right: 2px !important;
}

.prepa-hub-page .ph-col-idprepa {
    width: 88px;
    min-width: 80px;
}

/* Type : « Préfacture Écart » en entier */
.prepa-hub-page .ph-col-typeprepa {
    width: 148px !important;
    min-width: 140px !important;
    max-width: 160px !important;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
}

/* Date DD/MM/YYYY — pas le max-width 86px de mh-col-date */
.prepa-hub-page.mh-hub-page .mh-table th.ph-col-dateF,
.prepa-hub-page.mh-hub-page .mh-table td.ph-col-dateF,
.prepa-hub-page .ph-col-dateF {
    width: 100px !important;
    min-width: 96px !important;
    max-width: none !important;
    overflow: visible;
    text-overflow: unset;
}

.prepa-hub-page .ph-col-pdf,
.prepa-hub-page .ph-col-alerte {
    width: 32px;
    min-width: 28px;
    max-width: 36px;
    text-align: center;
    padding-left: 2px !important;
    padding-right: 2px !important;
}

/* Compte / Mission : largeur plafonnée (ne mangent pas les autres colonnes) */
.prepa-hub-page .ph-col-account {
    width: 14% !important;
    max-width: 180px !important;
    min-width: 100px;
    white-space: normal !important;
    word-break: break-word;
    line-height: 1.25;
    overflow: hidden;
}

.prepa-hub-page .ph-col-account a {
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
}

.prepa-hub-page .ph-col-mission {
    width: 12% !important;
    max-width: 160px !important;
    min-width: 90px;
    white-space: normal !important;
    word-break: break-word;
    line-height: 1.25;
    overflow: hidden;
}

.prepa-hub-page .ph-col-joursTravailles {
    width: 52px !important;
    min-width: 48px !important;
    max-width: 60px !important;
    text-align: right;
}

/* HT / TTC — pas le max-width 88px de .num */
.prepa-hub-page.mh-hub-page .mh-table th.ph-col-total,
.prepa-hub-page.mh-hub-page .mh-table td.ph-col-total,
.prepa-hub-page.mh-hub-page .mh-table th.ph-col-totalTTC,
.prepa-hub-page.mh-hub-page .mh-table td.ph-col-totalTTC,
.prepa-hub-page .ph-col-total,
.prepa-hub-page .ph-col-totalTTC {
    width: 108px !important;
    min-width: 100px !important;
    max-width: none !important;
    text-align: right;
    font-variant-numeric: tabular-nums;
    overflow: visible;
    text-overflow: unset;
}

/* Statut « Comptabilisée » — pas le max-width 92px de mh-col-status */
.prepa-hub-page.mh-hub-page .mh-table th.ph-col-status,
.prepa-hub-page.mh-hub-page .mh-table td.ph-col-status,
.prepa-hub-page .ph-col-status {
    width: 128px !important;
    min-width: 120px !important;
    max-width: none !important;
    overflow: visible;
    text-overflow: unset;
    white-space: nowrap;
}

.prepa-hub-page .ph-col-invoice {
    width: 90px;
    min-width: 80px;
}

/* Badges typeprepa (displayAsLabel Espo). */
.prepa-hub-page .ph-col-typeprepa .ph-type.label,
.prepa-hub-page .ph-type.label {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    vertical-align: middle;
    max-width: none !important;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: nowrap !important;
}

/* Bandeau sélection + totaux (comme Factures). */
.prepa-hub-page .ph-selection-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 0 0 8px;
    padding: 8px 12px;
    width: 100%;
    box-sizing: border-box;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 13px;
}

.prepa-hub-page .ph-selection-count {
    font-size: 15px;
    font-weight: 700;
    color: #212529;
    margin-left: 6px;
}

.prepa-hub-page .ph-selection-label,
.prepa-hub-page .ph-selection-title {
    color: #6c757d;
}

.prepa-hub-page .ph-selection-sep {
    color: #adb5bd;
    margin: 0 4px;
}

.prepa-hub-page .ph-selection-amount {
    font-size: 18px;
    font-weight: 700;
    color: #212529;
    white-space: nowrap;
}

.prepa-hub-page .mh-table tfoot.ph-list-totals tr.ph-totals-row td {
    border-top: 2px solid #dee2e6;
    background: #f8f9fa;
    font-weight: 700;
    vertical-align: middle;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
}

.prepa-hub-page .mh-table tfoot.ph-list-totals .ph-totals-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
}

.prepa-hub-page .mh-table .sh-badge,
.prepa-hub-page .ph-col-status .sh-badge {
    font-size: 12px;
    padding: 3px 8px;
    max-width: none;
    overflow: visible;
    text-overflow: unset;
    display: inline-block;
    vertical-align: middle;
    white-space: nowrap;
}

.prepa-hub-page .mh-table .sh-row-title {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prepa-hub-page .mh-table a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.prepa-hub-page .ph-col-mission a {
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
}
