/* Groupements (/contacts/groupements) — scripts/groupements.js */

#grp-app {
    --grp-primary: #294e5f;
    --grp-accent: #1e88e5;
    --grp-ok: #2e7d32;
    --grp-warn: #ef6c00;
    --grp-bad: #c62828;
    --grp-border: #e0e6ea;
    --grp-muted: #6b7a83;
    max-width: 1400px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 12px 16px 80px;
    color: #263238;
}

/* Les tableaux larges défilent dans leur cadre, sans élargir la page */
#grp-app > *,
.grp-panel,
.grp-card {
    min-width: 0;
    max-width: 100%;
}

.grp-table-wrap {
    max-width: 100%;
}

#grp-app .hidden,
#grp-dialog.hidden,
#grp-dialog .hidden {
    display: none !important;
}

/* Barre du haut */
.grp-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.grp-select-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border-radius: 8px;
    padding: 2px 10px;
    flex: 1 1 260px;
    max-width: 520px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}

.grp-select-wrap i {
    color: var(--grp-primary);
}

.grp-select-wrap select {
    border: none;
    font-weight: 700;
    font-size: 15px;
    height: 38px;
    background: transparent;
    flex: 1;
    min-width: 0;
}

/* Boutons */
.grp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--grp-border);
    background: #fff;
    color: var(--grp-primary);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.3;
    white-space: nowrap;
}

.grp-btn i {
    font-size: 18px;
}

.grp-btn:hover:not([disabled]) {
    background: #f1f6f9;
}

.grp-btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

.grp-btn-primary {
    background: var(--grp-accent);
    border-color: var(--grp-accent);
    color: #fff;
}

.grp-btn-primary:hover:not([disabled]) {
    background: #1976d2;
}

.grp-btn-flat {
    border-color: transparent;
    background: transparent;
    padding-left: 4px;
}

.grp-btn-danger {
    background: var(--grp-bad);
    border-color: var(--grp-bad);
    color: #fff;
}

.grp-btn-danger:hover:not([disabled]) {
    background: #b71c1c;
}

.grp-btn-danger-flat {
    border-color: transparent;
    background: transparent;
    color: var(--grp-bad);
}

.grp-btn.grp-big {
    font-size: 15px;
    padding: 10px 18px;
}

.grp-icon-btn {
    border: none;
    background: transparent;
    color: var(--grp-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    display: inline-flex;
}

.grp-icon-btn:hover {
    background: #fdecea;
    color: var(--grp-bad);
}

.grp-icon-btn i {
    font-size: 18px;
}

/* Cartes */
.grp-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.grp-card h6 {
    font-weight: 700;
    color: var(--grp-primary);
    margin: 0 0 8px;
}

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

p.grp-muted {
    margin: 0 0 8px;
    font-size: 13px;
}

#grp-empty {
    text-align: center;
    padding: 28px 20px;
    max-width: 760px;
    margin: 30px auto;
}

#grp-empty h5 {
    font-weight: 700;
    color: var(--grp-primary);
}

.grp-empty-icon i {
    font-size: 56px;
    color: var(--grp-accent);
}

.grp-steps {
    text-align: left;
    margin: 12px auto 20px;
    max-width: 620px;
    line-height: 1.5;
}

.grp-steps li {
    margin-bottom: 6px;
}

/* Résumé */
.grp-summary {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

/* Onglets : cartes blanches lisibles sur le fond, une couleur par onglet (pastille de l'icône, trait du haut),
   un compteur ; l'onglet ouvert est relié au panneau et porte un trait épais de sa couleur */
.grp-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    margin-bottom: 0;
    padding-top: 4px;
    scrollbar-width: none;
}

.grp-tab {
    --c: #546e7a;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: rgba(255, 255, 255, .88);
    color: #37474f;
    padding: 10px 16px 10px 10px;
    border-radius: 10px 10px 0 0;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: inset 0 3px 0 color-mix(in srgb, var(--c) 55%, transparent);
    transition: background .15s, transform .15s, box-shadow .15s;
}
.grp-tab[data-tab="situations"] { --c: #1565c0; }
.grp-tab[data-tab="pointage"] { --c: #00897b; }
.grp-tab[data-tab="depenses"] { --c: #ef6c00; }
.grp-tab[data-tab="bareme"] { --c: #6d4c41; }
.grp-tab[data-tab="parametres"] { --c: #546e7a; }

.grp-tab i {
    font-size: 18px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 12%, #fff);
}

.grp-tab:hover {
    background: #fff;
    transform: translateY(-2px);
}

.grp-tab.active {
    background: #fff;
    color: var(--c);
    box-shadow: inset 0 4px 0 var(--c), 0 -2px 8px rgba(0, 0, 0, .08);
    transform: none;
}
.grp-tab.active i {
    color: #fff;
    background: var(--c);
}

/* Compteur de l'onglet (nombre de situations, de dépenses, de postes…) */
.grp-tab-nb {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 12%, #fff);
}
.grp-tab-nb:empty { display: none; }
.grp-tab.active .grp-tab-nb { color: #fff; background: var(--c); }

.grp-panel {
    background: #fff;
    border-radius: 0 10px 10px 10px;
    padding: 14px 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.grp-panel .grp-card {
    box-shadow: none;
    border: 1px solid var(--grp-border);
}

.grp-panel-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.grp-panel-head > div:first-child {
    flex: 1 1 360px;
}

.grp-panel-head h6 {
    font-weight: 700;
    color: var(--grp-primary);
    margin: 0 0 4px;
}

.grp-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Tableaux */
.grp-table-wrap {
    overflow-x: auto;
    margin-bottom: 10px;
    border: 1px solid var(--grp-border);
    border-radius: 8px;
}

.grp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.grp-table th {
    background: #f1f5f8;
    color: var(--grp-primary);
    font-weight: 700;
    padding: 7px 8px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--grp-border);
}

.grp-table th small {
    font-weight: 400;
    color: var(--grp-muted);
}

.grp-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #f0f3f5;
    vertical-align: middle;
}

.grp-table .num {
    text-align: right;
    white-space: nowrap;
}

.grp-table tfoot td {
    font-weight: 700;
    background: #f7f9fb;
}

.grp-table.grp-small {
    font-size: 12px;
}

.grp-clickable tbody tr {
    cursor: pointer;
}

.grp-clickable tbody tr:hover {
    background: #eef6fd;
}

.grp-table input,
.grp-table select {
    height: 30px !important;
    border: 1px solid var(--grp-border) !important;
    border-radius: 4px !important;
    padding: 0 6px !important;
    margin: 0 !important;
    font-size: 13px !important;
    box-sizing: border-box !important;
    background: #fff;
    box-shadow: none !important;
    width: 100%;
    min-width: 90px;
}

.grp-table input.num {
    text-align: right;
    width: 90px;
    min-width: 70px;
}

.grp-table input.grp-xs {
    width: 60px;
    min-width: 50px;
}

.grp-table input.grp-wide-input {
    min-width: 220px;
}

.grp-table td.num small {
    display: block;
    font-size: 10px;
    color: var(--grp-muted);
}

.grp-table input:focus,
.grp-table select:focus {
    border-color: var(--grp-accent) !important;
    outline: none;
}

.grp-table input:disabled,
.grp-table select:disabled {
    background: #f7f9fb;
    color: #455a64;
}

/* Récapitulatif d'une situation */
.grp-recap tr.grp-section td {
    background: #eceff1;
    color: var(--grp-primary);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .3px;
    padding-top: 8px;
}

.grp-recap tr.total td {
    font-weight: 700;
    border-top: 1px solid #cfd8dc;
}

.grp-recap tr.fort td {
    background: #e3f2fd;
    font-size: 14px;
}

.grp-recap tr.detail td {
    color: var(--grp-muted);
    font-size: 12px;
}

.grp-recap tr.detail td:first-child {
    padding-left: 22px;
}

/* Badges, alertes */
.grp-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: #eceff1;
    color: #546e7a;
    white-space: nowrap;
}

.grp-badge i {
    font-size: 13px;
}

.grp-badge.ok {
    background: #e8f5e9;
    color: var(--grp-ok);
}

.grp-badge.info {
    background: #e3f2fd;
    color: #1565c0;
}

.grp-warn-icon {
    color: var(--grp-warn);
    font-size: 18px;
    vertical-align: middle;
}

.grp-alert,
.grp-info {
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 13px;
}

.grp-alert {
    background: #fff3e0;
    border: 1px solid #ffcc80;
    color: #8d4b00;
}

.grp-alert > div {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.grp-alert i,
.grp-info i {
    font-size: 18px;
}

.grp-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: #0d47a1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Texte long à côté de l'icône : il se resserre au lieu de passer sous l'icône */
.grp-info > span {
    flex: 1 1 240px;
    min-width: 0;
}

.grp-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin: 4px 0 12px;
}

.grp-check.ok {
    color: var(--grp-ok);
}

.grp-check.bad {
    color: var(--grp-bad);
}

.grp-hint {
    font-size: 12px;
    color: var(--grp-muted);
    margin: -2px 0 10px;
}

.grp-hint i.tiny {
    font-size: 14px;
    vertical-align: middle;
}

/* Pointage */
.grp-member-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 16px;
    color: var(--grp-primary);
    margin-bottom: 6px;
}

.grp-totals {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--grp-muted);
}

.grp-totals b {
    color: var(--grp-primary);
}

.grp-cat-title {
    font-weight: 700;
    font-size: 13px;
    color: #455a64;
    margin: 10px 0 4px;
}

.grp-cat-title small {
    font-weight: 400;
    color: var(--grp-muted);
}

/* Dépenses */
.grp-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin: 4px 0 10px;
}

.grp-filters select {
    height: 34px;
    border: 1px solid var(--grp-border);
    border-radius: 6px;
    width: auto;
    padding: 0 8px;
}

.grp-segmented {
    display: inline-flex;
    border: 1px solid var(--grp-border);
    border-radius: 6px;
    overflow: hidden;
    flex-wrap: wrap;
}

.grp-segmented button {
    border: none;
    background: #fff;
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    color: #455a64;
    border-right: 1px solid var(--grp-border);
}

.grp-segmented button:last-child {
    border-right: none;
}

.grp-segmented button.active {
    background: var(--grp-primary);
    color: #fff;
    font-weight: 700;
}

/* Champs de formulaire */
.grp-form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.grp-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 10px;
    flex: 0 1 200px;
    min-width: 140px;
}

