/*
 * QARNITAcrm — la charte de QARNITAlab, reprise telle quelle.
 *
 * Les jetons sont ceux de `qarnita/lab/assets/css/app.css`, mêmes noms, mêmes
 * valeurs, dans les deux thèmes : encre #16181A et minium #D8542A maîtres,
 * neutres CHAUDS. Une règle tient tout, comme au lab : le minium est réservé
 * à l'ACTION et à la MARQUE. Les états (une étape, une alerte) prennent les
 * couleurs de sens — jaune signal, vert, carmin — ou restent à l'encre.
 *
 * Sombre par défaut ; clair par préférence de l'appareil, ou par
 * <html data-theme="clair">. Les deux listes du clair doivent rester
 * identiques.
 */

/* IBM PLEX MONO, découpée par alphabet comme au lab. Space Grotesk n'a pas
   de fichier au lab non plus : la pile de secours prend le relais, et déposer
   `space-grotesk.woff2` dans fonts/ (avec sa déclaration) suffira ici aussi. */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  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+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  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;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
  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+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-ext-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
  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;
}

:root {
  --app: #101113;
  --barre: #16181A;
  --champ: #212325;
  --carte: #1E2023;
  --overlay: #141517;
  --filet: #2C2E30;
  --filet-champ: #34373A;
  --filet-actif: #F0784E;
  --neutre: #2A2C2E;
  --choix: #2E1A12;
  --texte: #FBFAF8;
  --texte-2: #D6D1CA;
  --texte-3: #A29A90;
  --marque-encre: #FBFAF8;
  --marque-accent: #F0784E;
  --accent: #F0784E;
  --action: #F0784E;
  --action-texte: #16181A;
  --action-survol: #F58F6A;
  --action-appui: #E0653A;
  --alerte: #E3C34A;
  --succes: #6FA383;
  --danger: #E0687F;
  --danger-fond: #3A2126;
  /* LES BLOCS ET LES LIGNES (maquette du 15/10) : un bloc se détache par un
     filet discret mais visible, qui s'allume au survol ; dans toute liste, la
     ligne survolée s'éclaire. Ni ombre, ni enfoncement. */
  --filet-bloc: #3A3D41;
  --bloc-allume: rgb(240 120 78 / 75%);
  --survol-ligne: #26292D; --tete-bloc: #2F2726; --fond-ligne: #191B1E;

  --police: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --police-valeur: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="sombre"]) {
    --app: #F2F0EC; --barre: #FBFAF8; --champ: #FFFFFF; --carte: #FFFFFF; --overlay: #FBFAF8;
    --filet: #DED8CF; --filet-champ: #C4BCB1; --filet-actif: #D8542A;
    --neutre: #E8E3DB; --choix: #F7E5DC;
    --texte: #16181A; --texte-2: #4A453E; --texte-3: #6B655C;
    --marque-encre: #16181A; --marque-accent: #D8542A;
    --accent: #A33A1C; --action: #C4471F; --action-texte: #FFFFFF;
    --action-survol: #BE441D; --action-appui: #A33A1C;
    --alerte: #8A6A18; --succes: #4A7A5C; --danger: #8E2F2F; --danger-fond: #F5E3E3;
    --filet-bloc: #CFC8BD; --bloc-allume: rgb(216 84 42 / 70%); --survol-ligne: #F1ECE5; --tete-bloc: #F7EDEB; --fond-ligne: #FAF8F5;
    color-scheme: light;
  }
}
:root[data-theme="clair"] {
  --app: #F2F0EC; --barre: #FBFAF8; --champ: #FFFFFF; --carte: #FFFFFF; --overlay: #FBFAF8;
  --filet: #DED8CF; --filet-champ: #C4BCB1; --filet-actif: #D8542A;
  --neutre: #E8E3DB; --choix: #F7E5DC;
  --texte: #16181A; --texte-2: #4A453E; --texte-3: #6B655C;
  --marque-encre: #16181A; --marque-accent: #D8542A;
  --accent: #A33A1C; --action: #C4471F; --action-texte: #FFFFFF;
  --action-survol: #BE441D; --action-appui: #A33A1C;
  --alerte: #8A6A18; --succes: #4A7A5C; --danger: #8E2F2F; --danger-fond: #F5E3E3;
  --filet-bloc: #CFC8BD; --bloc-allume: rgb(216 84 42 / 70%); --survol-ligne: #F1ECE5; --tete-bloc: #F7EDEB; --fond-ligne: #FAF8F5;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 var(--police);
  color: var(--texte-2);
  background: var(--app);
}
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { color: var(--texte); font-weight: 600; }
.valeur { font-family: var(--police-valeur); font-size: .86em; font-variant-numeric: tabular-nums; }
.sourd { color: var(--texte-3); }

/* ─── Le logotype : [méduse] QARNITAcrm, comme QARNITAlab ─── */

.marque { margin: 0; display: flex; align-items: center; font-size: 1.0625rem; line-height: 1; white-space: nowrap; }
.marque-lien { display: flex; align-items: center; gap: .42em; color: inherit; text-decoration: none; }
.marque-lien:focus-visible { outline: 2px solid var(--filet-actif); outline-offset: 3px; border-radius: 3px; }
.marque-symbole { flex: 0 0 auto; height: 1.72em; width: calc(1.72em * 85 / 114); }
.marque-symbole .filaments path,
.marque-symbole .filaments rect { fill: none; stroke: var(--marque-encre); stroke-width: 5; stroke-linejoin: round; }
.marque-symbole .filament-accent { fill: none; stroke: var(--marque-accent); stroke-width: 5; }
.marque-mot { font-weight: 600; letter-spacing: .10em; color: var(--marque-encre); }
.marque-produit { font-weight: 400; letter-spacing: .01em; margin-left: -.04em; color: var(--marque-accent); }

/* ─── La barre du haut ─── */

.app-header {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: .55rem 1rem;
  background: var(--barre);
  border-bottom: 1px solid var(--filet);
}
.views { display: flex; align-items: center; gap: .25rem; }
/* Les onglets du lab : le courant est une surface pleine, pas une touche en
   relief — c'est la valeur du fond qui dit où l'on est. */
