/*
 * GIRARDEAU HABITAT — système de design.
 *
 * Bootstrap 5.3 fournit la grille, le responsive et le comportement des
 * composants. Ce fichier fournit *l'identité* : une palette d'atelier
 * (ardoise, papier, orange chantier), une échelle typographique, deux niveaux
 * de surface, et les composants métier que Bootstrap n'a pas — grille
 * heures × phases, planning, feuille de chantier.
 *
 * Parti pris : l'application doit ressembler à un outil de métier, pas à un
 * tableau de bord générique. Habillage V2 (11/2026) : tons pierre chauds plutôt
 * qu'ardoise bleutée, titres en Archivo, surfaces en relief, liseré « ruban de
 * chantier » sous la barre de navigation — la démonstration jugeait l'ancien
 * habillage terne. Trois règles s'appliquent partout :
 *   1. les chiffres sont tabulaires et alignés à droite — on les compare ;
 *   2. une seule couleur d'accent, l'orange chantier, réservée à l'action ;
 *   3. la densité suit le poste : compacte au bureau, généreuse au doigt.
 *
 * Toutes les classes maison sont préfixées `gh-`.
 * Ce fichier est chargé APRÈS Bootstrap (cf. assets/app.js) : les surcharges
 * `--bs-*` posées ici font autorité.
 */

/* ================================================================== */
/* 1. Jetons                                                          */
/* ================================================================== */

:root {
    /* « Ardoise » — la structure : barre de navigation, titres, texte. Le nom
       est resté (une centaine de règles s'y réfèrent) mais la teinte est
       désormais une pierre chaude : le gris bleuté faisait logiciel de bureau. */
    --gh-ardoise-950: #13110f;
    --gh-ardoise-900: #1c1917;
    --gh-ardoise-800: #292524;
    --gh-ardoise-700: #44403c;
    --gh-ardoise-600: #57534e;
    --gh-ardoise-500: #6f6963;
    --gh-ardoise-400: #a8a29e;
    --gh-ardoise-300: #d6d3d1;
    --gh-ardoise-200: #e7e5e4;

    /* Papier — les surfaces. Le fond est un sable chaud, pas un gris :
       il fait exister les cartes blanches posées dessus. */
    --gh-fond: #f5f3ee;
    --gh-fond-creux: #ece8df;
    --gh-surface: #ffffff;
    --gh-trait: #e6e1d6;
    --gh-trait-fort: #d3ccbd;

    /* Orange chantier — l'accent, et lui seul. */
    --gh-orange: #c2410c;
    --gh-orange-clair: #ea580c;
    --gh-orange-pale: #fdece3;
    --gh-orange-fonce: #9a3412;

    /* Statuts — fonctionnels, jamais décoratifs. */
    --gh-vert: #15803d;
    --gh-vert-pale: #e7f6ec;
    --gh-ambre: #b45309;
    --gh-ambre-pale: #fdf2df;
    --gh-rouge: #b91c1c;
    --gh-rouge-pale: #fdeaea;
    --gh-bleu: #1d4ed8;
    --gh-bleu-pale: #e8eefc;
    --gh-violet: #6d28d9;
    --gh-violet-pale: #f0ebfd;

    /* Compatibilité : noms historiques utilisés par quelques gabarits. */
    --gh-beton: var(--gh-ardoise-500);
    --gh-sable: var(--gh-fond);

    /* Rythme — une seule échelle, multiples de 4. */
    --gh-e1: 0.25rem;
    --gh-e2: 0.5rem;
    --gh-e3: 0.75rem;
    --gh-e4: 1rem;
    --gh-e5: 1.5rem;
    --gh-e6: 2rem;

    --gh-navbar-hauteur: 3.5rem;
    --gh-radius: 0.875rem;
    --gh-radius-sm: 0.5rem;

    /* Deux niveaux d'élévation, pas trois. Une ombre plus portée qu'avant :
       les cartes doivent se détacher du fond, pas s'y fondre. */
    --gh-ombre: 0 1px 2px rgb(28 25 23 / 6%), 0 4px 14px rgb(28 25 23 / 6%);
    --gh-ombre-haute: 0 4px 8px rgb(28 25 23 / 8%), 0 16px 36px rgb(28 25 23 / 14%);

    /* Titres : Archivo, une linéale large et franche, celle des panneaux de
       chantier. Le texte courant reste en Inter, plus lisible en petit. */
    --gh-police-titre: 'Archivo', 'Inter', system-ui, sans-serif;

    /* Surcharges Bootstrap. */
    --bs-primary: var(--gh-ardoise-800);
    --bs-primary-rgb: 41, 37, 36;
    --bs-body-bg: var(--gh-fond);
    --bs-body-color: var(--gh-ardoise-800);
    --bs-secondary-color: var(--gh-ardoise-600);
    --bs-border-color: var(--gh-trait);
    --bs-border-radius: var(--gh-radius);
    --bs-border-radius-sm: var(--gh-radius-sm);
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-body-font-size: 0.9375rem;
    --bs-link-color: var(--gh-ardoise-900);
    --bs-link-hover-color: var(--gh-orange);
    --bs-emphasis-color: var(--gh-ardoise-950);
}

[data-bs-theme='dark'] {
    --gh-fond: #131110;
    --gh-fond-creux: #0d0c0b;
    --gh-surface: #1d1a18;
    --gh-trait: #302c28;
    --gh-trait-fort: #443e38;

    --gh-orange-pale: #3a1a0c;
    --gh-vert-pale: #0f2a1a;
    --gh-ambre-pale: #2e2008;
    --gh-rouge-pale: #331616;
    --gh-bleu-pale: #14203c;
    --gh-violet-pale: #221739;

    /* Les teintes de statut s'éclaircissent : sur fond sombre, le vert et le rouge
       du thème clair tombaient sous 3:1 — les étiquettes « validé » ou « en
       surcharge » devenaient illisibles, or c'est par elles que l'application
       dit l'essentiel. Ces valeurs tiennent au-dessus de 7:1 sur leur fond pâle. */
    --gh-vert: #5eda8b;
    --gh-ambre: #f5b942;
    --gh-rouge: #f98080;
    --gh-bleu: #8fb4fb;
    --gh-violet: #c4b1fb;

    --bs-body-bg: var(--gh-fond);
    --bs-body-color: #e7e2dc;
    --bs-secondary-color: var(--gh-ardoise-400);
    --bs-border-color: var(--gh-trait);
    --bs-emphasis-color: #faf7f2;
    --bs-link-color: #ece7e1;

    --gh-ombre: 0 1px 2px rgb(0 0 0 / 30%);
    --gh-ombre-haute: 0 8px 24px rgb(0 0 0 / 45%);
}

/* ================================================================== */
/* 2. Base                                                            */
/* ================================================================== */

/* Un champ qui prend le focus (ligne ajoutée, case suivante de la grille) ne
   doit pas se glisser sous la barre de navigation ni sous la barre
   d'enregistrement collée en bas des écrans de saisie. */
html {
    scroll-padding-top: calc(var(--gh-navbar-hauteur) + 0.5rem);
    scroll-padding-bottom: 5rem;
}

/* Le haut de page est un peu plus soutenu que le reste : l'en-tête se pose
   sur un plan, au lieu de flotter sur un aplat uniforme. */
