/* Contrôle factures (GP GROUP) — feuille de style
 *
 * Style repris de GPG-DOCS (outil interne GP GROUP) : jetons, composants et mode sombre identiques.
 * Système de design (ui-ux-pro-max) : style « Minimalism & Swiss » pour outil professionnel,
 * mise en page d'application avec barre latérale (240 px), primaire teal #0F766E (texte blanc 5,4:1),
 * neutres ardoise, police Plus Jakarta Sans (hébergée localement), icônes SVG Lucide.
 * Règles : contraste ≥ 4,5:1, focus visible, cibles ≥ 40 px, transitions 150–250 ms,
 * préférences système respectées (mouvement, transparence, contraste, sombre).
 */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("vendor/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("vendor/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
                 U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ========== Jetons ========== */
:root {
  color-scheme: light dark;

  --fond: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --texte: #0f172a;
  --texte-2: #334155;
  --discret: #64748b;
  --bord: #e2e8f0;
  --bord-fort: #cbd5e1;
  --survol: #f1f5f9;
  --appui: #e2e8f0;

  --primaire: #0f766e;
  --primaire-fonce: #115e59;
  --primaire-doux: #ccfbf1;
  --primaire-texte: #0f766e;
  --sur-primaire: #ffffff;
  --anneau: rgba(15, 118, 110, .35);

  --ok-fond: #ecfdf5;      --ok-bord: #10b981;      --ok-texte: #047857;
  --info-fond: #eff6ff;    --info-bord: #3b82f6;    --info-texte: #1d4ed8;
  --alerte-fond: #fffbeb;  --alerte-bord: #f59e0b;  --alerte-texte: #92400e;
  --erreur-fond: #fef2f2;  --erreur-bord: #ef4444;  --erreur-texte: #b91c1c;

  --lateral-fond: #0f172a;
  --lateral-texte: #cbd5e1;
  --lateral-discret: #8391a7;
  --lateral-survol: rgba(255, 255, 255, .06);
  --lateral-actif: rgba(45, 212, 191, .14);
  --lateral-actif-texte: #5eead4;

  --apercu-fond: #1e293b;

  --rayon-s: 6px;
  --rayon: 8px;
  --rayon-l: 12px;
  --ombre-s: 0 1px 2px rgba(15, 23, 42, .06);
  --ombre: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --ombre-l: 0 10px 30px -8px rgba(15, 23, 42, .18), 0 4px 8px -4px rgba(15, 23, 42, .08);

  --vite: 150ms;
  --moyen: 220ms;
  --courbe: cubic-bezier(.4, 0, .2, 1);

  --largeur-laterale: 240px;
  --hauteur-entete: 0px;

  --police: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  font: 400 15px/1.55 var(--police);
  color: var(--texte);
  background: var(--fond);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Sombre : suit le système, sauf si « Clair » est forcé (bouton de thème). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --fond: #0b1220;
    --surface: #111a2e;
    --surface-2: #16213a;
    --texte: #e2e8f0;
    --texte-2: #cbd5e1;
    --discret: #94a3b8;
    --bord: #1e2a44;
    --bord-fort: #2b3a5a;
    --survol: #16213a;
    --appui: #1e2a44;

    --primaire: #14b8a6;
    --primaire-fonce: #2dd4bf;
    --primaire-doux: rgba(20, 184, 166, .15);
    --primaire-texte: #5eead4;
    --sur-primaire: #042f2c;
    --anneau: rgba(45, 212, 191, .4);

    --ok-fond: rgba(16, 185, 129, .12);    --ok-bord: #10b981;    --ok-texte: #6ee7b7;
    --info-fond: rgba(59, 130, 246, .12);  --info-bord: #3b82f6;  --info-texte: #93c5fd;
    --alerte-fond: rgba(245, 158, 11, .12);--alerte-bord: #f59e0b;--alerte-texte: #fcd34d;
    --erreur-fond: rgba(239, 68, 68, .12); --erreur-bord: #ef4444;--erreur-texte: #fca5a5;

    --lateral-fond: #070c17;
    --apercu-fond: #070c17;

    --ombre-s: 0 1px 2px rgba(0, 0, 0, .4);
    --ombre: 0 1px 3px rgba(0, 0, 0, .45);
    --ombre-l: 0 12px 32px -8px rgba(0, 0, 0, .6);
  }
}
/* Sombre forcé par le bouton de thème. */
:root[data-theme="sombre"] {
    --fond: #0b1220;
    --surface: #111a2e;
    --surface-2: #16213a;
    --texte: #e2e8f0;
    --texte-2: #cbd5e1;
    --discret: #94a3b8;
    --bord: #1e2a44;
    --bord-fort: #2b3a5a;
    --survol: #16213a;
    --appui: #1e2a44;

    --primaire: #14b8a6;
    --primaire-fonce: #2dd4bf;
    --primaire-doux: rgba(20, 184, 166, .15);
    --primaire-texte: #5eead4;
    --sur-primaire: #042f2c;
    --anneau: rgba(45, 212, 191, .4);

    --ok-fond: rgba(16, 185, 129, .12);    --ok-bord: #10b981;    --ok-texte: #6ee7b7;
    --info-fond: rgba(59, 130, 246, .12);  --info-bord: #3b82f6;  --info-texte: #93c5fd;
    --alerte-fond: rgba(245, 158, 11, .12);--alerte-bord: #f59e0b;--alerte-texte: #fcd34d;
    --erreur-fond: rgba(239, 68, 68, .12); --erreur-bord: #ef4444;--erreur-texte: #fca5a5;

    --lateral-fond: #070c17;
    --apercu-fond: #070c17;

    --ombre-s: 0 1px 2px rgba(0, 0, 0, .4);
    --ombre: 0 1px 3px rgba(0, 0, 0, .45);
    --ombre-l: 0 12px 32px -8px rgba(0, 0, 0, .6);
  }


