/*
 * 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. 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. */
    --gh-ardoise-950: #0b1220;
    --gh-ardoise-900: #14202f;
    --gh-ardoise-800: #1f2937;
    --gh-ardoise-700: #334155;
    --gh-ardoise-600: #475569;
    --gh-ardoise-500: #64748b;
    --gh-ardoise-400: #94a3b8;
    --gh-ardoise-300: #cbd5e1;
    --gh-ardoise-200: #e2e8f0;

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

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

    /* 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.625rem;
    --gh-radius-sm: 0.375rem;

    /* Deux niveaux d'élévation, pas trois. */
    --gh-ombre: 0 1px 1px rgb(20 32 47 / 4%), 0 1px 3px rgb(20 32 47 / 6%);
    --gh-ombre-haute: 0 2px 4px rgb(20 32 47 / 6%), 0 8px 20px rgb(20 32 47 / 10%);

    /* Surcharges Bootstrap. */
    --bs-primary: var(--gh-ardoise-800);
    --bs-primary-rgb: 31, 41, 55;
    --bs-body-bg: var(--gh-fond);
    --bs-body-color: var(--gh-ardoise-800);
    --bs-secondary-color: var(--gh-ardoise-500);
    --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: #0e1520;
    --gh-fond-creux: #0a111a;
    --gh-surface: #16202e;
    --gh-trait: #263242;
    --gh-trait-fort: #35455a;

    --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: #dbe3ec;
    --bs-secondary-color: var(--gh-ardoise-400);
    --bs-border-color: var(--gh-trait);
    --bs-emphasis-color: #f1f5f9;
    --bs-link-color: #e2e8f0;

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

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

body {
    background-color: var(--bs-body-bg);
    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-weight: 700;
    letter-spacing: -0.018em;
    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                            */
/* ================================================================== */

.gh-navbar {
    background: var(--gh-ardoise-950);
    border-bottom: 1px solid rgb(255 255 255 / 8%);
    padding-block: 0.4rem;
}

.gh-navbar .navbar-brand {
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: 1.0625rem;
}

.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.5rem, 1.2rem + 1vw, 1.875rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin-bottom: 0.2rem;
}

.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);
}

/* 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: 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. */
.gh-kpi {
    background: var(--gh-surface);
    border: 1px solid var(--gh-trait);
    border-radius: var(--gh-radius);
    box-shadow: var(--gh-ombre);
    padding: var(--gh-e4);
    height: 100%;
}

.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-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    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. */
.table > thead > tr > th {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    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);
    --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: #9a3412;
    --bs-btn-active-border-color: #9a3412;
    box-shadow: 0 1px 2px rgb(154 52 18 / 25%);
}

.btn-outline-secondary {
    --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 : une trame légère suffit à le dire. */
.gh-planning td.gh-weekend {
    background: repeating-linear-gradient(
        45deg,
        var(--gh-fond) 0 6px,
        var(--gh-fond-creux) 6px 12px
    );
}

.gh-affectation {
    display: block;
    border: 1px solid var(--gh-trait);
    border-left: 3px solid var(--gh-ardoise-500);
    border-radius: var(--gh-radius-sm);
    background: var(--gh-surface);
    box-shadow: none;
    padding: 0.3rem 0.45rem;
    margin-bottom: 0.25rem;
    text-decoration: none;
    color: inherit;
    font-size: 0.8rem;
    line-height: 1.25;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.gh-affectation:hover {
    border-left-color: var(--gh-orange);
    box-shadow: var(--gh-ombre);
}

.gh-affectation--conflit {
    border-left-color: var(--gh-rouge);
    background: var(--gh-rouge-pale);
}

.gh-absence {
    display: block;
    border-radius: var(--gh-radius-sm);
    background: repeating-linear-gradient(
        45deg,
        var(--gh-ambre-pale) 0 5px,
        #f8e6c4 5px 10px
    );
    color: var(--gh-ambre);
    padding: 0.3rem 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
}

[data-bs-theme='dark'] .gh-absence {
    background: repeating-linear-gradient(45deg, var(--gh-ambre-pale) 0 5px, #3d2b0c 5px 10px);
    color: #f0c674;
}

/* 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); }

/* ================================================================== */
/* 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; }
}

@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; }
}