.grp-field.grp-grow {
    flex: 1 1 240px;
}

.grp-field.grp-wide {
    flex: 1 1 100%;
}

.grp-field.grp-inline {
    flex: 0 1 260px;
    margin-bottom: 0;
}

.grp-field > span {
    font-size: 12px;
    font-weight: 600;
    color: #546e7a;
}

.grp-field > small {
    font-size: 11px;
    color: var(--grp-muted);
}

#grp-app .grp-field input,
#grp-app .grp-field select,
#grp-app .grp-field textarea,
#grp-dialog .grp-field input,
#grp-dialog .grp-field select,
#grp-dialog .grp-field textarea {
    height: 36px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    padding: 0 10px;
    margin: 0;
    font-size: 14px;
    box-sizing: border-box;
    background: #fff;
    box-shadow: none;
    width: 100%;
}

#grp-app .grp-field textarea,
#grp-dialog .grp-field textarea {
    height: auto;
    padding: 8px 10px;
    resize: vertical;
    font-family: inherit;
}

#grp-app .grp-field input:focus,
#grp-app .grp-field select:focus,
#grp-app .grp-field textarea:focus,
#grp-dialog .grp-field input:focus,
#grp-dialog .grp-field select:focus,
#grp-dialog .grp-field textarea:focus {
    border-color: var(--grp-accent);
    outline: none;
}

#grp-app .grp-field input:disabled,
#grp-dialog .grp-field input:disabled,
#grp-dialog .grp-field textarea:disabled {
    background: #f5f7f8;
    color: #37474f;
}

.grp-suffix {
    display: flex;
    align-items: center;
    gap: 4px;
}

.grp-suffix input {
    text-align: right;
}

.grp-suffix i {
    font-style: normal;
    color: var(--grp-muted);
}

/* Cases à cocher natives (Materialize masque les cases sans span voisin) */
.grp-check-field {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 4px 0 10px;
    cursor: pointer;
    color: #37474f;
    font-size: 14px;
}

.grp-check-field input[type="checkbox"] {
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    flex: 0 0 18px;
}

.grp-check-field input[type="checkbox"] + span {
    padding-left: 0 !important;
    height: auto !important;
    line-height: 1.4 !important;
}

.grp-check-field input[type="checkbox"] + span::before,
.grp-check-field input[type="checkbox"] + span::after {
    display: none !important;
}

/* Paramètres */
.grp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 12px;
}

/* Carte à plusieurs rangées de champs (majorations et frais) : toute la largeur, les champs se mettent côte à côte */
.grp-grid > .grp-card-large {
    grid-column: 1 / -1;
}

.grp-member-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

#grp-app .grp-member-row input[type="text"] {
    height: 34px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    padding: 0 10px;
    margin: 0;
    flex: 1;
    box-sizing: border-box;
    box-shadow: none;
}

.grp-add-member {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 8px;
}

.grp-add-member select {
    height: 34px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    padding: 0 8px;
    flex: 1 1 220px;
    width: auto;
}

.grp-danger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border: 1px solid #ffcdd2;
    margin-top: 12px;
}

/* Fenêtre */
#grp-dialog {
    position: fixed;
    inset: 0;
    background: rgba(20, 35, 45, .55);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

body.grp-dialog-open {
    overflow: hidden;
}

.grp-dialog-box {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 1000px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
    color: #263238;
}

.grp-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--grp-border, #e0e6ea);
    flex: 0 0 auto;
}

.grp-dialog-title {
    font-size: 18px;
    font-weight: 800;
    color: #294e5f;
}

.grp-dialog-close {
    border: none;
    background: transparent;
    cursor: pointer;
    color: #607d8b;
    display: inline-flex;
    padding: 4px;
    border-radius: 50%;
}

.grp-dialog-close:hover {
    background: #eceff1;
}

.grp-dialog-body {
    padding: 14px 16px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.grp-dialog-foot {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-top: 1px solid #e0e6ea;
    flex: 0 0 auto;
}

.grp-dialog-foot:empty {
    display: none;
}

.grp-spacer {
    flex: 1;
}

/* Les styles des alertes et tableaux servent aussi dans la fenêtre (hors de #grp-app) */
#grp-dialog {
    --grp-primary: #294e5f;
    --grp-accent: #1e88e5;
    --grp-ok: #2e7d32;
    --grp-warn: #ef6c00;
    --grp-bad: #c62828;
    --grp-border: #e0e6ea;
    --grp-muted: #6b7a83;
}

/* Mobile */
@media (max-width: 600px) {
    #grp-app {
        padding: 8px 8px 80px;
    }

    .grp-tab span:not(.grp-tab-nb) {
        display: none;
    }

    .grp-tab {
        padding: 8px 10px 8px 8px;
    }

    .grp-panel {
        padding: 10px;
    }

    .grp-field {
        flex: 1 1 100%;
    }

    .grp-grid {
        grid-template-columns: 1fr;
    }

    #grp-dialog {
        padding: 0;
    }

    .grp-dialog-box {
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }

    .grp-btn span {
        white-space: normal;
    }
}

/* Formulaire de dépense : cadre invisible, sert à tout désactiver d'un coup (situation validée) */
.grp-fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.grp-fieldset:disabled {
    opacity: .75;
}

/* ───────── Lots du marché : un onglet par lot ───────── */
.grp-lots {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
}

.grp-lots-label {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--grp-muted);
    margin-right: 4px;
}