:root[data-theme="clair"] { color-scheme: light; }
:root[data-theme="sombre"] { color-scheme: dark; }

/* ========== Base ========== */
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
::selection { background: var(--primaire-doux); }
a { color: var(--primaire-texte); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--primaire); outline-offset: 2px; border-radius: var(--rayon-s); }

h1 { font-size: 1.625rem; line-height: 1.2; letter-spacing: -.025em; font-weight: 700; margin: 0 0 1.25rem; }
h2 { font-size: 1.125rem; line-height: 1.3; letter-spacing: -.015em; font-weight: 650; margin: 0 0 .75rem; }
h3 { font-size: 1rem; line-height: 1.35; letter-spacing: -.01em; font-weight: 650; margin: .75rem 0 .5rem; }
h4 { font-size: .9375rem; font-weight: 600; margin: 0 0 .25rem; }
h2.petit { font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--discret); margin-top: 1.5rem; }
h1 .discret { font-weight: 500; }
p { margin: 0 0 .75rem; }
.discret { color: var(--discret); }
.petit { font-size: .8125rem; line-height: 1.5; }
.texte-erreur { color: var(--erreur-texte); }
.nowrap { white-space: nowrap; }
strong { font-weight: 650; }
code {
  font-family: var(--mono); font-size: .8em; background: var(--surface-2); color: var(--texte-2);
  padding: .1em .4em; border-radius: 4px; border: 1px solid var(--bord); overflow-wrap: anywhere;
}
a code { color: var(--primaire-texte); background: var(--primaire-doux); border-color: transparent; }

.icone { width: 1.125rem; height: 1.125rem; flex: none; vertical-align: -.2em; }

.aller-au-contenu {
  position: fixed; left: 1rem; top: 1rem; z-index: 50; padding: .5rem .9rem; border-radius: var(--rayon);
  background: var(--surface); color: var(--texte); box-shadow: var(--ombre-l);
  transform: translateY(-200%); opacity: 0; pointer-events: none; transition: transform var(--moyen) var(--courbe), opacity var(--moyen);
}
.aller-au-contenu:focus { transform: none; opacity: 1; pointer-events: auto; }