body {
    background-color: var(--bs-body-bg);
    background-image: linear-gradient(180deg, var(--gh-fond-creux) 0, var(--bs-body-bg) 16rem);
    background-repeat: no-repeat;
    color: var(--bs-body-color);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Les utilitaires d'affichage de Bootstrap (.d-flex, .d-block…) sont en !important
   et l'emportent sur le `display: none` que le navigateur applique à [hidden] :
   sans cette règle, un bloc `class="alert d-flex" hidden` reste visible. */
[hidden] {
    display: none !important;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--gh-police-titre);
    font-weight: 700;
    letter-spacing: -0.005em;
    /* L'espace d'Archivo est étroit : sans ce réglage « Rapports à valider »
       se lisait « Rapportsà valider ». */
    word-spacing: 0.08em;
    color: var(--bs-emphasis-color);
}

/* Un chiffre se compare : il est tabulaire partout où il compte. */
table,
.gh-chiffre,
.gh-num,
.font-monospace {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

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

/* Intitulé de section : petite capitale espacée, le repère de lecture. */
.gh-surtitre {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

/* Un lien de contenu est à l'encre du texte ; il se signale au survol, à
   l'orange, comme tout ce qui est actionnable. */
a.text-body:hover,
a.text-body:focus-visible {
    color: var(--gh-orange) !important;
}

::selection {
    background: var(--gh-orange-pale);
    color: var(--gh-orange);
}

:focus-visible {
    outline: 2px solid var(--gh-orange);
    outline-offset: 2px;
}

/* ================================================================== */
/* 3. Ossature : barre de navigation, page                            */
/* ================================================================== */

/* Liseré orange sous la barre : le ruban de chantier, la seule fantaisie de
   l'ossature. Il signe l'application sans rien coûter à la lecture. */
.gh-navbar {
    background: var(--gh-ardoise-950);
    border-bottom: 3px solid var(--gh-orange);
    padding-block: 0.4rem;
}

.gh-navbar .navbar-brand {
    font-family: var(--gh-police-titre);
    font-weight: 800;
    letter-spacing: 0.01em;
    font-size: 1.0625rem;
}

/* Marque : un pignon de maison sur fond orange — la maçonnerie et le toit,
   les deux enseignes, en une forme. */
.gh-marque {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2rem;
    height: 2rem;
    border-radius: var(--gh-radius-sm);
    background: linear-gradient(145deg, var(--gh-orange-clair), var(--gh-orange));
    color: #fff;
    box-shadow: inset 0 -2px 0 rgb(0 0 0 / 18%);
}

.gh-marque svg { width: 62%; height: 62%; }

.gh-navbar .nav-link {
    color: rgb(226 232 240 / 72%);
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: var(--gh-radius-sm);
    padding-inline: 0.7rem;
    position: relative;
    transition: color 0.12s ease;
}

.gh-navbar .nav-link:hover,
.gh-navbar .nav-link:focus {
    color: #fff;
    background: rgb(255 255 255 / 6%);
}

/* L'écran courant est marqué par un trait orange, pas par une pastille grise :
   plus discret, et l'accent reste réservé à ce qui compte. */
.gh-navbar .nav-link.active {
    color: #fff;
    background: transparent;
}

.gh-navbar .nav-link.active::after {
    content: '';
    position: absolute;
    inset-inline: 0.7rem;
    bottom: 0.05rem;
    height: 2px;
    border-radius: 2px;
    background: var(--gh-orange-clair);
}

.gh-navbar .dropdown-menu {
    border-color: var(--gh-trait);
    border-radius: var(--gh-radius);
    box-shadow: var(--gh-ombre-haute);
    padding-block: var(--gh-e2);
}

.gh-navbar .dropdown-item {
    font-size: 0.9375rem;
    padding-block: 0.4rem;
}

.gh-main {
    padding-block: var(--gh-e5) 4rem;
}

/* En-tête de page : titre, contexte, actions — un seul motif partout. */
.gh-page-titre {
    font-size: clamp(1.625rem, 1.25rem + 1.1vw, 2.125rem);
    font-weight: 800;
    letter-spacing: -0.012em;
    line-height: 1.12;
    margin-bottom: 0.25rem;
}

.gh-page-soustitre {
    color: var(--bs-secondary-color);
    font-size: 0.9375rem;
    margin-bottom: var(--gh-e5);
}

/* ================================================================== */
/* 4. Surfaces                                                        */
/* ================================================================== */

.gh-card {
    background: var(--gh-surface);
    border: 1px solid var(--gh-trait);
    border-radius: var(--gh-radius);
    box-shadow: var(--gh-ombre);
}

/* Titre de carte : il porte la section, il doit se lire avant son contenu. */
.gh-card h2.h6,
.gh-card .h6:is(h2, h3) {
    font-size: 1.0625rem;
    font-weight: 700;
}

/* Barre de filtres : elle encadre la lecture, elle ne doit pas la concurrencer.
   Fond creux et sans ombre — c'est du mobilier, pas du contenu. */
.gh-filtres {
    background: color-mix(in srgb, var(--gh-surface) 55%, var(--gh-fond-creux));
    border: 1px solid var(--gh-trait);
    border-radius: var(--gh-radius);
    box-shadow: none;
    padding: var(--gh-e3) var(--gh-e4);
}

.gh-filtres .form-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    margin-bottom: 0.2rem;
}

/* Tuile d'indicateur : le chiffre d'abord, l'intitulé ensuite. */
/* Un filet de couleur en tête de tuile : ardoise par défaut, orange quand la
   tuile appelle une action, rouge quand elle alerte. */
.gh-kpi {
    position: relative;
    background: var(--gh-surface);
    border: 1px solid var(--gh-trait);
    border-radius: var(--gh-radius);
    box-shadow: var(--gh-ombre);
    padding: var(--gh-e4) var(--gh-e4) calc(var(--gh-e4) - 0.125rem);
    height: 100%;
    overflow: hidden;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.gh-kpi::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--gh-kpi-filet, var(--gh-ardoise-300));
}

a.gh-kpi:hover {
    transform: translateY(-1px);
    box-shadow: var(--gh-ombre-haute);
}

.gh-kpi--action { --gh-kpi-filet: var(--gh-orange); }
.gh-kpi--alerte { --gh-kpi-filet: var(--gh-rouge); }

.gh-kpi__intitule {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    margin-bottom: 0.35rem;
}

.gh-kpi__valeur {
    font-family: var(--gh-police-titre);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--bs-emphasis-color);
    font-variant-numeric: tabular-nums;
}

.gh-kpi__unite {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    margin-left: 0.15rem;
}

.gh-kpi--alerte .gh-kpi__valeur { color: var(--gh-rouge); }

/* État vide : une phrase, pas un vide. */
.gh-vide {
    text-align: center;
    padding: var(--gh-e6) var(--gh-e4);
    color: var(--bs-secondary-color);
}

.gh-vide__titre {
    font-weight: 600;
    color: var(--bs-body-color);
    margin-bottom: 0.25rem;
}

/* ================================================================== */
/* 5. Tableaux                                                        */
/* ================================================================== */

.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--gh-fond-creux);
    --bs-table-border-color: var(--gh-trait);
    margin-bottom: 0;
    font-size: 0.9375rem;
}

/* En-tête de tableau : lu comme une légende, pas comme une ligne de données.
   Un bandeau à peine teinté le sépare des lignes sans trait supplémentaire. */
.table > thead > tr > th {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--gh-ardoise-600);
    background: color-mix(in srgb, var(--gh-fond-creux) 45%, var(--gh-surface));
    border-bottom: 1px solid var(--gh-trait-fort);
    padding-block: 0.6rem;
    white-space: nowrap;
}