.view {
  padding: .3rem .8rem;
  border: 1px solid color-mix(in srgb, var(--texte-3) 22%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--neutre) 40%, transparent);
  color: var(--texte-3);
  text-decoration: none;
  font-size: .9rem;
  white-space: nowrap;
}
.view:hover { background: var(--neutre); border-color: color-mix(in srgb, var(--texte-3) 30%, transparent); color: var(--texte-2); }
.view.active { color: var(--texte-2); border-color: color-mix(in srgb, var(--texte-3) 45%, transparent); background: var(--neutre); }
.outils-entete { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
/* des onglets de page (Ventes : devis, factures) : soulignés, sous le titre */
.onglets-page { display: flex; gap: 1.4rem; border-bottom: 1px solid var(--filet); }
.onglets-page a { padding: .4rem 0; color: var(--texte-3); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.onglets-page a:hover { color: var(--texte-2); }
.onglets-page a.active { color: var(--texte); border-bottom-color: var(--texte-2); }
.outils-entete form { display: contents; }
.qui { font-size: .85rem; color: var(--texte-3); text-decoration: none; margin-right: .3rem; white-space: nowrap; }
/* la barre se resserre avant de passer à la ligne : le mot « Chercher » d'abord, puis le nom */
@media (max-width: 1360px) { .chercher-partout .chercher-mot { display: none; } }
.app-header .qui-icone { display: none; }
@media (max-width: 1220px) { .app-header .qui { display: none; } .app-header .qui-icone { display: inline-grid; } .app-header { gap: .9rem; } }
/* puis la recherche n'est plus que sa loupe, et les onglets se serrent */
@media (max-width: 1180px) {
  .chercher-partout kbd { display: none; }
  .chercher-partout { width: 2.1rem; padding: 0; justify-content: center; margin-right: 0; }
  .view { padding: .3rem .6rem; }
}
/* enfin les onglets passent sur leur propre ligne, et s'y replient s'il le faut */
@media (max-width: 1020px) {
  .app-header { flex-wrap: wrap; row-gap: .5rem; }
  .views { order: 3; width: 100%; flex-wrap: wrap; }
}
.qui:hover { color: var(--texte-2); }
.btn-icone {
  width: 2.1rem; height: 2.1rem;
  display: inline-grid; place-items: center;
  padding: 0;
  border: 1px solid transparent; border-radius: 4px;
  background: none; color: var(--texte-3);
  cursor: pointer;
}
.btn-icone:hover, .btn-icone.active { color: var(--texte); background: var(--neutre); border-color: var(--filet-champ); }
.btn-icone svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Page ─── */

.page {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 6rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.page-tete { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; }
.page-tete h1 { margin: 0; font-size: 1.7rem; line-height: 1.15; }
.page-tete .gestes { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.page-tete .gestes form { display: contents; }
.surtitre {
  margin: 0 0 .3rem;
  font-family: var(--police-valeur);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--texte-3);
}
.retour { color: var(--texte-3); text-decoration: none; font-size: .82rem; font-family: var(--police-valeur); }
.retour:hover { color: var(--accent); }
.vide {
  margin: 0; padding: 2rem 1.4rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: .8rem;
  color: var(--texte-3);
  border: 1px solid var(--filet-bloc); border-radius: 10px; background: var(--carte);
}
.vide strong { color: var(--texte); font-weight: 600; font-size: 1.05rem; }
/* dans un bloc, l'état vide est une ligne sourde */
.fiche .vide-bloc { margin: 0; padding: .9rem; color: var(--texte-3); }

/* ─── Touches : celles du lab, rectangulaires ─── */

.bouton {
  font: inherit;
  font-size: .88rem;
  white-space: nowrap;
  padding: .38rem .8rem;
  border: 1px solid var(--filet-champ);
  border-radius: 4px;
  background: var(--neutre);
  color: var(--texte-2);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: background-color 90ms, border-color 90ms, transform 90ms;
}
.bouton:hover { border-color: var(--filet-actif); color: var(--texte); }
.bouton:active { transform: translateY(1px); background: var(--champ); }
/* la touche qui engage : le minium en aplat, l'encre par-dessus */
.bouton.principal { color: var(--action-texte); border-color: var(--action); background: var(--action); font-weight: 600; }
.bouton.principal:hover { background: var(--action-survol); border-color: var(--action-survol); }
.bouton.principal:active { background: var(--action-appui); border-color: var(--action-appui); }
.bouton.danger { color: var(--danger); background: transparent; }
.bouton.danger:hover { background: var(--danger-fond); border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.bouton.petit { font-size: .78rem; padding: .2rem .55rem; }
.bouton:focus-visible, .view:focus-visible, .ligne:focus-visible, .btn-icone:focus-visible, .filtre:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ─── Filtres : des onglets, comme la barre ─── */

.filtres { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.filtre {
  font-size: .82rem;
  padding: .25rem .65rem;
  border: 1px solid color-mix(in srgb, var(--texte-3) 22%, transparent);
  border-radius: 4px;
  color: var(--texte-3);
  text-decoration: none;
}
.filtre:hover { background: var(--neutre); color: var(--texte-2); }
.filtre.active { background: var(--neutre); color: var(--texte); border-color: color-mix(in srgb, var(--texte-3) 45%, transparent); }
.filtre .compteur { font-family: var(--police-valeur); font-size: .78em; margin-left: .35rem; color: var(--texte-3); }
.separe { width: 1px; align-self: stretch; background: var(--filet); margin: 0 .3rem; }
.recherche { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.recherche input[type="search"] { flex: 1; min-width: 14rem; }
.case { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--texte-2); cursor: pointer; }
.case input { accent-color: var(--action); }

/* ─── Lignes : les cartes du lab ─── */

.lignes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.ligne {
  display: flex; align-items: center; gap: .9rem;
  padding: .7rem .9rem;
  border: 1px solid var(--filet-bloc);
  border-radius: 8px;
  background: var(--carte);
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms, background 100ms;
}
.ligne:hover { border-color: var(--bloc-allume); background: var(--survol-ligne); }
/* dans un bloc, chaque élément est une petite carte : son cadre, un fond un ton
   sous le bloc, un écart avec le suivant ; son cadre s'allume au survol */
.fiche .lignes { gap: .4rem; padding: 0; }
.fiche .ligne { border: 1px solid var(--filet); border-radius: 8px; background: var(--fond-ligne); padding: .6rem .8rem; }
.fiche .ligne:hover { border-color: var(--bloc-allume); background: var(--survol-ligne); }
/* toute ligne survolée s'éclaire, quelle que soit la liste ; un tableau aussi, même sans ligne qui s'ouvre
   (sauf le tableau croisé, dont les cases sont des gestes) */
.rang { cursor: pointer; transition: background 100ms; }
.rang:hover, .tableau:not(.croise) tbody tr:hover { background: var(--survol-ligne); }
.ligne.eteinte { opacity: .6; }
.ligne-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.ligne-nom { color: var(--texte); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-sous { font-size: .82rem; color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-cote { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; flex-shrink: 0; font-size: .82rem; }
.ligne-note { font-size: .82rem; color: var(--texte-2); margin-top: .2rem; white-space: pre-line; }
.ligne-gestes { display: flex; gap: .35rem; flex-shrink: 0; }
.ligne-gestes form { display: contents; }
/* les initiales de qui suit la fiche */
.initiales {
  display: inline-grid; place-items: center;
  width: 1.7rem; height: 1.7rem;
  border: 1px solid var(--filet-champ); border-radius: 50%;
  font-family: var(--police-valeur); font-size: .68rem;
  color: var(--texte-2);
}

/* ─── Pastilles : une couleur de SENS, jamais le minium ─── */

.pastille {
  --etat: var(--texte-3);
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .08rem .5rem;
  border: 1px solid color-mix(in srgb, var(--etat) 45%, transparent);
  border-radius: 4px;
  font-size: .74rem;
  color: var(--etat);
  background: color-mix(in srgb, var(--etat) 10%, transparent);
  white-space: nowrap;
}
.pastille::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: var(--etat); }
/* La couleur vient du SENS que la valeur porte dans les réglages. Neutre :
   diode creuse, rien n'est encore engagé ; éteint : le gris, estompé. */
.pastille[data-sens="neutre"] { --etat: var(--texte-2); }
.pastille[data-sens="neutre"]::before,
.pastille[data-sens="eteint"]::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--etat); }
.pastille[data-sens="succes"] { --etat: var(--succes); }
.pastille[data-sens="alerte"] { --etat: var(--alerte); }
.pastille[data-sens="danger"] { --etat: var(--danger); }
.pastille[data-sens="eteint"] { opacity: .8; }

/* ─── Signaux : ce qui demande un regard, en jaune signal ─── */

.signal {
  display: inline-block; margin-left: .35rem; padding: 0 .4rem;
  border: 1px solid color-mix(in srgb, var(--alerte) 50%, transparent); border-radius: 4px;
  font-size: .7rem; font-weight: 400; color: var(--alerte); vertical-align: .1em;
}
.signal-texte { color: var(--alerte); }
.avertissement {
  margin: 0; padding: .65rem .9rem;
  border: 1px solid color-mix(in srgb, var(--alerte) 45%, transparent);
  border-left: 3px solid var(--alerte);
  border-radius: 6px;
  background: color-mix(in srgb, var(--alerte) 8%, transparent);
  color: var(--texte);
  font-size: .9rem;
}
.avertissement.avec-geste { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.avertissement.avec-geste form, .avertissement.avec-geste > .bouton { margin-left: auto; }
.filtre.alerte { color: var(--alerte); }

/* ─── Fiche ─── */

.fiche {
  border: 1px solid var(--filet-bloc);
  border-radius: 10px;
  background: var(--carte);
  transition: border-color 120ms;
}
.fiche:hover { border-color: var(--bloc-allume); }
.fiche-barre { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .3rem .9rem; min-height: 2.25rem; border-bottom: 1px solid var(--filet); background: var(--tete-bloc); }
/* l'en-tête suit l'arrondi du bloc ; seul, il en prend aussi le bas */
.fiche > .fiche-barre:first-child { border-radius: 9px 9px 0 0; }
.fiche > .fiche-barre:only-child { border-radius: 9px; border-bottom: 0; }
.fiche-barre h2 { margin: 0; font-size: .92rem; line-height: 1.3; }
/* dans l'en-tête, les touches et les filtres se font petits : il reste une ligne fine */
.fiche-barre .bouton.petit, .fiche-barre .filtre { padding-top: .1rem; padding-bottom: .1rem; }
.fiche-barre .bouton.ajout { min-width: 1.6rem; height: 1.5rem; }
.fiche-barre .gestes { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; }
.fiche-corps { padding: .9rem; }
.fiche > .lignes { padding: .6rem; }
.fiche > .lignes + .lignes { padding-top: 0; }
.fiche > p.fiche-corps { margin: 0; }

.releve { margin: 0; display: grid; grid-template-columns: 9rem 1fr; gap: .5rem 1rem; }
.releve dt { color: var(--texte-3); font-size: .78rem; padding-top: .1rem; }
.releve dd { margin: 0; color: var(--texte); overflow-wrap: anywhere; }
.texte-libre { white-space: pre-line; }
/* un numéro de téléphone ne se coupe pas en deux */
.insecable { white-space: nowrap; }

.fiche-barre .gestes form { display: contents; }
.fiche-corps > p:first-child { margin-top: 0; }
.aide.pied { margin-top: .8rem; }
.sous-titre { margin: .3rem 0 0; font-size: .9rem; }

/* ─── Formulaires : les champs du lab, rectangulaires ─── */

.forme { display: flex; flex-direction: column; gap: .9rem; padding: 1rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.row.trois { grid-template-columns: 2fr 1fr 2fr; }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field > span { font-size: .78rem; color: var(--texte-3); }
/* un intertitre dans un long formulaire */
.rubrique { margin: .4rem 0 -.3rem; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--texte-3); }
.rubrique:first-of-type { margin-top: 0; }
.rubrique .facultatif { text-transform: none; letter-spacing: 0; font-weight: 400; }
.field .facultatif { opacity: .8; }
.field input, .field select, .field textarea, .recherche input[type="search"], .recherche input[type="date"], .recherche select {
  font: inherit;
  font-size: .92rem;
  padding: .42rem .55rem;
  border: 1px solid var(--filet-champ);
  border-radius: 4px;
  background: var(--champ);
  color: var(--texte-2);
  width: 100%;
}
.field textarea { resize: vertical; min-height: 6em; }
/* le champ en cours se signale par son filet : c'est le seul repère qui dit où l'on tape */
.field input:focus, .field select:focus, .field textarea:focus, .recherche input[type="search"]:focus, .recherche select:focus {
  outline: none;
  border-color: var(--filet-actif);
  box-shadow: inset 0 0 0 1px var(--filet-actif);
  color: var(--texte);
}
.field.en-erreur input, .field.en-erreur select, .field.en-erreur textarea { border-color: var(--danger); }
.erreur { color: var(--danger); font-size: .8rem; }
.aide { font-size: .78rem; color: var(--texte-3); margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* ─── Suivi : actions et fil des notes ─── */

/* le nombre d'actions qui attendent, sur l'onglet : le jaune signal, pas le minium */
.nombre-signal {
  display: inline-grid; place-items: center;
  min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; margin-left: .3rem;
  border-radius: 999px;
  /* le fond de page : sombre sur le jaune vif du thème sombre, clair sur le jaune foncé du clair */
  background: var(--alerte); color: var(--app);
  font-family: var(--police-valeur); font-size: .68rem; font-weight: 600;
}
.groupe { display: flex; flex-direction: column; gap: .45rem; }
.groupe .rubrique { margin: .4rem 0 0; }
.rubrique .compteur { font-family: var(--police-valeur); font-weight: 400; margin-left: .3rem; }
/* une action en retard se signale par un filet jaune à gauche */
.ligne.action[data-etat="en_retard"] { border-left: 3px solid var(--alerte); }
.ligne.action[data-etat="terminee"] { opacity: .8; }
.ligne.action .ligne-nom { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; white-space: normal; }

.note-saisie { border-bottom: 1px solid var(--filet); }
.note-pied { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem; }
.note-pied .field { flex: 1; min-width: 12rem; }
.note-pied input[type="file"] { padding: .3rem; font-size: .82rem; }
.fil { list-style: none; margin: 0; padding: .4rem .6rem .6rem; display: flex; flex-direction: column; gap: .4rem; }
.note { padding: .6rem .8rem; border: 1px solid var(--filet); border-radius: 8px; background: var(--fond-ligne); transition: border-color 120ms, background 100ms; }
.note:hover { border-color: var(--bloc-allume); background: var(--survol-ligne); }
.note-tete { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; font-size: .85rem; }
.note-tete strong { color: var(--texte); font-weight: 600; }
.note-tete .ligne-gestes { margin-left: auto; }
.note-texte { margin: .45rem 0 0 2.2rem; color: var(--texte); }
.note-edition { margin: .45rem 0 0 2.2rem; display: flex; flex-direction: column; gap: .4rem; }
.note-edition textarea {
  font: inherit; font-size: .92rem; padding: .42rem .55rem; resize: vertical;
  border: 1px solid var(--filet-actif); border-radius: 4px; background: var(--champ); color: var(--texte);
}
.pieces { list-style: none; margin: .4rem 0 0 2.2rem; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .85rem; }
.pieces a::before { content: "⎘ "; color: var(--texte-3); }
.recherche .field { min-width: 14rem; }

/* ─── Affaires ─── */

.montant { color: var(--texte); font-weight: 600; }
.totaux { margin-left: auto; display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; align-items: baseline; font-size: .9rem; }
.totaux strong { color: var(--texte); font-size: 1.05rem; margin-left: .3rem; }
/* l'en-tête d'un groupe : l'étape à gauche, ses sommes à droite */
.groupe-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem 1rem; text-transform: none; letter-spacing: 0; }
.groupe-tete .valeur { font-weight: 400; }
/* un petit formulaire en une ligne (motif de perte, associer un contact) */
.forme-ligne { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; border-top: 1px solid var(--filet); }
.forme-ligne .field { min-width: 11rem; }
.forme-ligne .field.large { flex: 1; min-width: 14rem; }
.avertissement-perte { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; border-top: 1px solid var(--filet); }
.avertissement-perte .bouton { margin-left: auto; }
.role select {
  font: inherit; font-size: .82rem; padding: .22rem .4rem;
  border: 1px solid var(--filet-champ); border-radius: 4px; background: var(--champ); color: var(--texte-2);
}
.role select[data-sens="succes"] { color: var(--succes); border-color: color-mix(in srgb, var(--succes) 50%, transparent); }
.role select[data-sens="alerte"] { color: var(--alerte); border-color: color-mix(in srgb, var(--alerte) 50%, transparent); }
.role select[data-sens="danger"] { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.role select[data-sens="eteint"] { color: var(--texte-3); }
.releve dd.montant { font-size: 1rem; }

/* ─── Devis : le tableau des lignes, les totaux, l'éditeur ─── */

.texte-fort { color: var(--texte); font-weight: 600; }
.tableau tr.eteinte td { opacity: .6; }
.tableau-devis td { vertical-align: top; }
/* rien n'élargit le tableau des lignes au-delà de l'écran : la désignation (un mot long, une adresse dans
   sa description) se coupe, l'unité passe sous sa quantité, qui reste d'un tenant */
.tableau-devis td:first-child { overflow-wrap: anywhere; }
.tableau-devis td.quantite { white-space: normal; }
.totaux-devis {
  margin: 0 0 0 auto; padding: .7rem .9rem 1rem; max-width: 26rem;
  /* pas d'écart entre les colonnes : le trait du total TTC court d'un bord à l'autre */
  display: grid; grid-template-columns: 1fr auto; row-gap: .3rem; font-size: .9rem;
}
.totaux-devis dt { color: var(--texte-2); }
.totaux-devis dd { margin: 0; padding-left: 1.5rem; text-align: right; color: var(--texte); }
.totaux-devis .ttc { font-weight: 600; font-size: 1.05rem; color: var(--texte); border-top: 1px solid var(--filet-champ); padding-top: .4rem; }

.lignes-saisie { display: flex; flex-direction: column; gap: .6rem; }
.ligne-saisie {
  display: flex; flex-direction: column; gap: .4rem;
  padding: .7rem; border: 1px solid var(--filet); border-radius: 8px; background: var(--app);
}
.ligne-saisie:focus-within { border-color: var(--filet-champ); }
.ligne-saisie.en-erreur { border-color: var(--danger); }
.ligne-saisie-tete { display: flex; gap: .5rem; align-items: center; }
.ligne-saisie .designation { flex: 1; font-weight: 600; }
.ligne-saisie-gestes { display: inline-flex; gap: .1rem; }
.ligne-saisie input, .ligne-saisie select, .ligne-saisie textarea {
  font: inherit; font-size: .9rem; padding: .35rem .5rem; width: 100%;
  border: 1px solid var(--filet-champ); border-radius: 4px; background: var(--champ); color: var(--texte-2);
}
.ligne-saisie textarea { resize: vertical; font-size: .85rem; }
.ligne-saisie input:focus, .ligne-saisie select:focus, .ligne-saisie textarea:focus {
  outline: none; border-color: var(--filet-actif); box-shadow: inset 0 0 0 1px var(--filet-actif); color: var(--texte);
}
/* chaque champ à sa largeur tant qu'il y a la place ; les champs se resserrent avant que le total déborde
   (tablette en portrait), et passent à deux colonnes au téléphone */
.ligne-saisie-chiffres {
  display: grid; gap: .5rem; align-items: end;
  grid-template-columns: minmax(0, 5rem) minmax(0, 8rem) minmax(0, 9rem) minmax(0, 6rem) minmax(0, 9rem) 1fr;
}
.ligne-saisie-chiffres label, .ligne-saisie-total { display: flex; flex-direction: column; gap: .2rem; }
.ligne-saisie-chiffres span { font-size: .72rem; color: var(--texte-3); }
/* champs et menu à la même hauteur : un menu natif est plus haut qu'un champ à padding égal */
.ligne-saisie-chiffres input, .ligne-saisie-chiffres select { height: 2.1rem; padding-top: 0; padding-bottom: 0; }
.ligne-saisie-total { align-items: flex-end; }
.ligne-saisie-total strong { color: var(--texte); font-size: .95rem; padding: .35rem 0; }
.ajout-lignes { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.ajout-lignes .field { min-width: 16rem; }
/* la remise globale à gauche, les totaux qu'elle change à droite */
.totaux-saisie { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .6rem 1rem; border-top: 1px solid var(--filet); padding-top: .8rem; }
.totaux-saisie [data-totaux] { flex: 1 1 16rem; }
.totaux-saisie .totaux-devis { padding-top: 0; }
.totaux-saisie p { margin: .4rem 0 0; text-align: right; }

/* facturer un devis : la facture, ou un acompte en pour cent */
.facturer { align-items: flex-end; }
.facturer form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; border: none; padding: 0; }
/* l'encaissement : le relevé à gauche, sans largeur maximale à droite */
.totaux-devis.encaissement { margin: 0 0 .8rem auto; padding: 0; }
.totaux-devis.encaissement a { color: var(--accent); }
form.en-ligne { display: inline; }
/* une croix discrète pour retirer (un paiement saisi par erreur) */
.passage-retire { font: inherit; line-height: 1; padding: 0 .3rem; border: none; background: none; color: var(--texte-3); cursor: pointer; }
.passage-retire:hover { color: var(--danger); }
.paiement { border-top: 1px solid var(--filet); padding-top: .8rem; }

/* les paramètres : deux colonnes, les textes longs sur toute la largeur */
.champs-grille { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.champs-grille .pleine { grid-column: 1 / -1; }

/* ─── Réglages : un tableau qui se lit, un tableau croisé des passages ─── */

.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tableau th {
  font-weight: 400; font-size: .74rem; text-align: left; color: var(--texte-3);
  padding: .5rem .7rem; border-bottom: 1px solid var(--filet-champ);
}
.tableau td { padding: .45rem .7rem; border-bottom: 1px solid var(--filet); vertical-align: middle; color: var(--texte-2); }
.tableau tbody tr:last-child td { border-bottom: none; }
.tableau .nombre { text-align: right; white-space: nowrap; }
.tableau .etroit { width: 1%; white-space: nowrap; }
.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.valeur-ordre { display: inline-flex; gap: .1rem; }
.valeur-ordre form { display: contents; }
.btn-icone.petit { width: 1.6rem; height: 1.6rem; font-size: .85rem; }
.btn-icone:disabled { opacity: .3; cursor: default; background: none; border-color: transparent; }
.etiquette {
  display: inline-block; margin: .1rem .3rem .1rem 0; padding: 0 .4rem;
  border: 1px solid var(--filet-champ); border-radius: 4px; font-size: .74rem; color: var(--texte-2);
}
.reglages-liste { padding: .9rem; border-top: none; }
.reglages-liste .field { flex: 1; min-width: 14rem; }
.retirees summary { cursor: pointer; color: var(--texte-3); font-size: .85rem; }
.retirees .lignes { margin-top: .6rem; }
.field.court { max-width: 12rem; }
.gestes-valeur { display: grid; grid-template-columns: auto 1fr; gap: .6rem 1rem; align-items: center; }
.gestes-valeur .aide { margin: 0; }

/* le tableau des valeurs : ses en-têtes de nombres vont à la ligne (« Probabilité (%) ») ; au téléphone,
   il garde la valeur et ses nombres, serrés (l'ordre se change sur la page de la valeur) */
.tableau.valeurs th.nombre { white-space: normal; }
@media (max-width: 760px) {
  .tableau.valeurs th, .tableau.valeurs td { padding-left: .45rem; padding-right: .45rem; }
}

/* le tableau croisé : de (lignes) → vers (colonnes) ; là où il ne tient pas — un écran étroit, ou
   trop de valeurs pour la largeur (crm.js le mesure) —, la même chose en liste, jamais de défilement */
.croise { font-size: .82rem; }
.croise th, .croise td { text-align: center; border: 1px solid var(--filet); padding: .35rem .4rem; }
.croise td { position: relative; }
.croise thead th { border-bottom-color: var(--filet-champ); }
.croise tbody th { text-align: left; white-space: nowrap; }
.croise .coin { font-family: var(--police-valeur); font-size: .68rem; color: var(--texte-3); white-space: nowrap; text-align: left; }
.croise .soi { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--filet) 5px 6px); }
.croise summary { cursor: pointer; list-style: none; padding: .15rem .3rem; border-radius: 4px; }
.croise summary::-webkit-details-marker { display: none; }
.croise .ouvert summary { color: var(--texte); background: var(--neutre); }
.croise .ferme summary { color: var(--texte-3); }
.croise summary:hover { outline: 1px solid var(--filet-actif); }
.case-geste {
  margin-top: .35rem;
  display: flex; flex-direction: column; gap: .35rem; padding: .55rem; min-width: 13rem; text-align: left;
  border: 1px solid var(--filet-champ); border-radius: 6px; background: var(--overlay);
  box-shadow: 0 10px 30px rgb(0 0 0 / 35%);
}
/* dans le tableau, le formulaire d'une case flotte par-dessus, calé sur son bord droit : la colonne ne s'en élargit pas */
.croise .case-geste { position: absolute; top: calc(100% - .2rem); right: 0; z-index: 5; }
.case-geste form { display: flex; flex-wrap: wrap; gap: .35rem; }
.case-geste input, .case-geste select {
  flex: 1; min-width: 0; font: inherit; font-size: .82rem; padding: .25rem .4rem;
  border: 1px solid var(--filet-champ); border-radius: 4px; background: var(--champ); color: var(--texte-2);
}
/* en liste : chaque valeur de départ, ses passages en étiquettes (un clic les règle), un « + » pour en ouvrir un */
.passages-liste, [data-passages].en-liste .croise { display: none; }
[data-passages].en-liste .passages-liste { display: flex; }
.passages-vers { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .35rem; }
.passages-vers summary { list-style: none; cursor: pointer; }
.passages-vers summary::-webkit-details-marker { display: none; }
.passages-vers summary:not(.bouton) { padding: .05rem .45rem; border: 1px solid var(--filet-champ); border-radius: 4px; font-size: .8rem; color: var(--texte-2); }
.passages-vers summary:not(.bouton):hover, .passages-vers details[open] > summary:not(.bouton) { border-color: var(--filet-actif); color: var(--texte); }
.passages-vers details[open] { flex-basis: 100%; }
.passages-vers .case-geste { box-shadow: none; }
@media (max-width: 1000px) {
  [data-passages] .croise { display: none; }
  [data-passages] .passages-liste { display: flex; }
}

/* ─── Connexion : une carte centrée, comme au lab ─── */

.page-connexion { min-height: 100vh; margin: 0; display: grid; place-items: center; background: var(--barre); }
.carte-connexion {
  width: min(26rem, calc(100vw - 2rem));
  padding: 2rem 2rem 1.5rem;
  background: var(--carte);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgb(0 0 0 / 45%);
}
.carte-connexion .marque { justify-content: center; font-size: 1.45rem; }
.carte-connexion .accroche { margin: .4rem 0 1.6rem; text-align: center; color: var(--texte-3); font-size: .875rem; }
.carte-connexion .forme { padding: 0; }
.carte-connexion .bouton.principal { width: 100%; justify-content: center; padding: .6rem; }

/* ─── Bandeau du bas : l'issue d'un geste ─── */

.bandeau {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 20;
  transform: translateX(-50%);
  max-width: calc(100vw - 2rem);
  display: flex; align-items: center; gap: .8rem;
  padding: .55rem .6rem .55rem .9rem;
  border: 1px solid var(--filet-champ);
  border-left: 3px solid var(--succes);
  border-radius: 6px;
  background: var(--overlay);
  box-shadow: 0 10px 30px rgb(0 0 0 / 35%);
  color: var(--texte);
  font-size: .9rem;
}
.bandeau.erreur { border-left-color: var(--danger); }
.bandeau button { font: inherit; font-size: 1.05rem; line-height: 1; width: 1.7rem; height: 1.7rem; border-radius: 4px; background: var(--neutre); border: none; color: var(--texte-3); cursor: pointer; }
.bandeau button:hover { color: var(--texte); }

/* ─── Question avant un geste qui détruit ─── */

.question {
  border: 1px solid var(--filet-champ);
  border-radius: 8px;
  background: var(--overlay);
  color: var(--texte-2);
  padding: 1.2rem 1.3rem;
  max-width: min(26rem, calc(100vw - 2rem));
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 70%);
}
.question::backdrop { background: rgb(0 0 0 / 50%); }
.question p { margin: 0 0 1rem; color: var(--texte); }
.question .form-actions { justify-content: flex-end; }

/* le contact principal : son nom dans un cartouche, sans mot de plus */
.nom-principal { padding: 0 .4rem; border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 4px; }

/* un e-mail ou un téléphone se copie d'un clic ; « copié » le confirme */
a[href^="mailto:"], a[href^="tel:"] { cursor: copy; }
a.copie::after { content: "copié"; margin-left: .35rem; font-size: .72rem; color: var(--succes); text-decoration: none; display: inline-block; }

/* le lien d'abonnement à l'agenda : le champ prend la place, les touches à côté */
.lien-agenda { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.lien-agenda input {
  flex: 1 1 20rem; min-width: 0; padding: .42rem .55rem; font-size: .8rem;
  border: 1px solid var(--filet-champ); border-radius: 4px; background: var(--champ); color: var(--texte-2);
}

/* l'ajout dans un bloc : un « + » seul, son libellé dans l'info-bulle */
.bouton.ajout { display: inline-flex; align-items: center; justify-content: center; text-align: center; min-width: 1.9rem; padding-left: 0; padding-right: 0; font-size: 1.05rem; line-height: 1; }

/* ─── Chercher partout (Ctrl K) ─── */

.chercher-partout {
  display: inline-flex; align-items: center; gap: .45rem; height: 2.1rem; padding: 0 .6rem;
  border: 1px solid var(--filet-champ); border-radius: 6px; background: var(--champ);
  color: var(--texte-3); font: inherit; font-size: .82rem; cursor: pointer; margin-right: .4rem;
}
.chercher-partout:hover { border-color: var(--bloc-allume); color: var(--texte-2); }
.chercher-partout svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.chercher-partout kbd { white-space: nowrap; font-family: var(--police-valeur); font-size: .7rem; padding: .05rem .3rem; border: 1px solid var(--filet); border-radius: 3px; }
.palette {
  width: min(36rem, calc(100vw - 2rem)); margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--filet-champ); border-radius: 10px; background: var(--overlay); color: var(--texte-2);
}
.palette::backdrop { background: rgb(0 0 0 / 50%); }
.palette input {
  width: 100%; padding: .85rem 1rem; border: 0; border-bottom: 1px solid var(--filet);
  background: none; color: var(--texte); font: inherit; font-size: 1rem; outline: none;
}
.palette-resultats { max-height: 60vh; overflow-y: auto; padding: .3rem 0; }
.palette-resultats:empty { display: none; }
.palette-groupe {
  margin: 0; padding: .55rem 1rem .25rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--texte-3); font-family: var(--police-valeur);
}
.palette-resultats a { display: flex; flex-direction: column; gap: .05rem; padding: .45rem 1rem; color: var(--texte-2); text-decoration: none; }
.palette-resultats a strong { color: var(--texte); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-resultats a span { font-size: .8rem; color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-resultats a:hover, .palette-resultats a.choisi { background: var(--survol-ligne); }
.palette-resultats a.choisi { box-shadow: inset 2px 0 0 var(--accent); }
.palette-vide { margin: 0; padding: .9rem 1rem; color: var(--texte-3); }
@media (max-width: 760px) {
  .chercher-partout .chercher-mot, .chercher-partout kbd { display: none; }
  .chercher-partout { width: 2.1rem; padding: 0; justify-content: center; margin-right: 0; }
}

/* ─── Listes : tableau triable, pagination, un seul résultat ─── */

.barre-filtres { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.barre-filtres .recherche { margin-left: auto; flex: 1 1 18rem; max-width: 30rem; }
.bloc-tableau { overflow: hidden; }
.bloc-tableau .tableau th { white-space: nowrap; background: var(--tete-bloc); padding-top: .35rem; padding-bottom: .35rem; }
.bloc-tableau .tableau td:first-child, .bloc-tableau .tableau th:first-child { padding-left: .9rem; }
.bloc-tableau .tableau td:last-child, .bloc-tableau .tableau th:last-child { padding-right: .9rem; }
.tableau td a { color: var(--texte); text-decoration: none; }
.tableau tr.rang:hover td a { color: var(--accent); }
.petit-texte { font-size: .8rem; }
.tri { color: inherit; text-decoration: none; }
.tri:hover, .tri.actif { color: var(--texte); }

.pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem .9rem; border-top: 1px solid var(--filet);
  font-size: .8rem; color: var(--texte-3);
}
.pagination nav { display: flex; gap: .25rem; }
.page-btn {
  min-width: 1.9rem; height: 1.9rem; padding: 0 .4rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--filet); border-radius: 6px;
  color: var(--texte-2); text-decoration: none; font-family: var(--police-valeur);
}
a.page-btn:hover { border-color: var(--bloc-allume); color: var(--texte); }
.page-btn.actif { border-color: var(--accent); color: var(--accent); }
.page-btn.eteint { opacity: .35; }

.picto { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.seul {
  display: flex; flex-direction: column; gap: .9rem; padding: 1.1rem 1.2rem;
  border: 1px solid var(--filet-bloc); border-radius: 10px; background: var(--carte);
  color: var(--texte-2); text-decoration: none;
}
.seul:hover { border-color: var(--bloc-allume); }
.seul-tete { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.seul-picto {
  width: 2.4rem; height: 2.4rem; flex: none; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--filet); color: var(--accent);
}
.seul-titre { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 0; }
.seul-titre strong { color: var(--texte); font-size: 1.1rem; font-weight: 600; }
.seul-chiffres { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; font-size: .88rem; }
.seul-ouvrir { color: var(--accent); font-size: .85rem; }

.recherche select { width: auto; font-size: .85rem; padding: .3rem .5rem; }
.recherche input[type="date"] { width: auto; font-size: .85rem; padding: .3rem .5rem; }
/* une précision qui n'apparaît qu'au téléphone, quand sa colonne est masquée */
.sous-telephone { display: none; }
@media (max-width: 760px) { .sous-telephone { display: block; } }
.bascule { display: inline-flex; border: 1px solid var(--filet-champ); border-radius: 4px; overflow: hidden; }
.bascule a { padding: .3rem .7rem; font-size: .82rem; color: var(--texte-3); text-decoration: none; }
.bascule a + a { border-left: 1px solid var(--filet-champ); }
.bascule a:hover { color: var(--texte-2); background: var(--survol-ligne); }
.bascule a.active { color: var(--texte); background: var(--neutre); }

.bandeau-closes { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; font-size: .85rem; }
.bandeau-closes a { display: inline-flex; align-items: center; gap: .4rem; color: var(--texte-2); text-decoration: none; padding: .15rem .3rem; border-radius: 4px; }
.bandeau-closes a:hover { background: var(--survol-ligne); }

/* les colonnes d'étape se partagent la largeur : jamais de défilement de côté */
.colonnes-etapes { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .6rem; align-items: start; }
.colonne-etape {
  display: flex; flex-direction: column; gap: .4rem; min-width: 0;
  padding: .5rem; border-radius: 10px; background: color-mix(in srgb, var(--carte) 45%, transparent);
}
.colonne-tete {
  margin: 0 0 .1rem; padding: .1rem .2rem; font-size: .85rem; font-weight: 400;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .3rem;
}
.colonne-tete .compteur, .fiche-barre .compteur { font-family: var(--police-valeur); font-size: .78rem; font-weight: 400; color: var(--texte-3); margin-left: .25rem; }
.carte-affaire {
  display: flex; flex-direction: column; gap: .25rem; min-width: 0; padding: .6rem .7rem;
  border: 1px solid var(--filet-bloc); border-radius: 8px; background: var(--carte);
  color: var(--texte-2); text-decoration: none; overflow-wrap: anywhere;
}
.carte-affaire:hover { border-color: var(--bloc-allume); }
.carte-pied { display: flex; align-items: center; gap: .4rem; margin-top: .15rem; }
.carte-pied .valeur { margin-right: auto; color: var(--texte); }
@media (max-width: 1100px) {
  .colonnes-etapes { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
}

/* ─── Fiche : en-tête chiffré, deux colonnes ─── */

.statut-tete { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-top: -.25rem; }
.statut-tete form { display: contents; }
.chiffres-tete { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.chiffre {
  display: flex; flex-direction: column; gap: .15rem; min-width: 0; padding: .7rem .9rem;
  border: 1px solid var(--filet-bloc); border-radius: 10px; background: var(--carte);
  color: var(--texte-2); text-decoration: none;
}
.chiffre:hover { border-color: var(--bloc-allume); }
.chiffre-libelle { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--texte-3); font-family: var(--police-valeur); }
.chiffre-valeur { font-family: var(--police-valeur); font-size: 1.25rem; color: var(--texte); white-space: nowrap; }
.chiffre-texte { color: var(--texte); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chiffre-sous { font-size: .8rem; color: var(--texte-3); }
.chiffre.en-alerte { border-color: color-mix(in srgb, var(--alerte) 55%, transparent); }

.deux-colonnes { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: .75rem; align-items: start; }
.colonne-principale, .colonne-cote { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.releve.serre { grid-template-columns: 5.5rem 1fr; gap: .35rem .8rem; font-size: .88rem; }
.releve dd.adresse { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.releve dd.adresse .btn-icone { flex: none; margin-top: -.15rem; color: var(--accent); }
.moment + .moment { border-top: 1px solid var(--filet); }
.moment-tete {
  margin: 0; padding: .6rem .9rem 0; font-size: .72rem; font-weight: 400;
  text-transform: uppercase; letter-spacing: .08em; color: var(--texte-3); font-family: var(--police-valeur);
}
.filtres-fil { gap: .25rem; }
/* au repos, la saisie d'une note n'est qu'un champ ; le reste vient quand on y entre */
.note-saisie textarea { min-height: 2.6em; }
.note-saisie:focus-within textarea, .note-saisie:not(:has(textarea:placeholder-shown)) textarea { min-height: 6em; }
.note-saisie:not(:focus-within):has(textarea:placeholder-shown) .note-pied { display: none; }
button.filtre { font: inherit; font-size: .78rem; background: none; cursor: pointer; }
.voir-plus {
  display: block; width: 100%; padding: .5rem .9rem; border: 0; border-top: 1px solid var(--filet);
  background: none; color: var(--accent); font: inherit; font-size: .82rem; text-align: left; cursor: pointer;
}
.voir-plus:hover { background: var(--survol-ligne); }
a.voir-plus { text-decoration: none; }
/* un bloc replié : « Plus » ouvre le reste, « Moins » le referme */
.replie > summary { list-style: none; }
.replie > summary::-webkit-details-marker { display: none; }
.replie:not([open]) .ouvert, .replie[open] .ferme { display: none; }
.fiche-barre + .replie > summary { border-top: 0; }
.replie[open] > summary { border-bottom: 1px solid var(--filet); }
.fiche > .replie:last-child:not([open]) > summary { border-radius: 0 0 9px 9px; }
/* les gestes d'une ligne attendent qu'on la survole (ou qu'on y entre au clavier) */
@media (hover: hover) {
  .ligne-gestes.au-survol { opacity: 0; transition: opacity 100ms; }
  .ligne:hover .ligne-gestes.au-survol, .ligne:focus-within .ligne-gestes.au-survol { opacity: 1; }
}
/* dans la colonne de côté, le titre prend toute la ligne, les chiffres passent dessous */
.colonne-cote .ligne { flex-wrap: wrap; row-gap: .35rem; }
.colonne-cote .ligne-corps { flex-basis: 100%; }
.colonne-cote .ligne-cote { width: 100%; }
.colonne-cote .ligne-cote .pastille { margin-left: auto; }
@media (hover: hover) {
  /* les gestes d'un contact viennent se poser sur sa ligne, sans lui réserver de place */
  .colonne-cote .ligne { position: relative; }
  .colonne-cote .ligne-gestes.au-survol { position: absolute; top: .45rem; right: .5rem; padding: .2rem; border-radius: 6px; background: var(--survol-ligne); }
}
.note:hover .ligne-gestes.au-survol, .note:focus-within .ligne-gestes.au-survol { opacity: 1; }
@media (max-width: 1000px) {
  .deux-colonnes { grid-template-columns: minmax(0, 1fr); }
  .chiffres-tete { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ─── Tableau de bord : des barres en CSS, sans bibliothèque ─── */

.annees { align-items: center; gap: .3rem; }
/* les deux temps du tableau de bord : ce qui est en cours, puis l'année choisie */
.rubrique-page {
  margin: .4rem 0 -.2rem; font-size: .72rem; font-weight: 400; text-transform: uppercase; letter-spacing: .12em;
  color: var(--texte-3); font-family: var(--police-valeur);
}
.annee-tete { display: flex; align-items: center; gap: .4rem; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--filet-bloc); }
.annee-tete h2 { margin: 0; font-size: 1.35rem; color: var(--texte); }
.annee-tete .btn-icone, .annees .btn-icone { border-color: var(--filet-champ); font-size: 1.15rem; text-decoration: none; color: var(--texte-2); }
.legende { display: inline-flex; align-items: center; gap: .3rem .5rem; font-size: .75rem; color: var(--texte-3); }
.legende i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; }
.cle-realise, .cle-pondere { background: var(--texte-2); }
.cle-objectif, .cle-montant { border: 1px dashed var(--texte-3); }

/* douze colonnes qui se partagent la largeur */
.graphe-mois { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .35rem; padding: .9rem; }
.graphe-col { display: flex; flex-direction: column; align-items: center; gap: .2rem; min-width: 0; border-radius: 6px; padding: .2rem 0; }
.graphe-col:hover { background: var(--survol-ligne); }
.graphe-col.courant .graphe-mois-nom { color: var(--texte); font-weight: 600; }
.graphe-barres { position: relative; width: 100%; height: 10rem; display: flex; align-items: flex-end; justify-content: center; }
.graphe-mois.petit .graphe-barres { height: 5rem; }
.barre-objectif { position: absolute; bottom: 0; left: 18%; right: 18%; border: 1px dashed var(--texte-3); border-bottom: 0; border-radius: 3px 3px 0 0; }
.barre-realise { position: relative; width: 44%; min-height: 0; background: var(--texte-2); border-radius: 3px 3px 0 0; opacity: .85; }
.barre-realise.atteint { background: var(--succes); opacity: 1; }
.graphe-mois-nom { font-size: .72rem; color: var(--texte-3); text-transform: capitalize; }
.graphe-valeur { font-family: var(--police-valeur); font-size: .66rem; color: var(--texte-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; min-height: 1em; }

/* barres horizontales : le pipeline */
.barres-h { display: flex; flex-direction: column; gap: .35rem; }
.barre-h {
  display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr) auto; align-items: center; gap: .7rem;
  padding: .35rem .5rem; border-radius: 6px; color: var(--texte-2); text-decoration: none;
}
.barre-h:hover { background: var(--survol-ligne); }
.barre-h-nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-h-nom .compteur { font-family: var(--police-valeur); font-size: .75rem; color: var(--texte-3); margin-left: .2rem; }
.barre-h-piste { position: relative; height: .8rem; }
.barre-h-montant { position: absolute; inset: 0 auto 0 0; border: 1px dashed var(--texte-3); border-radius: 3px; }
.barre-h-pondere { position: absolute; inset: 0 auto 0 0; background: var(--texte-2); border-radius: 3px; opacity: .85; }
.barre-h-valeur { font-size: .82rem; white-space: nowrap; text-align: right; }

.taux { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.taux-valeur { font-size: 1.5rem; color: var(--texte); }
.taux-piste { flex: 1; height: .5rem; border-radius: 3px; background: var(--neutre); overflow: hidden; }
.taux-piste span { display: block; height: 100%; background: var(--succes); }
.sans-marge { padding: .8rem 0 .3rem; }
.motifs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; font-size: .88rem; }
.motifs li { display: flex; justify-content: space-between; gap: .5rem; padding: .2rem .3rem; border-radius: 4px; }
.motifs li:hover { background: var(--survol-ligne); }

@media (max-width: 640px) {
  .graphe-mois { gap: .1rem; padding: .6rem .4rem; }
  .graphe-valeur { display: none; }
  .barre-h { grid-template-columns: minmax(0, 1fr) auto; }
  .barre-h-piste { grid-column: 1 / -1; grid-row: 2; }
}

/* sur un écran étroit, le tableau perd ses colonnes de confort plutôt que de déborder */
@media (max-width: 760px) {
  .tableau .col-large { display: none; }
  .bloc-tableau .tableau th, .bloc-tableau .tableau td, .tableau-devis th, .tableau-devis td { padding-left: .45rem; padding-right: .45rem; }
  .bloc-tableau .tableau .etroit { display: none; }
  .bloc-tableau .tableau td:first-child { overflow-wrap: anywhere; }
}

/* ─── Téléphone ─── */

@media (max-width: 640px) {
  .app-header { flex-wrap: wrap; gap: .5rem .8rem; padding: .5rem .8rem; }
  .views { order: 3; width: 100%; flex-wrap: wrap; }
  .qui { display: none; }
  .page { padding: 1.1rem 1rem 6rem; }
  .page-tete h1 { font-size: 1.4rem; }
  .page-tete .gestes { margin-left: 0; width: 100%; }
  .row, .row.trois { grid-template-columns: 1fr; }
  .releve { grid-template-columns: 1fr; gap: .05rem; }
  .releve dd { margin-bottom: .55rem; }
  /* 16px : en dessous, le téléphone zoome sur le champ touché */
  .field input, .field select, .field textarea, .recherche input[type="search"] { font-size: 16px; }
  .ligne { flex-wrap: wrap; }
  .ligne-cote { width: 100%; justify-content: space-between; }
  .separe { display: none; }
  .totaux { margin-left: 0; }
  .ligne-saisie-chiffres { grid-template-columns: 1fr 1fr; }
  .ligne-saisie-total { grid-column: 1 / -1; }
  .champs-grille { grid-template-columns: 1fr; }
  .note-texte, .note-edition, .pieces { margin-left: 0; }

  /* RIEN NE DÉBORDE : un enfant de la colonne ne s'élargit jamais au-delà de
     l'écran, les onglets passent à la ligne, et les boutons d'une ligne
     descendent sous son texte au lieu de le rogner. */
  .page > * { min-width: 0; max-width: 100%; }
  .views { flex-wrap: wrap; }
  .view { padding: .25rem .5rem; font-size: .82rem; }
  .ligne-corps { flex-basis: 100%; }
  .ligne-corps .ligne-sous { white-space: normal; }
  .ligne-gestes { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .ligne-cote .initiales { margin-left: auto; }
  .fiche-barre .gestes { margin-left: 0; }
  .note-tete .ligne-gestes { width: auto; margin-left: auto; }
  .note-pied .field { flex-basis: 100%; }
  .note-pied input[type="file"] { width: 100%; }
  .note-pied .bouton { margin-left: auto; }
}