/* ========== Coque de l'application : barre latérale ========== */
body.avec-menu { padding-left: var(--largeur-laterale); }
.barre-laterale {
  position: fixed; inset: 0 auto 0 0; width: var(--largeur-laterale); z-index: 30;
  display: flex; flex-direction: column; gap: 1.25rem; padding: 1.1rem .75rem .9rem;
  background: var(--lateral-fond); color: var(--lateral-texte);
}
.marque { display: flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none !important; padding: 0 .5rem; }
.marque > span:not(.marque-logo) { display: grid; font-weight: 700; font-size: 1rem; letter-spacing: -.02em; color: #f8fafc; line-height: 1.15; }
.marque small { font-size: .6875rem; font-weight: 600; letter-spacing: .08em; color: var(--lateral-discret); }
.marque-logo {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; font-weight: 800; font-size: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.barre-laterale nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.barre-laterale nav a {
  display: flex; align-items: center; gap: .7rem; min-height: 2.5rem; padding: .5rem .7rem; border-radius: var(--rayon);
  color: var(--lateral-texte); font-size: .875rem; font-weight: 500; text-decoration: none;
  transition: background-color var(--vite) var(--courbe), color var(--vite) var(--courbe);
}
.barre-laterale nav a .icone { opacity: .7; }
.barre-laterale nav a:hover { background: var(--lateral-survol); color: #f8fafc; }
.barre-laterale nav a[aria-current="page"] { background: var(--lateral-actif); color: var(--lateral-actif-texte); font-weight: 600; }
.barre-laterale nav a[aria-current="page"] .icone { opacity: 1; }
.nav-titre { margin: 1rem .7rem .35rem; font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--lateral-discret); }
.moi { display: flex; align-items: center; gap: .35rem; padding: .75rem .5rem 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.avatar {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; flex: none;
  background: #1e293b; color: #e2e8f0; font-weight: 700; font-size: .8125rem;
}
.moi-texte { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; flex: 1; line-height: 1.25; }
.moi-nom { font-size: .8125rem; font-weight: 600; color: #f1f5f9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moi-role { font-size: .75rem; color: var(--lateral-discret); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bouton-icone {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--rayon); flex: none;
  padding: 0; border: none; background: transparent; color: inherit; cursor: pointer; transition: background-color var(--vite) var(--courbe), color var(--vite);
}
.bouton-icone:hover { background: var(--lateral-survol); text-decoration: none; }
.barre-laterale .bouton-icone { color: var(--lateral-discret); }
.barre-laterale .bouton-icone:hover { color: #f8fafc; }
.barre-mobile, .voile { display: none; }

.contenu { max-width: 1280px; margin: 0 auto; padding: 2rem 2.25rem 4rem; }
.sans-menu .contenu { max-width: none; padding: 0; }

@media (max-width: 900px) {
  :root { --hauteur-entete: 3.5rem; }
  body.avec-menu { padding-left: 0; }
  .barre-mobile {
    display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 20;
    height: var(--hauteur-entete); padding: 0 .75rem; background: var(--lateral-fond); color: #f8fafc;
  }
  .barre-mobile .marque { font-weight: 700; color: #f8fafc; }
  .barre-laterale { transform: translateX(-100%); transition: transform var(--moyen) var(--courbe); box-shadow: var(--ombre-l); }
  .barre-laterale.ouverte { transform: none; }
  .voile { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15, 23, 42, .5); }
  .contenu { padding: 1.25rem 1rem 3rem; }
}

/* ========== Mise en page ========== */
.titre-page { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.titre-page h1, .titre-page h2 { margin: 0; }
.section { margin-bottom: 2.5rem; }
.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; }
.grille-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }

/* ========== Boutons ========== */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.5rem; padding: .5rem 1rem; border-radius: var(--rayon);
  border: 1px solid var(--bord-fort); background: var(--surface); color: var(--texte);
  font: inherit; font-size: .875rem; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  box-shadow: var(--ombre-s);
  transition: background-color var(--vite) var(--courbe), border-color var(--vite) var(--courbe), box-shadow var(--vite) var(--courbe), transform var(--vite) var(--courbe);
}
.bouton:hover { background: var(--survol); text-decoration: none; }
.bouton:active { transform: translateY(1px); box-shadow: none; }
.bouton.petit { min-height: 2rem; padding: .3rem .75rem; font-size: .8125rem; }
.bouton-principal { background: var(--primaire); border-color: var(--primaire); color: var(--sur-primaire); }
.bouton-principal:hover { background: var(--primaire-fonce); border-color: var(--primaire-fonce); }
.bouton-danger { color: var(--erreur-texte); }
.bouton-danger:hover { background: var(--erreur-fond); border-color: var(--erreur-bord); }
.bouton:disabled { opacity: .5; cursor: not-allowed; }
.lien { background: none; border: none; padding: 0; font: inherit; font-weight: 500; color: var(--primaire-texte); cursor: pointer; border-radius: 4px; }
.lien:hover { text-decoration: underline; text-underline-offset: .2em; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
form.en-ligne { display: inline; }

/* ========== Badges ========== */
.badge, .badge-etat {
  display: inline-flex; align-items: center; gap: .25rem; border-radius: 999px; padding: .1rem .55rem;
  font-size: .75rem; font-weight: 600; line-height: 1.5; background: var(--surface-2); color: var(--texte-2);
  font-variant-numeric: tabular-nums;
}
.badge-etat.ok { background: var(--ok-fond); color: var(--ok-texte); }
.badge-etat.faible { background: var(--alerte-fond); color: var(--alerte-texte); }
.badge-etat.erreur { background: var(--erreur-fond); color: var(--erreur-texte); }

/* ========== Retours ========== */
.alerte {
  display: block; padding: .75rem 1rem; margin: 0 0 .75rem; border-radius: var(--rayon); font-size: .875rem;
  background: var(--alerte-fond); color: var(--alerte-texte);
  border: 1px solid color-mix(in srgb, var(--alerte-bord) 35%, transparent); border-left: 3px solid var(--alerte-bord);
}
.alerte a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: .2em; }
.alerte-erreur { background: var(--erreur-fond); color: var(--erreur-texte); border-color: color-mix(in srgb, var(--erreur-bord) 35%, transparent); border-left-color: var(--erreur-bord); }
.alerte-ok { background: var(--ok-fond); color: var(--ok-texte); border-color: color-mix(in srgb, var(--ok-bord) 35%, transparent); border-left-color: var(--ok-bord); }
.alerte-info { background: var(--info-fond); color: var(--info-texte); border-color: color-mix(in srgb, var(--info-bord) 35%, transparent); border-left-color: var(--info-bord); }

/* ========== Tableaux ========== */
.tableau-conteneur { overflow-x: auto; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon-l); box-shadow: var(--ombre); }
.tableau { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .875rem; font-variant-numeric: tabular-nums; }
.tableau-conteneur .tableau { background: transparent; }
.tableau th, .tableau td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.tableau tbody tr:last-child td { border-bottom: none; }
.tableau th {
  position: sticky; top: var(--hauteur-entete); z-index: 1; background: var(--surface-2);
  font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--discret);
}
.tableau tbody tr { transition: background-color var(--vite) var(--courbe); }
.tableau tbody tr:hover { background: var(--survol); }
.tableau tr.inactif td { color: var(--discret); }
tr.corrige td { background: var(--alerte-fond); }
.tableau td a { font-weight: 600; }