.table > tbody > tr > td {
    padding-block: 0.6rem;
    vertical-align: middle;
    border-bottom-color: var(--gh-trait);
}

.table > tbody > tr:last-child > td {
    border-bottom-color: transparent;
}

/* ================================================================== */
/* 6. Étiquettes                                                      */
/* ================================================================== */

/*
 * Une étiquette porte une information, pas une couleur. Fond très pâle, texte
 * dense, et une pastille qui donne le code couleur : cinq activités côte à côte
 * restent lisibles là où cinq pastilles saturées se battaient entre elles.
 */
.gh-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem 0.2rem 0.45rem;
    border-radius: var(--gh-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    border: 1px solid transparent;
    background: var(--gh-fond-creux);
    color: var(--bs-secondary-color);
}

.gh-tag::before {
    content: '';
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentcolor;
    flex: none;
    opacity: 0.85;
}

.gh-tag--neuf       { background: var(--gh-bleu-pale);   color: var(--gh-bleu); }
.gh-tag--reno       { background: var(--gh-ambre-pale);  color: var(--gh-ambre); }
.gh-tag--couverture { background: var(--gh-vert-pale);   color: var(--gh-vert); }
.gh-tag--enduits    { background: var(--gh-violet-pale); color: var(--gh-violet); }
.gh-tag--success    { background: var(--gh-vert-pale);   color: var(--gh-vert); }
.gh-tag--warning    { background: var(--gh-ambre-pale);  color: var(--gh-ambre); }
.gh-tag--danger     { background: var(--gh-rouge-pale);  color: var(--gh-rouge); }
.gh-tag--info       { background: var(--gh-bleu-pale);   color: var(--gh-bleu); }
.gh-tag--muted      { background: var(--gh-fond-creux);  color: var(--gh-ardoise-600); }

/*
 * `.gh-tag--nu` retire la pastille. Règle d'emploi : la pastille sert quand
 * plusieurs valeurs d'une même famille se côtoient dans une colonne — elle donne
 * le code couleur. Sur une valeur isolée dans une phrase, elle n'apporte rien :
 * on prend `--nu`.
 */
.gh-tag--nu::before { display: none; }

/*
 * Puce d'état : un choix parmi plusieurs, déjà retenu ou non — période du
 * pilotage, semaine des rapports, activité du planning. Les gabarits posaient
 * jusqu'ici six variables Bootstrap en ligne pour l'obtenir.
 */
.gh-puce {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border: 1px solid var(--gh-trait-fort);
    border-radius: 999px;
    background: var(--gh-surface);
    color: var(--gh-ardoise-700);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.12s ease, color 0.12s ease;
}

.gh-puce:hover,
.gh-puce:focus-visible {
    border-color: var(--gh-ardoise-400);
    color: var(--gh-ardoise-950);
}

.gh-puce[aria-current],
.gh-puce--actif {
    background: var(--gh-ardoise-900);
    border-color: var(--gh-ardoise-900);
    color: #fff;
}

[data-bs-theme='dark'] .gh-puce { color: var(--gh-ardoise-300); }

[data-bs-theme='dark'] .gh-puce[aria-current],
[data-bs-theme='dark'] .gh-puce--actif {
    background: var(--gh-ardoise-200);
    border-color: var(--gh-ardoise-200);
    color: var(--gh-ardoise-950);
}

/* ================================================================== */
/* 7. Boutons et formulaires                                          */
/* ================================================================== */

.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--gh-radius-sm);
    transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
    --bs-btn-focus-box-shadow: 0 0 0 3px rgb(194 65 12 / 25%);
    letter-spacing: -0.005em;
}

.btn-primary {
    --bs-btn-bg: var(--gh-ardoise-900);
    --bs-btn-border-color: var(--gh-ardoise-900);
    --bs-btn-hover-bg: var(--gh-ardoise-800);
    --bs-btn-hover-border-color: var(--gh-ardoise-800);
    --bs-btn-active-bg: var(--gh-ardoise-950);
    --bs-btn-active-border-color: var(--gh-ardoise-950);
}

/* L'action de terrain — la seule à porter l'orange. */
.btn-chantier {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--gh-orange);
    --bs-btn-border-color: var(--gh-orange);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--gh-orange-clair);
    --bs-btn-hover-border-color: var(--gh-orange-clair);
    --bs-btn-active-bg: var(--gh-orange-fonce);
    --bs-btn-active-border-color: var(--gh-orange-fonce);
    background-image: linear-gradient(180deg, rgb(255 255 255 / 10%), transparent);
    box-shadow: 0 1px 2px rgb(154 52 18 / 30%), 0 4px 12px rgb(194 65 12 / 22%);
}

.btn-chantier:hover { box-shadow: 0 2px 4px rgb(154 52 18 / 30%), 0 8px 20px rgb(194 65 12 / 28%); }
.btn-chantier:active { transform: translateY(1px); }

/* Bouton secondaire sur fond blanc : posé sur le sable, un bouton transparent
   semblait désactivé. */
.btn-outline-secondary {
    --bs-btn-bg: var(--gh-surface);
    --bs-btn-color: var(--gh-ardoise-700);
    --bs-btn-border-color: var(--gh-trait-fort);
    --bs-btn-hover-color: var(--gh-ardoise-950);
    --bs-btn-hover-bg: var(--gh-fond-creux);
    --bs-btn-hover-border-color: var(--gh-ardoise-400);
    --bs-btn-active-bg: var(--gh-fond-creux);
    --bs-btn-active-color: var(--gh-ardoise-950);
    --bs-btn-active-border-color: var(--gh-ardoise-400);
}

[data-bs-theme='dark'] .btn-outline-secondary {
    --bs-btn-color: var(--gh-ardoise-300);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
}

.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gh-ardoise-700);
    margin-bottom: 0.3rem;
}

[data-bs-theme='dark'] .form-label { color: var(--gh-ardoise-300); }

.form-control,
.form-select {
    border-color: var(--gh-trait-fort);
    border-radius: var(--gh-radius-sm);
    background-color: var(--gh-surface);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--gh-orange-clair);
    box-shadow: 0 0 0 3px rgb(194 65 12 / 15%);
}

.form-text { font-size: 0.8125rem; }

/* Bootstrap fixe #0d6efd en dur sur les contrôles cochés (aucune variable ne le
   couvre). Or « livraison conforme oui/non » et « resto/panier » sont les cibles
   que le compagnon touche le plus : elles suivent la palette. */
.form-check-input:checked {
    background-color: var(--gh-ardoise-900);
    border-color: var(--gh-ardoise-900);
}

.form-check-input:focus {
    border-color: var(--gh-orange-clair);
    box-shadow: 0 0 0 3px rgb(194 65 12 / 15%);
}

.form-check-input:focus:not(:checked) {
    background-image: none;
}

.form-switch .form-check-input:checked {
    background-color: var(--gh-orange);
    border-color: var(--gh-orange);
}

[data-bs-theme='dark'] .form-check-input:checked {
    background-color: var(--gh-ardoise-300);
    border-color: var(--gh-ardoise-300);
}

[data-bs-theme='dark'] .form-check-input:checked::before { color: var(--gh-ardoise-950); }

.alert {
    border-radius: var(--gh-radius);
    border-width: 1px;
    font-size: 0.9375rem;
}

.badge { font-weight: 600; letter-spacing: 0.01em; }

/* ================================================================== */
/* 8. Feuille de chantier                                             */
/* ================================================================== */

