/* ============================================================
   Proxima design system — application stylesheet (starter kit)
   Brand accent lives in the --accent* tokens below — change them in ONE place.
   ============================================================ */

:root {
    /* Surfaces */
    --bg-primary:    #f8f9fc;
    --bg-secondary:  #ffffff;
    --bg-tertiary:   #f0f1f5;
    --bg-elevated:   #ffffff;
    --theme-bg-glass:       rgba(0, 0, 0, 0.02);
    --theme-bg-glass-hover: rgba(0, 0, 0, 0.04);
    --bg-primary-rgb: 248, 249, 252;

    /* Text */
    --theme-text-primary:   #1a1a2e;
    --theme-text-secondary: #666b7f;   /* #6b7084 tombait à 4,35:1 sur --bg-tertiary (ThemeContrasteTests) */
    --theme-text-muted:     #9ca3b4;

    /* Accent — bleu de marque Chronos (#0EABDB, RGB 14/171/219). Le bleu pur ne fait que 2,7:1 sur
       blanc : l'accent du thème clair (textes, liens, bordures) est donc le même bleu descendu
       d'un cran (#0A7FA6, 4,6:1). Le bleu pur reste aux aplats sans texte (logo, filets, lavis)
       et devient l'accent du thème sombre, où il se lit très bien. */
    --theme-accent:         #0a7fa6;
    --theme-accent-soft:    rgba(10, 127, 166, 0.10);
    /* Lavis d'accent un cran plus fort : le surlignage <mark> d'une recherche (guide § 5.13b). */
    --accent-soft-2:  rgba(10, 127, 166, 0.20);
    --accent-glow:    rgba(14, 171, 219, 0.18);
    /* Bouton principal : texte blanc dessus, d'où un dégradé qui s'arrête avant le bleu pur. */
    --accent-gradient: linear-gradient(135deg, #0a7fa6, #0c9bcb);

    /* Statut « validé » — le vert reste aux statuts (bandeau « Validée paie »), jamais au chrome. */
    --statut-valide:      #006838;
    --statut-valide-soft: rgba(0, 104, 56, 0.10);

    /* Brouillon — violet. Volontairement distinct du bleu de « Révisée » : un brouillon
       n'est ni révisé ni transmis, la confusion visuelle serait coûteuse. */
    --draft:      #7c3aed;
    --draft-soft: rgba(124, 58, 237, 0.10);

    /* Borders */
    --theme-border:  rgba(0, 0, 0, 0.08);
    --border-subtle: rgba(0, 0, 0, 0.04);

    /* ---- L'encre du THÈME, sous deux noms ----
       Les jetons --theme-* portent les valeurs du thème (clair ici, sombre plus bas) ; les jetons
       publics (--text-primary, --accent…) les reprennent ici. Pourquoi deux noms : l'entête et le
       pied de page sont posés sur le bleu et RÉÉCRIVENT les jetons publics en encre blanche pour
       tout leur sous-arbre (voir .appbar). Un panneau flottant ouvert depuis l'entête — la cloche
       de notifications, par exemple — héritait de cette encre blanche sur son fond blanc : texte
       invisible en thème clair. Les --theme-* ne sont jamais réécrits ; .surface-theme s'en sert
       pour rendre au panneau l'encre du thème. Tests : ThemeContrasteTests. */
    --text-primary:   var(--theme-text-primary);
    --text-secondary: var(--theme-text-secondary);
    --text-muted:     var(--theme-text-muted);
    --accent:         var(--theme-accent);
    --accent-soft:    var(--theme-accent-soft);
    --border:         var(--theme-border);
    --bg-glass:       var(--theme-bg-glass);
    --bg-glass-hover: var(--theme-bg-glass-hover);

    /* Scrollbar */
    --scrollbar-thumb:       rgba(0, 0, 0, 0.18);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.32);

    /* Chevron des <select>. En jeton parce qu'une image de fond ne peut pas hériter
       currentColor : la seule façon d'avoir la bonne couleur dans les deux thèmes est
       d'échanger l'image elle-même. */
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7084' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

    /* Radii */
    --radius-sm:   8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm:   0 1px 2px  rgba(0, 0, 0, 0.05);
    --shadow-md:   0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg:   0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Tokens additionnels utilisés par la zone « Rapports » — couleur de marque (voir --accent). */
    --accent-wash: radial-gradient(120% 100% at 0% 0%, rgba(14, 171, 219, 0.10) 0%, rgba(14, 171, 219, 0.00) 60%);
    --shimmer: linear-gradient(90deg, var(--bg-tertiary) 0%, var(--bg-glass-hover) 50%, var(--bg-tertiary) 100%);
    --status-success: #22c55e;
    --status-warning: #f59e0b;
    --status-danger:  #ef4444;

    /* ---- Fond de l'application : le bleu de marque et sa tapisserie d'horloges ----
       Même construction que Rippa. Le fond porte le dégradé de marque (bleu nuit → bleu
       corporatif) et une tapisserie de petites horloges, l'emblème de Chronos (cadran,
       deux aiguilles, repère de midi menthe) dessiné au trait. Le logo en couleur reste,
       lui, à un seul endroit : l'entête.

       Le contenu ne s'écrit pas sur le bleu. Il est posé sur une feuille claire (.app-main).
       Sans elle, il aurait fallu recolorer le texte de chaque écran. Avec elle, aucun
       caractère de contenu ne touche le fond et --text-primary garde son contraste.

       La tuile fait 80 px et porte DEUX horloges en quinconce. La seconde a ses aiguilles
       en miroir, donc une autre heure : sans ce décalage, la répétition se lit comme une
       grille au lieu d'un motif. Trait blanc à 14 %, repère menthe à 34 %.

       Le dégradé part PLUS FONCÉ que celui du logo (#0A7FA6 → #0EABDB). Sur le même bleu,
       le badge de l'entête disparaîtrait, et le blanc du pied de page manquerait de contraste
       sur #0b9b54.

       --bg-primary ne change PAS. L'aperçu de facture l'utilise comme « bureau » gris sous
       ses feuilles, et il n'a rien à faire en bleu. */
    --fond-haut:    #04293d;
    --fond-bas:     #0a5f86;
    --fond-degrade: linear-gradient(160deg, var(--fond-haut) 0%, var(--fond-bas) 100%);
    --fond-motif:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' opacity='0.14'%3E%3Ccircle cx='20' cy='21' r='9.5'/%3E%3Cpath d='M20 21V15.2M20 21l4.6 2.6'/%3E%3Ccircle cx='60' cy='61' r='9.5'/%3E%3Cpath d='M60 61V55.2M60 61l-4.6 2.6'/%3E%3C/g%3E%3Cg fill='%237FE0FF' opacity='0.34'%3E%3Ccircle cx='20' cy='11.5' r='1.7'/%3E%3Ccircle cx='60' cy='51.5' r='1.7'/%3E%3C/g%3E%3C/svg%3E");

    /* Le trait et l'encre de ce qui s'écrit directement sur le bleu : l'entête, le pied de
       page et le titre de la connexion. Identiques dans les deux thèmes, puisque le fond
       est sombre dans les deux. */
    --fond-trait:   rgba(255, 255, 255, 0.16);
    --fond-encre:   #ffffff;
    --fond-encre-2: rgba(255, 255, 255, 0.76);
    --fond-encre-3: rgba(255, 255, 255, 0.58);

    /* ---- Le bandeau DEV (Components/Layout/BandeauDev.razor) ----
       Un ambre franc, encre presque noire : il doit se voir avant tout le reste, en clair comme en
       sombre. Opaques, pour que ThemeContrasteTests en mesure le contraste. */
    --bandeau-dev-fond:  #fbbf24;
    --bandeau-dev-encre: #1c1300;
    --bandeau-dev-rayure: #f59e0b;
}

[data-theme="dark"] {
    --bandeau-dev-fond:  #78350f;
    --bandeau-dev-encre: #fffbeb;
    --bandeau-dev-rayure: #b45309;

    --bg-primary:    #0f1419;
    --bg-secondary:  #161b22;
    --bg-tertiary:   #1e242c;
    --bg-elevated:   #1a2028;
    --theme-bg-glass:       rgba(255, 255, 255, 0.03);
    --theme-bg-glass-hover: rgba(255, 255, 255, 0.06);
    --bg-primary-rgb: 15, 20, 25;

    /* Le fond de marque en sombre : le même dégradé, descendu d'un cran. Le motif ne change
       pas : le bleu plus sombre sous lui suffit à faire la différence. */
    --fond-haut: #02121c;
    --fond-bas:  #06324a;

    --theme-text-primary:   #e6edf3;
    --theme-text-secondary: #9aa4b1;
    --theme-text-muted:     #6b7280;

    /* Le bleu de marque pur sur fond sombre : 6,5:1 sur les panneaux, textes et liens lisibles. */
    --theme-accent:      #0eabdb;
    --accent-glow: rgba(14, 171, 219, 0.32);
    --theme-accent-soft: rgba(14, 171, 219, 0.16);
    --accent-soft-2: rgba(14, 171, 219, 0.30);

    --statut-valide:      #1c9c5d;
    --statut-valide-soft: rgba(28, 156, 93, 0.16);

    /* Violet éclairci pour rester lisible sur fond sombre. */
    --draft:      #a78bfa;
    --draft-soft: rgba(167, 139, 250, 0.16);

    --theme-border:  rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.04);

    --scrollbar-thumb:       rgba(255, 255, 255, 0.18);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.32);

    --shadow-sm: 0 1px 2px  rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.55);

    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa4b1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

    /* color-scheme: dark fait aussi dessiner à l'OS ses widgets natifs en sombre — c'est ce qui
       empêche la liste déroulante d'un <select> de s'ouvrir en blanc sur un thème sombre. */
    color-scheme: dark;
}

/* ---- Reset ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Le fond de marque est posé sur `body` SEUL, pas sur `html, body`. Tant que <html> n'a pas
   de fond, celui de <body> se propage au canevas et couvre toute la fenêtre, même sous une
   page plus courte que l'écran. Le poser sur les deux le peindrait deux fois.

   L'ordre des couches compte : la tapisserie est écrite en premier, donc elle passe AU-DESSUS
   du dégradé. `fixed` l'ancre à la fenêtre : un motif qui défile avec le contenu attire
   l'œil, et une tapisserie ne doit jamais le faire. */
body {
    background-color: var(--fond-haut);
    background-image: var(--fond-motif), var(--fond-degrade);
    background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

/* ---- Scrollbars ---- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}
*::-webkit-scrollbar          { width: 10px; height: 10px; }
*::-webkit-scrollbar-track    { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 8px;
    transition: background-color 0.15s ease;
}
*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: padding-box;
}
*::-webkit-scrollbar-corner   { background: transparent; }

/* ============================================================
   App shell
   ============================================================ */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.appbar {
    position: sticky;
    top: var(--bandeau-dev-hauteur);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 16px;
    /* Hauteur PLANCHER, pas fixe, et repli autorisé à toute largeur : la barre porte de deux à
       sept onglets et de deux à six contrôles selon les rôles, et il n'existe pas de largeur
       d'écran où toutes les combinaisons tiennent sur une rangée. Un point de rupture ne suffit
       donc pas — il déplace la coupure au lieu de la supprimer (le nôtre était à 640 px, alors
       qu'un administrateur demande ~1215 px : entre les deux, la fin de la barre était coupée).
       Tant que tout tient, rien ne se replie et l'aspect est inchangé. */
    flex-wrap: wrap;
    min-height: 56px;
    padding: 8px 24px;
    /* L'entête est posée SUR le bleu, pas sur une barre blanche. Elle n'est pas transparente
       pour autant : elle est collante (sticky) et la feuille claire défile dessous. À travers
       un fond vraiment transparent, on verrait passer le contenu. Le bleu à 78 %, plus le flou,
       donne l'effet voulu sans ce défaut. */
    background: color-mix(in srgb, var(--fond-haut) 78%, transparent);
    border-bottom: 1px solid var(--fond-trait);
    backdrop-filter: blur(20px);

    /* Avec le pied de page, c'est le seul endroit où le texte s'écrit sur le bleu. Au lieu de
       recolorer un à un les onglets, les icônes, les pastilles et le sélecteur d'usager (dont
       une partie du style vit dans le CSS isolé de MainLayout, inaccessible d'ici), on réécrit
       les JETONS pour cette sous-arborescence. Chaque descendant en hérite, y compris à travers
       le CSS isolé. */
    --text-primary:   var(--fond-encre);
    --text-secondary: var(--fond-encre-2);
    --text-muted:     var(--fond-encre-3);
    --accent:         var(--fond-encre);
    --accent-soft:    rgba(255, 255, 255, 0.18);
    --border:         rgba(255, 255, 255, 0.26);
    --bg-glass:       rgba(255, 255, 255, 0.10);
    --bg-glass-hover: rgba(255, 255, 255, 0.16);
}
/* ---- Surface au thème, dans une zone posée sur le bleu ----
   Tout ce qui a son PROPRE fond de thème (panneau, menu, champ) à l'intérieur de l'entête ou du
   pied de page porte cette classe : elle rend les jetons d'encre que .appbar / .footer ont
   réécrits en blanc. Sans elle : blanc sur blanc en thème clair (la cloche de notifications).
   ThemeContrasteTests vérifie qu'elle rétablit CHAQUE jeton réécrit, et que chaque surface
   opaque des composants de l'entête la porte. */
.surface-theme {
    --text-primary:   var(--theme-text-primary);
    --text-secondary: var(--theme-text-secondary);
    --text-muted:     var(--theme-text-muted);
    --accent:         var(--theme-accent);
    --accent-soft:    var(--theme-accent-soft);
    --border:         var(--theme-border);
    --bg-glass:       var(--theme-bg-glass);
    --bg-glass-hover: var(--theme-bg-glass-hover);
    color: var(--text-primary);
}

/* Le badge bleu du logo, posé sur le bleu de l'entête, se confondrait avec lui. Un liseré
   blanc discret le détache, sans toucher au dessin du logo. */
.appbar .brand-lockup .app-icon { border-radius: 8px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35); }
/* Les champs de l'entête (sélecteur d'usager) gardent leur fond de champ, clair ou sombre selon
   le thème : ils portent .surface-theme (plus haut), qui leur rend l'encre du thème. */
/* La pastille d'environnement est teintée pour une barre blanche : sur le bleu, l'ambre foncé
   disparaît. (Même chose pour les pastilles de rôle : voir après leurs couleurs, plus bas.) */