/* ========== Formulaires ========== */
.formulaire { display: grid; gap: 1rem; max-width: 600px; }
.formulaire label { display: grid; gap: .4rem; min-width: 0; font-size: .8125rem; font-weight: 600; color: var(--texte-2); }
.formulaire > *, .grille-2 > *, .fiche > *, .file-validation > * { min-width: 0; }
.formulaire label > input:not([type=checkbox]):not([type=radio]), .formulaire label > select, .formulaire label > textarea { width: 100%; }
.formulaire label.case, label.case { display: flex; align-items: center; gap: .55rem; font-weight: 500; color: var(--texte); font-size: .875rem; }

input[type=text], input[type=email], input[type=number], input[type=date], input[type=search], input[type=url],
input:not([type]), select, textarea {
  min-height: 2.5rem; padding: .5rem .75rem; border: 1px solid var(--bord-fort); border-radius: var(--rayon);
  background: var(--surface); color: var(--texte); font: inherit; font-size: .9375rem; font-weight: 400;
  box-shadow: var(--ombre-s); transition: border-color var(--vite) var(--courbe), box-shadow var(--vite) var(--courbe);
}
select { cursor: pointer; }
textarea { line-height: 1.5; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primaire) 40%, var(--bord-fort)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primaire); box-shadow: 0 0 0 3px var(--anneau); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--discret); box-shadow: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--primaire); width: 1.05rem; height: 1.05rem; margin: 0; cursor: pointer; }
::placeholder { color: var(--discret); opacity: .85; }

.formulaire fieldset {
  display: grid; gap: .75rem; min-width: 0; margin: 0;
  border: 1px solid var(--bord); border-radius: var(--rayon-l); padding: 1rem 1.1rem 1.1rem; background: var(--surface);
}
.formulaire fieldset legend { padding: 0 .4rem; font-weight: 700; font-size: .8125rem; color: var(--texte); }
.formulaire fieldset[disabled] { border: none; padding: 0; background: none; }
.formulaire.compact { gap: .85rem; max-width: none; }
.aide { margin: -.6rem 0 0; }
.ligne-formulaire { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.ligne-formulaire select, .ligne-formulaire input[type=text] { min-height: 2.25rem; padding: .35rem .6rem; }
label.faible { color: var(--alerte-texte); }
label.faible input, label.faible select { background: var(--alerte-fond); border-color: var(--alerte-bord); }

/* ========== Panneaux dépliables ========== */
details.ajout, details.panneau { margin-top: .75rem; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon-l); }
details.ajout > summary, details.panneau > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .55rem;
  padding: .8rem 1rem; font-weight: 600; font-size: .875rem; color: var(--primaire-texte); border-radius: var(--rayon-l);
  transition: background-color var(--vite) var(--courbe);
}
details.ajout > summary::-webkit-details-marker, details.panneau > summary::-webkit-details-marker { display: none; }
details.ajout > summary::before, details.panneau > summary::before {
  content: "+"; display: grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%;
  background: var(--primaire-doux); color: var(--primaire-texte); font-weight: 700; line-height: 1;
  transition: transform var(--moyen) var(--courbe);
}
details[open].ajout > summary::before, details[open].panneau > summary::before { transform: rotate(45deg); }
details.ajout > summary:hover, details.panneau > summary:hover { background: var(--survol); }
details[open].ajout > :not(summary), details[open].panneau > :not(summary) { margin: .25rem 1rem 1rem; }