/*
 * Le rapport est la reprise d'un document papier : il en garde l'aspect —
 * une feuille blanche, un filet d'encre en tête, des blocs séparés par des
 * traits. C'est ce qui fait dire au compagnon « c'est ma feuille ».
 */
.gh-feuille {
    background: var(--gh-surface);
    border: 1px solid var(--gh-trait);
    border-radius: var(--gh-radius);
    box-shadow: var(--gh-ombre);
    overflow: hidden;
}

.gh-feuille__entete {
    border-bottom: 2px solid var(--gh-ardoise-900);
    padding: var(--gh-e4);
}

.gh-feuille__bloc {
    border-top: 1px solid var(--gh-trait);
    padding: var(--gh-e4);
}

.gh-feuille__titre {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--gh-ardoise-600);
    margin-bottom: var(--gh-e3);
}

/* ================================================================== */
/* 9. Grille de saisie heures × phases                                */
/* ================================================================== */

/* Un en-tête collant se cale sur son plus proche ancêtre défilant. Bootstrap
   enveloppe ces tableaux dans un .table-responsive (overflow-x: auto), qui
   devient donc ce bloc de référence : sans hauteur bornée ni défilement
   vertical, `position: sticky` reste inerte et les noms des compagnons
   disparaissent dès qu'on descend dans les phases. */
.table-responsive:has(.gh-grille-heures),
.table-responsive:has(.gh-planning),
.table-responsive:has(.gh-charge) {
    max-height: calc(100dvh - 13rem);
    overflow: auto;
    overscroll-behavior: contain;
}

.gh-charge thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.gh-grille-heures {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    background: var(--gh-surface);
}

.gh-grille-heures th,
.gh-grille-heures td {
    border-right: 1px solid var(--gh-trait);
    border-bottom: 1px solid var(--gh-trait);
    padding: 0.35rem 0.5rem;
    vertical-align: middle;
}

.gh-grille-heures thead th {
    background: var(--gh-fond-creux);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gh-ardoise-700);
    text-align: center;
    border-bottom: 2px solid var(--gh-ardoise-800);
    position: sticky;
    top: 0;
    z-index: 2;
}

[data-bs-theme='dark'] .gh-grille-heures thead th {
    color: var(--gh-ardoise-200);
    border-bottom-color: var(--gh-ardoise-400);
}

.gh-grille-heures .gh-col-phase {
    text-align: left;
    min-width: 14rem;
    font-weight: 500;
    position: sticky;
    left: 0;
    background: var(--gh-surface);
    z-index: 1;
}

.gh-grille-heures tbody tr:hover .gh-col-phase,
.gh-grille-heures tbody tr:hover td {
    background: var(--gh-orange-pale);
}

.gh-grille-heures .gh-cellule-heure {
    text-align: center;
    padding: 0.15rem;
}

.gh-grille-heures .gh-cellule-heure input {
    width: 4.25rem;
    text-align: center;
    border: 0;
    background: transparent;
    padding: 0.3rem 0.15rem;
    border-radius: var(--gh-radius-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--bs-emphasis-color);
}

.gh-grille-heures .gh-cellule-heure input::placeholder { color: var(--gh-ardoise-300); }

.gh-grille-heures .gh-cellule-heure input:focus {
    outline: 2px solid var(--gh-orange);
    outline-offset: -2px;
    background: var(--gh-surface);
}

.gh-grille-heures .gh-total,
.gh-grille-heures tfoot td,
.gh-grille-heures tfoot th {
    background: var(--gh-fond-creux);
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--bs-emphasis-color);
}

.gh-grille-heures tfoot td,
.gh-grille-heures tfoot th {
    border-top: 2px solid var(--gh-ardoise-800);
}

[data-bs-theme='dark'] .gh-grille-heures tfoot td,
[data-bs-theme='dark'] .gh-grille-heures tfoot th { border-top-color: var(--gh-ardoise-400); }

/* Bandeau de groupe : le sous-titre du rapport papier (COUVERTURE, ZINGUERIE…). */
.gh-groupe-phase td {
    background: var(--gh-ardoise-800);
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.09em;
    padding-block: 0.3rem;
}

/* ================================================================== */
/* 10. Planning et plan de charge                                     */
/* ================================================================== */

.gh-planning,
.gh-charge {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 0.85rem;
    background: var(--gh-surface);
}

.gh-planning th,
.gh-planning td {
    border-right: 1px solid var(--gh-trait);
    border-bottom: 1px solid var(--gh-trait);
    padding: 0.35rem;
    vertical-align: top;
    min-width: 8.5rem;
}

.gh-planning thead th,
.gh-charge thead th {
    background: var(--gh-fond-creux);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gh-ardoise-700);
    border-bottom: 2px solid var(--gh-ardoise-800);
    position: sticky;
    top: 0;
    z-index: 2;
}

[data-bs-theme='dark'] .gh-planning thead th,
[data-bs-theme='dark'] .gh-charge thead th {
    color: var(--gh-ardoise-200);
    border-bottom-color: var(--gh-ardoise-400);
}

.gh-planning .gh-col-compagnon {
    position: sticky;
    left: 0;
    background: var(--gh-surface);
    min-width: 12rem;
    font-weight: 600;
    z-index: 1;
}

/* Le week-end est hors rythme : un simple grisé, comme sur le tableau papier. */
.gh-planning td.gh-weekend {
    background: color-mix(in srgb, var(--gh-fond-creux) 70%, var(--gh-surface));
}

/* Une affectation se lit comme une case surlignée du planning papier : un aplat
   à la couleur de l'équipe (`--gh-couleur`, posée par le gabarit), angles vifs,
   ni filet ni ombre. Les cartes arrondies à liseré faisaient « gadget ». */
.gh-affectation {
    display: block;
    border: 0;
    border-radius: 2px;
    background: color-mix(in srgb, var(--gh-couleur, var(--gh-ardoise-400)) 17%, var(--gh-surface));
    padding: 0.25rem 0.4rem;
    margin-bottom: 0.2rem;
    text-decoration: none;
    color: inherit;
    font-size: 0.8rem;
    line-height: 1.25;
}

.gh-affectation:hover {
    background: color-mix(in srgb, var(--gh-couleur, var(--gh-ardoise-400)) 27%, var(--gh-surface));
}

.gh-affectation--conflit,
.gh-affectation--conflit:hover {
    background: var(--gh-rouge-pale);
    box-shadow: inset 0 0 0 1px var(--gh-rouge);
}

/* Les actions d'appoint d'une grille (« + » d'une case vide, « × » d'une
   affectation) n'apparaissent qu'au survol de la ligne : affichées partout,
   elles couvraient la semaine d'un semis de signes. Au doigt, pas de survol :
   elles restent visibles. */
@media (hover: hover) {
    .gh-planning tbody tr:not(:hover) .gh-action-case { opacity: 0; }
}

.gh-absence {
    display: block;
    border-radius: 2px;
    background: var(--gh-ambre-pale);
    color: var(--gh-ambre);
    padding: 0.3rem 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
}