.grp-lot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 4px 12px;
    border: 2px solid #cfd8dc;
    border-radius: 20px;
    background: #fff;
    color: var(--grp-primary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.grp-lot i {
    font-size: 18px;
    color: #00897b;
}

.grp-lot small {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    background: #e0f2f1;
    color: #00695c;
}

.grp-lot.termine i { color: var(--grp-muted); }
.grp-lot.termine small { background: #eceff1; color: var(--grp-muted); }

.grp-lot:hover { border-color: #00897b; }

.grp-lot.active {
    background: #00897b;
    border-color: #00897b;
    color: #fff;
}

.grp-lot.active i { color: #fff; }
.grp-lot.active small { background: rgba(255, 255, 255, .22); color: #fff; }

.grp-lot-add {
    border-style: dashed;
    color: #00897b;
}

/* ───────── Cadres de paramètres : une couleur et une icône par cadre ───────── */
.grp-card.grp-sec {
    border-top: 5px solid var(--sec);
    background: linear-gradient(180deg, color-mix(in srgb, var(--sec) 6%, #fff) 0, #fff 70px);
}

.grp-card.grp-sec h6 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--sec);
    font-size: 17px;
}

.grp-sec-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--sec) 14%, #fff);
    flex: 0 0 32px;
}

.grp-sec-icon i {
    font-size: 19px;
    color: var(--sec);
}

/* ───────── Couleur de chaque entreprise ───────── */
.grp-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--m, #546e7a);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    flex: 0 0 30px;
}

.grp-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--m, #546e7a);
    margin-right: 6px;
    vertical-align: baseline;
}

.grp-nowrap { white-space: nowrap; }

.grp-th-membre {
    border-top: 4px solid var(--m) !important;
    background: color-mix(in srgb, var(--m) 8%, #fff) !important;
    color: color-mix(in srgb, var(--m) 75%, #000) !important;
}

/* Pointage : chaque entreprise dans son cadre de couleur */
.grp-card.grp-member-card {
    border-left: 6px solid var(--m);
    padding-top: 0;
    overflow: hidden;
}

.grp-member-card .grp-member-head {
    margin: 0 -16px 8px -16px;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--m) 12%, #fff);
    border-bottom: 1px solid color-mix(in srgb, var(--m) 30%, #fff);
}

.grp-member-name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: color-mix(in srgb, var(--m) 80%, #000);
    font-size: 17px;
}

.grp-member-card .grp-cat-title {
    color: color-mix(in srgb, var(--m) 70%, #000);
    border-bottom: 1px dashed color-mix(in srgb, var(--m) 35%, #fff);
    padding-bottom: 2px;
}

.grp-member-card .grp-btn-flat { color: color-mix(in srgb, var(--m) 85%, #000); }

/* ───────── Mandataire : un drapeau « Mandataire » (un seul par lot) ───────── */
.grp-mandat-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #00897b;
    border-radius: 10px;
    padding: 1px 8px 1px 5px;
    vertical-align: middle;
}

.grp-mandat-tag i {
    font-size: 13px !important;
    color: #fff !important;
}

.grp-member-row .grp-avatar { margin-right: 2px; }

.grp-mandat {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 30px;
    padding: 0 10px 0 7px;
    border-radius: 15px;
    border: 1.5px solid #cfd8dc;
    color: var(--grp-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex: 0 0 auto;
}

.grp-mandat input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none;
}

.grp-mandat i { font-size: 17px; }

.grp-mandat:hover { border-color: #00897b; color: #00897b; }

.grp-mandat.on {
    background: #00897b;
    border-color: #00897b;
    color: #fff;
}

.grp-mandat:focus-within { outline: 2px solid #80cbc4; outline-offset: 2px; }

/* Boutons radio des fenêtres (ajout d'un lot) */
.grp-check-field input[type="radio"] {
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    flex: 0 0 18px;
}

.grp-check-field input[type="radio"] + span {
    padding-left: 0 !important;
    height: auto !important;
    line-height: 1.4 !important;
}

.grp-check-field input[type="radio"] + span::before,
.grp-check-field input[type="radio"] + span::after {
    display: none !important;
}

/* En-tête : le lot en titre, le marché au-dessus */

.grp-card.grp-summary { border-left: 6px solid #00897b; }

/* ───────── Pointage : récapitulatif de la situation affichée ───────── */
.grp-card.grp-recap-pt {
    border-top: 5px solid #1565c0;
}

.grp-recap-pt-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.grp-recap-pt-head h6 {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #1565c0;
}

.grp-recap-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin: 6px 0 12px;
}

.grp-recap-kpis > div {
    background: #f4f7fb;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.grp-recap-kpis span {
    font-size: 12px;
    color: var(--grp-muted);
}

.grp-recap-kpis b {
    font-size: 19px;
    color: var(--grp-primary);
}

.grp-recap-kpis small {
    font-size: 12px;
    color: var(--grp-muted);
}

.grp-progress {
    height: 8px;
    border-radius: 4px;
    background: #dde5ec;
    overflow: hidden;
    margin: 2px 0;
}

.grp-progress i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #1e88e5, #00897b);
    border-radius: 4px;
}

.grp-recap-pt-table tbody td:first-child {
    border-left: 4px solid var(--m);
}

.grp-recap-pt-table tfoot td {
    font-weight: 700;
    background: #eef3f6;
}

/* ───────── Justificatifs des dépenses ───────── */
.grp-pj {
    margin-top: 12px;
    border-top: 1px solid var(--grp-border);
    padding-top: 10px;
}

.grp-pj-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--grp-primary);
}

.grp-pj-head > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.grp-pj-head small { color: var(--grp-muted); }

.grp-pj-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--grp-border);
    border-radius: 8px;
    margin-bottom: 6px;
    background: #fff;
}

.grp-pj-item.nouveau {
    border-style: dashed;
    border-color: #90caf9;
    background: #f5faff;
}

.grp-pj-icon { font-size: 30px; color: #78909c; }
.grp-pj-icon.pdf { color: #d32f2f; }
.grp-pj-icon.image { color: #7b1fa2; }
.grp-pj-icon.tableur { color: #2e7d32; }
.grp-pj-icon.texte { color: #1565c0; }

.grp-pj-nom {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.grp-pj-nom { color: #1565c0; text-decoration: underline; }

#grp-app .grp-pj-note,
#grp-dialog .grp-pj-note {
    height: 30px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    padding: 0 8px;
    margin: 2px 0 0;
    font-size: 13px;
    box-sizing: border-box;
    box-shadow: none;
}

.grp-pj-drop {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border: 2px dashed #90a4ae;
    border-radius: 10px;
    color: #455a64;
    background: #fafcfd;
    cursor: pointer;
    text-align: center;
}

.grp-pj-drop i { font-size: 30px; color: #1e88e5; }
.grp-pj-drop u { color: #1e88e5; }

.grp-pj-drop:hover,
.grp-pj-drop.survol {
    border-color: #1e88e5;
    background: #e3f2fd;
}

.grp-pj-drop:focus-within { outline: 2px solid #90caf9; }

/* Trombone du tableau des dépenses */
.grp-pj-col { text-align: center; width: 48px; }
.grp-pj-col i.material-icons { font-size: 18px; vertical-align: middle; }

.grp-pj-badge {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    padding: 1px 7px 1px 3px;
    border-radius: 10px;
    background: #e3f2fd;
    color: #1565c0;
    font-weight: 700;
    font-size: 12px;
}

.grp-pj-badge i.material-icons { font-size: 16px; transform: rotate(45deg); }

.grp-pj-aucun { color: #b0bec5; }

/* En-tête compact : lot, état, marché et chantier sur une seule ligne ; chiffres clés plus bas de hauteur */
.grp-card.grp-summary { padding: 10px 14px; gap: 10px 16px; }

/* ───────── En-tête du lot : bandeau du lot, entreprises avec leur part, chiffres clés ───────── */
.grp-hero {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
    overflow: hidden;
    margin-bottom: 12px;
}

.grp-hero-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    flex-wrap: wrap;
    padding: 12px 18px;
    background: linear-gradient(110deg, #00695c 0%, #00897b 55%, #26a69a 100%);
    color: #fff;
}

.grp-hero-lot {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.grp-hero-lot > i {
    font-size: 26px;
    background: rgba(255, 255, 255, .18);
    border-radius: 8px;
    padding: 4px;
}

.grp-hero-titre {
    font-size: 22px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grp-hero-etat {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 12px;
    background: #fff;
    color: #00695c;
    white-space: nowrap;
}

.grp-hero-etat.termine { background: rgba(255, 255, 255, .25); color: #fff; }

.grp-hero-marche {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    min-width: 0;
    max-width: 100%;
    line-height: 1.3;
}

.grp-hero-marche b,
.grp-hero-marche span {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grp-hero-marche b { font-size: 15px; }
.grp-hero-marche span { font-size: 12px; opacity: .85; }

.grp-hero-body {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(0, 1.6fr);
    gap: 14px 22px;
    padding: 12px 18px 14px;
    align-items: start;
}

.grp-hero-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.grp-hero-kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #f4f7fa;
    border-left: 4px solid #90a4ae;
    min-width: 0;
}

.grp-hero-kpi > span {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--grp-muted);
}

.grp-hero-kpi b {
    font-size: 21px;
    font-weight: 800;
    color: var(--grp-primary);
    white-space: nowrap;
}

.grp-hero-kpi small { font-size: 12px; color: var(--grp-muted); }
.grp-hero-kpi .grp-progress { margin-top: 4px; }

.grp-hero-kpi.ok { border-left-color: var(--grp-ok); }
.grp-hero-kpi.ok b { color: var(--grp-ok); }
.grp-hero-kpi.warn { border-left-color: var(--grp-warn); }
.grp-hero-kpi.warn b { color: var(--grp-warn); }
.grp-hero-kpi.bad { border-left-color: var(--grp-bad); }
.grp-hero-kpi.bad b { color: var(--grp-bad); }

@media (max-width: 1250px) {
    .grp-hero-body { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .grp-hero-kpis { grid-template-columns: 1fr; }
    .grp-hero-marche { align-items: flex-start; text-align: left; }
}

/* ───────── Fenêtre « dépense » : saisie à gauche (justificatifs en haut), document à droite ───────── */
.grp-dialog-box.grp-dialog-large {
    max-width: 1380px;
    height: calc(100vh - 32px);
}

.grp-dep-layout {
    display: grid;
    grid-template-columns: minmax(380px, 1fr) minmax(0, 1.15fr);
    gap: 18px;
    height: 100%;
    min-height: 0;
}

.grp-dep-saisie {
    min-width: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.grp-dep-saisie .grp-form-row { flex-wrap: wrap; }
.grp-dep-saisie .grp-form-row { gap: 0 12px; }
.grp-dep-saisie .grp-form-row > .grp-field { flex: 1 1 calc(50% - 6px); min-width: 0; }
.grp-dep-saisie .grp-form-row > .grp-field.grp-grow:first-child { flex-basis: 100%; }
.grp-dep-saisie .grp-form-row > .grp-check-field { flex: 1 1 100%; }

.grp-dep-vue {
    min-width: 0;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    background: #eceff1;
    overflow: hidden;
}

.grp-vue-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    background: #37474f;
    color: #fff;
    font-size: 13px;
}

.grp-vue-head .grp-pj-nom { color: #fff; }
.grp-vue-head a.link { color: #b3e5fc; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }

.grp-vue-doc {
    flex: 1;
    width: 100%;
    border: 0;
    background: #fff;
}

.grp-vue-img {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px;
}

.grp-vue-img img {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    background: #fff;
}

.grp-vue-attente {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    text-align: center;
    color: var(--grp-muted);
}

.grp-vue-attente .grp-pj-icon { font-size: 56px; }
.grp-vue-attente .loader { position: static; transform: none; }

/* Zone de dépôt quand aucun document n'est affiché */
.grp-pj-drop.grp-pj-drop-grand {
    flex: 1;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    border-radius: 10px;
    background: #f5f9fc;
}

.grp-pj-drop-grand i { font-size: 54px; }
.grp-pj-drop-grand b { font-size: 17px; color: var(--grp-primary); }
.grp-pj-drop-grand small { color: var(--grp-muted); line-height: 1.5; max-width: 420px; }

.grp-dialog-box.survol .grp-dep-vue { outline: 3px dashed #1e88e5; outline-offset: -3px; }

/* Liste des justificatifs, en haut de la saisie */
.grp-dep-saisie .grp-pj {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid var(--grp-border);
    border-top: 0;
    border-radius: 10px;
    background: #f8fafc;
}

.grp-pj-import { cursor: pointer; }

.grp-pj-liste {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.grp-dep-saisie .grp-pj-item {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
    gap: 8px;
    margin: 0;
    padding: 6px 8px;
}

.grp-pj-item.vu {
    border-color: #1e88e5;
    box-shadow: 0 0 0 1px #1e88e5;
}

.grp-pj-choix {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 6px;
    align-items: center;
    text-align: left;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    min-width: 0;
}

.grp-pj-choix .grp-pj-icon { grid-row: 1 / 3; font-size: 26px; }
.grp-pj-choix small { color: var(--grp-muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.grp-pj-vide { margin: 4px 0 0 !important; }

/* Bouton de lecture automatique */
.grp-btn.grp-btn-ia {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
    background: linear-gradient(90deg, #6a1b9a, #1e88e5);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
}

/* Survol : la couleur claire commune aux boutons ne s'applique pas (texte blanc devenu invisible) */
.grp-btn.grp-btn-ia:hover:not([disabled]) {
    background: linear-gradient(90deg, #7b1fa2, #1976d2);
    color: #fff;
    box-shadow: 0 2px 8px rgba(106, 27, 154, .35);
}
.grp-btn.grp-btn-ia[disabled] { background: #b0bec5; filter: none; }
.grp-btn.grp-btn-ia.en-cours i { animation: grp-tourne 1.2s linear infinite; }

@keyframes grp-tourne { to { transform: rotate(360deg); } }

/* Champ rempli par la lecture automatique, à vérifier */
#grp-dialog .grp-auto {
    background: #f3e5f5 !important;
    border-color: #8e24aa !important;
}

@media (max-width: 900px) {
    .grp-dialog-box.grp-dialog-large { height: auto; }
    .grp-dep-layout { grid-template-columns: 1fr; height: auto; }
    .grp-dep-vue { min-height: 360px; }
    .grp-dep-saisie { overflow: visible; }
}

.grp-dialog-large .grp-dialog-body { overflow: hidden; display: flex; flex-direction: column; }
.grp-dialog-large .grp-dep-layout { flex: 1; }

@media (max-width: 900px) {
    .grp-dialog-large .grp-dialog-body { overflow-y: auto; }
}

/* Forme du groupement : choix expliqués à la création, pastille dans l'en-tête */

.grp-hero-forme {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px 2px 7px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .7);
    color: #fff;
    white-space: nowrap;
}

.grp-hero-forme i { font-size: 15px; }
a.grp-hero-forme.vide { border-style: dashed; color: #fff; opacity: .9; }

/* Création : entreprises cochées, mandataire et part signée (groupement conjoint) */
.grp-ent-ligne {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 4px 0;
    border-bottom: 1px dashed #eceff1;
}

.grp-ent-ligne > .grp-check-field { flex: 1 1 auto; width: auto !important; min-width: 0; margin: 0; }
.grp-ent-ligne > .grp-part { flex: 0 0 170px; }
@media (min-width: 641px) { .grp-ent-ligne { flex-wrap: nowrap; } }

.grp-mandat-choix {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 28px;
    padding: 0 10px 0 7px;
    border-radius: 14px;
    border: 1.5px solid #cfd8dc;
    color: var(--grp-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.grp-mandat-choix input[type="radio"] { position: absolute !important; opacity: 0 !important; pointer-events: none; }
.grp-mandat-choix i { font-size: 16px; }
.grp-mandat-choix:has(input:checked) { background: #00897b; border-color: #00897b; color: #fff; }
.grp-ent-ligne:has(> .grp-check-field input:not(:checked)) .grp-mandat-choix { visibility: hidden; }

#grp-dialog .grp-part,
#grp-app .grp-part-param {
    width: 170px;
    height: 32px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    padding: 0 8px;
    margin: 0;
    text-align: right;
    box-sizing: border-box;
    box-shadow: none;
}

#grp-app .grp-part-param { flex: 0 0 130px; width: 130px; }

/* Parts affichées seulement en groupement conjoint, pour les entreprises cochées */
.grp-form-creation .grp-part,
.grp-form-creation .grp-repartition,
.grp-solidaire-note { display: none; }
.grp-form-creation:has(input[name="formeGroupement"][value^="conjoint"]:checked) .grp-part,
.grp-form-creation:has(input[name="formeGroupement"][value^="conjoint"]:checked) .grp-repartition { display: flex; }
.grp-form-creation:has(input[name="formeGroupement"][value^="conjoint"]:checked) .grp-part { display: block; }
.grp-form-creation:has(input[name="formeGroupement"][value="solidaire"]:checked) .grp-solidaire-note,
.grp-solidaire-note.visible { display: block; }
.grp-ent-ligne:has(> .grp-check-field input:not(:checked)) .grp-part { visibility: hidden; }

.grp-repartition {
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #eef3f6;
    font-size: 13px;
    color: #37474f;
}

.grp-repartition.visible { display: flex; }
.grp-repartition i { font-size: 18px; color: #546e7a; }
.grp-repartition.ok { background: #e8f5e9; color: #1b5e20; }
.grp-repartition.ok i { color: #2e7d32; }
.grp-repartition.ecart { background: #fff3e0; color: #e65100; }
.grp-repartition.ecart i { color: #ef6c00; }

.grp-solidaire-note {
    margin: 8px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: #e3f2fd;
    color: #0d47a1;
    font-size: 13px;
}

/* Fenêtre « dépense » : désignation sur plusieurs lignes, notes mises en forme */
#grp-dialog textarea.grp-textarea {
    min-height: 64px;
    padding: 8px 10px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    box-sizing: border-box;
}

.grp-notes { width: 100%; }

.grp-notes-barre {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 6px;
    border: 1px solid #cfd8dc;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    background: #f5f7f9;
}

.grp-notes-barre button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 28px;
    padding: 0 6px;
    border: 0;
    border-radius: 5px;
    background: none;
    color: #37474f;
    font-size: 15px;
    cursor: pointer;
}

.grp-notes-barre button:hover { background: #e0e7ec; }
.grp-notes-barre button i.material-icons { font-size: 18px; }

.grp-notes-barre .grp-notes-couleur {
    min-width: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0 2px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #cfd8dc;
}

.grp-notes-barre .grp-notes-couleur:hover { background: var(--c); transform: scale(1.15); }

.grp-notes-sep { width: 1px; height: 20px; margin: 0 6px; background: #cfd8dc; }

.grp-notes-zone {
    min-height: 130px;
    max-height: 60vh;
    overflow: auto;
    resize: vertical;
    padding: 8px 10px;
    border: 1px solid #cfd8dc;
    border-radius: 0 0 6px 6px;
    background: #fff;
    line-height: 1.45;
    color: #263238;
    outline: none;
}

.grp-notes-zone:not([contenteditable]) { border-radius: 6px; background: #f5f7f9; min-height: 60px; resize: none; }
.grp-notes-zone:focus { border-color: #1e88e5; box-shadow: 0 0 0 1px #1e88e5; }
.grp-notes-zone:empty::before { content: attr(data-placeholder); color: #90a4ae; }
.grp-notes-zone ul, .grp-notes-zone ol { margin: 4px 0; padding-left: 22px; }
.grp-notes-zone ul li { list-style: disc; }

/* En-tête : durée et montant du lot sous son titre */
.grp-hero-gauche { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.grp-hero-infos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 16px;
    padding-left: 44px;
    font-size: 13px;
    color: #e0f2f1;
}

.grp-hero-infos > span,
.grp-hero-infos > a { display: inline-flex; align-items: center; gap: 4px; color: #e0f2f1; }
.grp-hero-infos i { font-size: 16px; }
.grp-hero-infos b { color: #fff; }
.grp-hero-infos small { opacity: .85; }
.grp-hero-infos a { text-decoration: underline dashed; }

/* Montant global de chaque entreprise (groupement conjoint) */

@media (max-width: 640px) {
    .grp-hero-infos { padding-left: 0; }
}

/* Avenants */
.grp-av-resume {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 24px;
    margin: 4px 0 10px;
    font-size: 13px;
    color: var(--grp-muted);
}

.grp-av-resume b { color: var(--grp-primary); margin-left: 4px; }
.grp-av-resume .total b { color: #6d4c41; font-size: 15px; }
.grp-av-total td { background: #efebe9; }
.grp-av-detail { margin-top: 6px; display: none; }
.grp-form-avenant:has(input[name="mode"][value="detail"]:checked) .grp-av-detail { display: block; }
.grp-av-detail .grp-ent-ligne > .grp-check-field { display: inline-flex; align-items: center; }

/* ───────── Mandataire : chef de chantier casqué (remplace le drapeau) ───────── */
.grp-ico-mandataire {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    vertical-align: middle;
}

.grp-mandat-tag {
    gap: 3px;
    padding: 1px 9px 1px 3px;
    background: #ffca28;
    color: #1f3b5a;
    border: 1px solid #f9a825;
    font-weight: 800;
}

.grp-mandat-tag .grp-ico-mandataire { width: 18px; height: 18px; }

/* Bouton du mandataire (Paramètres) et choix à la création : jaune quand c'est lui, icône grisée sinon */
.grp-mandat .grp-ico-mandataire,
.grp-mandat-choix .grp-ico-mandataire { width: 18px; height: 18px; filter: grayscale(1) opacity(.55); }

.grp-mandat.on,
.grp-mandat-choix:has(input:checked) {
    background: #ffca28;
    border-color: #f9a825;
    color: #1f3b5a;
}

.grp-mandat.on .grp-ico-mandataire,
.grp-mandat-choix:has(input:checked) .grp-ico-mandataire { filter: none; }

.grp-mandat:hover,
.grp-mandat-choix:hover { border-color: #f9a825; color: #1f3b5a; }
.grp-mandat:hover .grp-ico-mandataire,
.grp-mandat-choix:hover .grp-ico-mandataire { filter: none; }

/* ───────── Mandataire, v2 : médaillon seul (bulle au survol), sans fond jaune ───────── */
.grp-mandat-tag {
    display: inline-flex;
    align-items: center;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 50%;
    vertical-align: middle;
    cursor: help;
}

.grp-mandat-tag .grp-ico-mandataire { width: 26px; height: 26px; }
.grp-member-name .grp-mandat-tag .grp-ico-mandataire { width: 30px; height: 30px; }
p.grp-muted .grp-mandat-tag .grp-ico-mandataire { width: 22px; height: 22px; }

/* Boutons « Mandataire / Désigner » : médaillon en couleur et contour orange quand c'est lui */
.grp-mandat .grp-ico-mandataire,
.grp-mandat-choix .grp-ico-mandataire { width: 22px; height: 22px; }

.grp-mandat.on,
.grp-mandat-choix:has(input:checked) {
    background: #fff3e0;
    border-color: #ff8f00;
    color: #e65100;
}

/* Pointage : total du mois mis en avant */
.grp-totals .grp-total-mois {
    padding: 2px 10px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--m, #546e7a) 16%, #fff);
    color: color-mix(in srgb, var(--m, #546e7a) 80%, #000);
    font-weight: 600;
}

.grp-totals .grp-total-mois b { color: inherit; font-size: 14px; }
.grp-totals { align-items: center; }

/* Fenêtre « avenant » : entreprises concernées (prorata) ou montants par entreprise */
.grp-av-prorata { display: none; margin: 2px 0 6px 26px; }
.grp-form-avenant:has(input[name="mode"][value="prorata"]:checked) .grp-av-prorata { display: block; }
.grp-av-prorata .grp-check-field { margin: 2px 0; }
.grp-av-objet { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-notes-zone.grp-auto { background: #f3e5f5 !important; border-color: #8e24aa !important; }

.grp-pj-ia {
    display: block;
    margin-top: 6px;
    text-align: center;
    font-size: 12px;
    color: #6a1b9a;
    text-decoration: underline dotted;
}

/* ───────── Mandataire, v3 : le bonhomme sans cercle, et le mot « Mandataire » ───────── */
.grp-mandat-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 8px;
    padding: 0;
    background: none;
    border: 0;
    font-size: 12px;
    font-weight: 700;
    color: #e65100;
    white-space: nowrap;
    cursor: help;
}

.grp-mandat-tag .grp-ico-mandataire,
.grp-member-name .grp-mandat-tag .grp-ico-mandataire,
p.grp-muted .grp-mandat-tag .grp-ico-mandataire { width: 22px; height: 22px; }
p.grp-muted .grp-mandat-tag { margin: 0 2px; }

/* ───────── En-tête : tableau des entreprises du lot et de leurs sous-traitants ───────── */
.grp-hero-body { grid-template-columns: 1fr !important; }
.grp-ent-lot { overflow-x: auto; }

.grp-ent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.grp-ent-table th {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--grp-muted);
    text-align: left;
    border-bottom: 1px solid var(--grp-border);
    white-space: nowrap;
}

.grp-ent-table th.num, .grp-ent-table td.num { text-align: right; }

.grp-ent-table td {
    padding: 7px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f3f5;
}

.grp-ent-table td.num small { display: block; font-size: 11px; color: var(--grp-muted); }

.grp-ent-ligne-lot td:first-child { border-left: 4px solid var(--m); }
.grp-ent-ligne-lot { background: color-mix(in srgb, var(--m) 5%, #fff); }

.grp-ent-nom {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.grp-ent-nom .grp-avatar { width: 28px; height: 28px; flex-basis: 28px; font-size: 11px; }

.grp-ent-barre {
    display: block;
    width: 100%;
    max-width: 160px;
    margin: 3px 0 1px auto;
    height: 6px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--m, #546e7a) 14%, #fff);
    overflow: hidden;
}

.grp-ent-barre i { display: block; height: 100%; background: var(--m, #546e7a); border-radius: 3px; }

.grp-st-ligne td { font-size: 13px; color: #37474f; padding-top: 4px; padding-bottom: 4px; }
.grp-st-ligne td:first-child { border-left: 4px solid color-mix(in srgb, var(--m, #90a4ae) 40%, #fff); padding-left: 26px; }

.grp-st-nom { display: inline-flex; align-items: center; gap: 4px; }
.grp-st-nom i { font-size: 16px; color: #90a4ae; }
.grp-st-nom small { margin-left: 6px; font-size: 11px; color: var(--grp-muted); }

.grp-depasse, .grp-depasse span { color: #c62828 !important; font-weight: 700; }

/* Paramètres : sous-traitants déclarés */
.grp-st-bloc {
    padding: 8px 0 6px 12px;
    border-left: 4px solid var(--m);
    margin-bottom: 10px;
}

.grp-st-entreprise { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.grp-st-entreprise small { color: var(--grp-muted); }

.grp-st-row {
    display: grid;
    grid-template-columns: minmax(160px, 1.4fr) minmax(200px, 1.2fr) 150px 140px 32px;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

#grp-app .grp-st-row input[type="text"],
#grp-app .grp-st-row select {
    height: 34px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    padding: 0 8px;
    margin: 0;
    box-sizing: border-box;
    box-shadow: none;
}

.grp-st-cumul { font-size: 13px; color: #37474f; text-align: right; }

@media (max-width: 900px) {
    .grp-st-row { grid-template-columns: 1fr 1fr; }
}

/* ───────── Choix compacts (nature du marché, forme du groupement) ───────── */
.grp-pilules { display: flex; flex-wrap: wrap; gap: 8px; }

.grp-pilule {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px 6px 10px;
    border: 1.5px solid #cfd8dc;
    border-radius: 20px;
    background: #fff;
    color: #37474f;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.grp-pilule input[type="radio"] {
    position: static !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 4px 0 0 !important;
}

.grp-pilule input[type="radio"] + span { display: inline-flex; align-items: center; gap: 4px; padding: 0 !important; height: auto !important; line-height: 1.3 !important; }
.grp-pilule input[type="radio"] + span::before,
.grp-pilule input[type="radio"] + span::after { display: none !important; }
.grp-pilule span i { font-size: 17px; color: #546e7a; }
.grp-pilule:hover { border-color: #00897b; }
.grp-pilule:has(input:checked) { border-color: #00897b; background: #e0f2f1; color: #004d40; box-shadow: 0 0 0 1px #00897b; }
.grp-pilule .infobulle-aide { margin-left: 2px; }

/* ───────── Maître d'ouvrage et maître d'œuvre ───────── */
.grp-intervenants {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px 16px;
    margin: 4px 0 10px;
}

.grp-intervenant {
    padding: 8px 12px;
    border: 1px solid var(--grp-border);
    border-radius: 10px;
    background: #fafcfd;
}

.grp-intervenant-titre {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: var(--grp-primary);
    margin-bottom: 4px;
}

.grp-intervenant-titre i { font-size: 18px; color: #546e7a; }
.grp-intervenant .grp-form-row > .grp-field { flex: 1 1 140px; min-width: 0; }

/* ───────── Mandataire : bonhomme dans une pastille orange (partout) ───────── */
.grp-mandat-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 10px 2px 5px;
    border: 1.5px solid #ff8f00;
    border-radius: 14px;
    background: #fff3e0;
    color: #e65100;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
    cursor: help;
}

.grp-mandat-tag .grp-ico-mandataire,
.grp-member-name .grp-mandat-tag .grp-ico-mandataire,
p.grp-muted .grp-mandat-tag .grp-ico-mandataire { width: 20px; height: 20px; }

/* ───────── Sous-traitant : ouvrier au casque blanc dans une pastille bleue ───────── */
.grp-ico-st { width: 20px; height: 20px; flex: 0 0 auto; vertical-align: middle; }

.grp-st-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    padding: 1px 8px 1px 4px;
    border: 1.5px solid #64b5f6;
    border-radius: 12px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
}

.grp-st-tag .grp-ico-st { width: 17px; height: 17px; }
.grp-st-nom .grp-ico-st { width: 20px; height: 20px; margin-right: 2px; }
.grp-st-ico { display: inline-flex; justify-content: center; }
.grp-st-ico .grp-ico-st { width: 24px; height: 24px; }
.grp-st-row { grid-template-columns: 28px minmax(150px, 1.4fr) minmax(200px, 1.2fr) 150px 140px 32px; }

@media (max-width: 900px) {
    .grp-st-row { grid-template-columns: 28px 1fr 1fr; }
}

/* Membres du groupement : en tête de l'en-tête, sous-traitants non déclarés signalés */
.grp-ent-lot { margin-bottom: 4px; }
.grp-ent-table th small { display: block; font-size: 10px; font-weight: 600; text-transform: none; letter-spacing: 0; color: #90a4ae; }

/* ───────── Composition du groupement : version compacte ───────── */
.grp-hero-body { padding: 8px 14px 10px; gap: 8px; }
.grp-ent-table { font-size: 13.5px; }
.grp-ent-table th { padding: 4px 8px; font-size: 10.5px; }
.grp-ent-table th small { display: none; }
.grp-ent-table td { padding: 4px 8px; }
.grp-ent-table td.num small { display: inline; font-size: 11px; margin-left: 2px; }
.grp-ent-nom { gap: 6px; }
.grp-ent-nom .grp-avatar { width: 24px; height: 24px; flex-basis: 24px; font-size: 10px; }
.grp-ent-nom .grp-mandat-tag { margin-left: 4px; padding: 0 8px 0 4px; font-size: 11px; }
.grp-ent-nom .grp-mandat-tag .grp-ico-mandataire { width: 17px; height: 17px; }
.grp-ent-barre { display: inline-block; vertical-align: middle; width: 60px; margin: 0 0 0 6px; height: 5px; }
.grp-st-ligne td { padding-top: 2px; padding-bottom: 2px; font-size: 12.5px; }
.grp-st-ligne td:first-child { padding-left: 34px; }
.grp-st-nom .grp-ico-st { width: 17px; height: 17px; }

/* Bouton des sous-traitants d'un membre */
.grp-st-compte {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
    padding: 0 4px 0 6px;
    height: 22px;
    border: 1px solid #90caf9;
    border-radius: 11px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.grp-st-compte .grp-ico-st { width: 15px; height: 15px; margin-right: 2px; }
.grp-st-compte i { font-size: 16px; }
.grp-st-compte.alerte { border-color: #ffb74d; background: #fff3e0; color: #e65100; }
.grp-st-compte:hover { filter: brightness(.97); }

.grp-st-contrat { margin-left: 6px; }
.grp-st-contrat {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 0 7px 0 4px;
    border-radius: 10px;
    background: #e8f5e9;
    color: #2e7d32 !important;
    font-size: 11px;
    font-weight: 700;
}
.grp-st-contrat i { font-size: 14px; }

/* Chiffres clés plus bas */
.grp-hero .grp-hero-kpi { padding: 6px 12px; }
.grp-hero .grp-hero-kpi b { font-size: 18px; }
.grp-hero .grp-hero-kpi .grp-progress { margin: 2px 0; }

/* Montants négatifs en rouge */
.grp-negatif, input.grp-negatif { color: #c62828 !important; }

/* Paramètres : lien avec le contrat de sous-traitance */
.grp-st-row { grid-template-columns: 28px minmax(140px, 1.3fr) minmax(190px, 1.1fr) 150px 120px minmax(170px, 1fr) 32px; }
.grp-st-lien { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.grp-st-lien select { min-width: 0; flex: 1; }
.grp-st-lien.ok a { display: inline-flex; align-items: center; gap: 3px; color: #2e7d32; font-weight: 700; font-size: 13px; }
.grp-st-lien.ok a i, .grp-st-creer i { font-size: 18px; }
.grp-st-creer { color: #546e7a; display: inline-flex; }

@media (max-width: 1100px) {
    .grp-st-row { grid-template-columns: 28px 1fr 1fr; }
}

/* Sous-traitants : déclaration de sous-traitance (oui / non, dates) */
.grp-st-row { row-gap: 4px; padding-bottom: 6px; border-bottom: 1px dashed #eceff1; }
.grp-st-declaration {
    grid-column: 2 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 13px;
    color: #546e7a;
}

.grp-st-q { display: inline-flex; align-items: center; font-weight: 600; }
.grp-pilule.petite { padding: 2px 10px 2px 8px; font-size: 13px; }
.grp-st-date { display: inline-flex; align-items: center; gap: 6px; }
#grp-app .grp-st-date input[type="date"] { height: 30px; border: 1px solid #cfd8dc; border-radius: 6px; padding: 0 6px; margin: 0; box-shadow: none; width: auto; }

.grp-st-declare {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
    padding: 0 7px 0 4px;
    border-radius: 10px;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
}

.grp-st-declare i { font-size: 14px; }

/* Tableau des dépenses : désignation plus large, repère du sous-traitant sous son nom */
.grp-table .grp-dep-designation { min-width: 280px; width: 30%; }

/* Paramètres, cadre Lot : bloc « Financier » */
.grp-financier {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #b2dfdb;
    border-radius: 10px;
    background: #f4fbfa;
}

.grp-financier-titre { display: flex; align-items: center; gap: 6px; font-weight: 800; color: #00695c; margin-bottom: 6px; }
.grp-financier-titre i { font-size: 20px; }
.grp-financier-av { margin: 6px 0; }
.grp-financier-av-titre { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--grp-primary); }
.grp-financier-av-titre .grp-btn { padding: 2px 8px; }

.grp-av-ligne {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 4px 0;
    padding: 6px 8px;
    border: 1px solid #e0e6ea;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.grp-av-ligne:hover { border-color: #00897b; }
.grp-av-ligne .grp-av-date { color: var(--grp-muted); white-space: nowrap; }
.grp-av-ligne .grp-av-objet { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #37474f; }
.grp-av-ligne .grp-av-montant { font-weight: 800; white-space: nowrap; }

.grp-financier-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #b2dfdb;
    font-weight: 700;
    color: var(--grp-primary);
}

.grp-financier-total small { font-weight: 500; color: var(--grp-muted); }
.grp-financier-total b { font-size: 17px; color: #00695c; white-space: nowrap; }
.grp-alerte-txt { display: block; margin-top: 4px; color: #e65100; font-size: 12px; }

/* Entreprises du lot : la part signée passe sous le nom (le nom reste lisible) */
.grp-member-row { flex-wrap: wrap; }
.grp-member-row > input[data-membre-nom] { flex: 1 1 140px; min-width: 120px; }
#grp-app .grp-member-row .grp-part-param { order: 10; flex: 1 1 100%; width: auto; margin-left: 38px; max-width: calc(100% - 78px); }

/* ───────── Paramètres : composition du groupement (tableau + anneau) ───────── */
.grp-compo { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.grp-compo-table { flex: 1 1 560px; min-width: 0; }
.grp-compo-table table td { vertical-align: middle; }
.grp-compo-table tbody tr td:first-child { border-left: 4px solid var(--m); }
.grp-compo-nom { display: flex; align-items: center; gap: 8px; min-width: 220px; }
#grp-app .grp-compo-nom input[type="text"] {
    flex: 1;
    min-width: 140px;
    height: 32px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    padding: 0 8px;
    margin: 0;
    box-shadow: none;
}
#grp-app .grp-compo-table .grp-part-param { width: 150px; margin: 0; order: 0; max-width: none; flex: none; }
.grp-compo-table tfoot td { font-weight: 700; background: #f3e5f5; }
.grp-compo-table .grp-add-member { margin-top: 10px; }
.grp-compo-anneau { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 10px; }
.grp-anneau { position: relative; width: 150px; height: 150px; }
.grp-anneau-centre { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.grp-anneau-centre b { font-size: 13px; color: var(--grp-primary); }
.grp-anneau-centre small { color: var(--grp-muted); font-size: 11px; }
.grp-anneau-legende { display: flex; flex-direction: column; gap: 3px; font-size: 13px; min-width: 180px; }
.grp-anneau-legende > div { display: flex; align-items: center; gap: 4px; }
.grp-anneau-legende b { margin-left: auto; padding-left: 10px; }

/* Paramètres : Marché et Lot côte à côte, sur deux colonnes */
.grp-panel[data-panel="parametres"] .grp-grid { grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); }
@media (max-width: 980px) { .grp-panel[data-panel="parametres"] .grp-grid { grid-template-columns: 1fr; } }

/* Composition : écart avec le montant signé */
.grp-repartition.erreur { background: #ffebee; color: #b71c1c; }
.grp-repartition.erreur i { color: #c62828; }
.grp-repartition .grp-btn-petit { margin-left: auto; padding: 3px 10px; font-size: 13px; white-space: nowrap; }
.grp-repartition span { flex: 1; }
.grp-compo-ecart td { background: #ffebee !important; color: #b71c1c; font-weight: 700; }
.grp-anneau-centre b { font-size: 11px; }

/* Barème : contrôle du GNR */
.grp-gnr { margin-top: 14px; border-top: 4px solid #6d4c41; }
.grp-gnr h6 { display: flex; align-items: center; gap: 6px; color: #5d4037; }
.grp-gnr h6 small { font-weight: 500; color: var(--grp-muted); font-size: 12px; }
.grp-gnr tbody td:first-child { border-left: 4px solid var(--m); }
.grp-gnr-note { margin-top: 8px !important; }
.grp-gnr-sit { width: auto !important; height: 30px; margin-left: 6px; font-size: 13px; border: 1px solid #cfd8dc; border-radius: 6px; }

/* ───────── Barème : familles dépliables ───────── */
.grp-fam-ajout {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px dashed #b0bec5;
    border-radius: 10px;
    background: #fafcfd;
}

.grp-fam-ajout > i { color: #546e7a; }
#grp-app .grp-fam-ajout input[type="text"] { flex: 1 1 260px; height: 34px; border: 1px solid #cfd8dc; border-radius: 6px; padding: 0 10px; margin: 0; box-shadow: none; }
#grp-app .grp-fam-ajout select { flex: 0 1 260px; height: 34px; }

.grp-fam {
    margin-bottom: 10px;
    border: 1px solid var(--grp-border);
    border-left: 5px solid var(--fam, #546e7a);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.grp-fam-encadrement { --fam: #6d4c41; }
.grp-fam-mo { --fam: #1565c0; }
.grp-fam-materiel { --fam: #ef6c00; }

.grp-fam-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: color-mix(in srgb, var(--fam) 9%, #fff);
    border-bottom: 1px solid color-mix(in srgb, var(--fam) 25%, #fff);
}

#grp-app .grp-fam-titre {
    flex: 0 1 460px;
    min-width: 160px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    padding: 0 8px;
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: color-mix(in srgb, var(--fam) 80%, #000);
    box-shadow: none;
}

#grp-app .grp-fam-titre:hover, #grp-app .grp-fam-titre:focus { border-color: #cfd8dc; background: #fff; }

.grp-fam-nature {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--fam) 16%, #fff);
    color: color-mix(in srgb, var(--fam) 85%, #000);
    cursor: help;
}

.grp-fam .grp-table-wrap { margin: 0; border: 0; border-radius: 0; }
.grp-bareme-table th small { font-weight: 500; color: var(--grp-muted); }
.grp-fam-vide { margin: 8px 14px !important; }

/* ───────── Pointage déclaré par les co-traitants ───────── */
.grp-ent-contact {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 2px 0 4px 28px;
}
.grp-ent-ligne:has(> .grp-check-field input:not(:checked)) .grp-ent-contact { display: none; }
.grp-ent-contact-titre { font-size: 12px; font-weight: 700; color: #546e7a; cursor: help; }
#grp-dialog .grp-ent-contact input[type="text"], #grp-dialog .grp-ent-contact input[type="tel"], #grp-dialog .grp-ent-contact input[type="email"],
#grp-app .grp-compo-contact input {
    width: 150px;
    height: 30px;
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    padding: 0 8px;
    margin: 0;
    font-size: 13px;
    box-shadow: none;
}
#grp-dialog .grp-ent-contact input[type="email"], #grp-app .grp-compo-contact input[type="email"] { width: 220px; }
.grp-ent-invite { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #00695c; font-weight: 600; cursor: pointer; }
.grp-ent-invite input[type="checkbox"] { position: static !important; opacity: 1 !important; pointer-events: auto !important; width: 16px !important; height: 16px !important; margin: 0 !important; }
.grp-ent-invite input[type="checkbox"] + span { padding-left: 0 !important; height: auto !important; line-height: 1.3 !important; }
.grp-ent-invite input[type="checkbox"] + span::before, .grp-ent-invite input[type="checkbox"] + span::after { display: none !important; }

.grp-compo-contact td { padding: 2px 8px 8px 46px !important; background: #fafbfc; }
.grp-compo-contact td > * { vertical-align: middle; margin-right: 6px; }
.grp-compo-contact .grp-btn { padding: 2px 8px; }
.grp-ct-note { font-size: 12px; color: #78909c; }

.grp-invit .grp-pilules { margin: 6px 0; }
.grp-invit-delai input { max-width: 120px; }

.grp-decl {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 4px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
}
.grp-decl > span { flex: 1; min-width: 200px; }
.grp-decl i { font-size: 20px; }
.grp-decl-recu { background: #e3f2fd; color: #0d47a1; }
.grp-decl-repris { background: #e8f5e9; color: #1b5e20; }
.grp-decl-attente { background: #f5f5f5; color: #607d8b; }
.grp-decl-table td, .grp-decl-table th { padding: 3px 5px !important; }

/* ───────── Récapitulatif d'une situation : colonnes des entreprises colorées ───────── */
.grp-recap-couleurs td.grp-col-m { background: color-mix(in srgb, var(--m) 6%, #fff); }
.grp-recap-couleurs tr.total td.grp-col-m { background: color-mix(in srgb, var(--m) 13%, #fff); font-weight: 700; }
.grp-recap-couleurs tr.fort td.grp-col-m { background: color-mix(in srgb, var(--m) 20%, #fff); color: color-mix(in srgb, var(--m) 75%, #000); font-weight: 800; }
.grp-recap-couleurs td.grp-col-grp { background: #f7f9fa; }
.grp-recap-couleurs tr.fort td.grp-col-grp { background: #e3f2fd; font-weight: 800; }
.grp-recap-couleurs tr.grp-section td { background: #eceff1; }

/* Historique des validations */
.grp-historique { margin-top: 10px; padding: 8px 12px; border: 1px solid var(--grp-border); border-radius: 10px; background: #fafcfd; }
.grp-historique-titre { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--grp-primary); margin-bottom: 4px; }
.grp-historique ul { margin: 0; padding: 0; list-style: none; }
.grp-historique li { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 13px; color: #37474f; }
.grp-historique li i { font-size: 16px; }
.grp-historique li.val i { color: #2e7d32; }
.grp-historique li.reo i { color: #ef6c00; }

/* Aperçu du PDF */
#grp-apercu { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1500; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.grp-apercu-boite { width: 100%; max-width: 1000px; height: 100%; background: #fff; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.grp-apercu-tete { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--grp-border); }
.grp-apercu-tete b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--grp-primary); }
.grp-apercu-boite iframe { flex: 1; width: 100%; border: 0; }

/* ───────── Situations : lignes clairement cliquables, total, vue d'ensemble ───────── */
.grp-sit-astuce {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #e3f2fd;
    color: #0d47a1;
    font-size: 13px;
}
.grp-sit-astuce i { font-size: 20px; color: #1e88e5; }

.grp-sit-table tbody tr { cursor: pointer; transition: background .12s, box-shadow .12s; }
.grp-sit-table tbody tr:hover, .grp-sit-table tbody tr:focus-visible {
    background: #e3f2fd !important;
    box-shadow: inset 4px 0 0 #1e88e5;
    outline: none;
}
.grp-sit-table tbody tr:hover td.grp-col-m { background: color-mix(in srgb, var(--m) 14%, #e3f2fd); }
.grp-sit-table td.grp-col-m { background: color-mix(in srgb, var(--m) 5%, #fff); }
.grp-sit-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    border-radius: 13px;
    background: #eceff1;
    color: var(--grp-primary);
    font-weight: 800;
}
.grp-sit-table tbody tr:hover .grp-sit-num { background: #1e88e5; color: #fff; }

.grp-sit-ouvrir { text-align: right; white-space: nowrap; }
.grp-sit-ouvrir span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px 3px 7px;
    border: 1px solid #90caf9;
    border-radius: 14px;
    color: #1565c0;
    font-size: 12px;
    font-weight: 700;
    background: #fff;
}
.grp-sit-ouvrir i { font-size: 15px; }
.grp-sit-table tbody tr:hover .grp-sit-ouvrir span { background: #1e88e5; border-color: #1e88e5; color: #fff; }

.grp-sit-total td { font-weight: 800; background: #eef3f6 !important; border-top: 2px solid #b0bec5; }
.grp-sit-total td.grp-col-m { background: color-mix(in srgb, var(--m) 16%, #fff) !important; }
.grp-sit-total .grp-btn { padding: 2px 8px; }

/* Vue d'ensemble */
.grp-synth-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.grp-synth-kpis > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; background: #f4f7fa; }
.grp-synth-kpis span { font-size: 12px; color: var(--grp-muted); }
.grp-synth-kpis b { font-size: 19px; color: var(--grp-primary); }
.grp-synth-kpis small { font-size: 12px; color: var(--grp-muted); }
.grp-synth-legende { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: #455a64; margin-bottom: 4px; }
.grp-synth-legende span { display: inline-flex; align-items: center; gap: 5px; }
.grp-synth-legende i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.grp-synth-legende i.ligne { height: 3px; border-radius: 2px; background: #00897b; }
.grp-synth-svg { width: 100%; height: auto; display: block; }

.grp-dialog-defile .grp-dialog-body { overflow-y: auto !important; display: block !important; }

/* ───────── Réouverture d'une situation : fenêtre du motif ───────── */
#grp-motif { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1400; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.grp-motif-boite { width: 100%; max-width: 680px; max-height: 100%; background: #fff; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.grp-motif-tete { display: flex; align-items: center; gap: 8px; padding: 14px 18px; background: #fff3e0; border-bottom: 1px solid #ffe0b2; color: #e65100; font-size: 17px; }
.grp-motif-tete b { color: #bf360c; }
.grp-motif-corps { padding: 14px 18px; overflow-y: auto; }
.grp-motif-explication { display: flex; gap: 8px; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px; background: #e3f2fd; color: #0d47a1; font-size: 13px; line-height: 1.45; }
.grp-motif-explication i { color: #1e88e5; font-size: 20px; }
.grp-motif-corps .grp-notes-zone { min-height: 140px; }
.grp-motif-erreur { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: #c62828; font-size: 13px; font-weight: 600; }
.grp-motif-erreur.hidden { display: none; }
.grp-motif-pied { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--grp-border); }
.grp-historique li { flex-wrap: wrap; }
.grp-historique-motif { flex-basis: 100%; margin: 2px 0 2px 22px; padding: 6px 10px; border-left: 3px solid #ef6c00; border-radius: 0 6px 6px 0; background: #fff8e1; color: #37474f; font-size: 13px; }
.grp-alert > div:has(> .grp-historique-motif) { flex-wrap: wrap; }
.grp-alert .grp-historique-motif { margin: 6px 0 0 28px; }
.grp-historique-motif ul { margin: 2px 0; padding-left: 18px; list-style: disc; }
.grp-historique-motif li { display: list-item; padding: 0; }

/* Numéro de la situation + icône d'ouverture (remplace la colonne « Détail ») */
.grp-sit-table td.grp-sit-n { white-space: nowrap; }
.grp-sit-table i.grp-sit-ouvrir { font-size: 16px; margin-left: 6px; vertical-align: middle; color: #1e88e5; opacity: .55; transition: opacity .12s, transform .12s; }
.grp-sit-table tbody tr:hover i.grp-sit-ouvrir, .grp-sit-table tbody tr:focus-visible i.grp-sit-ouvrir { opacity: 1; transform: scale(1.15); }
.grp-sit-total td { white-space: nowrap; }

/* ───────── Dépenses regroupées par type (comme le relevé imprimé) ───────── */
.grp-table tr.grp-dep-famille td { background: color-mix(in srgb, var(--t) 10%, #fff) !important; color: var(--t); font-weight: 800; border-top: 2px solid var(--t); padding-top: 9px; padding-bottom: 9px; cursor: default; }
.grp-table tr.grp-dep-famille td:first-child { box-shadow: inset 6px 0 0 var(--t); padding-left: 16px; }
.grp-dep-famille-nom { font-size: 15px; text-transform: uppercase; letter-spacing: .3px; margin-right: 10px; }
.grp-table tr.grp-dep-famille small { font-weight: 600; opacity: .8; }
.grp-table tr.grp-dep-famille .grp-dep-famille-part { font-size: 13px; }
.grp-table tr.grp-dep-nature td { background: color-mix(in srgb, var(--t) 6%, #fff) !important; color: var(--t); font-weight: 700; font-style: italic; font-size: 13px; padding-top: 5px; padding-bottom: 5px; cursor: default; }
.grp-table tr.grp-dep-nature svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.grp-table tr.grp-dep-ligne td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--t) 45%, #fff); }
.grp-table tr.grp-dep-st td { background: #f4f7fa !important; color: var(--t); font-weight: 700; font-size: 13px; cursor: default; }
.grp-table tr.grp-dep-st.famille td { background: color-mix(in srgb, var(--t) 7%, #f4f7fa) !important; border-bottom: 2px solid color-mix(in srgb, var(--t) 40%, #fff); }
.grp-table tr.grp-dep-st.nature td { background: color-mix(in srgb, var(--t) 3%, #fff) !important; font-weight: 600; }
.grp-table tfoot tr.grp-dep-total td { background: #294e5f !important; color: #fff; font-weight: 800; }

/* ───────── Vue d'ensemble : barre de filtres, cartes, classements ───────── */
.grp-synth-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.grp-synth-periode { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #455a64; }
#grp-dialog .grp-synth-periode select { width: auto; height: 32px; padding: 0 6px; border: 1px solid var(--grp-border); border-radius: 6px; font-size: 13px; }
.grp-synth-puces { display: flex; flex-wrap: wrap; gap: 6px; }
.grp-synth-puce { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--grp-border); border-radius: 16px; background: #fff; color: #90a4ae; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.grp-synth-puce i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--m); background: transparent; }
.grp-synth-puce.on { color: #263238; border-color: color-mix(in srgb, var(--m) 45%, #fff); background: color-mix(in srgb, var(--m) 8%, #fff); }
.grp-synth-puce.on i { background: var(--m); }
.grp-synth-sections { padding: 6px 10px; border-radius: 8px; background: #f4f7fa; font-size: 13px; }
.grp-synth-section { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border: 0; border-radius: 6px; background: transparent; color: #78909c; font-size: 13px; cursor: pointer; }
.grp-synth-section i { font-size: 18px; }
.grp-synth-section.on { color: #294e5f; font-weight: 600; }
.grp-synth-section.on i { color: #1e88e5; }
.grp-synth-section:hover { background: #e3f2fd; }
.grp-synth-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grp-synth-kpis > div { position: relative; }
.grp-synth-jauge { display: block; height: 5px; margin-top: 4px; border-radius: 3px; background: #dfe7ec; overflow: hidden; }
.grp-synth-jauge i { display: block; height: 100%; border-radius: 3px; background: #00897b; }
.grp-synth-carte { border: 1px solid var(--grp-border); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.grp-synth-carte header { margin-bottom: 6px; }
.grp-synth-carte h4 { margin: 0; font-size: 15px; font-weight: 800; color: var(--grp-primary); }
.grp-synth-carte h4 small { font-weight: 600; font-size: 12px; margin-left: 4px; }
.grp-synth-carte header > small { color: var(--grp-muted); font-size: 12px; }
.grp-synth-carte .grp-table-wrap { margin-top: 8px; }
.grp-synth-hit { cursor: default; transition: fill-opacity .1s; }
.grp-synth-hit:hover { fill-opacity: .07; }
.grp-synth-rangs { display: flex; flex-direction: column; gap: 2px; }
.grp-synth-rang { display: grid; grid-template-columns: minmax(180px, 1.3fr) 2fr 130px; align-items: center; gap: 12px; padding: 5px 6px; border-radius: 6px; }
.grp-synth-rang:hover { background: #f4f7fa; }
.grp-synth-rang-nom { display: flex; flex-direction: column; min-width: 0; }
.grp-synth-rang-nom b { font-size: 13px; color: #263238; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-synth-rang-nom span { font-size: 11.5px; color: #78909c; }
.grp-synth-rang-nom .grp-badge { font-size: 10.5px; padding: 0 6px; }
.grp-synth-rang-barre { height: 10px; border-radius: 5px; background: #eceff1; overflow: hidden; }
.grp-synth-rang-barre i { display: block; height: 100%; border-radius: 5px; }
.grp-synth-rang-val { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; }
.grp-synth-rang-val b { font-size: 13px; }
.grp-synth-rang-val small { min-width: 42px; text-align: right; color: var(--grp-muted); font-size: 11.5px; }
@media (max-width: 700px) { .grp-synth-rang { grid-template-columns: 1fr 90px; } .grp-synth-rang-barre { grid-column: 1 / -1; grid-row: 2; } }

/* ───────── Point : lien « Voir le calcul » et explication pas à pas ───────── */
.grp-lien-calcul { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 2px 8px 2px 5px; border: 1px solid #90caf9; border-radius: 12px; background: #fff; color: #1565c0; font-size: 12px; font-weight: 600; cursor: pointer; }
.grp-lien-calcul i { font-size: 15px; }
.grp-lien-calcul:hover { background: #1e88e5; border-color: #1e88e5; color: #fff; }
.grp-pt-titre { margin: 16px 0 6px; font-size: 15px; font-weight: 800; color: var(--grp-primary); }
.grp-pt-etapes { margin: 0 0 10px; padding-left: 22px; line-height: 1.5; }
.grp-pt-etapes li { margin-bottom: 4px; }
.grp-pt-formule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px; border-radius: 10px; background: #f4f7fa; }
.grp-pt-formule > i { font-style: normal; font-size: 20px; font-weight: 800; color: #78909c; }
.grp-pt-bloc { display: flex; flex-direction: column; padding: 6px 10px; border: 1px solid var(--grp-border); border-radius: 8px; background: #fff; }
.grp-pt-bloc span { font-size: 11.5px; color: var(--grp-muted); }
.grp-pt-bloc b { font-size: 15px; color: #263238; }
.grp-pt-bloc.fort { border-color: #90caf9; background: #e3f2fd; }
.grp-pt-bloc.ok { border-color: #a5d6a7; background: #e8f5e9; } .grp-pt-bloc.ok b { color: #2e7d32; }
.grp-pt-bloc.warn { border-color: #ffcc80; background: #fff3e0; } .grp-pt-bloc.warn b { color: #e65100; }
.grp-pt-bloc.bad { border-color: #ef9a9a; background: #ffebee; } .grp-pt-bloc.bad b { color: #c62828; }
.grp-pt-lecture { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.grp-pt-lecture > div { padding: 8px 10px; border-radius: 8px; border-left: 4px solid; font-size: 13px; line-height: 1.45; background: #fafcfd; }
.grp-pt-lecture .bad { border-color: #ef6c00; } .grp-pt-lecture .ok { border-color: #2e7d32; } .grp-pt-lecture .up { border-color: #1e88e5; }
.grp-pt-conclusion { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #e3f2fd; color: #0d47a1; }

/* ───────── Archives ───────── */
.grp-archive-bandeau { background: #eceff1; border-color: #b0bec5; color: #37474f; align-items: center; flex-wrap: wrap; gap: 8px; }
.grp-archive-bandeau > div { flex: 1 1 320px; }
.grp-archiver { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-left: 4px solid #546e7a; }
.grp-danger-bloque { border-color: #cfd8dc !important; background: #fafbfc !important; }
.grp-archives-filtre { width: 100%; margin: 6px 0 10px !important; padding: 0 10px !important; height: 38px !important; border: 1px solid #cfd8dc !important; border-radius: 8px !important; box-sizing: border-box; }
.grp-archives-table td { vertical-align: middle; }
.grp-vide-archives { margin-top: 14px; }
#grp-archives { margin-left: auto; }