/* ========== Onglets ========== */
.onglets { display: flex; gap: 1.5rem; margin: -.25rem 0 1.75rem; border-bottom: 1px solid var(--bord); flex-wrap: wrap; }
.onglets a {
  padding: .6rem 0; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--discret);
  font-size: .875rem; font-weight: 600; text-decoration: none; transition: color var(--vite) var(--courbe), border-color var(--vite) var(--courbe);
}
.onglets a:hover { color: var(--texte); text-decoration: none; }
.onglets a[aria-current="page"] { color: var(--primaire-texte); border-bottom-color: var(--primaire); }

/* ========== Accueil ========== */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin: 0 0 2rem; }
.tuile {
  position: relative; display: grid; gap: .2rem; padding: 1.15rem 1.25rem; border-radius: var(--rayon-l);
  background: var(--surface); border: 1px solid var(--bord); box-shadow: var(--ombre); color: var(--texte); text-decoration: none;
  transition: border-color var(--vite) var(--courbe), box-shadow var(--moyen) var(--courbe), transform var(--moyen) var(--courbe);
}
.tuile:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primaire) 45%, var(--bord)); box-shadow: var(--ombre-l); transform: translateY(-1px); }
.tuile-icone {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: var(--rayon); margin-bottom: .6rem;
  background: var(--primaire-doux); color: var(--primaire-texte);
}
.tuile-nombre { font-size: 1.875rem; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tuile-libelle { font-weight: 600; font-size: .875rem; color: var(--texte-2); }
.tuile-aide { font-size: .8125rem; color: var(--discret); }
.tuile-active { border-color: var(--primaire); box-shadow: 0 0 0 1px var(--primaire), var(--ombre); }
.tuile-active .tuile-icone { background: var(--primaire); color: var(--sur-primaire); }

/* ========== Connexion : deux panneaux ========== */
.connexion { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(400px, 1.1fr); min-height: 100vh; }
.connexion-marque {
  display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: 2.5rem 3rem;
  color: #cbd5e1; background:
    radial-gradient(700px 420px at 15% 110%, rgba(20, 184, 166, .28), transparent 60%),
    radial-gradient(520px 360px at 100% 0%, rgba(15, 118, 110, .35), transparent 60%),
    #0b1220;
}
.connexion-marque .marque { padding: 0; }
.connexion-accroche { max-width: 30rem; }
.connexion-titre { font-size: 2.125rem; line-height: 1.15; letter-spacing: -.03em; font-weight: 700; color: #f8fafc; margin: 0 0 1.75rem; }
.connexion-accroche ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.connexion-accroche li { display: flex; align-items: center; gap: .75rem; font-size: .9375rem; }
.connexion-accroche li .icone {
  width: 2rem; height: 2rem; padding: .4rem; border-radius: var(--rayon); color: #5eead4;
  background: rgba(45, 212, 191, .1); box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .2);
}
.connexion-pied { margin: 0; font-size: .8125rem; color: #8391a7; }
.connexion-formulaire { display: grid; place-items: center; padding: 2rem; background: var(--fond); }
.carte-connexion { width: 100%; max-width: 380px; }
.carte-connexion h1 { font-size: 1.75rem; margin-bottom: .4rem; }
.carte-connexion > .discret { margin-bottom: 1.75rem; }
.bouton-google {
  width: 100%; min-height: 3rem; gap: .75rem; font-size: .9375rem; margin-bottom: 1.25rem;
  background: var(--surface); border-color: var(--bord-fort); box-shadow: var(--ombre);
}
.bouton-google:hover { background: var(--surface-2); border-color: var(--discret); }
.logo-google { width: 1.25rem; height: 1.25rem; flex: none; }
@media (max-width: 860px) {
  .connexion { grid-template-columns: 1fr; }
  .connexion-marque { padding: 1.5rem; gap: 1rem; }
  .connexion-accroche, .connexion-pied { display: none; }
  .connexion-formulaire { align-items: start; padding: 2.5rem 1.25rem; }
}

/* ========== Dépôt ========== */
.zone-depot {
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: .75rem;
  min-height: 200px; padding: 1.5rem; border: 2px dashed var(--bord-fort); border-radius: var(--rayon-l);
  background: var(--surface); color: var(--texte-2); font-weight: 600; text-align: center; cursor: pointer; position: relative;
  transition: border-color var(--vite) var(--courbe), background-color var(--vite) var(--courbe);
}
.zone-depot::before {
  content: ""; width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--primaire-doux) no-repeat center / 1.4rem
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m17 8-5-5-5 5'/%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3C/svg%3E");
}
.zone-depot:hover, .zone-depot.survol { border-color: var(--primaire); background: color-mix(in srgb, var(--primaire-doux) 40%, var(--surface)); }
.zone-depot input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.filtres { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1.25rem; }
.filtres select, .filtres input { min-height: 2.25rem; padding: .35rem .65rem; font-size: .875rem; }
.filtres .recherche { flex: 1 1 100%; min-height: 2.75rem; padding: .6rem 1rem; font-size: 1rem; }
.pagination { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 1.25rem; font-variant-numeric: tabular-nums; }

.journal { list-style: none; padding: 0; margin: 0; }
.journal li { padding: .55rem 0; border-bottom: 1px solid var(--bord); color: var(--texte-2); }
.journal li:last-child { border-bottom: none; }

/* ========== Contrôle factures : compléments propres à l'application ========== */
/* Fil d'Ariane (repris de la fiche GPG-DOCS). */
.fil-ariane { display: flex; align-items: center; gap: .35rem; margin: 0 0 .75rem; font-size: .8125rem; color: var(--discret); min-width: 0; }
.fil-ariane .icone { width: .9rem; height: .9rem; opacity: .6; }
.fil-ariane span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Carte : panneau de surface (formulaires d'ajout, import, résumé). */
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon-l); padding: 1.1rem 1.25rem; box-shadow: var(--ombre); margin-bottom: 1.5rem; }
.carte > h2:first-child { margin-top: 0; }
.carte > :last-child { margin-bottom: 0; }
.carte-etroite { max-width: 600px; }
.carte-centree { max-width: 560px; margin: 2rem auto; }