[data-bs-theme='dark'] .gh-absence { color: #f0c674; }

/* Case de pointage : le chiffre, et le statut écrit dessous quand il compte. */
.gh-pointage-case {
    display: block;
    padding: 0.2rem 0.25rem;
    border-radius: 2px;
    color: var(--bs-emphasis-color);
    text-decoration: none;
}

.gh-pointage-case:hover { background: var(--gh-fond-creux); color: var(--bs-emphasis-color); }

.gh-pointage-case .gh-pointage-case__statut {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
}

.gh-pointage-case__statut--valide   { color: var(--gh-vert); }
.gh-pointage-case__statut--transmis { color: var(--gh-bleu); }

/* Jauge de charge hebdomadaire. */
.gh-charge-barre {
    height: 1.1rem;
    border-radius: var(--gh-radius-sm);
    background: var(--gh-fond-creux);
    overflow: hidden;
}

.gh-charge-barre span {
    display: block;
    height: 100%;
    background: var(--gh-vert);
}

.gh-charge-barre--sous span { background: var(--gh-bleu); }
.gh-charge-barre--sur span  { background: var(--gh-rouge); }

/* ================================================================== */
/* 11. État hors ligne                                                */
/* ================================================================== */

/* Quand la bannière est affichée, le contenu se décale pour ne pas passer
   dessous : sur tablette, elle recouvrait le bouton « Enregistrer le rapport »
   et captait le toucher. */
body:has(.gh-hors-ligne:not(.d-none)) {
    padding-bottom: 4rem;
}

.gh-hors-ligne {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 1080;
    background: var(--gh-ambre);
    color: #fff;
    text-align: center;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.9375rem;
    box-shadow: 0 -2px 12px rgb(0 0 0 / 18%);
}

.gh-file-attente { background: var(--gh-bleu); }

/* ================================================================== */
/* 11 bis. Fenêtre de saisie et listes déroulantes                    */
/* ================================================================== */

/* La fenêtre reprend la page qu'elle affiche : on y masque ce qui n'a de
   sens qu'en pleine page (lien de retour, sous-titre d'accroche). */
.gh-modale .modal-content {
    background: var(--gh-fond);
    border: 1px solid var(--gh-trait-fort);
    box-shadow: var(--gh-ombre-haute);
}

.gh-modale .modal-header {
    background: var(--gh-surface);
    border-bottom-color: var(--gh-trait);
}

.gh-modale .modal-title { font-weight: 700; }

.gh-modale nav[aria-label='Retour'],
.gh-modale .gh-page-soustitre,
.gh-modale .gh-hors-modale { display: none; }

/* Boutons d'action collés au bas de la fenêtre, comme sur les écrans de saisie. */
.gh-modale .gh-actions-formulaire {
    position: sticky;
    bottom: calc(-1 * var(--bs-modal-padding, 1rem));
    background: var(--gh-fond);
    padding-block: var(--gh-e3);
    margin-bottom: calc(-1 * var(--bs-modal-padding, 1rem));
    border-top: 1px solid var(--gh-trait);
    z-index: 2;
}

/* Tom Select, aux couleurs de la charte. Le cadre et le chevron restent ceux
   du <select> d'origine (classe form-select reportée sur l'enveloppe) : la
   liste décorée a la même allure que les champs voisins. */
.ts-wrapper.form-select { background-color: var(--gh-surface); }

.ts-wrapper .ts-control { color: var(--bs-body-color); align-items: center; }

.ts-wrapper.form-select.focus {
    border-color: var(--gh-orange-clair);
    box-shadow: 0 0 0 3px rgb(194 65 12 / 15%);
}

.ts-dropdown {
    border-color: var(--gh-trait-fort);
    border-radius: var(--gh-radius-sm);
    background: var(--gh-surface);
    color: var(--bs-body-color);
    box-shadow: var(--gh-ombre-haute);
    z-index: 1080;
}

/* Tom Select borne sa liste à 200 px : quatre salariés visibles à peine. On
   laisse voir une bonne dizaine de lignes, sans dépasser la moitié de l'écran. */
.ts-dropdown .ts-dropdown-content { max-height: min(22rem, 50vh); }

/* Au doigt : des options hautes, faciles à viser. */
.ts-dropdown .option { padding: 0.55rem 0.75rem; }

@media (pointer: coarse) {
    .ts-dropdown .option { padding-block: 0.8rem; }
}

.ts-dropdown .active { background: var(--gh-orange-pale); color: var(--bs-emphasis-color); }
.ts-dropdown .selected { font-weight: 600; }
.ts-dropdown .no-results { padding: 0.6rem 0.75rem; color: var(--bs-secondary-color); }

.ts-wrapper.multi .ts-control > .item {
    background: var(--gh-fond-creux);
    border: 1px solid var(--gh-trait-fort);
    color: var(--bs-body-color);
    border-radius: var(--gh-radius-sm);
}

.ts-wrapper.is-invalid .ts-control { border-color: var(--bs-form-invalid-border-color); }

[data-bs-theme='dark'] .ts-control input { color: var(--bs-body-color); }

/* Pastille de couleur d'un compagnon (templates/_composants/_pastille_compagnon.html.twig). */
.gh-pastille {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 2px;
    flex: none;
    vertical-align: baseline;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 12%);
}

.gh-pastille-compagnon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

/* Sur fond sombre, la pastille reçoit un liseré clair : une teinte foncée
   choisie librement ne doit pas se fondre dans la surface. */
[data-bs-theme='dark'] .gh-pastille { box-shadow: 0 0 0 1px rgb(255 255 255 / 30%); }

/* Ligne de détail calée sous le nom, après la pastille. */
.gh-retrait-pastille { padding-left: 1rem; }

/* ================================================================== */
/* 11 ter. Grille du rapport : compagnons, ajout, totaux               */
/* ================================================================== */

/* L'angle « PHASES » colle à gauche ET en haut : il doit passer au-dessus des
   en-têtes de compagnons qui défilent dessous. Ouvert, son menu passe aussi
   au-dessus de la barre d'enregistrement collée en bas. */
.gh-grille-heures thead th.gh-col-phase { z-index: 3; }
.gh-grille-heures thead th.gh-col-phase:has(.dropdown-menu.show) { z-index: 1030; }

.gh-entete-phases {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gh-e2);
}

/* Chaque colonne de compagnon porte sa couleur en liseré de tête. */
.gh-grille-heures thead th.gh-entete-compagnon {
    box-shadow: inset 0 3px 0 var(--gh-couleur-compagnon, transparent);
    white-space: nowrap;
}

.gh-grille-heures thead th.gh-entete-compagnon .gh-pastille-compagnon { font-weight: 700; }

/* La croix de retrait : discrète, mais assez grande pour le doigt. */
.gh-retrait-compagnon {
    display: block;
    margin: 0.1rem auto 0;
    min-width: 2rem;
    min-height: 1.75rem;
    padding: 0 0.4rem;
    border: 0;
    border-radius: var(--gh-radius-sm);
    background: transparent;
    color: var(--gh-ardoise-400);
    font-size: 0.8125rem;
    line-height: 1;
}

.gh-retrait-compagnon:hover,
.gh-retrait-compagnon:focus-visible {
    color: var(--gh-rouge);
    background: var(--gh-rouge-pale);
}

.gh-btn-ajout-compagnon {
    --bs-btn-color: var(--gh-orange);
    --bs-btn-border-color: var(--gh-orange);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--gh-orange);
    --bs-btn-hover-border-color: var(--gh-orange);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--gh-orange);
    --bs-btn-active-border-color: var(--gh-orange);
    background: var(--gh-surface);
    font-size: 0.8125rem;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

[data-bs-theme='dark'] .gh-btn-ajout-compagnon {
    --bs-btn-color: var(--gh-orange-clair);
    --bs-btn-border-color: var(--gh-orange-clair);
}

.gh-menu-compagnons {
    width: min(22rem, calc(100vw - 2rem));
    padding: var(--gh-e2);
    border-color: var(--gh-trait-fort);
    background: var(--gh-surface);
    box-shadow: var(--gh-ombre-haute);
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

.gh-menu-compagnons__entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--gh-e2);
}