.appbar .appbar-badge.badge-dev { color: #fcd34d; background: rgba(252, 211, 77, 0.18); }
.appbar-leading,
.appbar-trailing { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Seuls les onglets s'étirent : ils absorbent l'espace libre et se centrent dedans, ce qui pousse
   les contrôles à droite — inchangé sur un écran large. Leur base `auto` (et non 0) est ce qui
   les fait descendre d'une rangée ENTIÈRE quand la place manque, au lieu d'être comprimés au
   ras d'un onglet. `justify-content` tient les contrôles à droite même seuls sur leur rangée.
   Pas d'`order` ici : il réordonnerait aussi l'affichage sur une seule rangée, où les onglets
   passeraient après les contrôles. */
.appbar-trailing { justify-content: flex-end; }
.appbar-center   { flex: 1 1 auto; min-width: 0; }

/* Menu de sections dans la barre d'app (Accueil · Organigramme). */
.section-nav { display: flex; align-items: center; justify-content: center; gap: 4px; }
.section-link {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-weight: 600; font-size: 13.5px; font-family: inherit;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.12s ease, background-color 0.12s ease;
}
.section-link:hover { color: var(--text-primary); background: var(--bg-glass-hover); }
.section-link.is-active { color: var(--accent); background: var(--accent-soft); }

/* Sélecteur d'utilisateur courant + badges de rôle (barre d'app + page Utilisateurs). */
.user-switcher { display: inline-flex; align-items: center; gap: 8px; }
.user-switcher .user-select { height: 32px; padding: 4px 8px; font-size: 12.5px; max-width: 160px; width: auto; }
.role-badge {
    display: inline-block;
    font-weight: 700; font-size: 9.5px; font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}
.role-badge.role-admin { color: #7c3aed; background: rgba(124, 58, 237, 0.14); }
.role-badge.role-reviewer { color: var(--statut-valide); background: var(--statut-valide-soft); }
.role-badge.role-timesheetuser { color: #2f6ff0; background: rgba(47, 111, 240, 0.14); }
/* Paie : ambre. Facturation : sarcelle — la dernière famille libre entre le violet (admin), le
   vert (réviseur), le bleu (saisie) et l'ambre (paie). Les cinq badges doivent rester
   distinguables d'un coup d'œil, et la classe vient de role.ToString() en minuscules : un rôle
   sans règle ici s'afficherait sans couleur. */
.role-badge.role-payroll { color: #b45309; background: rgba(180, 83, 9, 0.14); }
.role-badge.role-facturation { color: #0f766e; background: rgba(15, 118, 110, 0.14); }
/* Organigramme : rose — à l'écart des cinq familles déjà prises. */
.role-badge.role-organigramme { color: #be185d; background: rgba(190, 24, 93, 0.14); }
/* Rôles CRÉÉS (⚙ Configuration → Rôles → « Nouveau rôle ») : une seule couleur, ardoise, pour
   tous — leur nombre n'est pas borné, et la pastille dit « créé ici », pas « lequel ». */
.role-badge.role-cree { color: #475569; background: rgba(71, 85, 105, 0.14); }
[data-theme="dark"] .role-badge.role-admin { color: #c4b5fd; }
[data-theme="dark"] .role-badge.role-cree { color: #cbd5e1; }
[data-theme="dark"] .role-badge.role-timesheetuser { color: #93c5fd; }
[data-theme="dark"] .role-badge.role-payroll { color: #fcd34d; }
[data-theme="dark"] .role-badge.role-facturation { color: #5eead4; }
[data-theme="dark"] .role-badge.role-organigramme { color: #f9a8d4; }
/* Dans l'entête, la pastille de rôle est posée sur le bleu : le violet, le bleu et l'ambre
   foncés y disparaissent. Elle passe en encre claire. La règle vient APRÈS les couleurs de
   rôle et les surpasse d'un cran de spécificité, dans les deux thèmes. */
.appbar .user-switcher .role-badge { color: var(--fond-encre); background: rgba(255, 255, 255, 0.18); }
/* Cases à cocher des rôles (ligne d'édition de la grille Utilisateurs) : une par rôle, empilées. */
.role-checks { display: flex; flex-direction: column; gap: 4px; }

.paste-summary { cursor: pointer; font-weight: 600; color: var(--text-primary); }

/* ── Authentification (écran de connexion) ────────────────────────────────── */
/* ── Le bandeau DEV ─────────────────────────────────────────────────────────
   En tête de chaque page de chronos-dev (copie des données de production). Pleine largeur, une
   rayure de chantier dessous, et le texte se replie sur un téléphone plutôt que de déborder. */
/* Le bandeau DEV reste TOUJOURS visible (décision du 2026-10-26) : collé en haut de l'écran,
   indépendant du défilement. Tout ce qui colle sous lui (barre d'app, barres d'actions) se décale
   de sa hauteur : --bandeau-dev-hauteur vaut 0 hors Dev, une estimation dès qu'il existe
   (:has), puis sa vraie hauteur, mesurée par App.razor (il se replie sur un téléphone). */
:root { --bandeau-dev-hauteur: 0px; }
:root:has(.bandeau-dev) { --bandeau-dev-hauteur: 41px; }
@media (max-width: 640px) { :root:has(.bandeau-dev) { --bandeau-dev-hauteur: 78px; } }
.bandeau-dev {
    position: sticky;
    top: 0;
    z-index: 60;                    /* au-dessus de l'appbar (50) et de tout ce qui colle */
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 2px 14px;
    padding: 8px 16px 10px;
    background: var(--bandeau-dev-fond);
    color: var(--bandeau-dev-encre);
    border-bottom: 4px solid transparent;
    border-image: repeating-linear-gradient(-45deg,
        var(--bandeau-dev-encre) 0 10px, var(--bandeau-dev-rayure) 10px 20px) 4;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    overflow-wrap: anywhere;
}
.bandeau-dev-titre { font-weight: 700; letter-spacing: 0.01em; }
.bandeau-dev-phrase { font-weight: 500; }
@media (max-width: 640px) {
    .bandeau-dev { flex-direction: column; align-items: center; padding: 8px 12px 10px; }
}
/* Un document imprimé (facture, rapport, feuille) garde sa mise en page : la pastille Dev et ce
   bandeau sont des rappels d'écran. */
@media print { .bandeau-dev { display: none !important; } }

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
/* La carte de connexion flotte directement sur le bleu : pas de fond ici, celui de <body> se voit. */
.auth-card {
    width: 100%; max-width: 380px; background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-lg, 16px); box-shadow: var(--shadow-lg); padding: 32px 28px;
    display: flex; flex-direction: column; gap: 16px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-lockup-name { font-weight: 700; font-size: 18px; color: var(--text-primary); }
.auth-title { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 4px 0 0; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .form-field { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.auth-submit { width: 100%; justify-content: center; margin-top: 4px; }
.app-loading { min-height: 60vh; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.user-name-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.logout-form { display: inline-flex; margin: 0; }

/* ── Cloche de notifications (barre d'app) ────────────────────────────────── */
.notif-bell { position: relative; display: inline-flex; }
.notif-bell .btn-icon { position: relative; }
.notif-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 16px; height: 16px; padding: 0 4px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 9.5px; font-weight: 700; line-height: 1;
    color: #fff; background: #dc2626;
    border-radius: var(--radius-full);
}
.notif-panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
    width: 340px; max-height: 420px; overflow-y: auto;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-md, 12px); box-shadow: var(--shadow-lg);
    padding: 10px 0;
}
.notif-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 2px 14px 8px; border-bottom: 1px solid var(--border);
}
.notif-panel-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.notif-empty { margin: 10px 14px 4px; font-size: 12.5px; color: var(--text-muted); }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item {
    display: flex; flex-direction: column; gap: 2px; width: 100%;
    padding: 9px 14px; border: 0; background: none; cursor: pointer;
    text-align: left; font-family: inherit;
}
.notif-item:hover { background: var(--bg-glass-hover); }
.notif-item .notif-message { font-size: 12.5px; color: var(--text-secondary); }
.notif-item.is-unread .notif-message { font-weight: 600; color: var(--text-primary); }
.notif-item .notif-time { font-size: 11px; color: var(--text-muted); }
.notif-item.is-unread .notif-time::before {
    content: "●"; color: var(--accent); margin-right: 5px; font-size: 8px; vertical-align: 1px;
}

/* ── Éditeur de saisie des heures ─────────────────────────────────────────── */
.saisie-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.saisie-toolbar .tb-group { display: flex; align-items: center; gap: 8px; }
.tb-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.tb-emp { max-width: 220px; }
.tb-week { max-width: 160px; }
.tb-week-range { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-icon-sm {
    width: 30px; height: 30px; border: 1px solid var(--border); background: var(--bg-secondary);
    border-radius: var(--radius-sm); cursor: pointer; color: var(--text-primary); font-size: 15px;
}
.btn-icon-sm:hover:not(:disabled) { background: var(--bg-glass-hover); }
.btn-icon-sm:disabled { opacity: 0.4; cursor: default; }

.tb-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.tb-toggle-btn { padding: 5px 12px; font-size: 12px; font-weight: 600; background: var(--bg-secondary); color: var(--text-secondary); border: none; cursor: pointer; }
.tb-toggle-btn.on { background: var(--accent); color: #fff; }
.timer-on { background: var(--status-warning); }

.chips-card { display: flex; flex-direction: column; gap: 8px; }
.chips-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips-title { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-right: 4px; }
.proj-chip { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-full); overflow: hidden; }
.proj-chip.pinned { border-color: var(--accent); }
.chip-main { border: none; background: transparent; padding: 4px 10px; font: inherit; font-size: 12px; font-family: 'JetBrains Mono', monospace; color: var(--text-primary); cursor: pointer; }
.chip-main:hover { background: var(--bg-glass-hover); }
.chip-pin { border: none; background: transparent; padding: 4px 7px; cursor: pointer; font-size: 11px; color: var(--text-muted); }
.chip-pin:hover { color: var(--accent); }

/* Panneau « Mes projets habituels » : choix du jour + projets à cocher. */
/* Le choix des JOURS : une rangée de cases, une par jour de la semaine, suivie des deux
   raccourcis (« Lun–ven », « Aucun »). Elle s'enroule au lieu de déborder — sept jours et deux
   boutons ne tiennent pas sur un panneau étroit. */
.habits-day-pick { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
/* Chaque journée en colonne : son nom en haut, sa case centrée juste en dessous. */
.habits-jour { white-space: nowrap; flex-direction: column; align-items: center; gap: 3px; }
.habits-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 6px 18px; margin-bottom: 4px;
}
.habits-item { font-size: 13px; color: var(--text-primary); }
.habits-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Juste ce qu'il faut pour la poignée de déplacement — plus de case à cocher à loger. */
.saisie-grid .col-sel { width: 34px; text-align: center; white-space: nowrap; }
.saisie-grid .cell-projet-nom { color: var(--text-secondary); font-size: 13px; text-align: left; }
.cell-ro { color: var(--text-primary); font-size: 14px; }
/* Une valeur qui manque encore — elle doit se voir sans crier. */
.cell-manquant { color: var(--status-warning); font-weight: 600; }
.cell-ro-hours { font-weight: 600; }
/* 6px en vertical (et non 8) : la bande du jour porte maintenant les cases du pense-bête,
   dont le libellé au-dessus ajoute déjà de la hauteur. */
.saisie-grid .day-header td { background: var(--bg-tertiary); border-top: 1px solid var(--border); padding: 6px 12px; text-align: left; }
/* La flèche qui plie/déplie la journée : assez grosse pour qu'on la reconnaisse comme un triangle. */
.day-toggle { border: none; background: none; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 4px; vertical-align: middle; color: var(--text-primary); margin-right: 6px; }
.day-toggle:hover { color: var(--theme-accent); }

/* ── La journée dans laquelle on saisit ────────────────────────────────────
   Sept bandes de jour empilées se ressemblent, et « Entrée » ajoute sa ligne à CELLE où se
   trouve le curseur : sans repère, on ne savait pas laquelle allait grandir — on tapait
   Entrée en espérant.

   :focus-within plutôt qu'un état gardé côté serveur, pour deux raisons : le repère désigne
   alors exactement ce que le raccourci vise (le <tbody> qui contient le champ focalisé, celui
   dont le data-day part vers OnShortcut), et il s'allume sans aller-retour au serveur à chaque
   tabulation.

   Ce qui s'allume : la BANDE du jour, et un liseré à gauche des lignes. Jamais le fond des
   lignes — il appartient à la validation (row-error rouge, row-warn ambre, row-timer indigo),
   et deux vocabulaires sur la même surface ne se lisent plus. */
.saisie-grid tbody:focus-within .day-header > td {
    background: var(--accent-soft);
    border-top-color: var(--accent);
}
.saisie-grid tbody:focus-within .day-header strong { color: var(--accent); }
/* inset et non border-left : un liseré qui prend de la place décalerait toute la colonne
   d'une journée à l'autre, au rythme du focus. */
.saisie-grid tbody:focus-within > tr > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.saisie-grid tbody:focus-within .day-actif { display: inline-flex; }

.day-actif {
    display: none; /* montrée par le :focus-within ci-dessus, et nulle part ailleurs */
    align-items: center;
    margin-left: 10px; padding: 1px 9px;
    border-radius: var(--radius-full);
    background: var(--accent); color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
    white-space: nowrap;
}
.day-sub { color: var(--text-muted); font-size: 12px; margin-left: 12px; }
.day-dup { margin-left: 14px; font-size: 12px; }
.saisie-grid .cell-hours { width: 1%; white-space: nowrap; }
.saisie-grid .hours-wrap { display: flex; align-items: center; gap: 8px; justify-content: flex-start; }
.saisie-grid .hours-wrap .cell-heures-txt { flex: 0 0 50px; width: 50px; text-align: center; font-size: 15px; font-weight: 600; }
/* Ligne 1 : +,25 / +,5 / +1 (vert) · Ligne 2 : −,25 / −,5 / −1 (rouge), alignés en 3 colonnes. */
.saisie-grid .steppers { display: grid; grid-template-columns: repeat(3, auto); gap: 2px; flex: 0 0 auto; }
.steppers button {
    border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-secondary);
    border-radius: 5px; font-size: 10px; padding: 2px 5px; cursor: pointer; line-height: 1.2;
}
.steppers button:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
/* Boutons d'ajout (vert) / retrait (rouge) — couleurs statut du style guide. */
.steppers .step-plus  { border-color: #22c55e; color: #16a34a; }
.steppers .step-minus { border-color: #ef4444; color: #dc2626; }
[data-theme="dark"] .steppers .step-plus  { color: #4ade80; }
[data-theme="dark"] .steppers .step-minus { color: #f87171; }
.steppers .step-plus:hover  { background: rgba(34, 197, 94, 0.14);  border-color: #22c55e; color: #16a34a; }
.steppers .step-minus:hover { background: rgba(239, 68, 68, 0.12); border-color: #ef4444; color: #dc2626; }
[data-theme="dark"] .steppers .step-plus:hover  { color: #4ade80; }
[data-theme="dark"] .steppers .step-minus:hover { color: #f87171; }
.day-addrow { margin-left: 12px; }
/* Ligne de férié ou de vacances : heures, attribution et commentaire grisés — la journée vaut
   la journée normale, sans rien à coder ni à décrire. Le projet, lui, reste modifiable : c'est
   par lui qu'on sort de l'état congé. */
.saisie-grid .row-conge .input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background-color: var(--bg-tertiary);
}
.saisie-grid .row-conge .steppers button:disabled {
    cursor: not-allowed;
    opacity: 0.35;
    background: var(--bg-tertiary);
}

/* ── Pense-bête de la journée : AM · PM · SOIR ─────────────────────────────
   Des heures notées AVANT la ventilation par projet, pour s'en souvenir. Elles ne comptent
   jamais comme des heures saisies — d'où un vocabulaire visuel volontairement inverse de
   celui des vraies heures : trait POINTILLÉ au lieu du plein, gris au lieu du bleu d'accent,
   et pas de steppers ±,25. Le plein et la couleur restent aux chiffres qui comptent.

   L'en-tête du jour est coupé en deux cellules (voir Saisie.razor) : le groupe démarre donc
   sous « Nom du projet » et reste aligné d'une journée à l'autre. */
.saisie-grid .day-header-rappel { padding-left: 14px; }
.day-rappel { display: inline-flex; align-items: center; gap: 10px; }
.day-rappel-lead {
    font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--text-muted); cursor: help;
}
.rappel-box { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.rappel-label { font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; color: var(--text-muted); }
.rappel-input {
    width: 58px; padding: 3px 6px; text-align: center;
    font-family: inherit; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
    color: var(--text-primary); background: var(--bg-secondary);
    border: 1px dashed var(--text-muted); border-radius: 6px;
}
.rappel-input::placeholder { color: var(--text-muted); font-weight: 400; }
.rappel-input:focus {
    outline: none; border-style: solid; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.rappel-total {
    display: inline-block; padding: 1px 9px; border-radius: var(--radius-full);
    border: 1px dashed var(--text-muted); color: var(--text-secondary);
    font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
/* L'écart entre le pense-bête et ce qui est réellement ventilé — le seul rôle actif de ces
   trois cases. Ambre = il reste du temps à ventiler, jamais une erreur ni un blocage. */
.rappel-reste { margin-left: 10px; color: var(--status-warning); font-size: 12px; font-weight: 600; }
/* Et le rouge : les heures ventilées DÉPASSENT le pense-bête, les deux ne balancent pas. C'est la
   seule des trois teintes qui signale une contradiction plutôt qu'un travail en cours — et elle ne
   bloque toujours rien : le rappel informe, il n'est pas une consigne. */
.rappel-trop { margin-left: 10px; color: var(--status-danger); font-size: 12px; font-weight: 600; }
.rappel-ok { margin-left: 10px; color: var(--status-success); font-size: 12px; font-weight: 600; }
/* Feuille transmise : le rappel se lit encore, il ne s'édite plus. */
.rappel-ro { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.banner-with-action { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

/* Poignée de glisser-déposer : largeur triplée (~14px → 42px) et glyphe grossi (13 → 22px) pour
   une cible plus visible et plus facile à saisir. inline-block + centrage pour que le glyphe reste
   au milieu de la zone ; letter-spacing détendu (les deux points étaient écrasés à -3px). */
.drag-grip { display: inline-block; width: 42px; text-align: center; cursor: grab; color: var(--text-muted); user-select: none; font-size: 22px; letter-spacing: -1px; line-height: 1; margin-right: 4px; }
.drag-grip:active { cursor: grabbing; }
.saisie-grid tr.row-dragging td { opacity: 0.45; }

.saisie-grid tfoot .grid-total td { border-top: 2px solid var(--border); background: var(--bg-tertiary); padding: 10px 14px; }
.grid-total-label { text-align: right; font-weight: 600; color: var(--text-secondary); }
/* Pied de la grille de saisie : rappels de la semaine et reste à ventiler, à côté du total. */
.saisie-grid tfoot .grid-total td.grid-total-rappels { text-align: left; white-space: nowrap; }
.saisie-grid tfoot .grid-total-rappels .rappel-total { margin-left: 0; }
.proj-actif-toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.saisie-grid tfoot .grid-total-hours { text-align: center; font-weight: 700; font-size: 15px; color: var(--text-primary); }

/* Total d'une journée : sous-total repris en pied de chaque groupe de jour, plus une pastille dans
   l'en-tête du jour pour le lire même quand le jour est replié. */
.saisie-grid tr.day-total td { background: var(--bg-glass); border-top: 1px dashed var(--border); padding: 7px 12px; }
.saisie-grid tr.day-total .grid-total-label { font-size: 12.5px; }
.saisie-grid tr.day-total .grid-total-hours { text-align: center; font-weight: 700; font-size: 14px; color: var(--text-primary); }
.day-total-badge {
    display: inline-block; margin-left: 10px; padding: 1px 9px; border-radius: var(--radius-full);
    background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Attribution en saisie : listes déroulantes assez larges pour lire la catégorie complète. */
.saisie-grid .cell-attr { text-align: left; }
.saisie-grid .cell-attr-select { min-width: 190px; font-size: 12.5px; }
.cell-attr-na { color: var(--text-muted); }

/* ── Banque de temps ──────────────────────────────────────────────────────── */
.banque-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }
.banque-stat {
    display: flex; flex-direction: column; gap: 2px; min-width: 150px;
    padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--bg-secondary);
}
.banque-stat-strong { border-color: var(--accent); background: var(--accent-soft); }
.banque-label { font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-muted); }
.banque-value { font-size: 17px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.banque-value.neg { color: #dc2626; }
[data-theme="dark"] .banque-value.neg { color: #f87171; }
.banque-value .tag { margin-left: 6px; vertical-align: middle; }

.tpl-hint { font-size: 11.5px; color: var(--text-muted); }
.tpl-hint kbd {
    font-family: 'JetBrains Mono', monospace; font-size: 10.5px; background: var(--bg-tertiary);
    border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; color: var(--text-secondary);
}

/* Les raccourcis clavier de la grille de saisie. Ils vivaient en 11,5 px gris clair (.tpl-hint) :
   du texte que personne ne lisait, pour les gestes qui font la différence sur une feuille de vingt
   lignes. Un bandeau, donc — même fond et même bordure qu'une carte, pour qu'il se lise comme un
   élément de l'écran et non comme une note de bas de page. Délibérément SANS couleur d'accent ni
   d'alerte : c'est une aide, elle ne doit pas disputer l'attention à la grille. */
.saisie-raccourcis {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin: 0 0 2px; padding: 9px 14px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px; color: var(--text-secondary);
}
.saisie-raccourcis-lead { font-weight: 600; color: var(--text-primary); margin-right: 4px; }
.saisie-raccourcis-sep { color: var(--border); }
.saisie-raccourcis kbd {
    font-family: 'JetBrains Mono', monospace; font-size: 11.5px; background: var(--bg-tertiary);
    border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
    padding: 2px 6px; color: var(--text-primary);
}
.row-tools { white-space: nowrap; }
.tool-btn { border: none; background: none; cursor: pointer; font-size: 14px; padding: 2px 4px; color: var(--text-secondary); }
.tool-btn:hover { color: var(--accent); }
.tool-btn:disabled { opacity: 0.3; cursor: default; color: var(--text-secondary); }

/* Saisie — les outils de ligne (⧉ ✂️ ✕) restent collés au bord droit de la grille. Quand la
   fenêtre n'est pas en plein écran, la grille est plus large que la carte : la colonne des outils
   sortait de la vue, et la barre de défilement horizontale, tout en bas d'une semaine de lignes,
   ne se voyait pas. Même patron que la grille de Révision (.revision-entrees.avec-outils).
   Seules l'en-tête et les cellules d'outils collent : les bandes de jour et les totaux (colspan)
   défilent normalement. */
.saisie-grid thead th:last-child,
.saisie-grid tbody td.row-tools {
    position: sticky;
    right: 0;
    background: var(--bg-secondary);
    box-shadow: -1px 0 0 0 var(--border);
}
.saisie-grid thead th:last-child { z-index: 2; background: var(--bg-tertiary); }
/* La cellule collée est opaque (sinon les lignes défileraient dessous) : elle reprend la teinte
   de sa ligne signalée (erreur, avertissement, minuteur) par-dessus le fond de la carte. */
.saisie-grid tbody tr.row-error td.row-tools {
    background: linear-gradient(rgba(239, 68, 68, 0.09), rgba(239, 68, 68, 0.09)), var(--bg-secondary);
}
.saisie-grid tbody tr.row-warn td.row-tools {
    background: linear-gradient(rgba(245, 158, 11, 0.09), rgba(245, 158, 11, 0.09)), var(--bg-secondary);
}
.saisie-grid tbody tr.row-timer td.row-tools {
    background: linear-gradient(rgba(99, 102, 241, 0.10), rgba(99, 102, 241, 0.10)), var(--bg-secondary);
}
[data-theme="dark"] .saisie-grid tbody tr.row-error td.row-tools {
    background: linear-gradient(rgba(239, 68, 68, 0.16), rgba(239, 68, 68, 0.16)), var(--bg-secondary);
}
[data-theme="dark"] .saisie-grid tbody tr.row-warn td.row-tools {
    background: linear-gradient(rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.14)), var(--bg-secondary);
}
[data-theme="dark"] .saisie-grid tbody tr.row-timer td.row-tools {
    background: linear-gradient(rgba(99, 102, 241, 0.18), rgba(99, 102, 241, 0.18)), var(--bg-secondary);
}

/* ── Colonne « Ordre » (⚙ Configuration → Attributions générales) ──────────────
   Poignée à glisser, rang en pastille, chevrons discrets révélés au survol ou au
   focus clavier : le geste principal est le glisser, les chevrons font le pas à pas. */
.data-table td.cell-ordre { width: 1%; white-space: nowrap; }
.ordre-ctl { display: inline-flex; align-items: center; gap: 6px; }
.ordre-poignee {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 26px; border-radius: var(--radius-sm, 6px);
    color: var(--text-muted); cursor: grab; user-select: none; font-size: 16px; line-height: 1;
    transition: background-color .15s, color .15s;
}
.ordre-poignee:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.ordre-poignee:active { cursor: grabbing; }
.ordre-poignee.is-off { opacity: .35; cursor: not-allowed; }
.ordre-rang {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px;
    background: var(--accent-glow, rgba(14,116,144,.12)); color: var(--accent);
    font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.ordre-rang.is-hors { background: none; color: var(--text-muted); font-weight: 400; }
.ordre-pas {
    display: inline-flex; flex-direction: column; opacity: 0;
    transition: opacity .15s;
}
tr:hover .ordre-pas, .ordre-pas:focus-within { opacity: 1; }
.ordre-pas button {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 13px; padding: 0; border: 0; border-radius: 4px;
    background: none; color: var(--text-secondary); cursor: pointer;
}
.ordre-pas button:hover:not(:disabled) { background: var(--bg-glass-hover); color: var(--accent); }
.ordre-pas button:disabled { opacity: .25; cursor: default; }
.ordre-pas svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.data-table tbody tr.row-drop-target td { box-shadow: inset 0 2px 0 var(--accent); background: var(--accent-glow, rgba(14,116,144,.08)); }
.totals-bar {
    display: flex; align-items: center; gap: 14px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-md); padding: 11px 16px; box-shadow: var(--shadow-md);
}
.totals-text { font-size: 14px; white-space: nowrap; }
.totals-track { flex: 1; height: 8px; background: var(--bg-tertiary); border-radius: var(--radius-full); overflow: hidden; }
.totals-fill { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width 0.2s ease; }
.totals-bar.over .totals-fill { background: var(--status-warning); }
.totals-remaining { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }

/* Organigramme corporatif embarqué (visualisation autonome dans un iframe). */
.orgchart-frame {
    display: block;
    width: 100%;
    height: calc(100vh - 172px);
    min-height: 520px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.brand-lockup      { display: inline-flex; align-items: center; gap: 12px; }
.brand-lockup-name { font-weight: 600; font-size: 18px; font-family: inherit; letter-spacing: -0.015em; color: var(--text-primary); }
.app-icon { display: inline-block; flex-shrink: 0; }
.app-icon-md { width: 32px; height: 32px; }

.appbar-badge {
    font-weight: 500; font-size: 9.5px; font-family: inherit;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.6;
}
/* Pastille d'environnement (BadgeEnvironnement.razor) : Dev en ambre — de vraies données,
   pour essais — lisible dans les deux thèmes. Démo garde l'accent de .appbar-badge. */
.appbar-badge.badge-dev { color: #b45309; background: rgba(245, 158, 11, 0.16); }
[data-theme="dark"] .appbar-badge.badge-dev { color: #fbbf24; }

.status-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500; font-size: 11px; font-family: inherit;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.btn-icon:hover { background: var(--bg-glass-hover); color: var(--accent); }
/* Icône de la barre d'app dont la page est ouverte (ex. « Ma fiche ») : même teinte que les onglets actifs. */
.btn-icon.is-active { color: var(--accent); background: var(--accent-soft); }

/* ---- Mobile ----
   Sur petit écran, tout débordement horizontal fait « dézoomer » le navigateur, ce qui casse
   toute la mise en page (grilles qui repassent en 2 colonnes, champs coupés). On réduit donc le
   padding de la barre du haut et du contenu pour tout faire tenir dans la largeur de l'écran.

   Le REPLI de la barre, lui, ne vit plus ici : il vaut à toute largeur (voir `.appbar`). Ce bloc
   ne garde que ce qui relève de la TAILLE — marges, icônes et sélecteur resserrés, pour qu'un
   téléphone tienne en deux ou trois rangées plutôt qu'en cinq. */
@media (max-width: 640px) {
    .appbar { padding: 8px 14px; gap: 8px 10px; }
    .appbar-trailing { gap: 6px; }

    .btn-icon { width: 30px; height: 30px; }
    .user-switcher { gap: 6px; }
    .user-switcher .user-select { max-width: 116px; }

    /* La feuille garde une marge sur le bleu, plus étroite : sur un téléphone, chaque pixel
       de largeur sert au contenu. */
    .app-main { padding: 18px 14px; margin: 10px auto 14px; border-radius: var(--radius-md); }
}

.app-main {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    /* Utilise l'essentiel de la largeur de l'écran (≈ 95 % sur écran standard, plafonné sur
       très grand écran) au lieu de l'ancien 1320px qui laissait de larges marges vides. */
    max-width: min(2000px, 95vw);

    /* LA FEUILLE. Tout le contenu de l'application est posé dessus : c'est ce qui permet au
       fond d'être bleu sans qu'aucun écran ait à changer une couleur de texte. Les marges
       ne sont pas décoratives : sans elles, la feuille touche les bords et ne flotte plus,
       elle recouvre le fond. */
    margin: 20px auto 24px;
    padding: 28px 28px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

/* « Chargement… », rendu avant l'entête et la feuille, s'écrit directement sur le bleu. */
.app-loading { color: var(--fond-encre-2); }

/* ---- Impression et contraste renforcé ----
   La tapisserie est DÉCORATIVE : elle ne porte aucune information, donc elle part la première
   dès que la page doit se lire autrement. À l'impression, la feuille redevient une page, même
   si l'option « imprimer les arrière-plans » est cochée. */
@media print {
    body      { background: #fff; }
    .app-main { margin: 0; background: #fff; box-shadow: none; border-radius: 0; }
}
@media (prefers-contrast: more) {
    body { background-image: none; }
}

/* ---- Footer ---- */
/* Le pied de page est posé sur le bleu, sous la feuille : transparent, avec les mêmes jetons
   d'encre claire que l'entête (voir .appbar). */
.footer {
    background: none;
    border-top: 1px solid var(--fond-trait);
    font-size: 13px;

    --text-primary:   var(--fond-encre);
    --text-secondary: var(--fond-encre-2);
    --text-muted:     var(--fond-encre-3);
    color: var(--text-secondary);
}
.footer-minimal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
}
.footer-copy strong { color: var(--text-primary); font-weight: 600; }
.footer-meta { color: var(--text-muted); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
    .footer-minimal { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ============================================================
   Page
   ============================================================ */
.page { display: flex; flex-direction: column; gap: 20px; }

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.page-title    { font-weight: 600; font-size: 28px; font-family: inherit; letter-spacing: -0.02em; color: var(--text-primary); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---- Search ---- */
.search-field { position: relative; min-width: 280px; }
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: inline-flex;
    pointer-events: none;
}
.input.search-input { padding-left: 36px; }

.input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    /* IMPORTANT : hériter la police du body (Inter). Le raccourci « font: … inherit » est
       invalide et était ignoré → les <input>/<select> tombaient en Arial et les <textarea>
       en monospace. On déclare donc les propriétés séparément. */
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---- <select> : le navigateur en dessine une partie, comme <input type="file"> ----

   La BOÎTE FERMÉE obéit à .input depuis toujours. Ce qui restait natif, c'est la flèche (que
   le navigateur peint lui-même) et la LISTE OUVERTE (que dessine le système d'exploitation —
   d'où le surlignage bleu de Windows au milieu d'une interface bleue).

   La flèche se règle partout : appearance:none la supprime, et on remet la nôtre.
   La liste ouverte, elle, n'est stylable que depuis `appearance: base-select` (Chrome/Edge ;
   Firefox et Safari ne l'ont pas encore). D'où le @supports plus bas : amélioration
   progressive, jamais une condition de bon fonctionnement.

   ⚠️ Ne PAS remplacer <select> par un composant maison. On y perd la navigation au clavier,
   le sélecteur natif du mobile et le support des lecteurs d'écran — trois choses difficiles à
   refaire correctement, pour gagner une bordure. */
select.input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 34px;                 /* la place de notre chevron */
    background-image: var(--select-chevron);
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 15px 15px;
    cursor: pointer;
}
select.input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background-image: none;              /* désactivé : rien à dérouler, pas de chevron */
}

/* Chrome/Edge : la liste déroulante devient un élément de la page, donc enfin la nôtre.
   Partout ailleurs ce bloc est ignoré et la liste native — parfaitement fonctionnelle et
   accessible — reste en place. */
@supports (appearance: base-select) {
    select.input {
        appearance: base-select;
        /* On GARDE notre chevron en image de fond : le glyphe que le navigateur fournit dans
           ce mode est un triangle plein, qui jure avec le reste des icônes (traits fins). */
    }
    select.input::picker-icon { display: none; }

    select.input::picker(select) {
        appearance: base-select;
        margin-top: 4px;
        padding: 4px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--bg-elevated);
        box-shadow: var(--shadow-md);
    }
    select.input option {
        padding: 8px 10px;
        border-radius: 6px;
        font-size: 14px;
        color: var(--text-primary);
    }
    select.input option:hover { background: var(--bg-glass-hover); }
    select.input option:checked { background: var(--accent-soft); color: var(--accent); }
    /* La coche que le navigateur ajoute devant l'option choisie : superflue, on garde la
       couleur d'accent comme seule marque. */
    select.input option::checkmark { display: none; }
}

/* Les grilles et la barre d'app resserrent le padding des champs avec le raccourci
   `padding:` — plus spécifique, il écraserait la place réservée au chevron. On la
   re-réserve pour les <select> concernés. */
.user-switcher select.user-select,
.data-table td select.input,
.entry-table tbody td select.input { padding-right: 28px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: #ffffff;
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 6px 14px var(--accent-glow), 0 2px 4px rgba(0, 0, 0, 0.06); }
.btn-primary:active { transform: translateY(0); }
/* Sans cette règle, un bouton principal désactivé gardait l'air cliquable : « Émettre la facture »
   ne réagissait pas au clic, sans rien laisser voir. */
.btn-primary:disabled,
.btn-primary:disabled:hover { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 8px 16px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text-primary); }

/* « Relevés de paye » (Validation de la paie) : bouton en couleur et plus grand, pour qu'il ressorte
   à côté de « ↻ Actualiser » (demande FORGE-20261125-102134). */
.btn-primary.btn-releves {
    padding: 11px 22px;
    font-size: 15px;
    font-weight: 600;
}

/* Bouton « brouillon » — même poids visuel que btn-secondary (il ne doit pas concurrencer
   l'action principale « Envoyer pour révision »), mais teinté violet pour rattacher
   l'action au brouillon plutôt qu'à une validation. */
.btn-draft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 8px 16px;
    background: var(--draft-soft);
    color: var(--draft);
    border: 1px solid var(--draft);
    border-radius: var(--radius-sm);
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    transition: var(--transition);
}
.btn-draft:hover { background: var(--draft); color: #fff; }
.btn-draft:disabled { opacity: 0.45; cursor: default; background: var(--draft-soft); color: var(--draft); }

/* ============================================================
   List
   ============================================================ */
.list { list-style: none; padding: 0; margin: 0; }
.list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color 0.12s ease;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover      { background: var(--bg-glass-hover); }
.list-item-body  { flex: 1; min-width: 0; }
.list-item-title {
    font-weight: 600; font-size: 15px; font-family: inherit;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.list-item-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

.project-item-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.project-number {
    font: 600 11px 'JetBrains Mono', 'Fira Code', monospace;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

/* ============================================================
   Table
   ============================================================ */
.table-scroll {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: auto;              /* scrolls horizontally and vertically as needed */
    max-height: 640px;
}
.table {
    width: 100%;
    min-width: 720px;            /* keep columns readable; the wrapper scrolls when narrower */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    table-layout: fixed;
}
.table thead th {
    position: sticky;            /* header stays put while the rows scroll */
    top: 0;
    z-index: 1;
    background: var(--bg-tertiary);
    text-align: left;
    padding: 11px 14px;
    font-weight: 500;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
/* Clickable, sortable column headers — styled to read like the header label itself.
   Shared by the projects list (.table) and every detail table (.data-table). */
.table thead th .th-sort,
.data-table thead th .th-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}
.table thead th .th-sort:hover,
.data-table thead th .th-sort:hover { color: var(--text-primary); }
.table thead th .th-sort:focus-visible,
.data-table thead th .th-sort:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}
.table thead th:not([aria-sort="none"]) .th-sort,
.data-table thead th:not([aria-sort="none"]) .th-sort { color: var(--text-primary); }
.sort-arrow {
    font-size: 10px;
    line-height: 1;
    opacity: 0.4;
    transition: opacity 0.15s ease, color 0.15s ease;
}
.sort-arrow.is-active {
    opacity: 1;
    color: var(--accent);
}
.table tbody td {
    padding: 12px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover         { background: var(--bg-glass-hover); }

/* Column widths — applied to header and body so the two aligned tables match.
   Every column (including Projet, col 2) gets a width so none collapses to 0 when
   the table is narrow; table-layout:fixed then shrinks them proportionally. */
.table th:nth-child(1), .table td:nth-child(1) { width: 130px; }
.table th:nth-child(2), .table td:nth-child(2) { width: 260px; }
.table th:nth-child(3), .table td:nth-child(3) { width: 190px; }
.table th:nth-child(4), .table td:nth-child(4) { width: 160px; }
.table th:nth-child(5), .table td:nth-child(5) { width: 120px; }
.table th:nth-child(6), .table td:nth-child(6) { width: 130px; }

.cell-number {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    white-space: nowrap;
}
.cell-title {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cell-sub {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cell-action { text-align: right; white-space: nowrap; }
.btn-row { padding: 6px 12px; }
/* Troncature « … » générique pour les colonnes texte (Contact, Emplacement) afin que
   les valeurs longues n'augmentent pas la hauteur des lignes — la valeur complète reste
   visible au survol via l'attribut title. */
.cell-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Pagination
   ============================================================ */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.table-footer-info { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.pagination { display: inline-flex; align-items: center; gap: 4px; }
.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pagination-btn:hover:not(:disabled):not(.active) {
    border-color: var(--border);
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}
.pagination-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    cursor: default;
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-ellipsis { color: var(--text-muted); padding: 0 6px; user-select: none; }

/* ============================================================
   Tags
   ============================================================ */
.tag {
    display: inline-block;
    padding: 3px 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-full);
    white-space: nowrap;
}
.tag.tag-success { color: #22c55e; background: rgba(34, 197, 94, 0.14); }
.tag.tag-info    { color: var(--text-secondary); background: var(--bg-tertiary); }   /* jeton, pas #6b7084 : en sombre, le gris figé tombait à 3:1 sur --bg-tertiary */
.tag.warn        { color: #b45309; background: rgba(245, 158, 11, 0.16); }
.tag.error       { color: #b91c1c; background: rgba(239, 68, 68, 0.14); }
/* Brouillon — violet : ni validé ni transmis, à ne pas confondre avec « Révisée » (bleu). */
.tag.tag-draft   { color: var(--draft); background: var(--draft-soft); }
/* Révisée — bleu : le réviseur a fait son travail, mais rien n'est encore validé. Le vert
   (`tag-success`) appartient à « Validée paie », le dernier feu vert avant la clôture ; les deux
   étapes se suivent, elles ne peuvent donc pas partager une teinte. Même bleu que `cat-color-2`
   du nuancier des catégories : les deux ne se croisent jamais sur un même axe de lecture. */
.tag.tag-review  { color: #2563eb; background: rgba(37, 99, 235, 0.14); }
[data-theme="dark"] .tag.tag-review { color: #93c5fd; }
/* Archives — historique clos repris d'Excel : gris neutre, volontairement discret. */
.tag.tag-archived { color: #6b7280; background: rgba(107, 114, 128, 0.14); }
[data-theme="dark"] .tag.tag-archived { color: #9ca3af; background: rgba(156, 163, 175, 0.16); }
/* Tag portant une icône de tête (ex. projet inactif) — aligne le glyphe sur le texte. */
.tag.tag-with-ico { display: inline-flex; align-items: center; gap: 4px; }
.tag .tag-ico { flex-shrink: 0; }
[data-theme="dark"] .tag.warn  { color: #fbbf24; }
[data-theme="dark"] .tag.error { color: #f87171; }

/* ── Nuancier des catégories d'employé ──────────────────────────────────────
   Huit teintes attribuées à l'acronyme par `EmployeeCategoryRules.CouleurClasse`
   (condensé stable → même catégorie, même couleur partout et à chaque démarrage).
   Elles sont DISTINCTIVES, pas sémantiques : contrairement à vert/ambre/rouge
   ailleurs dans l'app, la teinte ne dit rien de bon ou de mauvais — elle sert
   uniquement à repérer une catégorie sans lire chaque ligne.

   ⚠ AUCUN ROUGE dans ce nuancier, et ce n'est pas un choix esthétique : dans le
   reste de l'app le rouge signale une erreur (ligne bloquante, tag `error`,
   suppression). Une catégorie teintée en rouge — PROF l'a été — se lisait comme
   un employé en défaut. Rose et corail sont écartés pour la même raison : de
   loin, ils sont du rouge. Toute teinte ajoutée ici doit passer le même test. */
.tag.cat-color-1 { color: #7c3aed; background: rgba(124, 58, 237, 0.14); }  /* violet */
.tag.cat-color-2 { color: #2563eb; background: rgba(37, 99, 235, 0.14); }   /* bleu */
.tag.cat-color-3 { color: #0d9488; background: rgba(13, 148, 136, 0.16); }  /* sarcelle */
.tag.cat-color-4 { color: #a16207; background: rgba(161, 98, 7, 0.16); }    /* ocre */
.tag.cat-color-5 { color: #4338ca; background: rgba(67, 56, 202, 0.14); }   /* indigo */
.tag.cat-color-6 { color: #a21caf; background: rgba(162, 28, 175, 0.13); }  /* magenta */
.tag.cat-color-7 { color: #0369a1; background: rgba(3, 105, 161, 0.14); }   /* cyan */
.tag.cat-color-8 { color: #4d7c0f; background: rgba(77, 124, 15, 0.16); }   /* olive */
/* En thème sombre, seules les teintes de TEXTE sont éclaircies : les fonds translucides
   restent lisibles tels quels sur le fond sombre. */
[data-theme="dark"] .tag.cat-color-1 { color: #c4b5fd; }
[data-theme="dark"] .tag.cat-color-2 { color: #93c5fd; }
[data-theme="dark"] .tag.cat-color-3 { color: #5eead4; }
[data-theme="dark"] .tag.cat-color-4 { color: #fcd34d; }
[data-theme="dark"] .tag.cat-color-5 { color: #a5b4fc; }
[data-theme="dark"] .tag.cat-color-6 { color: #f0abfc; }
[data-theme="dark"] .tag.cat-color-7 { color: #7dd3fc; }
[data-theme="dark"] .tag.cat-color-8 { color: #bef264; }

/* ============================================================
   Cards / details
   ============================================================ */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.detail-description { font-size: 15px; line-height: 1.6; color: var(--text-primary); }

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.breadcrumbs a { color: var(--text-secondary); transition: color 0.12s ease; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs-sep { color: var(--border); }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.detail-field {
    background: var(--bg-secondary);
    padding: 14px 18px;
}
.detail-field dt {
    font-weight: 500; font-size: 11px; font-family: inherit;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.detail-field dd {
    font-weight: 500; font-size: 14px; font-family: inherit;
    color: var(--text-primary);
    /* Les valeurs longues sans espaces (courriel, URL, adresse) se replient dans la
       case au lieu de déborder horizontalement. */
    overflow-wrap: anywhere;
}
.detail-field dd a { color: var(--accent); text-decoration: none; }
.detail-field dd a:hover { text-decoration: underline; }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 48px 24px;
    color: var(--text-secondary);
}
.empty-state-icon {
    width: 72px;
    height: 72px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 4px;
}
.empty-state-title { font-weight: 600; font-size: 17px; font-family: inherit; color: var(--text-primary); letter-spacing: -0.01em; }
.empty-state-body  { font-size: 13.5px; line-height: 1.55; max-width: 360px; color: var(--text-muted); margin-bottom: 8px; }

/* ---- Blazor error UI ---- */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 12px 24px;
    background: #fef2f2;
    color: #b91c1c;
    border-top: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 13px;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

@media (max-width: 600px) {
    .page-header { flex-direction: column; align-items: stretch; }
    .search-field { min-width: 0; width: 100%; }
    .list-item { flex-direction: column; align-items: stretch; }
}

/* ============================================================
   Project detail — tabs, KPIs, people, data tables
   ============================================================ */
.section-title {
    font-weight: 600; font-size: 16px; font-family: inherit;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 26px 0 12px;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    /* Espace sous les onglets réduit (au-dessus des barres d'outils) — interface plus compacte. */
    margin: 16px 0 12px;
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 10px 14px;
    font-weight: 500; font-size: 14px; font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.tab:hover { color: var(--text-primary); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-muted);
}
.tab.is-active .tab-count { background: var(--accent-soft); color: var(--accent); }

/* ---- KPI cards ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 6px;
}
.kpi-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
}
.kpi-label { font-weight: 500; font-size: 11px; font-family: inherit; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.kpi-value { font-weight: 600; font-size: 22px; font-family: inherit; letter-spacing: -0.02em; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.kpi-value.neg { color: #dc2626; }
[data-theme="dark"] .kpi-value.neg { color: #f87171; }
.kpi-sub { font-size: 12px; color: var(--text-muted); }

/* ---- People ---- */
.person-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.person-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}
.person-role { font-weight: 500; font-size: 11px; font-family: inherit; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.person-name { font-weight: 600; font-size: 15px; font-family: inherit; color: var(--text-primary); margin-bottom: 3px; }
.person-line { font-size: 13px; color: var(--text-secondary); }
a.person-line:hover { color: var(--accent); }
.person-line.muted, .muted { color: var(--text-muted); }

/* ---- Data tables (budget, transactions, orders, reports, rates) ---- */
.data-scroll {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: auto;
}
/* Les longues tables utilisent ~toute la hauteur d'écran restante (au lieu d'un plafond fixe à 560px)
   pour voir beaucoup plus de lignes sans rogner l'en-tête de page. Plancher pour les petits écrans. */
.data-scroll.tall { max-height: calc(100vh - 240px); min-height: 360px; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}
.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--bg-tertiary);
    text-align: center;
    padding: 10px 14px;
    font-weight: 600; font-size: 11px; font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
/* Valeurs centrées dans toutes les grilles (les cellules d'action restent à droite). */
.data-table tbody td {
    padding: 9px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: center;
}
.data-table td.cell-action { text-align: right; }
.data-table thead th .th-sort { justify-content: center; }
.data-table tbody tr:hover { background: var(--bg-glass-hover); }

/* Lignes signalées par le validateur : fond teinté selon la sévérité. L'erreur (bloquante)
   prime sur l'avertissement. Un liseré gauche renforce le repère sans nuire à la lisibilité. */
.data-table tbody tr.row-error {
    background: rgba(239, 68, 68, 0.09);
    box-shadow: inset 3px 0 0 0 #ef4444;
}
.data-table tbody tr.row-error:hover { background: rgba(239, 68, 68, 0.15); }
.data-table tbody tr.row-warn {
    background: rgba(245, 158, 11, 0.09);
    box-shadow: inset 3px 0 0 0 #f59e0b;
}
.data-table tbody tr.row-warn:hover { background: rgba(245, 158, 11, 0.15); }
[data-theme="dark"] .data-table tbody tr.row-error { background: rgba(239, 68, 68, 0.16); }
[data-theme="dark"] .data-table tbody tr.row-error:hover { background: rgba(239, 68, 68, 0.24); }
[data-theme="dark"] .data-table tbody tr.row-warn { background: rgba(245, 158, 11, 0.14); }
[data-theme="dark"] .data-table tbody tr.row-warn:hover { background: rgba(245, 158, 11, 0.22); }
/* Ligne passée ou déjà acquise (férié écoulé, proposition déjà au calendrier) : lisible, mais en retrait. */
.data-table tbody tr.row-muted td { color: var(--text-muted); }

/* Ligne créée par le minuteur : surbrillance indigo — une couleur à elle, distincte du rouge
   (erreur) et de l'ambre (avertissement), pour la retrouver et lui donner son projet. Le liseré
   reste visible même quand l'état de validation (row-error/row-warn) colore déjà le fond. */
.data-table tbody tr.row-timer {
    background: rgba(99, 102, 241, 0.10);
    box-shadow: inset 3px 0 0 0 #6366f1;
}
.data-table tbody tr.row-timer:hover { background: rgba(99, 102, 241, 0.16); }
[data-theme="dark"] .data-table tbody tr.row-timer { background: rgba(99, 102, 241, 0.18); }
[data-theme="dark"] .data-table tbody tr.row-timer:hover { background: rgba(99, 102, 241, 0.26); }

/* Marqueur "attribution proposée automatiquement" (mots-clés) — à valider par le réviseur. */
.attr-auto-wrap { display: flex; flex-direction: column; gap: 4px; }
.tag.tag-auto {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.14);
    align-self: flex-start;
}
[data-theme="dark"] .tag.tag-auto { color: #c4b5fd; }
.input.is-auto { border-color: #a78bfa; box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.14); }

/* Champ exigé et vide. Le même ambre que la ligne en alerte (.row-warn) et que la pastille
   « à relire » : le vocabulaire de couleur de la grille ne se dédouble pas pour une règle de plus.
   Ambre et non rouge — c'est une case à remplir, pas une saisie impossible. */
.input.is-missing { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16); }
[data-theme="dark"] .input.is-missing { border-color: #fbbf24; }

/* L'astérisque d'un en-tête de colonne obligatoire. En <abbr> plutôt qu'un simple caractère :
   l'infobulle porte la dispense (férié, vacances, reprise), qui ne tient pas dans un titre. */
th .req {
    color: #b45309;
    font-weight: 700;
    text-decoration: none;
    cursor: help;
    margin-left: 2px;
}
[data-theme="dark"] th .req { color: #fbbf24; }

/* Les trois niveaux de confiance de la proposition automatique. Ils sont CALIBRÉS sur l'exactitude
   réellement observée en validation croisée (fort 97 %, moyen 72 %, faible 43 %) : la couleur dit
   où porter son attention, elle n'est pas décorative. Violet = sûr (le ton « auto » d'origine),
   ambre = à relire, rouge = à vérifier — le même vocabulaire que les lignes en alerte. */
.tag.tag-auto-moyen  { color: #b45309; background: rgba(245, 158, 11, 0.16); }
.tag.tag-auto-faible { color: #b91c1c; background: rgba(239, 68, 68, 0.14); }
[data-theme="dark"] .tag.tag-auto-moyen  { color: #fbbf24; }
[data-theme="dark"] .tag.tag-auto-faible { color: #f87171; }

/* Attribution corrigée à la main contre une proposition du système : neutre et discrète — il n'y a
   plus rien à valider, mais la ligne reste identifiable (et mesurable) comme une correction. */
.tag.tag-corrige { color: #6b7280; background: rgba(107, 114, 128, 0.14); align-self: flex-start; }
[data-theme="dark"] .tag.tag-corrige { color: #9ca3af; background: rgba(156, 163, 175, 0.16); }

/* Attribution IMPOSÉE par une exception de projet (⚙ Configuration → Attributions). Sarcelle, et
   non le violet des propositions : ce n'est pas une suggestion à valider mais une règle décidée.
   La cellule de saisie n'affiche alors plus de menu — une valeur qu'on ne peut pas changer ne se
   présente pas comme un choix (voir Saisie.razor). */
.tag.tag-forcee { color: #0d9488; background: rgba(13, 148, 136, 0.16); align-self: flex-start; }
[data-theme="dark"] .tag.tag-forcee { color: #5eead4; background: rgba(45, 212, 191, 0.18); }

/* ── Onglets de la page Configuration ─────────────────────────────────────── */
/* Navigation de la configuration : une barre LATÉRALE groupée. Onze écrans ne
   tiennent pas sur une rangée d'onglets — elle passait à la ligne, et le trait de
   sélection se retrouvait sous la mauvaise. Les groupes portent en plus le sens :
   on cherche « Clients » sous Facturation, pas dans une liste de onze mots. */
.config-layout {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.config-nav {
    display: grid;
    gap: 18px;
    position: sticky;
    top: calc(76px + var(--bandeau-dev-hauteur));   /* 56 px de barre d'app collante + une respiration (+ le bandeau DEV) */
}
.config-nav-group { display: grid; gap: 2px; }
.config-nav-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 10px 6px;
}
.config-nav-item {
    appearance: none;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    padding: 8px 12px;
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: color 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}
.config-nav-item:hover { color: var(--text-primary); background: var(--bg-glass-hover); }
.config-nav-item.is-active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--bg-glass-hover);
}

/* Le panneau ne doit jamais pousser la grille : les tableaux larges défilent chez eux. */
.config-panel { min-width: 0; }

/* Sous 900 px la barre repasse au-dessus du contenu, en rangée défilante — mieux
   qu'une colonne de 232 px qui mangerait la moitié d'un écran de portable. */
@media (max-width: 900px) {
    .config-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .config-nav {
        position: static;
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        gap: 20px;
        overflow-x: auto;
        padding-bottom: 6px;
        border-bottom: 1px solid var(--border);
    }
    .config-nav-group { grid-auto-flow: column; grid-auto-columns: max-content; gap: 4px; align-items: center; }
    .config-nav-title { padding: 0 6px 0 0; }
    .config-nav-item { border-left: none; border-bottom: 2px solid transparent; border-radius: var(--radius-sm); white-space: nowrap; }
    .config-nav-item.is-active { border-left-color: transparent; border-bottom-color: var(--accent); }
}

/* ---- Sous-onglets d'un écran de configuration (onglet Projets) ----
   Un contrôle segmenté : une piste grise, la section active posée dessus comme une carte.
   Distinct de .tabs (soulignés) pour qu'on ne le confonde pas avec la barre de gauche. */
.seg-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    max-width: 100%;
}
.seg-tab {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}
.seg-tab:hover { color: var(--text-primary); }
.seg-tab.is-active {
    background: var(--bg-secondary);
    color: var(--accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border);
}
.seg-count {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    background: var(--bg-glass-hover);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.seg-tab.is-active .seg-count { background: var(--accent-soft); color: var(--accent); }
.seg-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.seg-dot.is-ok { background: var(--status-success); }

/* ---- Onglets par type de projet, au-dessus de la grille ----
   Des pastilles qui passent à la ligne plutôt que de défiler : un type caché hors champ
   est un type qu'on ne trouve pas, et une douzaine tient sur deux rangées. */
.type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 0 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.type-tab {
    appearance: none;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}
.type-tab:hover { color: var(--text-primary); border-color: var(--accent-soft-2); }
.type-tab.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.type-tab-count {
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.type-tab.is-active .type-tab-count { background: var(--accent); color: #fff; }
/* Un type sans projet visible reste cliquable (on veut pouvoir le constater), mais s'efface. */
.type-tab.is-empty:not(.is-active) { opacity: 0.55; }

/* ---- Barre d'outils d'une grille : case à gauche, « Trier par » à droite ---- */
.grid-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin: 10px 0 4px;
}
.sort-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.sort-control label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.sort-control select.input { width: auto; min-width: 160px; padding-top: 6px; padding-bottom: 6px; }
.sort-direction { font-variant-numeric: tabular-nums; min-width: 72px; }
/* Sur un téléphone, les quatre sous-onglets en 2 × 2 : la rangée cassait au hasard. */
@media (max-width: 600px) {
    .seg-tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .seg-tab { justify-content: center; white-space: normal; text-align: center; }
    .sort-control { margin-left: 0; }
}
/* Lien discret dans une cellule (le compteur de projets d'un type mène à son onglet). */
.cell-link { font-variant-numeric: tabular-nums; }

.config-check { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.config-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.config-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.config-inline .input { max-width: 140px; }

/* ── Test de connexion Monday / débogage ──────────────────────────────────── */
.debug-exchange {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
}
.debug-exchange-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.debug-meta { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.debug-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); margin: 8px 0 3px; }
.debug-pre {
    margin: 0;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 320px;
    overflow: auto;
}

/* Attribution désactivée : ligne estompée dans le tableau de configuration. */
.data-table tbody tr.row-inactive td:not(.cell-action) { opacity: 0.5; }

/* ── Grille de taux (⚙ Configuration → Facturation) ──────────────────────────
   Toutes les cases sont saisissables ; c'est la COULEUR qui porte la lecture de l'écran :
   gris = hérité du taux de base (rien n'est stocké), foncé et gras = exception enregistrée.
   Sans cette distinction, 84 cases remplies de chiffres ne diraient pas lesquelles ont été
   décidées — et on changerait un taux de base en croyant changer le taux facturé. */
.taux-cell { width: 74px; padding-left: 8px; padding-right: 8px; font-variant-numeric: tabular-nums; }
.taux-herite { color: var(--text-muted); }
.taux-exception { color: var(--text-primary); font-weight: 700; border-color: var(--accent-glow); }
.data-table tbody tr.taux-base-row td { color: var(--text-muted); font-size: 12px; }

/* La majoration d'un type et son affichage, au bout de sa ligne : un filet les sépare des taux.
   Neuf colonnes de plus que de catégories : on resserre les marges pour tenir sans défiler. */
.data-table.grille-taux thead th,
.data-table.grille-taux tbody td { padding-left: 8px; padding-right: 8px; }
.data-table .majoration-col { border-left: 1px solid var(--border); }
.affichage-majoration { width: 112px; padding-top: 4px; padding-bottom: 4px; }
/* Sous une case : le pourcentage que son taux représente par rapport au taux de base. */
.taux-ecart {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-glow);
}
.data-table td .taux-ecart { display: block; width: fit-content; margin: 3px auto 0; }
.taux-ecart-baisse { color: var(--text-muted); background: var(--bg-tertiary); }
/* Taux calculé par la majoration de la ligne : lisible, pas modifiable. */
.taux-calcule { color: var(--text-secondary); font-style: italic; }
input.taux-calcule:disabled { opacity: 1; background: var(--bg-tertiary); cursor: not-allowed; }
.data-table tfoot td {
    position: sticky;
    bottom: 0;
    background: var(--bg-tertiary);
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-primary);
    border-top: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.data-table .num { text-align: center; font-variant-numeric: tabular-nums; }
/* Police des nombres agrandie dans le corps et le pied des grilles (pas dans l'en-tête). */
.data-table td.num { font-size: 15px; font-weight: 600; }
/* Texte justifié à gauche dans une grille aux valeurs centrées : une description se lit depuis
   son début, et des débuts de ligne alignés se parcourent d'un coup d'œil. */
.data-table td.cell-left { text-align: left; white-space: normal; }

/* Révision — « Sommaire par projet » : grille resserrée. Quatre colonnes courtes n'ont pas à
   s'étirer sur toute la carte ; les heures viennent juste après le projet, et la description,
   justifiée à gauche, prend le reste. Le tableau est agrandi de 30 % (polices et espacements
   ×1,3) pour se lire plus aisément. */
.sommaire-projets .data-scroll { width: fit-content; max-width: 100%; }
.sommaire-projets .data-table { width: auto; font-size: 17px; }
.sommaire-projets .data-table thead th { padding: 9px 13px; font-size: 14px; }
.sommaire-projets .data-table tbody td { padding: 6.5px 13px; }
.sommaire-projets .data-table td.num { font-size: 17.5px; }
.sommaire-projets .data-table .mono { font-size: 15.5px; }
.sommaire-projets .data-table .sort-arrow { font-size: 13px; }
.sommaire-projets .data-table thead th:nth-child(n+3) { text-align: left; }
.sommaire-projets .data-table thead th:nth-child(n+3) .th-sort { justify-content: flex-start; }

.data-table .mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; color: var(--text-secondary); }
/* Colonne Commentaire : largeur plafonnée + retour à la ligne, pour garder toute la grille
   visible sans défilement horizontal excessif. */
.data-table td.cell-comment {
    max-width: 380px;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Champs d'édition en ligne dans la grille des entrées (édition directe cellule par cellule). */
.data-table td .input {
    padding: 5px 8px;
    font-size: 13px;
    color: var(--text-primary);
    width: 100%;
    min-width: 0;
}

/* Cellule en cours d'édition : toute la cellule s'illumine (liseré accent + fond doux) pour
   repérer d'un coup d'œil où l'on saisit — le liseré de la cellule fait office de contour. */
.data-table tbody td:has(.input):focus-within,
.entry-table tbody td:has(.input):focus-within {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 2px var(--accent);
}
/* Le contour est porté par la cellule : on neutralise l'anneau propre du champ dans la grille
   pour éviter un double anneau (le champ garde son bord accent via .input:focus).
   Repli sans :has() → le champ garde simplement son bord accent, sans surbrillance de cellule. */
.data-table td .input:focus,
.entry-table td .input:focus {
    box-shadow: none;
}
.data-table .cell-date { width: 150px; }
/* Colonnes d'attribution (saisie et révision) : largeur bornée. Sans borne, un libellé long
   (« Réfection des façades 20-55 #15103 (2012-039) ») débordait du menu et passait
   sous les outils de ligne. Le menu garde une largeur plancher et écourte sa valeur
   (« … ») ; l'infobulle la donne en entier. */
.data-table td.cell-attribution { text-align: left; width: 220px; max-width: 220px; }
.data-table td.cell-attribution-specifique { width: 300px; max-width: 300px; }
.data-table td.cell-attribution select.input {
    min-width: 180px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.data-table td.cell-attribution-specifique select.input { min-width: 220px; }
.data-table td.cell-attribution .attr-auto-wrap { min-width: 0; }
/* Valeur affichée en texte (lecture seule, attribution imposée) : elle passe à la ligne
   plutôt que de sortir de la colonne bornée. */
.data-table td.cell-attribution .cell-ro { white-space: normal; overflow-wrap: break-word; }
/* Champ projet élargi (118 → 230px) : le numéro tapé reste lisible en entier. À la saisie,
   c'est le conteneur d'un champ de référence (.reference-field.is-compact), dont la liste
   s'élargit d'elle-même pour montrer numéro, description et client.
   ⚠ Le sélecteur doit être AU MOINS aussi spécifique que `.data-table td .input` (width: 100%,
   min-width: 0) plus haut, sinon la largeur est écrasée et la colonne reste étroite. */
.data-table .cell-projet,
.data-table td .input.cell-projet {
    width: 230px;
    min-width: 200px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
}
.data-table td.num .cell-heures { width: 74px; text-align: center; font-size: 15px; font-weight: 600; }
/* Révision — grille des entrées : elle doit TENIR dans la page. Sur un écran courant, la somme
   des largeurs (projet 230, commentaire 300, attributions 220 + 300…) dépassait la carte et
   repoussait les outils de ligne (⧉ ✂️ ✕) hors de vue. On resserre : jour abrégé (L, Ma, Me…), projet,
   description, client et attributions plus étroits (le texte passe à la ligne). Filet de
   sécurité : la colonne des outils reste collée au bord droit même si la grille défile. */
.revision-entrees .data-table thead th { padding: 10px 8px; }
.revision-entrees .data-table tbody td { padding: 7px 8px; }
.revision-entrees .data-table td.cell-jour { width: 30px; font-weight: 600; }
.revision-entrees .data-table .cell-date { width: 128px; }
.revision-entrees .data-table .cell-projet { width: 150px; min-width: 130px; }
.revision-entrees .data-table tbody td:nth-child(4),
.revision-entrees .data-table tbody td:nth-child(5) {
    min-width: 120px;
    max-width: 170px;
    white-space: normal;
    overflow-wrap: break-word;
}
.revision-entrees .comment-field { min-width: 200px; }
.revision-entrees .data-table td.cell-comment { max-width: 280px; }
.revision-entrees .data-table td.cell-attribution { width: 170px; max-width: 170px; }
.revision-entrees .data-table td.cell-attribution select.input { min-width: 140px; }
.revision-entrees .data-table td.cell-attribution-specifique { width: 200px; max-width: 200px; }
.revision-entrees .data-table td.cell-attribution-specifique select.input { min-width: 160px; }
.revision-entrees.avec-outils .data-table thead th:last-child,
.revision-entrees.avec-outils .data-table tbody td:last-child {
    position: sticky;
    right: 0;
    background: var(--bg-secondary);
    box-shadow: -1px 0 0 0 var(--border);
}
.revision-entrees.avec-outils .data-table thead th:last-child { z-index: 2; background: var(--bg-tertiary); }
/* La cellule collée est opaque (sinon les lignes défileraient dessous) : elle reprend la teinte
   de sa ligne signalée par-dessus le fond de la carte. */
.revision-entrees.avec-outils .data-table tbody tr.row-error td:last-child {
    background: linear-gradient(rgba(239, 68, 68, 0.09), rgba(239, 68, 68, 0.09)), var(--bg-secondary);
}
.revision-entrees.avec-outils .data-table tbody tr.row-warn td:last-child {
    background: linear-gradient(rgba(245, 158, 11, 0.09), rgba(245, 158, 11, 0.09)), var(--bg-secondary);
}
[data-theme="dark"] .revision-entrees.avec-outils .data-table tbody tr.row-error td:last-child {
    background: linear-gradient(rgba(239, 68, 68, 0.16), rgba(239, 68, 68, 0.16)), var(--bg-secondary);
}
[data-theme="dark"] .revision-entrees.avec-outils .data-table tbody tr.row-warn td:last-child {
    background: linear-gradient(rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.14)), var(--bg-secondary);
}
/* ── Champ « Commentaire » (CommentaireField) — saisie et révision ───────────────────────────
   Au repos : jusqu'à 3 lignes visibles, le bas s'estompe au-delà et une pastille « N car. »
   prévient qu'il reste à lire. Au focus : la zone grandit avec le texte (≈ 12 lignes, puis
   défile), un compteur s'affiche. ⤢ ouvre la grande fenêtre d'édition.
   ⚠ Les sélecteurs commencent par `.data-table td` : il faut battre `.data-table td .input`
   (width: 100%, padding) défini plus haut. */
.comment-field {
    position: relative;
    min-width: 300px;
    text-align: left;                 /* certaines grilles centrent leurs cellules */
}
.comment-field-box { position: relative; }
.data-table td .comment-field .comment-field-input {
    display: block;
    field-sizing: content;            /* auto-hauteur, navigateurs récents */
    min-height: 40px;                 /* la hauteur des deux boutons ▾ ⤢ empilés */
    max-height: calc(3 * 1.45em + 12px);
    padding: 6px 30px 6px 9px;        /* à droite : la place des boutons ▾ ⤢ */
    line-height: 1.45;
    resize: none;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    transition: max-height 0.15s ease;
}
.data-table td .comment-field.is-focused .comment-field-input {
    max-height: calc(12 * 1.45em + 12px);
    overflow-y: auto;
}
/* Texte plus long que l'aperçu : la 3e ligne s'estompe, la coupure ne passe pas pour la fin.
   Voile posé SUR le texte (un <textarea> n'a pas de ::after) — un masque estomperait aussi la
   bordure du champ. Même fond que .input, pour les deux thèmes. */
.comment-field.is-clamped .comment-field-box::after {
    content: "";
    position: absolute; left: 1px; right: 1px; bottom: 1px;
    height: 1.9em;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: linear-gradient(to bottom, transparent, var(--bg-elevated) 85%);
    pointer-events: none;
}
.comment-field-input:disabled { cursor: not-allowed; }

.comment-field-tools {
    position: absolute; top: 3px; right: 3px; z-index: 1;
    display: flex; flex-direction: column; gap: 2px;
    opacity: 0; transition: opacity 0.12s ease;
}
.comment-field:hover .comment-field-tools,
.comment-field.is-focused .comment-field-tools { opacity: 1; }
.comment-field-tool {
    width: 22px; height: 16px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-elevated); color: var(--text-secondary);
    font-size: 12px; line-height: 1; cursor: pointer;
}
.comment-field-tool:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.comment-field-meta {
    display: flex; align-items: center; gap: 6px;
    margin-top: 3px;
    font-size: 11px; line-height: 1.2; color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.comment-field-badge {
    padding: 1px 6px; border-radius: 999px;
    font-weight: 600; color: var(--accent); background: var(--accent-soft);
}

/* Liste des commentaires-types : position fixe, placée par chronosDatePicker (App.razor). */
.comment-field-menu {
    position: fixed; z-index: 9999;
    max-height: 260px; overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: date-picker-in 0.14s ease-out;
}
.comment-field-menu-head {
    padding: 7px 12px; text-align: left;
    background: var(--bg-tertiary); border-bottom: 1px solid var(--border);
    font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted);
}
.comment-field-option {
    padding: 7px 12px; font-size: 13px; line-height: 1.4; text-align: left;
    color: var(--text-primary); cursor: pointer;
    white-space: normal; overflow-wrap: anywhere;
}
.comment-field-option:hover,
.comment-field-option.active { background: var(--accent-soft); color: var(--accent); }

/* Lecture seule (feuille envoyée, révision close) : 3 lignes, puis « Voir tout ». */
.comment-field.is-readonly { min-width: 260px; }
.comment-field-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13.5px; line-height: 1.45;
    color: var(--text-primary);
}
.comment-field.is-readonly.is-expanded .comment-field-text { display: block; -webkit-line-clamp: unset; line-clamp: none; }
.comment-field-empty { color: var(--text-muted); }
.comment-field-more {
    margin-top: 2px; padding: 0;
    border: 0; background: none;
    font-size: 11.5px; font-weight: 600; color: var(--accent);
    cursor: pointer;
}
.comment-field-more:hover { text-decoration: underline; }

/* Fenêtre « Agrandir » : la modale du guide (§5.22), élargie pour écrire un paragraphe. */
.modal-card.comment-editor { width: 680px; text-align: left; white-space: normal; }
.comment-editor-context {
    margin: -4px 0 12px;
    font-size: 12.5px; color: var(--text-secondary);
    overflow-wrap: anywhere;
}
.comment-editor .comment-editor-input {
    width: 100%;
    min-height: 220px; max-height: 60vh;
    padding: 10px 12px;
    font-size: 14px; line-height: 1.55;
    resize: vertical;
    white-space: pre-wrap;
}
.comment-editor-foot {
    display: flex; justify-content: space-between; gap: 12px;
    margin: 6px 0 16px;
    font-size: 11.5px; color: var(--text-muted);
}
.comment-editor-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.data-table .neg { color: #dc2626; }
[data-theme="dark"] .data-table .neg { color: #f87171; }
.data-table td.num.neg, .data-table .kpi-value.neg { color: #dc2626; }
/* économie (Écart positif : Budget ≥ Facturé) — vert */
.data-table .pos { color: #16a34a; }
[data-theme="dark"] .data-table .pos { color: #4ade80; }

/* hour chips inside the labour-report detail cell */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 2px 4px 2px 0;
    padding: 2px 9px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.chip strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Document link button in transaction / order tables */
.file-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-weight: 500; font-size: 12px; font-family: inherit;
    white-space: nowrap;
    transition: border-color 0.12s ease, color 0.12s ease;
}
.file-link:hover { border-color: var(--accent); color: var(--accent); }
.file-link-empty { color: var(--text-muted); }

/* ---- Onglet Avenant : tableau maître-détail extensible ---- */
/* Bouton « Voir détails » / « Masquer » de chaque ligne parent. */
.btn-link {
    border: none;
    background: none;
    padding: 0;
    font-weight: 500; font-size: 12px; font-family: inherit;
    color: var(--accent);
    cursor: pointer;
    white-space: nowrap;
}
.btn-link:hover { text-decoration: underline; }
/* Ligne d'en-tête des sous-lignes (petite légende). */
.data-table tbody tr.avenant-sub-head td {
    background: var(--bg-tertiary);
    padding-left: 32px;
    font-weight: 600; font-size: 10px; font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
/* Sous-lignes de documents : fond subtil + indentation à gauche pour lire comme du détail imbriqué. */
.data-table tbody tr.avenant-sub td { background: var(--bg-glass); }
.data-table tbody tr.avenant-sub td:first-child { padding-left: 32px; }
.data-table tbody tr.avenant-sub:hover { background: transparent; }

.detail-grid.compact { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 14px; }
.detail-card + .data-scroll { margin-top: 0; }

/* ---- DataTable: filter row + empty state ---- */
.data-table-wrap { display: flex; flex-direction: column; gap: 12px; }
.table-filter { min-width: 0; width: 100%; max-width: 380px; }
.table-filter .search-input { padding-right: 70px; }
.table-filter-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.data-table .empty-row { text-align: center; color: var(--text-muted); padding: 22px; }

/* ---- View toggle (Tableau / Graphique) ---- */
.view-toggle {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    margin-bottom: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.view-btn {
    background: none;
    border: 0;
    padding: 6px 16px;
    font-weight: 500; font-size: 13px; font-family: inherit;
    color: var(--text-muted);
    border-radius: calc(var(--radius-md) - 3px);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.view-btn:hover { color: var(--text-primary); }
.view-btn.is-active { background: var(--accent); color: #fff; }

/* ---- Budget treemap ---- */
.treemap { display: flex; flex-direction: column; gap: 12px; }
.treemap-crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.treemap-crumb {
    background: none;
    border: 0;
    padding: 2px 4px;
    font-weight: 600; font-size: 13px; font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
}
.treemap-crumb:hover { color: var(--accent); }
.treemap-crumb.is-active { color: var(--text-primary); cursor: default; }
.treemap-crumb-sep { color: var(--text-muted); }
.treemap-hint { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.treemap-crumbs { justify-content: space-between; }
.treemap-title { font-weight: 500; font-size: 13px; font-family: inherit; color: var(--text-secondary); }
.treemap-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
/* #2 — indicateurs cliquables (boutons de tri) du graphique d'écart au budget. */
.legend-btn { border: 1px solid var(--border, #d7dde3); background: var(--surface, #fff); border-radius: 999px; padding: 3px 10px; cursor: pointer; line-height: 1.4; transition: background .12s, border-color .12s, color .12s; }
.legend-btn:hover { border-color: var(--accent, #0a7a45); color: var(--text-secondary); }
.legend-btn.is-active { border-color: var(--accent, #0a7a45); background: rgba(10, 122, 69, .10); color: var(--text-secondary); font-weight: 600; }

/* #6 — niveau « facture » (2e imbrication) du résumé de contrat : léger retrait + fond plus pâle. */
.suivi-sub-2 > td:first-child { padding-left: 28px; }
.suivi-sub-2 { background: rgba(125, 125, 125, .04); }

/* #4 — édition en ligne de la DP dans le suivi d'heures. */
.dp-edit { display: inline-flex; align-items: center; gap: 4px; }
.dp-input { width: 72px; padding: 2px 6px; text-align: right; }
.dp-edit-btn { margin-left: 6px; opacity: .55; }
.dp-edit-btn:hover { opacity: 1; }

/* ---- Budget bar chart (facturé vs budget, par activité) ---- */
.budget-bars { display: flex; flex-direction: column; gap: 14px; }
.bars-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.bars-title { font-weight: 500; font-size: 13px; font-family: inherit; color: var(--text-secondary); max-width: 560px; }
.bars-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.bars-body { display: flex; gap: 14px; align-items: flex-start; }
.bars-list { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.bar-row {
    display: grid;
    grid-template-columns: 220px 1fr 156px;
    align-items: center;
    gap: 14px;
    padding: 5px 8px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.bar-row:hover { background: var(--bg-glass-hover); }
.bar-row.is-selected { background: var(--accent-soft); }
.bar-label { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.bar-code { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; color: var(--text-muted); }
.bar-desc { font-size: 12.5px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track {
    position: relative;
    height: 22px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
}
.bar-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 4px 0 0 4px; transition: width 0.2s ease; }
.bar-budget-line { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--text-secondary); opacity: 0.7; }
.bar-meta { text-align: right; display: flex; flex-direction: column; gap: 1px; }
.bar-pct { font-weight: 700; font-size: 13px; font-family: inherit; font-variant-numeric: tabular-nums; }
.bar-ecart { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.bar-ecart.over { color: #dc2626; }
.bar-ecart.under { color: var(--text-muted); }
[data-theme="dark"] .bar-ecart.over { color: #f87171; }

/* Detail panel beside the bars — reuses the figures styling, stays in view while scrolling. */
.bars-detail {
    position: sticky;
    top: 12px;
    flex: 0 0 250px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

@media (max-width: 760px) {
    .bars-body { flex-direction: column; }
    .bars-detail { position: static; flex-basis: auto; width: 100%; }
    .bar-row { grid-template-columns: 110px 1fr 120px; gap: 8px; }
}

.treemap-body { display: flex; gap: 14px; align-items: flex-start; }
.treemap-svg {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    overflow: visible;
}
.treemap-tile { cursor: pointer; }
.treemap-tile rect { transition: opacity 0.12s ease; }
.treemap-tile:hover rect { opacity: 0.86; }
.treemap-tile rect.is-selected { stroke: var(--text-primary); stroke-width: 3; }
.treemap-label { font: 600 13px 'Inter', sans-serif; pointer-events: none; }
.treemap-amount { font: 500 12px 'Inter', sans-serif; pointer-events: none; opacity: 0.92; font-variant-numeric: tabular-nums; }
.treemap-dev { font: 700 12px 'Inter', sans-serif; pointer-events: none; }
.treemap-state { font-weight: 600; font-size: 13px; font-family: inherit; margin-bottom: 12px; }

.treemap-detail {
    flex: 0 0 250px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}
.treemap-detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.treemap-detail-close { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 14px; }
.treemap-detail-close:hover { color: var(--text-primary); }
.treemap-detail-title { font-weight: 600; font-size: 14px; font-family: inherit; color: var(--text-primary); margin-bottom: 12px; line-height: 1.4; }
.treemap-figures { display: flex; flex-direction: column; gap: 8px; }
.treemap-figures > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.treemap-figures dt { color: var(--text-muted); }
.treemap-figures dd { color: var(--text-primary); font-variant-numeric: tabular-nums; font-weight: 500; }
.treemap-figures dd.neg { color: #dc2626; }
[data-theme="dark"] .treemap-figures dd.neg { color: #f87171; }
.treemap-figures dd.pos { color: #16a34a; }
[data-theme="dark"] .treemap-figures dd.pos { color: #4ade80; }

@media (max-width: 720px) {
    .treemap-body { flex-direction: column; }
    .treemap-detail { flex-basis: auto; width: 100%; }
}

/* ============================================================
   Forms (new project, new rates, new report)
   ============================================================ */
.header-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* ---- Projects list filter bar ---- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; user-select: none; }
.filter-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.filter-years { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label { font-size: 13px; color: var(--text-muted); }
/* Bornes de dates dans une barre de filtres : le champ prend toute la largeur par défaut. */
.filter-dates .date-field { width: 140px; }
.chip-toggle {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-weight: 500; font-size: 12.5px; font-family: inherit;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.chip-toggle:hover:not(:disabled) { border-color: var(--accent); color: var(--text-primary); }
.chip-toggle.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Statut sans aucune feuille : chip conservée pour la stabilité de la barre, mais inactive. */
.chip-toggle:disabled { opacity: 0.4; cursor: default; }
.chip-more { font-weight: 600; }
.filter-count { margin-left: auto; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.tab-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.toolbar-locked { font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 4px;
}
.form-grid.tight { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.span-2 { grid-column: span 2; }
.form-field label { font-weight: 500; font-size: 12px; font-family: inherit; color: var(--text-secondary); }
.form-field .req { color: #dc2626; }
[data-theme="dark"] .form-field .req { color: #f87171; }

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
.form-running-total { margin-right: auto; color: var(--text-secondary); font-size: 13px; }
.form-running-total strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Barre d'actions principale, EN HAUT de page (saisie et révision) : Enregistrer/Envoyer y sont
   visibles dès l'ouverture. Le témoin d'enregistrement automatique vit à côté des boutons. */
.actions-top .form-actions { margin-top: 0; flex-wrap: wrap; }
.autosave-status { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

/* Saisie et révision : la barre d'actions est VERROUILLÉE sous la barre d'application pendant le
   défilement — Enregistrer / Envoyer, Supprimer / Retourner / Sauvegarder / Réviser restent
   atteignables même au bas d'une longue feuille. top = hauteur de l'appbar (56 px), même motif
   que .fact-apercu-barre ;
   z-index sous l'appbar (50) mais au-dessus des en-têtes de table collants (1). L'ombre douce
   détache la barre du contenu qui glisse dessous. */
.actions-top-sticky {
    position: sticky;
    top: calc(56px + var(--bandeau-dev-hauteur));
    z-index: 30;
    box-shadow: 0 6px 12px -8px rgba(15, 23, 42, 0.25);
}

/* Révision / Paie : le nom de l'employé en tête de la barre d'actions verrouillée — il reste
   visible au défilement, quand le titre de la page est sorti de l'écran. */
.revision-nom-employe {
    font-weight: 600; font-size: 15px; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40ch;
}

/* Révision : le total envoyé par l'employé, figé, juste au-dessus des lignes de la feuille
   (à gauche, sous le titre « Entrées »). Encadré ambre dès que la feuille corrigée ne balance plus. */
.revision-total-employe {
    display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 6px 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 13px; color: var(--text-secondary);
}
.revision-total-employe-valeur { color: var(--text-primary); font-variant-numeric: tabular-nums; font-size: 15px; }
.revision-total-employe.ecart { border-color: #f59e0b; background: rgba(245, 158, 11, 0.08); }

.form-card { margin-bottom: 18px; }
.form-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.form-card-head h3 { font-weight: 600; font-size: 16px; font-family: inherit; color: var(--text-primary); }
/* Plusieurs boutons dans l'en-tête d'une carte (ex. Employés : « Imprimer PDF » + « Ajouter »). */
.employes-outils { display: flex; align-items: center; gap: 8px; }
.form-card-close { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 15px; }
.form-card-close:hover { color: var(--text-primary); }
.form-subhead { font-weight: 600; font-size: 12px; font-family: inherit; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); margin: 18px 0 10px; }

.form-banner {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 14px;
}
.form-banner.success { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
/* Bandeau lié au brouillon (ex. « feuille rappelée ») — violet, surtout pas le vert de succès :
   repasser en brouillon n'est pas une validation. */
.form-banner.draft { background: var(--draft-soft); color: var(--draft); border: 1px solid var(--draft); }
.form-banner.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
[data-theme="dark"] .form-banner.error { color: #f87171; }
.form-banner.warn {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.45);
}
[data-theme="dark"] .form-banner.warn { color: #fbbf24; }
.form-banner-title { font-weight: 600; margin-bottom: 4px; }

/* Bandeau d'état de la feuille de temps (écran de révision). */
.status-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}
.status-banner-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    flex: 0 0 auto;
    color: #fff;
}
.status-banner-approved {
    background: var(--statut-valide-soft);
    color: var(--statut-valide);
    border: 1px solid var(--statut-valide);
}
.status-banner-approved .status-banner-icon { background: var(--statut-valide); }
/* Révisée — bleu, comme le tag du même statut : le bandeau vert annonçait « c'est fini » alors
   qu'il reste la validation de la paie. Le vert est resté au bandeau « Validée paie ». */
.status-banner-review {
    background: rgba(37, 99, 235, 0.10);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.45);
}
.status-banner-review .status-banner-icon { background: #2563eb; }
[data-theme="dark"] .status-banner-review { color: #93c5fd; }
[data-theme="dark"] .status-banner-review .status-banner-icon { background: #3b82f6; }
/* Archives — historique clos : gris neutre, sans emphase (rien à faire sur cette feuille). */
.status-banner-archived {
    background: rgba(107, 114, 128, 0.10);
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.35);
}
.status-banner-archived .status-banner-icon { background: #6b7280; color: #fff; }
[data-theme="dark"] .status-banner-archived { color: #9ca3af; }
.status-banner-sent {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border: 1px solid #6d28d9;
    font-size: 16px;
    font-weight: 600;
    padding: 18px 22px;
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.45);
}
.status-banner-sent strong { color: #fff; }
.status-banner-sent .status-banner-icon {
    background: #fff;
    color: #7c3aed;
    width: 28px;
    height: 28px;
    font-size: 16px;
}

.form-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
/* Un indice qui signale une incohérence — pas une erreur : le champ reste enregistrable.
   Ambre plutôt que rouge, comme partout ailleurs (voir .rappel-reste). */
.form-hint.hint-warn { color: var(--status-warning); }

/* ---- Commentaires-types : une liste ORDONNÉE qu'on remplit un élément à la fois ----
   Fiche employé et grille d'administration. Des cartes numérotées : l'ordre de la liste est
   celui dans lequel la saisie propose les commentaires. La carte se saisit par sa poignée
   (même geste que les lignes de la saisie) ou se déplace avec les chevrons ; les actions
   restent discrètes tant qu'on ne vise pas la carte, pour que la liste se lise d'abord. */
.ct-field { display: flex; flex-direction: column; gap: 10px; max-width: 560px; text-align: left; white-space: normal; }
.ct-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ct-item {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 8px 7px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), opacity var(--transition);
}
.ct-item:hover,
.ct-item:focus-within { border-color: var(--accent-soft-2); box-shadow: var(--shadow-md); }
.ct-item.is-dragging { opacity: 0.4; transform: scale(0.98); }
/* Là où la carte glissée tombera : un liseré d'accent plutôt qu'un fantôme — on voit la place. */
.ct-item.is-drop-target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.ct-grip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 28px; flex: none;
    color: var(--text-muted); cursor: grab; user-select: none;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}
.ct-grip:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.ct-grip:active { cursor: grabbing; }
.ct-rang {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    min-width: 24px; height: 24px; padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--accent-soft); color: var(--accent);
    font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ct-texte { flex: 1 1 auto; min-width: 0; font-size: 13.5px; color: var(--text-primary); overflow-wrap: anywhere; }
.ct-actions { display: inline-flex; gap: 2px; flex: none; opacity: 0.45; transition: opacity var(--transition); }
.ct-item:hover .ct-actions,
.ct-item:focus-within .ct-actions { opacity: 1; }
.ct-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; padding: 0;
    border: none; background: transparent; cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}
.ct-btn:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.ct-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ct-btn:disabled { opacity: 0.25; cursor: default; }
.ct-btn.ct-retirer:hover:not(:disabled) { color: #b91c1c; background: rgba(239, 68, 68, 0.12); }
[data-theme="dark"] .ct-btn.ct-retirer:hover:not(:disabled) { color: #fca5a5; }
.ct-vide {
    margin: 0; padding: 14px; text-align: center;
    color: var(--text-muted); font-size: 12.5px;
    border: 1px dashed var(--border); border-radius: var(--radius-md);
}
/* L'ajout se lit comme la carte suivante de la liste : même rayon, bord pointillé, « + » d'accent. */
.ct-ajout {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 5px 5px 10px;
    border: 1px dashed var(--accent-soft-2);
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.ct-ajout:focus-within { border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.ct-ajout-plus { flex: none; color: var(--accent); font-size: 18px; font-weight: 600; line-height: 1; }
.ct-ajout-input {
    flex: 1 1 auto; min-width: 0;
    border: none; outline: none; background: transparent;
    font: inherit; font-size: 13.5px; color: var(--text-primary);
    padding: 6px 0;
}
.ct-ajout-input::placeholder { color: var(--text-muted); }
/* En cellule de grille : mêmes cartes, moins d'air — la ligne d'édition reste une ligne. */
.ct-field.is-compact { gap: 6px; min-width: 280px; }
.ct-field.is-compact .ct-liste { gap: 4px; }
.ct-field.is-compact .ct-item { padding: 3px 4px 3px 2px; gap: 6px; box-shadow: none; }
.ct-field.is-compact .ct-texte,
.ct-field.is-compact .ct-ajout-input { font-size: 12px; }
.ct-field.is-compact .ct-rang { min-width: 20px; height: 20px; font-size: 10.5px; }
.ct-field.is-compact .ct-btn { width: 24px; height: 24px; }
.ct-field.is-compact .ct-vide { padding: 8px; }

/* ---- Editable budget-entry table (new project) ---- */
.entry-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.entry-table thead th {
    text-align: left;
    padding: 9px 12px;
    font-weight: 600; font-size: 11px; font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}
.entry-table thead th.num { text-align: right; }
.entry-table tbody td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.entry-table tbody td .input { padding: 7px 9px; }
.entry-table .mono-input { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.entry-table .num-input { text-align: right; font-variant-numeric: tabular-nums; }
.entry-table .empty-row { text-align: center; color: var(--text-muted); padding: 20px; }
.entry-table tfoot td {
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.entry-table tfoot td.num { text-align: right; }
.row-remove,
.row-edit {
    background: none;
    border: 0;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
}
/* Le jumeau du ✕ pour l'édition : même gabarit, mais il vire à l'accent et non au
   rouge — supprimer et modifier ne se signalent pas de la même couleur. */
.row-edit:hover:not(:disabled) { color: var(--accent); background: var(--bg-glass-hover); }
.row-edit:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
   Modal (Proxima design system — STYLE_GUIDE.html, "Overlays")
   ============================================================ */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center; justify-content: center;
    z-index: 1000;
    animation: modal-backdrop-in 0.18s ease-out;
}
@keyframes modal-backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    width: 460px;
    max-width: calc(100vw - 32px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22),
                0 4px 12px  rgba(0, 0, 0, 0.08);
    animation: modal-card-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modal-card-in {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}
.modal-title { margin: 0 0 10px; font-weight: 600; font-size: 17px; line-height: 1.3; font-family: inherit; letter-spacing: -0.01em; color: var(--text-primary); }
.modal-body  { margin: 0 0 22px; font-size: 14px; line-height: 1.55; color: var(--text-secondary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.row-remove:hover { color: #dc2626; background: var(--bg-glass-hover); }

/* ═══════════════════════════════════════════════════════════════════════════
   Zone de danger (⚙ Configuration → Zone de danger, administrateurs)
   Rouge = --status-danger, la seule couleur codée en dur admise (statut), le
   reste passe par les jetons habituels. Volontairement à part du reste de la
   page : on doit voir qu'on a changé de registre avant de cliquer.
   ═══════════════════════════════════════════════════════════════════════════ */
.config-nav-danger { color: var(--status-danger); }
.config-nav-danger:hover { color: var(--status-danger); }
.config-nav-danger.is-active { color: var(--status-danger); border-left-color: var(--status-danger); }
@media (max-width: 900px) {
    .config-nav-danger.is-active { border-left-color: transparent; border-bottom-color: var(--status-danger); }
}

.danger-zone {
    border-color: rgba(239, 68, 68, 0.35);
    background:
        linear-gradient(180deg, rgba(239, 68, 68, 0.05) 0%, rgba(239, 68, 68, 0) 120px),
        var(--bg-secondary);
}
.danger-zone .form-card-head h3 { display: flex; align-items: center; gap: 8px; color: var(--status-danger); }
.danger-ico { flex-shrink: 0; }

.danger-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px 24px;
    margin: 4px 0 16px;
}
.danger-list-title {
    font: 600 12px/1 'Inter', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.danger-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--status-danger);
    color: #ffffff;
    font: 500 13px/1 'Inter', system-ui, sans-serif;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn-danger:hover:not(:disabled)  { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(239, 68, 68, 0.35), 0 2px 4px rgba(0, 0, 0, 0.06); }
.btn-danger:active:not(:disabled) { transform: translateY(0); }
.btn-danger:disabled { opacity: 0.45; cursor: default; }

/* ═══════════════════════════════════════════════════════════════════════════
   Édition dans la grille (référentiels : employés, utilisateurs, catégories)
   La ligne se transforme en champs sur place : aucun formulaire séparé. Même
   idiome que la grille de saisie (.cell-ro en lecture, .input en édition), avec
   la ligne en cours teintée à l'accent pour qu'on sache toujours où on écrit.
   ═══════════════════════════════════════════════════════════════════════════ */
.data-table tbody tr.row-editing > td {
    background: var(--accent-soft);
    vertical-align: middle;
}
.data-table tbody tr.row-editing > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.data-table tbody tr.row-editing .cell-ro { color: var(--text-secondary); }

/* Champ numérique en grille : chiffres alignés à droite, largeur juste. */
.data-table td .input.num-input {
    width: 92px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Case à cocher en grille, avec son étiquette courte (« Auto »). */
.grid-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; color: var(--text-secondary); }
.grid-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }

/* Boutons compacts pour les actions de ligne. Doit rester APRÈS .btn-primary /
   .btn-secondary (même spécificité de classe simple) — d'où le sélecteur à deux
   classes, sinon le padding standard l'emporterait. */
.btn-primary.btn-sm,
.btn-secondary.btn-sm { padding: 5px 11px; font-size: 12.5px; }

/* ── Grille des clients : dix colonnes et 49 fiches dans UNE fenêtre ─────────
   La grille est bâtie comme les autres (.data-table), mais elle porte quatre textes
   longs — raison sociale, adresse de facturation, terme, mention d'intérêt. Deux
   défauts se sont succédé, et les deux tiennent à l'adresse
   (« 123, RUE PRINCIPALE, BUREAU 200 · VILLE-DÉMO QC J0X 1A0 ») :

   1. en largeur automatique, elle imposait sa longueur à toute la table avec le
      `white-space: nowrap` de .data-table — la grille débordait du panneau ;
   2. une fois la largeur bornée, elle imposait sa HAUTEUR — trois lignes par fiche,
      soit un écran et demi pour dix clients.

   D'où le réglage complet : `table-layout: fixed` + largeurs en POURCENTAGE (la table
   fait exactement la largeur disponible, quel que soit l'écran), texte coupé à « … »
   sur UNE ligne avec la valeur entière au survol, gouttières et hauteur de ligne
   resserrées. Le reste se joue dans le balisage : filtre au-dessus, `data-scroll tall`
   pour caler le défilement sur la fenêtre, et les deux majorations en une colonne. */
.table-clients { table-layout: fixed; }
/* Sélecteurs doublement qualifiés : `.data-table thead th` / `.data-table tbody td`
   sont plus spécifiques qu'une simple classe — sans `.data-table` ici, la gouttière
   d'origine l'emporterait. */
.data-table.table-clients thead th {
    white-space: normal;          /* l'en-tête, lui, tient sur deux lignes plutôt que d'élargir sa colonne */
    overflow-wrap: anywhere;
    padding: 8px 9px;
}
.data-table.table-clients tbody td { padding: 5px 9px; }
/* La ligne « Aucun résultat » garde sa respiration : elle n'est pas une fiche à compacter. */
.data-table.table-clients tbody td.empty-row { padding: 22px; }
/* Colonnes texte : une seule ligne, coupée par « … ». C'est ce qui fait tenir la
   grille dans une fenêtre — rien n'est perdu, le title porte la valeur entière. */
.data-table.table-clients tbody td.cell-trunc {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* La pastille « Inactif » demande ~55 px : à 6 % elle débordait sur la colonne
   voisine dès que la fenêtre se resserrait. */
.table-clients th:nth-child(1),  .table-clients td:nth-child(1)  { width: 8%; }   /* Actif */
.table-clients th:nth-child(2),  .table-clients td:nth-child(2)  { width: 9%; }   /* Code */
.table-clients th:nth-child(3),  .table-clients td:nth-child(3)  { width: 14%; }  /* Raison sociale */
.table-clients th:nth-child(4),  .table-clients td:nth-child(4)  { width: 14%; }  /* Adresse */
.table-clients th:nth-child(5),  .table-clients td:nth-child(5)  { width: 11%; }  /* Responsable */
.table-clients th:nth-child(6),  .table-clients td:nth-child(6)  { width: 8%; }   /* Terme */
.table-clients th:nth-child(7),  .table-clients td:nth-child(7)  { width: 9%; }   /* Intérêt */
.table-clients th:nth-child(8),  .table-clients td:nth-child(8)  { width: 9%; }   /* Major. % */
.table-clients th:nth-child(9),  .table-clients td:nth-child(9)  { width: 5%; }   /* Proj. */
/* Assez large pour « Enregistrer » en toutes lettres sur la ligne en édition — c'est
   elle qui dicte la largeur, les deux icônes du mode lecture tiennent partout. */
.table-clients th:nth-child(10), .table-clients td:nth-child(10) { width: 13%; }  /* Actions */
/* Colonne d'actions : deux ICÔNES (✎ ✕) qui tiennent côte à côte, sans repli.
   « Modifier » en toutes lettres suivi du ✕ demandait ~85 px là où la colonne en
   offre parfois 70 : les deux boutons passaient à la ligne — chaque fiche prenait
   deux fois la hauteur — puis débordaient sur la colonne voisine. Le libellé n'est
   pas perdu, il est porté par le title et l'aria-label. */
.table-clients .row-tools {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    white-space: normal;
}
/* La ligne en édition, elle, porte deux VRAIS boutons (Enregistrer / Annuler) qui ne
   tiennent pas côte à côte dans cette colonne : ils s'empilent sur toute sa largeur.
   Une seule ligne est éditable à la fois — sa hauteur qui grandit marque justement la
   fiche qu'on est en train de modifier. */
.table-clients tr.row-editing .row-tools {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}
/* Gouttière resserrée : « Enregistrer » doit tenir sur une ligne dans la colonne,
   sinon le libellé se coupe en deux à l'intérieur du bouton. */
.table-clients tr.row-editing .row-tools .btn-primary,
.table-clients tr.row-editing .row-tools .btn-secondary { padding: 5px 8px; font-size: 12px; }
/* Les deux majorations partagent une colonne : transport à gauche, administration à droite. */
.table-clients .cell-majorations { display: flex; gap: 4px; }
/* Le champ numérique en grille est calibré à 92 px : dans ces colonnes il déborde. */
.table-clients td .input.num-input { width: 100%; min-width: 0; padding-left: 5px; padding-right: 5px; }
/* Terme + délai d'échéance dans une colonne : le texte prend la place, le nombre reste court. */
.table-clients .cell-terme .input:not(.num-input) { flex: 1 1 auto; min-width: 0; }
.table-clients .cell-terme .input.num-input { flex: 0 0 46px; width: 46px; }

/* ── Facturation ──────────────────────────────────────────────────────────── */

/* Liste des fiches client PROPOSÉES d'après les projets : une proposition n'est pas
   un enregistrement, elle vit donc dans le bandeau et non dans la grille. */
.clients-proposes { margin: 10px 0 4px; padding-left: 18px; display: grid; gap: 6px; }
.clients-proposes li { line-height: 1.45; }
.clients-proposes .form-hint { display: block; margin: 2px 0 0; }

/* ══ L'atelier de facturation : la saisie à gauche, le document à droite ═════
   Moitié / moitié (1fr / 1fr). C'était deux tiers / un tiers au profit de la saisie,
   et 40 % / 60 % avant cela : à un tiers d'écran, l'aperçu se relisait mal — la
   facture y était trop étroite pour juger de sa mise en page. À parts égales, les
   menus gardent leur aisance et le document se lit tel qu'il s'imprimera. Chaque
   moitié défile pour elle-même. L'aperçu garde un plancher (380 px) pour que ses
   tableaux ne s'écrasent pas sur un écran moyen. Chaque panneau défile POUR LUI-MÊME :
   régler une dépense en bas de la saisie ne fait plus perdre de vue la facture,
   et inversement.
   La page, elle, ne défile pas — c'est ce qui rend la barre d'actions du bas
   (aperçu, PDF, enregistrement) constamment atteignable, sans position: fixed.
   ═══════════════════════════════════════════════════════════════════════════ */
.facturation-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 1fr);
    gap: 18px;
    /* Hauteur d'écran moins la barre d'application, l'en-tête de page, les marges
       et le pied. Bornée en bas : sur un petit écran, mieux vaut laisser la page
       s'allonger que réduire les deux panneaux à une fente. */
    height: calc(100vh - 250px);
    min-height: 520px;
}

.fact-panneau,
.fact-apercu {
    display: flex;
    flex-direction: column;
    /* Sans min-height:0, un enfant en défilement pousse la colonne au lieu de
       défiler dedans — le classique piège du flex en hauteur contrainte. */
    min-height: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Trois onglets (saisie · brouillons · émises) dans le panneau de saisie : le
   rembourrage par défaut les faisait passer à la ligne, et une rangée d'onglets sur deux étages
   se lit mal. Resserrés ici, et là seulement — ailleurs les onglets gardent leur taille. */
.fact-panneau-onglets { flex: 0 0 auto; margin: 0 14px 0; flex-wrap: nowrap; }
.fact-panneau-onglets .tab { padding: 10px 10px; font-size: 13.5px; gap: 6px; white-space: nowrap; }
.fact-panneau-corps {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 16px 18px;
}

.fact-panneau-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 11px 14px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
}
.fact-actions-motif { flex: 1 0 100%; margin: 0; }
.fact-actions-etat { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.fact-actions-boutons { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-left: auto; }

/* Les sections du panneau : des blocs séparés par un filet, et non des cartes
   dans une carte (l'ombre portée d'une carte imbriquée fait du bruit). */
.fact-bloc { padding: 16px 0 4px; border-top: 1px solid var(--border-subtle); }
.fact-bloc:first-of-type { border-top: 0; padding-top: 10px; }
.fact-bloc .form-card-head { margin-bottom: 10px; }
.fact-bloc .form-card-head h3 { font-size: 14.5px; }
.fact-projets { margin-top: 14px; }

/* ── Facture regroupée (l'exception : plusieurs projets sur une facture) ── */
.fact-projets-tete { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fact-projets-tete label { margin: 0; }
.tag.tag-regroupee { color: #b45309; background: rgba(245, 158, 11, 0.16); }
[data-theme="dark"] .tag.tag-regroupee { color: #fbbf24; }
.fact-projets-pastilles {
    display: flex; flex-wrap: wrap; gap: 8px; padding: 8px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elevated);
}
.fact-projet-pastille {
    display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
    padding: 5px 8px 5px 10px; border-radius: var(--radius-full);
    background: var(--accent-soft); color: var(--text-primary); font-size: 13px;
}
.fact-projet-pastille .mono { font-weight: 600; }
.fact-projet-pastille-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.fact-projet-pastille-retirer {
    border: 0; background: none; padding: 0 2px; cursor: pointer;
    color: var(--text-muted); font-size: 12px; line-height: 1;
}
.fact-projet-pastille-retirer:hover { color: var(--text-primary); }
.fact-projet-ajouter {
    padding: 5px 10px; border: 1px dashed var(--border); border-radius: var(--radius-full);
    background: none; color: var(--accent); font-size: 13px; cursor: pointer;
}
.fact-regrouper-lien {
    display: inline-block; margin-top: 8px; padding: 0; border: 0; background: none;
    color: var(--accent); font-size: 13px; cursor: pointer; text-align: left;
}
.fact-regrouper-lien:hover { text-decoration: underline; }
.fact-regrouper-panneau {
    margin-top: 10px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-secondary);
}
.fact-regrouper-tete { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; }
.fact-regrouper-ligne {
    display: grid; grid-template-columns: 18px auto 1fr auto; gap: 10px; align-items: center;
    padding: 7px 6px; border-radius: var(--radius-sm); font-size: 13.5px; cursor: pointer;
}
.fact-regrouper-ligne.is-on { background: var(--accent-soft); }
.fact-regrouper-ligne .mono { color: var(--text-secondary); }
.fact-regrouper-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact-regrouper-heures { color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fact-regrouper-pied {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 8px; font-size: 12.5px; color: var(--text-muted);
}
.fact-regrouper-pied .btn-primary { white-space: nowrap; flex-shrink: 0; }

/* La portée : le client sur toute la largeur, puis « Du » et « Au » côte à côte.
   Deux colonnes FIXES et non l'auto-fill de .form-grid : dans le panneau de
   saisie, l'auto-fill retombait à une colonne et empilait les deux dates alors
   qu'elles bornent une seule période — on les lit ensemble, elles tiennent sur une
   ligne. */
.fact-portee { display: grid; gap: 10px; margin-bottom: 4px; }
.fact-periode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- Panneau de droite : la barre de titre, puis le document qui se défile ---- */
.fact-apercu-barre {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 18px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}
.fact-apercu-titre { font-weight: 600; font-size: 14px; font-family: inherit; color: var(--text-primary); }
.fact-apercu-sous  { font-size: 11.5px; color: var(--text-muted); }
.fact-apercu-total {
    font-weight: 700; font-size: 18px; font-family: inherit;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.fact-apercu-defile {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 18px;
    /* Le fond de l'application derrière les feuilles : le document se détache
       comme du papier posé sur un bureau. */
    background: var(--bg-primary);
}

/* ---- Dépenses à refacturer et ajouts de temps : une GRILLE compacte, une ligne par saisie ----
   Une facture en porte souvent plusieurs ; la fiche (trois rangées par saisie)
   poussait le reste du panneau hors de vue. Champs resserrés, et le conteneur
   défile à l'horizontale plutôt que d'écraser les champs sur un écran étroit. */
.depenses-grille-defile {
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.depenses-grille { min-width: 620px; font-size: 12.5px; }
.depenses-grille thead th { padding: 6px 8px; font-size: 10.5px; white-space: nowrap; }
.depenses-grille tbody td { padding: 4px 6px; vertical-align: top; }
.depenses-grille tbody td .input { padding: 5px 8px; font-size: 12.5px; }
.depenses-grille tbody tr:last-child td { border-bottom: 0; }
.depenses-grille tfoot td { padding: 7px 8px; font-size: 13px; }
.depenses-grille .col-date { width: 132px; }
.depenses-grille .col-projet { width: 120px; }
.depenses-grille .col-attribution { width: 30%; }
.depenses-grille .col-montant { width: 118px; }
.depenses-grille .col-retirer { width: 32px; text-align: center; }
.depenses-grille .depense-specifique { margin-top: 4px; }
/* Les ajouts de temps portent une colonne de plus (l'employé) : la grille s'élargit d'autant
   avant de défiler. */
.ajouts-temps-grille { min-width: 760px; }
.depenses-grille .col-employe { width: 150px; }
.depenses-grille .col-heures { width: 96px; }
/* Attribution (dépenses et ajouts de temps) : une ligne par menu, comme en saisie et en
   révision. Un libellé long (« Réfection des façades 20-55 #15103 (2012-039) ») s'écourte
   au lieu de faire grandir le menu sur trois lignes et de pousser la colonne Retirer hors
   de la grille ; l'infobulle donne la valeur entière. */
select.input.select-attribution {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.depenses-grille td.col-attribution { max-width: 240px; }
.depenses-grille td.col-attribution .muted { white-space: normal; overflow-wrap: break-word; }
/* Une ligne incomplète se signale d'un filet à gauche : la bannière sous la grille
   dit QUOI compléter, le filet dit OÙ. */
.depenses-grille tbody tr.is-incomplete td:first-child { box-shadow: inset 3px 0 0 var(--status-warning); }
.depense-montant { display: inline-flex; align-items: center; gap: 4px; }
.depense-montant .input { width: 92px; }
/* Pas de flèches d'incrément sur le montant : on le tape, on ne le fait pas défiler au cent près. */
.depense-montant .input { -moz-appearance: textfield; appearance: textfield; }
.depense-montant .input::-webkit-inner-spin-button,
.depense-montant .input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.depense-devise { color: var(--text-muted); font-size: 12px; }

/* ---- L'onglet qui prend toute la largeur : la grille des factures émises ----
   Le registre grossit sans fin, et huit colonnes ne tiennent pas dans un tiers d'écran (c'est ce
   qui avait fait choisir des fiches à l'origine). Plutôt que de resserrer la grille jusqu'à
   l'illisible, l'aperçu s'efface : on cherche une facture, on ne la relit pas encore. Cliquer
   « 👁 Voir » ramène la coupe moitié / moitié et le document. */
.facturation-split.est-grille { grid-template-columns: 1fr; }
.facturation-split.est-grille .fact-panneau-corps { padding-bottom: 14px; }
.fact-filtres { margin: 10px 0 14px; }
.fact-filtre-client { min-width: 210px; padding-top: 4px; padding-bottom: 4px; font-size: 12.5px; }
/* Paie : la liste des périodes tient sur la ligne des pastilles, comme le filtre client ci-dessus. */
.paie-filtre-periode { width: auto; min-width: 230px; padding-top: 4px; padding-bottom: 4px; font-size: 12.5px; }
.fact-col-numero { font-weight: 600; color: var(--accent); }
/* Les actions d'une ligne : sur une seule ligne, elles ne doivent pas faire grandir la rangée. */
.grille-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
/* La facture actuellement ouverte à droite — repérée sans la chercher, comme l'était la fiche. */
.data-table tbody tr.row-ouverte { background: var(--accent-soft); }
.data-table tbody tr.row-ouverte td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ---- Les brouillons : une grille comme les factures émises ----
   La note reste modifiable dans sa colonne : un champ compact, assez large pour se relire. */
.data-table td.fact-col-note { min-width: 220px; }
.data-table td.fact-col-note .input { width: 100%; padding-top: 4px; padding-bottom: 4px; font-size: 12.5px; }

/* Sous 1200 px, les deux panneaux s'empilent : la page reprend son défilement
   ordinaire, et la barre d'actions colle au bas de la fenêtre pour rester
   constamment visible — c'est la promesse de l'écran, pas un effet de mise en page. */
@media (max-width: 1200px) {
    .facturation-split { grid-template-columns: 1fr; height: auto; min-height: 0; }
    /* La grille, elle, garde sa hauteur d'écran : c'est une liste qu'on parcourt, et la faire
       défiler avec la page ferait perdre les filtres restés en haut. */
    .facturation-split.est-grille { height: calc(100vh - 250px); min-height: 520px; }
    .facturation-split.est-grille .fact-panneau { overflow: hidden; }
    .facturation-split.est-grille .fact-panneau-corps { overflow-y: auto; }
    .fact-panneau, .fact-apercu { overflow: visible; }
    .fact-panneau-corps { overflow-y: visible; }
    .fact-apercu-defile { overflow: visible; max-height: none; }
    .fact-panneau-actions { position: sticky; bottom: 0; z-index: 20; }
    .fact-apercu-barre { position: sticky; top: calc(56px + var(--bandeau-dev-hauteur)); z-index: 19; }
}

/* ── Document de facturation (aperçu à l'écran) ───────────────────────────── */
/* L'aperçu ressemble au papier : le tirage n'est alors plus une surprise. Les deux
   pages (facture sommaire et relevé) sont des FEUILLES — fond blanc franc, ombre
   portée, filet d'accent en tête — et non des cartes d'application : on doit voir
   du premier coup d'œil qu'on regarde un document, pas un écran de plus. */

.facture-doc { display: grid; gap: 26px; }

.facture-page,
.releve-page {
    position: relative;
    padding: 34px 34px 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
/* Le filet de tête : la seule couleur franche du document. */
.facture-page::before,
.releve-page::before {
    content: "";
    position: absolute; inset: 0 0 auto;
    height: 4px;
    background: var(--accent-gradient);
}

/* ---- En-tête : émetteur à gauche, timbre de facture à droite ---- */
.fact-entete {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 32px; flex-wrap: wrap;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border-subtle);
}
/* Hauteur et largeur DOUBLÉES (36 → 72 px, 300 → 600 px) à la demande : un logo de 36 px
   se perdait à côté de la raison sociale, et les logos larges (lockup horizontal avec
   baseline) s'y réduisaient à une vignette illisible. Le rapport reste libre — width:auto
   et max-width : un logo carré monte à 72 px, un logo long s'arrête à 600 px. La règle
   d'impression suit, dans print.css. */
.fact-logo { height: 72px; width: auto; max-width: 600px; display: block; margin-bottom: 10px; }

/* Aperçu du logo téléversé (⚙ Configuration → Paramètres facturation). Fond en damier clair
   plutôt qu'uni : un PNG transparent sur fond blanc ne se distingue pas d'un fichier vide, et
   c'est précisément ce qu'on veut vérifier avant de l'imprimer. */
.logo-apercu {
    display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
    padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
    background-color: var(--bg-tertiary);
    background-image:
        linear-gradient(45deg, rgba(128, 128, 128, 0.12) 25%, transparent 25% 75%, rgba(128, 128, 128, 0.12) 75%),
        linear-gradient(45deg, rgba(128, 128, 128, 0.12) 25%, transparent 25% 75%, rgba(128, 128, 128, 0.12) 75%);
    background-size: 14px 14px;
    background-position: 0 0, 7px 7px;
}
/* L'aperçu montre le logo à la taille où il s'affichera sur la facture — sinon il donnerait
   à valider autre chose que ce qui s'imprime. */
.logo-apercu img { height: 72px; width: auto; max-width: 440px; }
.fact-raison {
    font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25;
    color: var(--text-primary);
}
.fact-coord { margin-top: 6px; font-size: 12.5px; line-height: 1.6; color: var(--text-secondary); }

.fact-timbre {
    min-width: 232px;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    text-align: right;
}
.fact-timbre-type {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--text-muted);
}
.fact-timbre-numero {
    font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: 0.01em;
    color: var(--accent);
}
.fact-timbre-meta {
    display: grid; grid-template-columns: auto auto; gap: 2px 14px; justify-content: end;
    margin: 10px 0 0; font-size: 12.5px;
}
.fact-timbre-meta dt { color: var(--text-muted); }
.fact-timbre-meta dd { margin: 0; color: var(--text-primary); font-weight: 500; }

/* ---- Parties : « Facturé à » et « Service rendu » ---- */
.fact-parties {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    /* align-items:start — sans quoi la carte « Facturé à » s'étire sur la hauteur de la liste des
       services rendus et laisse un grand vide sous l'adresse. */
    align-items: start;
    gap: 16px; margin: 22px 0 24px;
}
.fact-partie {
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.fact-partie-titre {
    margin-bottom: 8px;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-muted);
}
.fact-partie-nom { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.fact-partie-corps { margin-top: 3px; font-size: 12.5px; line-height: 1.6; color: var(--text-secondary); }
.fact-partie-code { margin-top: 4px; font-size: 11.5px; color: var(--text-muted); }
/* Commentaire libre de la facture : son propre encadré, sur toute la largeur, sous le titre
   « Honoraires professionnels » et avant les lignes ; coiffé d'une bulle « Info », imprimé comme tapé. */
.fact-info { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.fact-info-bulle {
    flex: 0 0 auto; padding: 2px 9px; border-radius: var(--radius-full);
    background: var(--accent-soft); color: var(--accent);
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
}
.fact-info-texte { font-size: 12.5px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; color: var(--text-primary); }
.fact-service + .fact-service { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.fact-contrat { color: var(--text-muted); }
/* Beaucoup de projets sur une même facture : chacun se réduit à son nom et à son contrat.
   C'est ce qui garde la page 1 sur UNE feuille — le détail de chaque projet vit sur son
   relevé, en-tête compris. */
.fact-service-compact + .fact-service-compact { margin-top: 6px; padding-top: 6px; }
.fact-service-compact .fact-partie-nom { font-size: 13px; }
.fact-service-reste { margin-top: 8px; font-size: 12px; font-style: italic; color: var(--text-muted); }

/* ---- Corps : les postes facturés, puis le bloc de totaux ---- */
.fact-lignes { width: 100%; border-collapse: collapse; }
.fact-lignes-titre {
    padding: 0 0 10px;
    text-align: left;
    font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.fact-lignes th {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-muted); text-align: left;
}
.fact-lignes td {
    padding: 9px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13.5px; vertical-align: baseline;
}
.fact-lignes .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fact-lignes th.num { text-align: right; }
.fact-ligne-libelle { color: var(--text-primary); }
/* Le calcul qui justifie le montant, en retrait : « 2,25 h × 160,00 $ ». */
.fact-ligne-detail { margin-left: 10px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* Un poste sans montant ce mois-ci reste lisible mais s'efface. */
.fact-ligne-vide { color: var(--text-muted); }
.fact-ligne-vide .fact-ligne-libelle { color: var(--text-muted); }

.fact-totaux {
    margin: 18px 0 0 auto;
    width: min(360px, 100%);
    display: grid; gap: 2px;
    font-size: 13.5px;
}
.fact-totaux-ligne {
    display: flex; align-items: baseline; justify-content: space-between; gap: 18px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
}
.fact-totaux-ligne .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fact-totaux-taux { color: var(--text-muted); font-size: 12px; }
/* Le numéro d'inscription à la taxe : obligatoire sur le document, mais il ne doit pas
   se lire avant le montant. */
.fact-totaux-nore { display: block; font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.01em; }
.fact-totaux-grand {
    margin-top: 6px;
    padding: 12px 14px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    font-size: 17px; font-weight: 700;
}
.fact-totaux-grand .num { color: var(--accent); }

.fact-pied {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
    margin-top: 26px; padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12.5px; line-height: 1.7; color: var(--text-secondary);
}
.fact-pied-etiquette {
    display: inline-block; min-width: 58px;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-muted);
}
.fact-merci { font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: 0.01em; }

/* ---- Relevé des services professionnels ---- */
.releve-entete {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 20px; flex-wrap: wrap;
    padding-bottom: 16px; margin-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.releve-titre { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.releve-projet { margin-top: 3px; font-size: 13px; color: var(--text-secondary); }
.releve-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.releve-chip {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 11.5px; color: var(--text-secondary); white-space: nowrap;
}
.releve-chip-fort { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.releve-sous-titre {
    margin: 22px 0 8px;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-muted);
}

.releve-grille, .releve-codes {
    width: 100%; border-collapse: collapse;
    font-size: 12.5px;
}
.releve-grille th, .releve-codes th {
    padding: 7px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); text-align: left; white-space: nowrap;
}
.releve-grille td, .releve-codes td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-subtle);
    font-variant-numeric: tabular-nums; vertical-align: top;
}
.releve-grille .num, .releve-codes .num { text-align: right; white-space: nowrap; }
.releve-grille th.num, .releve-codes th.num { text-align: right; }
/* Les en-têtes de catégorie chapeautent leurs colonnes d'employé — et se lisent DANS le
   même axe qu'elles : catégorie, nom d'employé et heures tombent tous sur le bord droit
   de la colonne. Centrer la catégorie décalait son libellé d'un demi-mot par rapport au
   nom qu'elle chapeaute, et la colonne se lisait en escalier. Le filet sous le libellé
   continue de marquer l'étendue du groupe quand il couvre plusieurs employés. */
.releve-categories th {
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary); text-align: right; letter-spacing: 0.04em;
}
.releve-categories th.num { text-align: right; }
.releve-col-code { width: 92px; }
.releve-description { min-width: 320px; color: var(--text-secondary); }

/* Bande de semaine : elle structure un tableau qui, autrement, est un mur de chiffres. */
.releve-semaine-titre td {
    padding: 8px;
    background: var(--bg-tertiary);
    font-weight: 600; color: var(--text-primary);
}
.releve-attrib { white-space: nowrap; }
/* Attribution sans numéro : c'est un texte, pas un code — il s'écourte plutôt que d'étirer la colonne. */
.releve-attrib-libelle {
    display: inline-block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    vertical-align: bottom;
    font-size: 11.5px; color: var(--text-secondary);
}
.releve-montant { font-weight: 600; }

/* ---- Détail des attributions : une table de postes par projet ----
   Deux colonnes de texte puis trois de chiffres. Les libellés d'attribution sont longs et
   s'enroulent — une table qui s'étire déborderait de la feuille à l'impression, et c'est le
   même DOM qui part chez le client. */
.detail-projet + .detail-projet { margin-top: 26px; }
.detail-attributions th:first-child,
.detail-attributions td:first-child { width: 34%; }
.detail-attributions th:nth-child(2),
.detail-attributions td:nth-child(2) { width: 24%; }
/* L'attribution spécifique est le complément du poste, pas son nom : elle se lit en second. */
.detail-specifique { color: var(--text-secondary); }
/* Les dépenses à refacturer, après le détail : la même table que la grille de saisie (date,
   description, attribution, montant). La date est courte, la description prend la place. */
.detail-depenses-table th:first-child,
.detail-depenses-table td:first-child { width: 14%; white-space: nowrap; }
/* Rien ne distingue un poste sans numéro au plan : « hors plan » ne se dit plus sur le
   document (voir FactureVue) — ni pastille, ni ligne teintée. */
.releve-total td {
    padding-top: 9px; padding-bottom: 9px;
    border-top: 2px solid var(--border); border-bottom: none;
    font-weight: 700;
}
.releve-total-label { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }

.releve-verification {
    list-style: none; margin: 0; padding: 14px 16px;
    display: grid; gap: 4px; max-width: 420px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    font-size: 12.5px;
}
.releve-verification li { display: flex; justify-content: space-between; gap: 16px; }
.releve-verification .num { font-variant-numeric: tabular-nums; }
.releve-verification li:last-child {
    margin-top: 4px; padding-top: 6px;
    border-top: 1px solid var(--border);
    font-weight: 700;
}

/* ── Dépenses saisies sur la facture ──────────────────────────────────────── */
/* Une dépense n'est pas du temps : elle se saisit ici, au moment de facturer, et non
   sur la feuille de temps de l'employé qui l'a avancée. */
.depenses-grille { width: 100%; }
.depenses-grille .input { min-width: 0; }
.depenses-grille .cell-montant { width: 120px; }
.depenses-grille .cell-montant .input { width: 100%; text-align: right; font-variant-numeric: tabular-nums; }
.depenses-grille .cell-date { width: 150px; }
.depenses-vide { color: var(--text-muted); }
.depenses-total { display: flex; justify-content: flex-end; gap: 14px; align-items: baseline; margin-top: 10px; font-size: 13.5px; }
.depenses-total strong { font-variant-numeric: tabular-nums; }

/* ── Sélecteur de date (guide de style § 5.8) ─────────────────────────────── */
/* Le calendrier natif ne se thème pas : il arrive en anglais, au format du poste et
   avec ses propres couleurs. On le remplace donc par un déclencheur qui reprend .input
   et un popover dessiné avec les mêmes jetons que le reste de l'application.
   Le popover est en position:fixed et placé par script (chronosDatePicker, App.razor) :
   il n'est jamais rogné par une carte ou une cellule de tableau qui défile. */

.date-field { position: relative; }

.date-field-trigger {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font: 400 14px 'Inter', -apple-system, system-ui, sans-serif;
    cursor: pointer; text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.date-field-trigger:hover:not(:disabled) { border-color: var(--text-secondary); }
.date-field.open .date-field-trigger,
.date-field-trigger:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}
.date-field-trigger:disabled { opacity: 0.55; cursor: not-allowed; }

.date-field-value {
    flex: 1; min-width: 0;
    font-variant-numeric: tabular-nums;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.date-field-value.empty { color: var(--text-muted); }
.date-field-icon { color: var(--text-muted); flex-shrink: 0; }
.date-field.open .date-field-icon { color: var(--accent); }

/* Variante compacte, pour une cellule de grille où la place est comptée. */
.date-field-sm .date-field-trigger { padding: 5px 8px; gap: 6px; font-size: 12.5px; }
.date-field-sm .date-field-icon { width: 14px; height: 14px; }

.date-picker {
    position: fixed; z-index: 9999;
    width: 280px; padding: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: date-picker-in 0.14s ease-out;
}
@keyframes date-picker-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.date-picker-header { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 10px; }
.date-picker-title { flex: 1; text-align: center; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.date-picker-nav {
    width: 28px; height: 28px; padding: 0; flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 15px; line-height: 1; cursor: pointer;
    transition: var(--transition);
}
.date-picker-nav:hover { border-color: var(--accent); color: var(--accent); }

.date-picker-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.date-picker-weekdays span {
    text-align: center; padding: 4px 0;
    font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted);
}

.date-picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-picker-day {
    padding: 7px 0; text-align: center;
    background: transparent; border: none; border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 13px; font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background 0.12s ease;
}
.date-picker-day.empty { cursor: default; }
.date-picker-day:not(.empty):not(:disabled):hover { background: var(--accent-soft); }
.date-picker-day.today { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); font-weight: 600; }
.date-picker-day.selected { background: var(--accent); color: #fff; font-weight: 600; }
.date-picker-day:disabled { opacity: 0.3; cursor: not-allowed; }

.date-picker-footer {
    display: flex; align-items: center;
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}
.date-picker-action {
    border: none; background: transparent; color: var(--accent);
    font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.date-picker-action:hover { text-decoration: underline; }

/* Les <input type="date"> qui subsistent (filtres, champs secondaires) doivent au moins
   suivre le thème : sans color-scheme, la fenêtre native s'ouvre en blanc éclatant
   par-dessus une page sombre. */
input[type="date"], input[type="time"], input[type="datetime-local"] {
    min-width: 150px;
    font-variant-numeric: tabular-nums;
    color-scheme: light;
}
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer; opacity: 0.55; transition: opacity 0.12s ease;
}
input[type="date"]:hover::-webkit-calendar-picker-indicator,
input[type="time"]:hover::-webkit-calendar-picker-indicator,
input[type="datetime-local"]:hover::-webkit-calendar-picker-indicator { opacity: 0.85; }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }

/* ── Champ de référence (guide de style § 5.13b) ─────────────────────────────
   Choisir un ENREGISTREMENT (un client) dans une liste longue, en tapant. Même boîte que
   .input, même chevron que select.input ; la liste est en position:fixed et placée par
   script (chronosDatePicker, App.razor) — jamais rognée par le panneau qui défile. */

.reference-field { position: relative; }

.reference-field-control {
    display: flex; align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.reference-field-control:hover { border-color: var(--text-secondary); }
.reference-field-control:focus-within,
.reference-field.open .reference-field-control {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.reference-field-input {
    flex: 1; min-width: 0; padding: 9px 12px;
    border: none; background: transparent; outline: none;
    color: var(--text-primary);
    font-family: inherit; font-size: 14px; line-height: 1.5;
}
.reference-field-input::placeholder { color: var(--text-muted); }

.reference-field-clear {
    display: none; padding: 2px 8px;
    border: none; background: transparent; color: var(--text-muted);
    font-size: 15px; line-height: 1; cursor: pointer;
}
.reference-field-clear:hover { color: var(--danger); }
.reference-field.has-value .reference-field-clear { display: inline-flex; }

.reference-field-caret {
    display: inline-flex; flex-shrink: 0; margin-right: 11px;
    color: var(--text-muted); cursor: pointer;
    transition: transform 0.15s ease, color 0.15s ease;
}
.reference-field.open .reference-field-caret { color: var(--accent); transform: rotate(180deg); }

.reference-field-menu {
    position: fixed; z-index: 9999; overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: date-picker-in 0.14s ease-out;
}

.reference-field-head {
    display: grid; gap: 12px; padding: 8px 12px;
    background: var(--bg-tertiary); border-bottom: 1px solid var(--border);
    font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted);
}
.reference-field-list { max-height: 260px; overflow: auto; }
.reference-field-option {
    display: grid; gap: 12px; padding: 9px 12px; align-items: center;
    cursor: pointer; border-bottom: 1px solid var(--border-subtle);
    font-size: 14px; color: var(--text-primary);
}
.reference-field-option:last-child { border-bottom: none; }
.reference-field-option:hover,
.reference-field-option.active   { background: var(--accent-soft); }
.reference-field-option.selected .primary { color: var(--accent); }
.reference-field-option .primary { font-weight: 600; font-variant-numeric: tabular-nums; }
.reference-field-option .muted   { color: var(--text-secondary); font-size: 13px; }
.reference-field-option mark     { background: var(--accent-soft-2); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Les colonnes ne s'alignent qu'avec des fractions fixes + troncature, en tête ET en ligne. */
.reference-field-head > span,
.reference-field-option > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.reference-field-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Variante COMPACTE — dans une cellule de grille (le Projet de la saisie) : même boîte, même
   liste, mais à la hauteur des autres champs de la ligne. Le numéro est en chasse fixe, comme
   partout où il se tape ; la liste, elle, garde sa taille normale (voir LargeurMenuMin). */
.reference-field.is-compact .reference-field-input {
    padding: 7px 9px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
}
.reference-field.is-compact .reference-field-caret { margin-right: 8px; }
.reference-field.is-compact .reference-field-clear { padding: 2px 5px; font-size: 13px; }

/* ── Écrans d'entrée : portes, double authentification, mot de passe ──────────
   Rendus statiquement (voir App.razor) sur la même carte que la connexion. */
.auth-card.auth-card-large { max-width: 520px; }
.auth-subtitle { font-size: 13.5px; line-height: 1.55; color: var(--text-muted); margin: 0; }
.auth-sep { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.auth-portes { display: flex; flex-direction: column; gap: 10px; }
.auth-portes .btn-secondary { width: 100%; justify-content: center; text-align: center; }
/* « Qui travaille ? » (démo) : le nom à gauche, le rôle à droite, en sourdine. */
.auth-choix .btn-secondary { display: flex; justify-content: space-between; gap: 12px; }
.auth-choix-role { color: var(--text-muted); font-size: 12px; }
.auth-footer { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.auth-card h2 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 8px 0 0; }

/* Le code QR : un carré blanc à marge calme, même en thème sombre — un lecteur lit mal un code
   inversé. Taille bornée : lisible par un téléphone tenu à 30 cm, sans dévorer la page. */
.qr-double-auth { width: min(220px, 100%); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.qr-double-auth svg { display: block; width: 100%; height: auto; }
.cle-manuelle { font-size: 1.05rem; letter-spacing: .04em; word-break: break-word; user-select: all; }
/* Deux colonnes de codes : ils se recopient ou s'impriment d'un coup d'œil. */
.codes-secours { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; margin: 4px 0; padding-left: 1.4em; font-size: 1.05rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   Usagers & accès — les pièces communes (Usagers, Rôles, Qui a accès à quoi).
   Reprises de Rippa et CamRack, où le contrat a été éprouvé ; le même vivra dans
   le kit : seuls les jetons changent d'une app à l'autre. Globales, parce que le
   CSS isolé d'une page n'atteint pas ses composants enfants (tiroir, modale).
   ═══════════════════════════════════════════════════════════════════════════ */
.section-titre {
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.sous-titre {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin: 16px 0 8px;
}
.etat-texte {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.integration-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.integration-table th {
    text-align: left;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.integration-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: top;
}
.integration-table code,
.etat-texte code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--text-primary);
}

/* Libellés et textes discrets — bornés aux écrans d'accès, pour ne rien changer ailleurs. */
.acces-ecran .field-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.acces-ecran .text-muted { color: var(--text-muted); font-size: 12.5px; }
.acces-ecran .champ + .champ { margin-top: 12px; }
.acces-ecran .actions-ligne { display: flex; flex-wrap: wrap; gap: 6px; }

/* Boutons : le rouge des gestes destructifs (la petite taille .btn-sm existe déjà plus haut). */
.btn-primary.btn-danger { background: var(--status-danger); }
.btn-primary.btn-danger:hover { box-shadow: 0 6px 14px rgba(239, 68, 68, 0.3), 0 2px 4px rgba(0, 0, 0, 0.06); }
/* .btn-danger seul (plus haut) est un bouton plein rouge : sans ces surcharges, son fond
   rouge et son « border: none » l'emportaient sur .btn-secondary, et le texte rouge
   disparaissait dans le fond rouge. La variante secondaire garde le fond et la bordure
   d'un bouton secondaire ; seul le texte passe au rouge. */
.btn-secondary.btn-danger {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--status-danger);
    box-shadow: none;
}
.btn-secondary.btn-danger:hover:not(:disabled) { border-color: var(--status-danger); color: var(--status-danger); transform: none; box-shadow: none; }

/* Pastilles d'état d'un compte (EtatCompte). */
.etat-compte { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* Modale de confirmation — STYLE_GUIDE §5.22. */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center; justify-content: center;
    z-index: 1000;
    animation: modal-backdrop-in 0.18s ease-out;
}
@keyframes modal-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
    width: 460px;
    max-width: calc(100vw - 32px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: modal-card-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-card:focus { outline: none; }
@keyframes modal-card-in {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title { margin: 0 0 10px; font-weight: 600; font-size: 17px; line-height: 1.3; font-family: inherit; letter-spacing: -0.01em; color: var(--text-primary); }
.modal-body  { margin: 0 0 22px; font-size: 14px; line-height: 1.55; color: var(--text-secondary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Tiroir latéral — STYLE_GUIDE §5.23. Pleine largeur sur un téléphone. */
.tiroir-fond {
    position: fixed; inset: 0;
    background: rgba(20, 22, 30, 0.45);
    z-index: 900;
    animation: modal-backdrop-in 0.18s ease-out;
}
.tiroir {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(560px, 100vw);
    display: flex; flex-direction: column;
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg), -12px 0 40px rgba(0, 0, 0, 0.12);
    z-index: 910;
    animation: tiroir-entree 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.tiroir:focus { outline: none; }
@keyframes tiroir-entree { from { transform: translateX(100%); } to { transform: translateX(0); } }
.tiroir-tete {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--border-subtle);
}
.tiroir-titre { margin: 0; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--text-primary); }
.tiroir-sous-titre { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }
.tiroir-fermer {
    border: 0; background: none; cursor: pointer;
    color: var(--text-muted); font-size: 16px; line-height: 1;
    padding: 6px; border-radius: var(--radius-sm);
}
.tiroir-fermer:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.tiroir-corps { flex: 1; overflow-y: auto; padding: 18px 24px; }
.tiroir-pied {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
}
@media (prefers-reduced-motion: reduce) {
    .tiroir, .tiroir-fond, .modal-card, .modal-backdrop { animation: none; }
}

/* Choix de rôles dans le tiroir : une case, le nom, et ce que le rôle ouvre. */
.choix-role {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.choix-role + .choix-role { margin-top: 6px; }
.choix-role:hover { border-color: var(--border); }
.choix-role input { margin-top: 3px; accent-color: var(--accent); }
.choix-role-nom { font-weight: 500; font-size: 13.5px; color: var(--text-primary); }
.choix-role-quoi {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
    font-size: 12.5px; color: var(--text-muted);
}

/* Saisie déléguée dans le tiroir : une liste d'employés à cocher, compacte et sur deux colonnes —
   pas de défilement imbriqué dans le tiroir, qui défile déjà. */
.choix-delegues { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 8px; }
.choix-delegue {
    display: flex; gap: 8px; align-items: center;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px; color: var(--text-primary);
    cursor: pointer;
}
.choix-delegue:hover { border-color: var(--border-subtle); }
.choix-delegue.is-coche { border-color: var(--accent); background: var(--accent-soft); }
.choix-delegue input { accent-color: var(--accent); }

/* Le mot de passe généré, montré une fois (RevelationSecret). */
.revelation-secret { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; scroll-margin-top: 80px; }
.revelation-secret:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.revelation-tete { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.revelation-tete .text-muted { color: var(--text-muted); font-size: 12px; }
.revelation-valeur { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.revelation-code {
    display: inline-block;
    padding: 6px 10px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    user-select: all;
    overflow-wrap: anywhere;
}
.revelation-consigne { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }

/* Les onglets de la configuration sont des LIENS (une adresse par onglet) : même allure que
   les anciens boutons. */
a.config-nav-item { display: block; text-decoration: none; }

/* DataTable : une ligne qui ouvre quelque chose (OnRowClick). */
.data-table tbody tr.ligne-cliquable { cursor: pointer; }
.data-table tbody tr.ligne-selectionnee td { background: var(--accent-soft); }

/* Liste : la recherche avancée (« Chercher aussi dans : »). Les lignes trouvées — et les feuilles
   qui les contiennent — sont mises en évidence, le mot cherché surligné (guide § 5.13b). */
.liste-recherche { margin-bottom: 12px; }
.liste-lignes-head { margin-top: 4px; }
.liste-lignes-head h4 { margin: 0; }
.data-table tbody tr.liste-ligne-trouvee td { background: var(--accent-soft); }
.data-table tbody tr.liste-ligne-trouvee td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.data-table td mark { background: var(--accent-soft-2); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Usagers : l'entête de la liste (titre + « Nouvel usager »), les filtres rapides. */
.entete-liste { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.entete-liste .section-titre { margin-bottom: 0; }
.filtres-acces { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 12px; }
.lien-compte { font-size: 13.5px; font-weight: 600; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.lien-registre { display: block; margin-top: 4px; font-size: 12px; color: var(--accent); }

/* La fiche d'un usager, dans le tiroir : quatre sections dans le même ordre partout. */
.fiche-section + .fiche-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-subtle); }
.fiche-titre {
    margin: 0 0 10px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--text-muted);
}
.fiche-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; font-size: 13.5px; }
.fiche-dl dt { color: var(--text-muted); }
.fiche-dl dd { margin: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.fiche-dl code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12.5px; }
.fiche-etat { margin-bottom: 10px; }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fiche-actions a.btn-secondary { text-decoration: none; }
.champ-ligne { display: flex; gap: 8px; align-items: center; }
.champ-ligne .input { flex: 1; min-width: 0; }
.fiche-historique { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 12.5px; color: var(--text-secondary); }
.fiche-historique li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.fiche-historique .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; color: var(--text-muted); }
@media (max-width: 480px) {
    .fiche-dl { grid-template-columns: 1fr; gap: 2px; }
    .fiche-dl dd { margin-bottom: 8px; }
}

/* Création : les sortes de compte en cartes cliquables. */
.choix-sorte { display: grid; gap: 8px; }
.choix-sorte-carte {
    display: flex; flex-direction: column; gap: 4px; text-align: left;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit; font-size: 13.5px; color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.12s ease, background-color 0.12s ease;
}
.choix-sorte-carte:hover, .choix-sorte-carte:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.choix-sorte-carte .text-muted { font-size: 12.5px; }

/* La liste des usagers garde le tableau de l'app (centré, sans retour à la ligne), sauf deux
   colonnes : l'identifiant, qu'on lit à gauche, et dont la description tient en deux lignes ;
   les rôles, qui passent à la ligne plutôt que de pousser l'état hors de l'écran. */
.data-table td.cellule-compte { text-align: left; white-space: normal; min-width: 180px; max-width: 320px; }
.data-table td.cellule-compte .description-compte {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
    font-size: 12.5px;
}
.data-table td.cellule-roles { white-space: normal; max-width: 240px; }
.data-table td.cellule-texte { text-align: left; white-space: normal; min-width: 280px; }

/* Les droits d'un rôle, rangés par zone (ListeDroitsParZone). */
.droits-par-zone { display: grid; gap: 14px; }
.droit-tout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--status-danger); border-radius: var(--radius-sm); cursor: pointer; }
.zone-droits { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 8px 12px 10px; margin: 0; }
.zone-droits legend { padding: 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.famille-droits + .famille-droits { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-subtle); }
.famille-entete { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 4px; cursor: pointer; }
.droit { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0 5px 12px; cursor: pointer; font-size: 13px; color: var(--text-primary); }
.droit code, .famille-entete code, .droit-tout code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }
.droit .tag { margin-left: 4px; }
.droit .text-muted { font-size: 12px; }
.droit-herite { opacity: 0.75; cursor: default; }
.droit input, .famille-entete input, .droit-tout input { margin-top: 3px; accent-color: var(--accent); }

/* Mon compte (/compte) et Qui a accès à quoi */
.compte-faits { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 13.5px; }
.compte-faits dt { color: var(--text-muted); }
.compte-faits dd { margin: 0; overflow-wrap: anywhere; }
.compte-roles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.compte-droits { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; }
.acces-defilement { overflow-x: auto; }
.acces-defilement td:not(.cellule-texte) { text-align: center; }

/* ⚙ Projets → Import Monday : dans la grille de l'import préparé, une ligne qui retire ou
   désactive porte un liseré ambre — c'est ce qu'il faut avoir lu avant de confirmer. */
.data-table tr.row-attention td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }

/* ⚙ Projets → Import Monday, import préparé : bandeau neutre « rien n'est encore modifié »,
   case à cocher par élément, fiche finale en clair et changement en commentaire dessous. Le
   récapitulatif de confirmation reprend les seuls éléments cochés. */
.form-banner.info { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
.import-selection { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; font-size: 13px; color: var(--text-secondary); }
.import-case { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.import-final-fiche { color: var(--text-primary); font-weight: 500; }
.import-final-commentaire { margin-top: 3px; font-size: 12px; font-style: italic; color: var(--text-muted); }
.import-garanties { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.import-recap { display: grid; gap: 4px; max-height: 360px; overflow-y: auto; padding: 8px; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); margin-bottom: 12px; }
.import-recap-ligne { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; padding: 3px 6px; }
.import-recap-ligne.is-attention { box-shadow: inset 3px 0 0 #f59e0b; }
.import-recap-final { color: var(--text-secondary); }
/* Les colonnes courtes (case, famille, élément, action) se serrent : la place va à la fiche finale. */
.import-prepare .data-table th { white-space: nowrap; }
.import-prepare .data-table td:not(.cell-left) { width: 1%; white-space: normal; }
.import-prepare .data-table td.cell-left { width: auto; }

/* Saisie — « Corrections du réviseur » : la saisie de l'employé barrée, la valeur retenue en
   accent. On lit d'un coup d'œil ce qu'il faut faire autrement la semaine suivante. */
.corrections-revision .correction-avant { color: var(--text-muted); text-decoration: line-through; white-space: normal; }
.corrections-revision .correction-apres { color: var(--accent); font-weight: 600; white-space: normal; }

/* Rapport des corrections — la fenêtre qui suit « Réviser » (RapportCorrections.razor) :
   plus large qu'une confirmation, le texte dans un cadre défilant, Copier / Imprimer PDF
   dans le coin droit de l'en-tête. */
.modal-card.rapport-corrections {
    width: 1040px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}
.rapport-corrections-tete {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.rapport-corrections-outils { display: flex; gap: 8px; flex-shrink: 0; }
.rapport-corrections .modal-body { margin-bottom: 14px; }
/* Le tableau des corrections (TableauCorrections.razor) : une ligne corrigée = un bloc, séparé du
   suivant par un trait plus marqué ; le texte passe à la ligne au lieu de déborder. */
.rapport-corrections-compte { margin: 0 0 8px; font-weight: 600; color: var(--text-primary); }
.rapport-corrections-tableau {
    flex: 1 1 auto;
    min-height: 120px;
    margin: 0 0 16px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.tableau-corrections { white-space: normal; }
.tableau-corrections tbody td { vertical-align: top; text-align: left; overflow-wrap: anywhere; }
.tableau-corrections thead th { text-align: left; }
.tableau-corrections tbody.tc-ligne + tbody.tc-ligne tr:first-child td { border-top: 2px solid var(--border); }
.tableau-corrections tbody tr:hover { background: none; }
.tableau-corrections .tc-jour { white-space: nowrap; }
.tableau-corrections .tc-projet { min-width: 140px; }
.tableau-corrections .tc-champ { font-weight: 600; white-space: nowrap; }
.tableau-corrections .tc-commentaire { min-width: 180px; color: var(--text-secondary); font-style: italic; }
.tableau-corrections .correction-avant { color: var(--text-muted); text-decoration: line-through; }
.tableau-corrections .correction-apres { color: var(--accent); font-weight: 600; }
.tableau-corrections tr.tc-inchangee td.tc-champ,
.tableau-corrections tr.tc-inchangee td.tc-apres { color: var(--text-muted); font-weight: 400; }
.rapport-corrections-texte {
    width: 100%;
    min-height: 180px;
    flex: 1 1 auto;
    margin: 0 0 16px;
    padding: 12px 14px;
    resize: vertical;
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    white-space: pre;
    overflow: auto;
}