/* États de facture : badge-etat (ok / faible / erreur, repris) + info et neutre. */
.badge-etat.info { background: var(--info-fond); color: var(--info-texte); }
.badge-etat.neutre { background: var(--surface-2); color: var(--discret); }
.badge-etat .icone { width: .85rem; height: .85rem; }

/* Tags de facture : 8 teintes déduites du nom (filtre couleur_tag). */
.tag {
  display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .1rem .6rem;
  font-size: .75rem; font-weight: 600; line-height: 1.5; text-decoration: none !important; white-space: nowrap;
  background: var(--tag-fond); color: var(--tag-texte); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag-texte) 18%, transparent);
}
a.tag { transition: box-shadow var(--vite) var(--courbe); }
a.tag:hover { box-shadow: inset 0 0 0 1px var(--tag-texte); }
.tag.choisi { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primaire); }
.tag form { display: inline; }
.tag button { all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 1rem; height: 1rem; border-radius: 50%; opacity: .65; font-size: .95rem; line-height: 1; }
.tag button:hover { opacity: 1; background: color-mix(in srgb, var(--tag-texte) 15%, transparent); }
.tag button:focus-visible { outline: 2px solid var(--primaire); outline-offset: 1px; opacity: 1; }
.tag-1 { --tag-fond: #f1f5f9; --tag-texte: #334155; }
.tag-2 { --tag-fond: #eff6ff; --tag-texte: #1d4ed8; }
.tag-3 { --tag-fond: #ecfdf5; --tag-texte: #047857; }
.tag-4 { --tag-fond: #fffbeb; --tag-texte: #92400e; }
.tag-5 { --tag-fond: #fff1f2; --tag-texte: #be123c; }
.tag-6 { --tag-fond: #f5f3ff; --tag-texte: #6d28d9; }
.tag-7 { --tag-fond: #ecfeff; --tag-texte: #0e7490; }
.tag-8 { --tag-fond: #fff7ed; --tag-texte: #9a3412; }
/* Sombre : suit le système, sauf si « Clair » est forcé (bouton de thème). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .tag-1 { --tag-fond: rgba(148, 163, 184, .14); --tag-texte: #cbd5e1; }
  :root:not([data-theme="clair"]) .tag-2 { --tag-fond: rgba(59, 130, 246, .14);  --tag-texte: #93c5fd; }
  :root:not([data-theme="clair"]) .tag-3 { --tag-fond: rgba(16, 185, 129, .14);  --tag-texte: #6ee7b7; }
  :root:not([data-theme="clair"]) .tag-4 { --tag-fond: rgba(245, 158, 11, .14);  --tag-texte: #fcd34d; }
  :root:not([data-theme="clair"]) .tag-5 { --tag-fond: rgba(244, 63, 94, .14);   --tag-texte: #fda4af; }
  :root:not([data-theme="clair"]) .tag-6 { --tag-fond: rgba(139, 92, 246, .16);  --tag-texte: #c4b5fd; }
  :root:not([data-theme="clair"]) .tag-7 { --tag-fond: rgba(6, 182, 212, .14);   --tag-texte: #67e8f9; }
  :root:not([data-theme="clair"]) .tag-8 { --tag-fond: rgba(249, 115, 22, .14);  --tag-texte: #fdba74; }
}
/* Sombre forcé par le bouton de thème. */
:root[data-theme="sombre"] .tag-1 { --tag-fond: rgba(148, 163, 184, .14); --tag-texte: #cbd5e1; }
  :root[data-theme="sombre"] .tag-2 { --tag-fond: rgba(59, 130, 246, .14);  --tag-texte: #93c5fd; }
  :root[data-theme="sombre"] .tag-3 { --tag-fond: rgba(16, 185, 129, .14);  --tag-texte: #6ee7b7; }
  :root[data-theme="sombre"] .tag-4 { --tag-fond: rgba(245, 158, 11, .14);  --tag-texte: #fcd34d; }
  :root[data-theme="sombre"] .tag-5 { --tag-fond: rgba(244, 63, 94, .14);   --tag-texte: #fda4af; }
  :root[data-theme="sombre"] .tag-6 { --tag-fond: rgba(139, 92, 246, .16);  --tag-texte: #c4b5fd; }
  :root[data-theme="sombre"] .tag-7 { --tag-fond: rgba(6, 182, 212, .14);   --tag-texte: #67e8f9; }
  :root[data-theme="sombre"] .tag-8 { --tag-fond: rgba(249, 115, 22, .14);  --tag-texte: #fdba74; }

.liste-tags { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.ajout-tag { display: inline-flex; align-items: center; gap: .25rem; }
.ajout-tag input { min-height: 1.75rem !important; width: 6.5rem !important; min-width: 0 !important; padding: .15rem .55rem !important; font-size: .75rem !important; border-radius: 999px !important; box-shadow: none !important; }
.ajout-tag .lien { font-size: .75rem; }

/* Formulaire d'ajout à la grille depuis le rapport. */
.ajout-grille { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.ajout-grille input { width: 7.5rem !important; min-width: 0 !important; }
.ajout-grille .bouton { white-space: nowrap; }

/* Dans un conteneur à défilement horizontal, l'en-tête collant se cale sur le
   conteneur et non sur la page : sans ce zéro, il laisse une bande vide sur mobile. */
.tableau-conteneur .tableau th { top: 0; }

/* Saisie dans les tableaux (correction des lignes, prix) : champs compacts. */
.tableau input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .tableau select { min-height: 2.25rem; padding: .35rem .6rem; font-size: .875rem; width: 100%; min-width: 5rem; }
.tableau td.nombre, .tableau th.nombre { text-align: right; white-space: nowrap; }
.tableau td.code, .code { font-family: var(--mono); font-size: .8125rem; white-space: nowrap; }
.tableau td.actions-ligne { white-space: nowrap; text-align: right; }
.tableau td.actions-ligne > * + * { margin-left: .75rem; }
.tableau td.haut, .tableau tr.haut td { vertical-align: top; }
.tableau .vide { text-align: center; color: var(--discret); padding: 2rem 1rem; }

/* Rapport : la ligne prend la teinte de son statut, avec un filet à gauche. */
.tableau tr.statut-non_conforme td { background: var(--erreur-fond); }
.tableau tr.statut-a_verifier td { background: var(--alerte-fond); }
.tableau tr.statut-absente td { background: color-mix(in srgb, var(--alerte-fond) 55%, var(--surface)); }
.tableau tr.statut-non_conforme td:first-child { box-shadow: inset 3px 0 0 var(--erreur-bord); }
.tableau tr.statut-a_verifier td:first-child { box-shadow: inset 3px 0 0 var(--alerte-bord); }
.tableau tr.statut-absente td:first-child { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--alerte-bord) 55%, transparent); }
.repere { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; margin-left: .25rem; border-radius: 50%; font-size: .75rem; font-weight: 700; cursor: help; }
.repere.ton-erreur { background: var(--erreur-fond); color: var(--erreur-texte); }
.repere.ton-alerte { background: var(--alerte-fond); color: var(--alerte-texte); }
.repere.ton-neutre { background: var(--surface-2); color: var(--discret); }
.ecart-positif { color: var(--erreur-texte); font-weight: 600; }
.ecart-negatif { color: var(--ok-texte); font-weight: 600; }

/* Tuiles de statut cliquables (filtre du rapport) : tons d'état sur l'icône. */
.tuile-icone.ton-ok { background: var(--ok-fond); color: var(--ok-texte); }
.tuile-icone.ton-alerte { background: var(--alerte-fond); color: var(--alerte-texte); }
.tuile-icone.ton-erreur { background: var(--erreur-fond); color: var(--erreur-texte); }
.tuiles.compactes { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.tuiles.compactes .tuile { padding: .9rem 1rem; }
.tuiles.compactes .tuile-nombre { font-size: 1.5rem; }
.totaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0; margin: 0; }
.totaux > div { padding: .25rem 0; }
.totaux dt { font-size: .75rem; font-weight: 600; color: var(--discret); }
.totaux dd { margin: 0; font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

/* Dépôt de factures : zone de dépôt reprise, en ligne avec son bouton. */
.depot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; margin-bottom: 1.5rem; }
.depot .zone-depot { min-height: 120px; flex-direction: row; gap: 1rem; }
.depot .zone-depot span { display: grid; gap: .1rem; text-align: left; }
.depot .zone-depot small { font-weight: 400; color: var(--discret); }
@media (max-width: 700px) { .depot { grid-template-columns: 1fr; } }

/* Formulaire en grille (ajout de tarif, filtres du journal). */
.grille-formulaire { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem 1rem; align-items: end; }
.grille-formulaire label { display: grid; gap: .4rem; font-size: .8125rem; font-weight: 600; color: var(--texte-2); min-width: 0; }
.grille-formulaire label > input:not([type=checkbox]), .grille-formulaire label > select { width: 100%; }
.grille-formulaire label.case { display: flex; align-items: center; min-height: 2.5rem; font-weight: 500; color: var(--texte); font-size: .875rem; }
.grille-formulaire .large { grid-column: span 2; }
.grille-formulaire .pleine { grid-column: 1 / -1; }
@media (max-width: 500px) { .grille-formulaire .large { grid-column: auto; } }

/* Détail dépliable d'un tarif, sous sa ligne. */
.tableau tr.detail td { padding-top: 0; background: var(--surface-2); }
.tableau tr.detail:hover, .tableau tr.detail:hover td { background: var(--surface-2); }
.tableau tr.avec-detail td { border-bottom: none; }
.tableau tr.detail details > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; min-height: 2rem; font-size: .8125rem; font-weight: 600; color: var(--primaire-texte); }
.tableau tr.detail details > summary::-webkit-details-marker { display: none; }
.tableau tr.detail details > summary .icone { width: .9rem; height: .9rem; transition: transform var(--moyen) var(--courbe); }
.tableau tr.detail details[open] > summary .icone { transform: rotate(90deg); }
.tableau tr.detail details[open] { padding-bottom: .75rem; }
.sous-titre { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--discret); margin: 1rem 0 .35rem; }
.vide-etat { padding: 1.5rem 1.5rem 1.25rem; }
.vide-etat ol { margin: .5rem 0 1rem; padding-left: 1.25rem; color: var(--texte-2); }
.vide-etat li { margin-bottom: .25rem; }
.voile[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ========== Préférences système ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .tuile:hover, .bouton:active { transform: none; }
}
@media (prefers-contrast: more) {
  :root { --bord: #94a3b8; --bord-fort: #475569; --discret: #334155; }
}
/* Sombre : suit le système, sauf si « Clair » est forcé (bouton de thème). */
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) { --bord: #64748b; --bord-fort: #94a3b8; --discret: #cbd5e1; }
}
@media (prefers-contrast: more) {
  :root[data-theme="sombre"] { --bord: #64748b; --bord-fort: #94a3b8; --discret: #cbd5e1; }
}