.gh-menu-compagnons__liste {
    max-height: min(22rem, 45vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.gh-option-compagnon {
    display: flex;
    align-items: center;
    gap: var(--gh-e2);
    padding: 0.55rem 0.6rem;
    border-radius: var(--gh-radius-sm);
    font-size: 0.9375rem;
    white-space: normal;
}

.gh-option-compagnon .gh-pastille { width: 0.75rem; height: 0.75rem; }
.gh-option-compagnon__nom { font-weight: 600; white-space: nowrap; }

.gh-option-compagnon__equipe {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 50%;
    margin-left: auto;
    overflow: hidden;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-option-compagnon:hover,
.gh-option-compagnon:focus-visible {
    background: var(--gh-orange-pale);
    color: var(--bs-emphasis-color);
}

.gh-menu-compagnons__vide {
    margin: 0;
    padding: 0.5rem 0.6rem;
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

/* Colonne tout juste ajoutée : un éclat bref pour que l'œil la trouve. */
@keyframes gh-eclat {
    from { background-color: var(--gh-orange-pale); }
    to { background-color: var(--gh-fond-creux); }
}

.gh-grille-heures thead th.gh-colonne-ajoutee { animation: gh-eclat 1.5s ease-out; }

/* « TOTAL HEURES/OUVRIER » reste visible en bas de la grille pendant qu'on
   descend dans les phases : le total se lit sans faire défiler. */
.gh-grille-heures tfoot td,
.gh-grille-heures tfoot th {
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.gh-grille-heures tfoot th.gh-col-phase { z-index: 3; }

/* Bouton d'envoi pendant l'enregistrement : le second toucher est ignoré. */
.btn.gh-en-cours {
    pointer-events: none;
    opacity: 0.75;
}

/* ================================================================== */
/* 11 quater. Nuancier de couleur d'un compagnon                       */
/* ================================================================== */

.gh-nuancier {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gh-e2);
    margin-bottom: 0.25rem;
}

.gh-nuancier__teinte {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    margin: 0;
    padding: 0.2rem;
    border-radius: 999px;
    cursor: pointer;
}

.gh-nuancier__radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.gh-nuancier__pastille {
    display: block;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--gh-teinte);
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / 15%);
    transition: transform 0.12s ease;
}

[data-bs-theme='dark'] .gh-nuancier__pastille { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 25%); }

.gh-nuancier__teinte:hover .gh-nuancier__pastille { transform: scale(1.08); }

/* Teinte retenue : un anneau d'encre et une coche, lisibles sur toutes les couleurs. */
.gh-nuancier__radio:checked + .gh-nuancier__pastille {
    box-shadow: 0 0 0 3px var(--gh-surface), 0 0 0 5px var(--bs-emphasis-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='m4 8.5 2.5 2.5L12 5.5'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 70%;
}

.gh-nuancier__radio:focus-visible + .gh-nuancier__pastille {
    outline: 2px solid var(--gh-orange);
    outline-offset: 4px;
}

/* La teinte que l'enregistrement attribuera si rien n'est choisi. */
.gh-nuancier__teinte--suggeree .gh-nuancier__pastille {
    outline: 2px dashed var(--gh-ardoise-400);
    outline-offset: 3px;
}

.gh-nuancier__teinte--libre {
    padding-right: 0.75rem;
    border: 1px dashed var(--gh-trait-fort);
}

.gh-nuancier__libelle {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gh-ardoise-700);
}

[data-bs-theme='dark'] .gh-nuancier__libelle { color: var(--gh-ardoise-300); }

/* Le sélecteur de couleur couvre toute la pastille « Autre… » : un toucher
   l'ouvre, et la valeur choisie coche la pastille. */
.gh-nuancier__selecteur {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: 0;
    padding: 0;
}

/* Composition d'une équipe : les compagnons sur plusieurs colonnes. */
.gh-liste-membres {
    columns: 3 14rem;
    column-gap: var(--gh-e5);
}

.gh-liste-membres .form-check { break-inside: avoid; margin-bottom: 0.35rem; }

/* ================================================================== */
/* 11 quinquies. Lignes de matériaux : tableau sur bureau, fiches sur  */
/* tablette en portrait                                                */
/* ================================================================== */

.gh-lignes-materiaux { table-layout: fixed; min-width: 100%; }
.gh-lignes-materiaux .gh-col-article { width: 30%; }
.gh-lignes-materiaux .gh-col-fournisseur { width: 19%; }
.gh-lignes-materiaux .gh-col-provenance { width: 14%; }
.gh-lignes-materiaux .gh-col-quantite { width: 8.5%; }
.gh-lignes-materiaux .gh-col-commentaire { width: auto; }
.gh-lignes-materiaux .gh-col-actions { width: 3.5rem; }

/* Une liste décorée ne doit pas élargir sa cellule au-delà de sa colonne. */
.gh-lignes-materiaux .ts-wrapper { min-width: 0; }
.gh-lignes-materiaux .ts-control { flex-wrap: nowrap; }
.gh-lignes-materiaux .ts-control .item { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 991.98px) {
    /* Une ligne = une petite fiche : matériau en tête, puis fournisseur,
       provenance, quantités et commentaire — sans défilement horizontal. */
    .gh-lignes-materiaux,
    .gh-lignes-materiaux tbody { display: block; table-layout: auto; }
    .gh-lignes-materiaux thead { display: none; }

    .gh-lignes-materiaux tr[data-collection-ligne] {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: var(--gh-e2) var(--gh-e3);
        padding: var(--gh-e3) 0;
        border-bottom: 1px solid var(--gh-trait);
    }

    .gh-lignes-materiaux tr[data-collection-ligne] > td {
        display: block;
        padding: 0;
        border: 0;
        min-width: 0 !important;
        max-width: none !important;
        text-align: left !important;
    }

    .gh-lignes-materiaux tr[data-collection-ligne] > td::before {
        content: attr(data-libelle);
        display: block;
        margin-bottom: 0.15rem;
        font-size: 0.6875rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--bs-secondary-color);
    }

    .gh-lignes-materiaux .gh-cellule-article { grid-row: 1; grid-column: 1 / -2; }
    .gh-lignes-materiaux .gh-cellule-actions { grid-row: 1; grid-column: -2 / -1; align-self: end; text-align: right !important; }
    .gh-lignes-materiaux .gh-cellule-fournisseur { grid-column: 1 / 4; }
    .gh-lignes-materiaux .gh-cellule-provenance { grid-column: 4 / -1; }
    .gh-lignes-materiaux .gh-cellule-quantite,
    .gh-lignes-materiaux .gh-cellule-commentaire { grid-column: span 2; }
    .gh-lignes-materiaux .gh-cellule-quantite input { text-align: left !important; }
}

/* ================================================================== */
/* 11 sexies. Navigation et repères de chargement                      */
/* ================================================================== */

/* Barre de progression de Turbo : à l'orange chantier et plus épaisse, pour
   qu'on voie sur la tablette que la page arrive. */
.turbo-progress-bar {
    height: 3px;
    background: var(--gh-orange-clair);
}

/* Tablette à l'horizontale (992 à 1199 px) : la barre de navigation déborde
   et toute la page défilait de côté. On resserre les intitulés plutôt que de
   perdre une entrée ; depuis les menus Pilotage et Commercial de la V2, le
   nom de l'application s'efface aussi derrière son logo « G ». */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .gh-navbar .navbar-brand { font-size: 0.9375rem; margin-right: 0.5rem; }
    .gh-navbar .gh-navbar__nom { display: none; }
    .gh-navbar .nav-link { padding-inline: 0.45rem; font-size: 0.875rem; }
    .gh-navbar .nav-link.active::after { inset-inline: 0.45rem; }
}

/* ================================================================== */
/* 12. Densité                                                        */
/* ================================================================== */

/* Sur un écran tactile — la tablette du chef d'équipe — les cibles s'élargissent.
   44 px est le seuil confortable pour une saisie au doigt, gants compris. */
@media (pointer: coarse) {
    .btn { min-height: 2.75rem; }

    .form-control,
    .form-select { min-height: 2.75rem; font-size: 1rem; }

    .gh-grille-heures .gh-cellule-heure input {
        min-height: 2.75rem;
        min-width: 3.25rem;
        font-size: 1.05rem;
    }

    .gh-grille-heures th,
    .gh-grille-heures td { padding: 0.45rem 0.55rem; }

    .gh-affectation { padding: 0.5rem 0.6rem; }

    .table > tbody > tr > td { padding-block: 0.8rem; }

    .gh-retrait-compagnon { min-height: 2.25rem; min-width: 2.5rem; }
    .gh-btn-ajout-compagnon { font-size: 0.9375rem; }
    .gh-option-compagnon { padding-block: 0.8rem; }

    /* Tom Select fixe sa propre hauteur aux listes « -sm » : au doigt, elles
       reprennent la hauteur des champs voisins. */
    .ts-wrapper.form-select,
    .ts-wrapper.form-control { min-height: 2.75rem; }
}

@media print {
    /* À l'impression, la grille se déplie entièrement : rien ne défile sur du papier. */
    .table-responsive:has(.gh-grille-heures),
    .table-responsive:has(.gh-planning),
    .table-responsive:has(.gh-charge) {
        max-height: none;
        overflow: visible;
    }

    .gh-navbar,
    .gh-no-print,
    .btn { display: none !important; }

    body { background: #fff; }

    .gh-card,
    .gh-feuille,
    .gh-kpi {
        box-shadow: none;
        border-color: #999;
    }

    .gh-eviter-coupure { break-inside: avoid; }

    /* Les couleurs de fond ne s'impriment pas par défaut : la pastille et le
       liseré du compagnon, si — c'est une identité, pas une décoration. */
    .gh-pastille,
    .gh-grille-heures thead th.gh-entete-compagnon {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .gh-grille-heures tfoot td,
    .gh-grille-heures tfoot th { position: static; }
}

/* ================================================================== */
/* 12. Fluidité : notifications flottantes, aperçus, recherche        */
/* ================================================================== */

/* Messages flash en page : ils flottent, pour rester visibles même quand
   la page a gardé sa position de défilement après une action. */
.gh-flashes {
    position: fixed;
    top: 4.25rem;
    right: 1rem;
    z-index: 1090;
    width: min(28rem, calc(100vw - 2rem));
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
}
.gh-flashes .alert {
    pointer-events: auto;
    margin: 0;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .15);
}
@media (max-width: 575.98px) {
    .gh-flashes { top: auto; bottom: 5.5rem; right: 1rem; }
}

/* Une fiche ouverte en fenêtre n'a pas besoin de son lien « ← Retour ». */
.gh-modale nav[aria-label="Retour"] { display: none; }

/* Chaîne documentaire : devis → commande → factures → commandes fournisseurs. */
.gh-chaine { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-size: .875rem; }
.gh-chaine__maillon {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .6rem; border: 1px solid var(--bs-border-color); border-radius: 999px;
    background: var(--bs-body-bg); color: var(--bs-body-color); text-decoration: none; white-space: nowrap;
}
a.gh-chaine__maillon:hover { border-color: var(--bs-primary); color: var(--bs-primary); }
.gh-chaine__maillon--courant { border-color: var(--bs-body-color); font-weight: 600; }
.gh-chaine__maillon--vide { border-style: dashed; color: var(--bs-secondary-color); }
.gh-chaine__fleche { color: var(--bs-secondary-color); }

/* Recherche instantanée : la liste se grise le temps de la requête. */
turbo-frame[busy] .gh-resultats { opacity: .55; transition: opacity .15s; }

/* Recherche globale de la barre de navigation. */
.gh-recherche { position: relative; }
.gh-recherche__resultats {
    position: absolute; top: calc(100% + .35rem); right: 0; z-index: 1080;
    width: min(34rem, calc(100vw - 2rem)); max-height: 70vh; overflow-y: auto;
    background: var(--bs-body-bg); color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color); border-radius: var(--gh-radius-sm, .5rem);
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .2);
}
.gh-recherche__groupe { padding: .4rem .75rem .2rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); }
.gh-recherche__lien { display: block; padding: .45rem .75rem; color: inherit; text-decoration: none; }
.gh-recherche__lien:hover, .gh-recherche__lien.active { background: var(--bs-tertiary-bg); }
.gh-recherche__lien small { color: var(--bs-secondary-color); }

/* ================================================================== */
/* 14. Raccourcis de l'accueil                                        */
/* ================================================================== */

/* Des tuiles à pictogramme plutôt qu'une pile de boutons gris : six boutons
   identiques se lisaient comme un formulaire, pas comme des portes d'entrée. */
.gh-raccourcis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gh-e2);
}

.gh-raccourci {
    display: flex;
    align-items: center;
    gap: var(--gh-e3);
    min-height: 3.5rem;
    padding: var(--gh-e3);
    border: 1px solid var(--gh-trait);
    border-radius: var(--gh-radius-sm);
    background: var(--gh-surface);
    color: var(--bs-emphasis-color);
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.25;
    text-decoration: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.gh-raccourci:hover,
.gh-raccourci:focus-visible {
    border-color: color-mix(in srgb, var(--gh-orange) 45%, var(--gh-trait));
    box-shadow: var(--gh-ombre);
    transform: translateY(-1px);
    color: var(--bs-emphasis-color);
}

.gh-raccourci__icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--gh-radius-sm);
    background: var(--gh-orange-pale);
    color: var(--gh-orange);
}

[data-bs-theme='dark'] .gh-raccourci__icone { color: #fb923c; }

.gh-icone { width: 1.25rem; height: 1.25rem; flex: none; }

@media (min-width: 1200px) and (max-width: 1399.98px) {
    .gh-raccourcis { grid-template-columns: 1fr; }
}

/* ==========================================================================
   V2 — Sociétés repérées par leur couleur (pastille, liseré du bandeau)
   ========================================================================== */
.gh-societe {
    --gh-societe: var(--gh-ardoise-500);
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    vertical-align: middle;
    white-space: nowrap;
}
.gh-societe__sigle {
    display: inline-block;
    min-width: 2.1rem;
    padding: .05rem .35rem;
    border-radius: .3rem;
    background: var(--gh-societe);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .03em;
    line-height: 1.35;
    text-align: center;
}
.gh-societe--toutes .gh-societe__sigle { background: var(--gh-ardoise-600); }
.gh-navbar--societe { box-shadow: inset 0 -4px 0 var(--gh-societe); }
.gh-societe-choix .dropdown-item.active { background: var(--gh-fond-creux); color: inherit; font-weight: 600; }
/* Barre étroite (tablette en paysage) : le sigle suffit, le nom est dans le menu. */
@media (min-width: 992px) and (max-width: 1399.98px) {
    .gh-navbar .gh-societe-choix > .nav-link .gh-societe__nom { display: none; }
}

/* V2 — Fiche tiers (onglets Batigest) et listes denses */
.gh-fiche-tiers__identification {
    border: 1px solid var(--gh-trait);
    border-radius: .5rem;
    padding: .25rem .75rem 0;
    margin: 0;
}
.gh-fiche-tiers__identification legend {
    float: none;
    width: auto;
    padding: 0 .35rem;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gh-ardoise-600);
}
.gh-fiche-tiers .mb-3 { margin-bottom: .6rem !important; }
.gh-onglets { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.gh-onglets .nav-link { white-space: nowrap; }
.gh-onglets__contenu { border: 1px solid var(--bs-border-color); border-top: 0; border-radius: 0 0 .5rem .5rem; padding: .9rem; }
.gh-ligne-collection { border: 1px dashed var(--gh-trait-fort); border-radius: .5rem; padding: .6rem .75rem; margin-bottom: .6rem; }
.gh-annuaire { background: var(--gh-fond-creux); border-radius: .5rem; padding: .6rem; margin-bottom: .75rem; }
.gh-annuaire__resultats .list-group { max-height: 18rem; overflow-y: auto; }
.gh-table-dense > :not(caption) > * > * { padding: .3rem .45rem; }
.gh-table-dense thead th { font-size: .78rem; white-space: nowrap; }
.gh-filtres-colonnes td { padding-top: 0 !important; background: var(--gh-fond-creux); }
.gh-filtres-colonnes .form-control-sm { min-width: 4.5rem; }
.gh-tri { color: inherit; text-decoration: none; display: inline-flex; gap: .25rem; align-items: center; }
.gh-tri__fleche { opacity: .35; font-size: .7em; }
.gh-tri--actif .gh-tri__fleche { opacity: 1; color: var(--gh-orange); }
.gh-col-code { width: 7rem; }
.gh-col-cp { width: 5rem; }

/* V2 — Catalogue « Articles / Éléments » : filtres latéraux, liste dense, clic droit */
.gh-catalogue { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.gh-catalogue__filtres { background: var(--gh-surface); border: 1px solid var(--gh-trait); border-radius: .6rem; padding: .8rem; position: sticky; top: calc(var(--gh-navbar-hauteur) + .75rem); }
.gh-catalogue__filtres .form-label, .gh-catalogue__filtres legend { font-size: .78rem; font-weight: 700; margin-bottom: .2rem; }
.gh-catalogue__filtres .form-check { font-size: .85rem; }
.gh-catalogue__selection { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; background: var(--gh-orange-pale); border-radius: .5rem; padding: .5rem .75rem; margin-bottom: .6rem; }
.gh-catalogue__selection .form-select { width: auto; }
.gh-catalogue__table td, .gh-catalogue__table th { font-size: .85rem; }
.gh-catalogue__aide { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; padding: .7rem 1rem; font-size: .8rem; color: var(--gh-ardoise-600); }
.gh-nature { display: inline-block; width: 1.1rem; text-align: center; color: var(--gh-bleu); }
.gh-nature--ouvrage { color: var(--gh-violet); }
.gh-menu-contextuel {
    /* Habillage d'un menu déroulant Bootstrap, sans sa classe (voir menu_contextuel_controller.js). */
    --bs-dropdown-item-padding-x: 1rem;
    --bs-dropdown-item-padding-y: .3rem;
    --bs-dropdown-link-color: var(--bs-body-color);
    --bs-dropdown-link-hover-color: var(--bs-body-color);
    --bs-dropdown-link-hover-bg: var(--bs-tertiary-bg);
    --bs-dropdown-link-active-color: var(--bs-body-color);
    --bs-dropdown-link-active-bg: var(--bs-tertiary-bg);
    --bs-dropdown-link-disabled-color: var(--bs-tertiary-color);
    --bs-dropdown-header-color: var(--bs-secondary-color);
    --bs-dropdown-header-padding-x: 1rem;
    --bs-dropdown-header-padding-y: .4rem;
    --bs-dropdown-divider-bg: var(--bs-border-color-translucent);
    --bs-dropdown-divider-margin-y: .4rem;
    position: fixed;
    z-index: 1080;
    display: block;
    min-width: 17rem;
    max-height: 80vh;
    overflow-y: auto;
    padding: .4rem 0;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius);
}
.gh-menu-contextuel .dropdown-header { font-size: .8rem; }
.gh-menu-contextuel[hidden] { display: none; }
@media (max-width: 1199.98px) {
    .gh-catalogue { grid-template-columns: 1fr; }
    .gh-catalogue__filtres { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0 .75rem; }
    .gh-catalogue__filtres > * { margin-bottom: .5rem !important; }
}
@media print { .gh-catalogue { display: block; } }

/* V2 — Pièces jointes et photo d'article */
.gh-pieces__liste { display: grid; gap: .5rem; margin-bottom: .75rem; }
.gh-pieces__piece { display: flex; gap: .75rem; align-items: center; border: 1px solid var(--gh-trait); border-radius: .5rem; padding: .4rem .6rem; }
.gh-pieces__piece img { width: 4.5rem; height: 3.4rem; object-fit: cover; border-radius: .35rem; }
.gh-pieces__icone { display: inline-grid; place-items: center; width: 4.5rem; height: 3.4rem; border-radius: .35rem; background: var(--gh-fond-creux); font-weight: 700; font-size: .75rem; }
.gh-photo-article { border: 1px solid var(--gh-trait); border-radius: .6rem; min-height: 9rem; display: grid; place-items: center; padding: .5rem; text-align: center; background: var(--gh-surface); }
.gh-photo-article img { max-width: 100%; max-height: 12rem; object-fit: contain; }

/* V2 — Affaires */
.gh-kpi--alerte { border-color: var(--gh-rouge) !important; box-shadow: inset 4px 0 0 var(--gh-rouge); }
.gh-echange { border-left: 3px solid var(--gh-trait-fort); padding: .35rem .75rem; margin-bottom: .6rem; }
.gh-catalogue__filtres > a.btn { align-self: end; }

/* Écran de sélection du catalogue (éditeur de lignes d'un devis / d'une facture) :
   fenêtre native <dialog>, liste dense façon maquette « Articles / Éléments ». */
.gh-selection-catalogue {
    width: min(72rem, calc(100vw - 1.5rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 25%);
}
.gh-selection-catalogue[open] { display: flex; flex-direction: column; }
.gh-selection-catalogue::backdrop { background: rgb(0 0 0 / 40%); }
.gh-selection-catalogue__entete,
.gh-selection-catalogue__pied {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.gh-selection-catalogue__pied { border-bottom: 0; border-top: 1px solid var(--bs-border-color); flex-wrap: wrap; }
.gh-selection-catalogue__corps { flex: 1 1 auto; overflow: auto; padding: .6rem 1rem; min-height: 12rem; }
.gh-selection-catalogue__filtres { display: flex; flex-wrap: wrap; gap: .5rem .75rem; margin-bottom: .5rem; }
.gh-selection-catalogue__filtre { flex: 0 1 14rem; }
.gh-selection-catalogue__filtre--q { flex: 1 1 16rem; }
.gh-selection-catalogue__filtre .form-label { font-size: .75rem; margin-bottom: .15rem; }
.gh-selection-catalogue__table td, .gh-selection-catalogue__table th { vertical-align: middle; }
.gh-selection-catalogue__table tbody label { cursor: pointer; }
.gh-selection-catalogue__table .form-control-sm { padding-top: .1rem; padding-bottom: .1rem; }
