/* Frach Commercial — feuille de style
   Encre, bleu d'atelier, jaune mousse. Titres et chiffres en DIN (police d'atelier),
   texte courant dans la police du systeme. Pas d'ombres : des filets. */
:root {
  --encre: #16202e; --atelier: #1f3a5f; --atelier-2: #182d4a; --mousse: #f6c445; --mousse-2: #e0ad22;
  --papier: #ffffff; --brume: #eef1f5; --brume-2: #e4e8ee; --trait: #d5dbe4; --ardoise: #5b6676;
  --vert: #1e7f53; --rouge: #b93a2e; --ambre: #a86400; --bleu: #2563a8;
  --vert-fond: #e3f3eb; --rouge-fond: #fbe9e6; --ambre-fond: #fdf1dc; --bleu-fond: #e6eef8;
  --titre: "DIN Alternate", "Bahnschrift", "Avenir Next Condensed", "Arial Narrow", system-ui, sans-serif;
  --texte: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --rayon: 4px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--texte); color: var(--encre); background: var(--brume); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--titre); font-weight: 700; margin: 0; letter-spacing: .01em; }
h1 { font-size: 26px; line-height: 1.15; } h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--bleu); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--bleu); outline-offset: 1px; }
.chiffre, td.n, th.n, .total { font-variant-numeric: tabular-nums; }
.muet { color: var(--ardoise); } .petit { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- ossature ---------- */
#app { display: grid; grid-template-columns: 208px 1fr; min-height: 100%; }
#menu { background: var(--atelier); color: #dfe7f2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
#menu .marque { padding: 18px 18px 14px; font-family: var(--titre); font-size: 21px; font-weight: 700; color: #fff; line-height: 1.05; }
#menu .marque small { display: block; font: 12px var(--texte); color: #a9bad1; margin-top: 4px; font-weight: 400; }
#menu nav { flex: 1; overflow-y: auto; padding: 6px 0; }
#menu nav a { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: #dfe7f2; border-left: 3px solid transparent; }
#menu nav a:hover { background: var(--atelier-2); text-decoration: none; }
#menu nav a.actif { border-left-color: var(--mousse); background: var(--atelier-2); color: #fff; font-weight: 600; }
#menu nav .groupe { padding: 14px 18px 4px; font-size: 12px; color: #93a7c2; }
#menu .pied { padding: 12px 18px; border-top: 1px solid #2c4b76; font-size: 12.5px; color: #a9bad1; }
#menu .pied button { background: none; border: 0; color: #dfe7f2; padding: 0; cursor: pointer; text-decoration: underline; }
#corps { min-width: 0; display: flex; flex-direction: column; }
#barre { display: flex; align-items: center; gap: 12px; padding: 10px 22px; background: var(--papier); border-bottom: 1px solid var(--trait); position: sticky; top: 0; z-index: 5; }
#barre .recherche { flex: 1; max-width: 520px; position: relative; }
#barre .recherche input { width: 100%; }
#resultats { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); max-height: 60vh; overflow: auto; z-index: 20; }
#resultats a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; color: var(--encre); border-bottom: 1px solid var(--brume); }
#resultats a:hover, #resultats a.choisi { background: var(--brume); text-decoration: none; }
#vue { padding: 22px; max-width: 1500px; width: 100%; }
.bandeau-copie { background: var(--ambre-fond); color: #6b4100; padding: 7px 22px; font-size: 13px; border-bottom: 1px solid #f0d9ad; }

/* ---------- commandes ---------- */
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], select, textarea {
  background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 7px 9px; min-height: 34px; }
input:focus, select:focus, textarea:focus { border-color: var(--bleu); outline: none; box-shadow: 0 0 0 2px var(--bleu-fond); }
.bouton { display: inline-flex; align-items: center; gap: 6px; background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 7px 13px; min-height: 34px; cursor: pointer; color: var(--encre); white-space: nowrap; }
.bouton:hover { background: var(--brume); text-decoration: none; }
.bouton.principal { background: var(--mousse); border-color: var(--mousse-2); font-weight: 600; }
.bouton.principal:hover { background: var(--mousse-2); }
.bouton.danger { color: var(--rouge); }
.bouton[disabled] { opacity: .5; cursor: default; }
.bascule { display: inline-flex; border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; background: var(--papier); }
.bascule button { border: 0; background: none; padding: 7px 12px; min-height: 34px; cursor: pointer; border-right: 1px solid var(--trait); }
.bascule button:last-child { border-right: 0; }
.bascule button.actif { background: var(--atelier); color: #fff; }
.filtres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.filtres label { display: inline-flex; align-items: center; gap: 6px; color: var(--ardoise); font-size: 13px; }
.entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.entete .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fil { font-size: 13px; color: var(--ardoise); margin-bottom: 4px; }

/* ---------- panneaux, chiffres ---------- */
.panneau { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); }
.panneau > h2, .panneau > .tete { padding: 12px 16px; border-bottom: 1px solid var(--trait); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dedans { padding: 14px 16px; }
.grille { display: grid; gap: 16px; } .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: 2fr 1fr; }
.reperes { display: grid; grid-template-columns: repeat(auto-fit, minmax(156px, 1fr)); background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); margin: 14px 0 16px; }
.repere { padding: 13px 16px; border-right: 1px solid var(--trait); }
.repere:last-child { border-right: 0; }
.repere .valeur { font-family: var(--titre); font-size: 25px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.repere .libelle { color: var(--ardoise); font-size: 13px; }
.repere .note { font-size: 12.5px; margin-top: 2px; }
.plus { color: var(--vert); } .moins { color: var(--rouge); }

/* ---------- tableaux ---------- */
.defile { overflow-x: auto; }
table.liste { width: 100%; border-collapse: collapse; background: var(--papier); }
table.liste th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ardoise); padding: 8px 10px; border-bottom: 1px solid var(--trait); white-space: nowrap; background: var(--papier); position: sticky; top: 0; }
table.liste th.tri { cursor: pointer; } table.liste th.tri:hover { color: var(--encre); }
table.liste td { padding: 7px 10px; border-bottom: 1px solid var(--brume); vertical-align: top; }
table.liste tr.lien { cursor: pointer; } table.liste tr.lien:hover td { background: #f7f9fb; }
table.liste td.n, table.liste th.n { text-align: right; white-space: nowrap; }
table.liste tfoot td { font-weight: 700; border-top: 2px solid var(--trait); border-bottom: 0; }
.vide { padding: 28px 16px; text-align: center; color: var(--ardoise); }
.pages { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; color: var(--ardoise); font-size: 13px; }

/* ---------- etiquettes ---------- */
.etiq { display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 12px; font-weight: 600; background: var(--brume-2); color: var(--encre); white-space: nowrap; }
.etiq.vert { background: var(--vert-fond); color: var(--vert); } .etiq.rouge { background: var(--rouge-fond); color: var(--rouge); }
.etiq.ambre { background: var(--ambre-fond); color: var(--ambre); } .etiq.bleu { background: var(--bleu-fond); color: var(--bleu); }
.etiq.essai { background: var(--mousse); color: var(--encre); }
/* le nuancier : une pastille de mousse par densite */
.dens { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dens i { width: 13px; height: 13px; border-radius: 2px; display: inline-block; border: 1px solid rgba(22, 32, 46, .22); background: var(--c, #cfd6df); flex: none; }
.barres { display: flex; height: 22px; border-radius: 3px; overflow: hidden; border: 1px solid var(--trait); }
.barres span { display: block; background: var(--c, #cfd6df); min-width: 2px; }
.histo { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: 6px; }
.histo div { flex: 1; background: var(--atelier); min-height: 1px; border-radius: 2px 2px 0 0; position: relative; }
.histo div.ref { background: #b9c6d8; } .histo div.jour { background: var(--mousse-2); }
.histo-pied { display: flex; gap: 3px; font-size: 11px; color: var(--ardoise); margin-top: 3px; }
.histo-pied span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }

/* ---------- fiches et documents ---------- */
dl.fiche { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; }
dl.fiche dt { color: var(--ardoise); } dl.fiche dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.onglets { display: flex; gap: 2px; border-bottom: 1px solid var(--trait); margin: 16px 0 0; overflow-x: auto; }
.onglets button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 14px; cursor: pointer; color: var(--ardoise); white-space: nowrap; }
.onglets button.actif { color: var(--encre); border-bottom-color: var(--mousse); font-weight: 600; }
.doc-tete { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 16px; }
.champ { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.champ > span { font-size: 12.5px; color: var(--ardoise); }
.champ input, .champ select, .champ textarea { width: 100%; }
.cote { display: flex; gap: 10px; } .cote > * { flex: 1; min-width: 0; }
table.saisie { width: 100%; border-collapse: collapse; }
table.saisie th { text-align: left; font-size: 12.5px; color: var(--ardoise); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--trait); }
table.saisie td { padding: 4px 4px; border-bottom: 1px solid var(--brume); vertical-align: top; }
table.saisie input { width: 100%; min-height: 32px; padding: 5px 7px; }
table.saisie td.n input { text-align: right; font-variant-numeric: tabular-nums; }
table.saisie td.n, table.saisie th.n { text-align: right; }
.totaux { margin-left: auto; width: 320px; max-width: 100%; }
.totaux div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--brume); }
.totaux div.grand { font-family: var(--titre); font-size: 22px; font-weight: 700; border-bottom: 0; padding-top: 9px; }
.suggestions { position: absolute; z-index: 30; background: var(--papier); border: 1px solid var(--trait); border-radius: var(--rayon); max-height: 280px; overflow: auto; min-width: 320px; }
.suggestions div { padding: 6px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 14px; }
.suggestions div:hover, .suggestions div.choisi { background: var(--brume); }
.message { padding: 10px 14px; border-radius: var(--rayon); margin: 12px 0; border: 1px solid var(--trait); background: var(--papier); }
.message.erreur { background: var(--rouge-fond); border-color: #efc4bd; color: #7d241b; }
.message.ok { background: var(--vert-fond); border-color: #bfe2cf; color: #145a3a; }
.message.info { background: var(--bleu-fond); border-color: #c5d7ee; color: #1b4a80; }

/* ---------- connexion ---------- */
#connexion { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
#connexion .cote-marque { background: var(--atelier); color: #fff; padding: 9vh 6vw; display: flex; flex-direction: column; justify-content: space-between; }
#connexion .cote-marque h1 { font-size: clamp(34px, 5vw, 64px); line-height: .98; }
#connexion .cote-marque p { color: #c3d0e2; max-width: 34em; font-size: 15px; }
#connexion .nuancier { display: flex; gap: 0; height: 54px; max-width: 520px; }
#connexion .nuancier span { flex: 1; background: var(--c); display: flex; align-items: flex-end; padding: 4px 5px; font-size: 11px; color: rgba(22, 32, 46, .8); font-family: var(--titre); }
#connexion form { padding: 9vh 6vw; display: flex; flex-direction: column; justify-content: center; gap: 12px; background: var(--papier); }
#connexion form input { font-size: 22px; letter-spacing: .2em; padding: 12px 14px; max-width: 320px; }
#connexion form .bouton { max-width: 320px; justify-content: center; min-height: 44px; font-size: 15px; }

/* ---------- impression ---------- */
@media print {
  #menu, #barre, .bandeau-copie, .actions, .filtres, .onglets, .pas-imprimer { display: none !important; }
  #app { display: block; } #vue { padding: 0; max-width: none; } body { background: #fff; font-size: 12px; }
  .panneau { border: 0; } table.liste th { position: static; }
}
/* ---------- telephone et tablette ---------- */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  #menu { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; z-index: 40; border-top: 1px solid #2c4b76; }
  #menu .marque, #menu .pied, #menu nav .groupe { display: none; }
  #menu nav { display: flex; overflow-x: auto; padding: 0; }
  #menu nav a { flex-direction: column; gap: 2px; padding: 9px 13px; font-size: 11.5px; border-left: 0; border-top: 3px solid transparent; white-space: nowrap; }
  #menu nav a.actif { border-top-color: var(--mousse); }
  #vue { padding: 14px 12px 84px; } #barre { padding: 8px 12px; }
  .g2, .g3, .doc-tete { grid-template-columns: 1fr; } h1 { font-size: 22px; }
  #connexion { grid-template-columns: 1fr; } #connexion .cote-marque { padding: 28px 22px; gap: 18px; } #connexion form { padding: 28px 22px; }
  dl.fiche { grid-template-columns: 110px 1fr; }
}
@media (prefers-reduced-motion: no-preference) { .bouton, #menu nav a { transition: background-color .12s; } }

/* ---------- complements des ecrans ---------- */
.entete h1 + .sous { margin-top: 3px; max-width: 78ch; }
.espace { margin-top: 16px; }
.gros { font-size: 17px; font-weight: 600; line-height: 1.25; margin: 2px 0 4px; }
.fil a { color: var(--ardoise); text-decoration: underline; }
.etiq.soc.mss { background: var(--bleu-fond); color: var(--atelier); }
.etiq.soc.blf { background: #efe9dc; color: #5c4a1c; }
a.repere { color: inherit; display: block; }
a.repere:hover { background: #f7f9fb; text-decoration: none; }
.panneau > .tete h2 { font-size: 16px; }
.onglet > .panneau { border: 0; }
.onglet .pages { border-top: 1px solid var(--brume); }
.onglets { margin: 0; padding: 0 6px; }
tr.report td { color: var(--ardoise); font-style: italic; background: #fafbfc; }
.texte p { max-width: 68ch; margin: 0 0 10px; }
.ligne-chiffres { display: flex; flex-wrap: wrap; gap: 6px 26px; }
dl.fiche.serre { grid-template-columns: 118px 1fr; }

/* le nuancier des densites : une bande de mousses, chaque densite a la largeur de sa part des ventes */
.nuancier-grand { display: flex; height: 76px; border: 1px solid rgba(22, 32, 46, .28); border-radius: var(--rayon); overflow: hidden; }
.nuancier-grand > div { background: var(--c, #cfd6df); flex-basis: 0; min-width: 5px; border-right: 1px solid rgba(22, 32, 46, .28); padding: 8px 9px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; white-space: nowrap; color: var(--encre); }
.nuancier-grand > div:last-child { border-right: 0; }
.nuancier-grand b { font-family: var(--titre); font-size: 15px; }
.nuancier-grand span { font-variant-numeric: tabular-nums; font-size: 13px; }
td.codes { letter-spacing: .02em; }

/* ventes des 12 derniers mois : pour chaque mois, l'annee d'avant puis l'annee en cours */
.histo2 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; height: 290px; }
.histo2 .col { display: flex; flex-direction: column; min-width: 0; }
.histo2 .paire { flex: 1; display: flex; align-items: flex-end; gap: 2px; padding-top: 18px; }
.histo2 .barre { flex: 1; background: var(--atelier); min-height: 1px; position: relative; border-radius: 2px 2px 0 0; }
.histo2 .barre.ref { background: #c3cedd; }
.histo2 .barre.jour { background: var(--mousse-2); }
.histo2 .barre span { position: absolute; left: 50%; top: -17px; transform: translateX(-50%); font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ardoise); }
.histo2 .mois { text-align: center; font-size: 12px; color: var(--ardoise); padding-top: 5px; border-top: 1px solid var(--trait); }
.legende { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-top: 12px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; display: inline-block; border-radius: 2px; }
.legende .c-ref { background: #c3cedd; } .legende .c-mois { background: var(--atelier); } .legende .c-jour { background: var(--mousse-2); }
.histo.annees { height: 190px; gap: 6px; }
.histo.annees .col { background: none; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; min-width: 0; }
.histo.annees .col div { background: var(--atelier); border-radius: 2px 2px 0 0; min-height: 1px; flex: none; }
.histo.annees .col span { font-size: 11px; color: var(--ardoise); text-align: center; white-space: nowrap; overflow: hidden; }
.histo.annees .col small { text-align: center; font-size: 11.5px; color: var(--ardoise); border-top: 1px solid var(--trait); padding-top: 3px; }

/* saisie */
.cadre-mousse { border-left: 3px solid var(--mousse-2); }
.cote.etroit { max-width: 760px; }
.aide-ligne { font-size: 12px; color: var(--ardoise); padding: 3px 2px 0; min-height: 18px; display: flex; align-items: center; gap: 5px; }
.aide-ligne .dens i { width: 11px; height: 11px; }
table.saisie td.net { padding-top: 11px; font-weight: 600; }
.retirer { border: 0; background: none; color: var(--ardoise); font-size: 20px; line-height: 1; cursor: pointer; padding: 6px 8px; border-radius: var(--rayon); }
.retirer:hover { background: var(--rouge-fond); color: var(--rouge); }
.sous-lignes { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.bas-saisie { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: 8px; }
.bas-saisie .gauche { flex: 1; min-width: 240px; max-width: 460px; }
.actions.fin { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.formulaire { max-width: 860px; }
textarea { width: 100%; resize: vertical; }
input[type=checkbox], table.saisie input[type=checkbox] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--atelier); vertical-align: middle; }
table.saisie td { vertical-align: middle; } table.saisie.haut td { vertical-align: top; }
.filtres input[type=search] { min-width: 220px; }

@media print {
  .pas-imprimer, .pages, .fil { display: none !important; }
  .document .doc-tete { grid-template-columns: 1.3fr 1fr 1fr; }
  .onglet > .filtres { display: none !important; }
  a { color: inherit; }
}
@media (max-width: 900px) {
  .histo2 { gap: 4px; height: 170px; } .histo2 .barre span { display: none; }
  .nuancier-grand b { font-size: 13px; }
  .bas-saisie .totaux { width: 100%; }
}

.onglet > .dedans.filtres, .onglet .filtres.dedans { margin: 0; }
@media (max-width: 900px) { .pm { display: none; } .reperes { grid-template-columns: 1fr 1fr; } .repere { border-bottom: 1px solid var(--trait); } }

/* ================= version 2 : analyses, details depliables, tableaux larges ================= */
/* ---------- graphiques en colonnes ---------- */
.cols { display: flex; align-items: stretch; gap: 6px; }
.cols.serre { gap: 3px; }
.cols .col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cols .col.lien { cursor: pointer; }
.cols .col.lien:hover .pile i { filter: brightness(1.12); }
.cols .pile { flex: 1; min-height: 0; display: flex; flex-direction: column-reverse; justify-content: flex-start; padding-top: 16px; border-bottom: 1px solid var(--trait); }
.cols .pile i { display: block; flex: none; min-height: 0; }
.cols .pile i:nth-last-of-type(1) { border-radius: 2px 2px 0 0; }
.cols .pile .val { flex: none; font-size: 11px; line-height: 15px; text-align: center; color: var(--ardoise); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cols.groupe .pile { flex-direction: row; align-items: flex-end; gap: 2px; padding-top: 4px; }
.cols.groupe .pile i { flex: 1; border-radius: 2px 2px 0 0; }
.cols.groupe .pile .val { display: none; }
.cols small { text-align: center; font-size: 11.5px; color: var(--ardoise); padding-top: 4px; white-space: nowrap; overflow: hidden; }
.cols.serre small { font-size: 10.5px; }
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.multiples .panneau > .tete { padding: 9px 12px; } .multiples .panneau > .tete h3 { font-size: 15px; }
.multiples .dedans { padding: 8px 12px 10px; }
.legende.petit { margin-top: 10px; }

/* barres horizontales : un classement (villes, chauffeurs, zones) */
.barres-liste .ligne { display: grid; grid-template-columns: minmax(100px, 1.15fr) minmax(60px, 1.6fr) minmax(64px, auto) minmax(112px, auto); gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--brume); color: inherit; }
.barres-liste .ligne:last-child { border-bottom: 0; }
.barres-liste .lib { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barres-liste .trait { height: 10px; background: var(--brume); border-radius: 2px; overflow: hidden; }
.barres-liste .trait i { display: block; height: 100%; background: var(--atelier); }
.barres-liste .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.barres-liste .note { text-align: right; font-size: 12.5px; color: var(--ardoise); white-space: nowrap; }

/* anciennete de l'encours */
.barres.haut { height: 30px; }
.barres span { flex-basis: 0; }
.tranche.t3 { color: var(--ambre); } .tranche.t4, .tranche.t5 { color: var(--rouge); font-weight: 600; }
.nuancier-grand.bas { height: 56px; margin-bottom: 4px; }

/* ---------- tableaux : en-tetes de ligne, premiere colonne figee, periode en cours ---------- */
table.liste tbody th, table.liste tfoot th { text-align: left; font-weight: 400; font-size: 14px; color: var(--encre); padding: 7px 10px; border-bottom: 1px solid var(--brume); white-space: nowrap; position: static; vertical-align: top; }
table.liste tfoot th { font-weight: 700; border-top: 2px solid var(--trait); border-bottom: 0; }
table.fige thead th:first-child, table.fige tbody th, table.fige tfoot th, table.fige tbody td:first-child, table.fige tfoot td:first-child { position: sticky; left: 0; z-index: 1; background: var(--papier); box-shadow: 1px 0 0 var(--trait); }
table.fige thead th:first-child { z-index: 2; }
table.liste tr.lien:hover th { background: #f7f9fb; }
table.liste tr.groupe > * { font-weight: 600; border-top: 1px solid var(--trait); }
table.liste tr.detail-code > * { font-size: 12.5px; color: var(--ardoise); padding-top: 3px; padding-bottom: 3px; border-bottom-color: transparent; }
table.liste tr.detail-code th { padding-left: 32px; }
table.liste tr.detail-code .sous b { color: var(--encre); font-weight: 600; }
table.liste td.total, table.liste th.total { background: #f7f9fb; }
table.liste td.courant, table.liste th.courant { background: #fdf7e3; }
table.liste tr.choisi td { background: #fdf7e3; font-weight: 600; }
table.liste th.etroit, table.liste td.etroit { width: 34px; padding-right: 0; }
table.liste th.compte, table.liste td.compte { background: #f7f9fb; }
table.matrice td.barre { min-width: 82px; }
table.matrice thead th .dens { font-weight: 600; }

/* ---------- details deplies sous une ligne ---------- */
.deplier { width: 22px; height: 22px; border: 1px solid var(--trait); background: var(--papier); border-radius: 3px; cursor: pointer; line-height: 1; font-weight: 700; color: var(--ardoise); padding: 0; }
.deplier:hover { background: var(--brume); color: var(--encre); }
table.liste tr.detail > td { background: #f7f9fb; padding: 12px 14px 14px 44px; border-bottom: 1px solid var(--trait); }
.detail-bloc { display: flex; flex-direction: column; gap: 10px; max-width: 1040px; }
.detail-suite { margin-top: 2px; }
.detail-suite > table { margin-top: 6px; }
table.liste.mini { background: var(--papier); border: 1px solid var(--trait); }
table.liste.mini th { position: static; padding: 5px 9px; font-size: 12px; }
table.liste.mini td { padding: 5px 9px; font-size: 13px; }
table.liste.mini tfoot td { border-top: 1px solid var(--trait); }
.faits { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.faits div span { display: block; font-size: 12px; color: var(--ardoise); }
.faits div b { font-weight: 600; }
/* reglements d'un client : chaque ecriture, puis les bons qu'elle a soldes */
table.ecritures tr.ecriture td { border-bottom: 0; padding-top: 10px; border-top: 1px solid var(--trait); }
table.ecritures tr.ecriture.annule td { color: var(--ardoise); }
table.ecritures tr.ecriture.annule td b { text-decoration: line-through; font-weight: 400; }
table.ecritures tr.sous-ecriture td { padding: 0 10px 10px; border-bottom: 0; }
table.ecritures tr.sous-ecriture table.mini { width: auto; min-width: min(680px, 100%); }
details.panneau > summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
details.panneau[open] > summary { border-bottom: 1px solid var(--trait); }
.reperes.dans { margin: 0; border: 0; border-radius: 0; }
h2.espace { margin-top: 22px; margin-bottom: 4px; }
.entete .sous a { text-decoration: underline; }
.filtres select { max-width: 100%; }

@media print { .deplier, .multiples .legende { display: none !important; } table.fige thead th:first-child, table.fige tbody th, table.fige tbody td:first-child { position: static; box-shadow: none; } }
@media (max-width: 900px) {
  .multiples { grid-template-columns: 1fr; }
  .barres-liste .ligne { grid-template-columns: 1fr auto; } .barres-liste .trait, .barres-liste .note { display: none; }
  table.liste tr.detail > td { padding-left: 12px; }
  .cols small { font-size: 10px; }
}
table.liste.mini caption { caption-side: top; text-align: left; font-size: 12px; color: var(--ardoise); padding: 0 0 3px; }

/* tableaux serres : beaucoup de colonnes de chiffres */
table.liste.serre { font-size: 13px; }
table.liste.serre th, table.liste.serre td { padding: 6px 7px; }
table.liste.serre tbody th { font-size: 13px; padding: 6px 7px; }
table.liste.serre tr.detail-code > * { font-size: 12px; padding-top: 2px; padding-bottom: 2px; }
table.liste.serre tr.detail-code th { padding-left: 28px; max-width: 250px; overflow: hidden; text-overflow: ellipsis; }
table.matrice thead th { white-space: normal; vertical-align: bottom; min-width: 74px; }
table.matrice thead th .dens { white-space: normal; }
table.matrice tbody th { min-width: 190px; max-width: 240px; white-space: normal; }
table.matrice td.barre { min-width: 74px; }
table.balance tbody td:first-child { min-width: 200px; }
table.liste td.insecable { white-space: nowrap; }
.barres-liste .ligne { grid-template-columns: minmax(120px, 1.5fr) minmax(50px, 1.4fr) minmax(64px, auto) minmax(112px, auto); }

/* bons soldes par une ecriture, en version compacte */
.bons-regles { max-width: 760px; }
table.liste.mini.sans-tete { border: 0; border-left: 2px solid var(--trait); background: none; }
table.liste.mini.sans-tete td { border-bottom: 0; padding: 2px 10px; }
.lien-bouton { background: none; border: 0; color: var(--bleu); cursor: pointer; padding: 3px 12px; font-size: 12.5px; }
.lien-bouton:hover { text-decoration: underline; }
.totaux.large { width: 100%; margin: 0 0 14px; }
.totaux.large div.grand { font-size: 19px; }

.barres-liste .ligne { grid-template-columns: 34% 1fr 96px 132px; }
table.liste td.nom { max-width: 210px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.balance tbody td:first-child { min-width: 170px; }
select.large { max-width: min(420px, 100%); }
.filtres label { min-width: 0; max-width: 100%; }
.panneau > .tete .petit a + a { margin-left: 12px; }
@media (max-width: 900px) {
  .repere .valeur { font-size: 20px; }
  .barres-liste .ligne { grid-template-columns: 1fr auto; }
  .filtres label:has(select.large) { flex: 1 1 100%; } select.large { flex: 1; min-width: 0; }
}

/* alertes de credit */
.message.attention { background: #fdf3dc; border-color: #ecc874; color: #6b4b06; }
.alertes-client { margin-top: 10px; }
.alertes-client ul { margin: 6px 0 0 18px; padding: 0; }
.alertes-client li { margin: 2px 0; }
.alertes-client .passer { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-weight: 600; }
.alertes { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.alertes .etiq { white-space: nowrap; cursor: help; }
.conditions-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 18px; align-items: end; }
.conditions-form .large { grid-column: 1 / -1; }
label.case { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
a.repere.choisi { outline: 2px solid var(--jaune, #e0ad22); outline-offset: -2px; }

/* bon de preparation : fiche d'atelier */
.fiche-atelier td, .fiche-atelier th { font-size: 15px; padding-top: 9px; padding-bottom: 9px; }
.fiche-atelier .case-cocher { text-align: center; width: 60px; font-size: 18px; }

.petit.bloc { display: block; }

/* indicateurs cles et IA locale */
.sous-titre { margin: 22px 0 8px; font-size: 15px; font-weight: 600; color: var(--encre); }
.lecture-ia .gros { font-weight: 600; margin: 0 0 8px; }
.points-ia { margin: 0 0 10px; padding-left: 20px; } .points-ia li { margin: 4px 0; line-height: 1.45; }
.designations td { vertical-align: top; } .designations .exemple { margin-bottom: 3px; }
.champ-nom { display: flex; gap: 6px; } .champ-nom input { min-width: 260px; flex: 1; }

.codes-famille > summary { cursor: pointer; list-style: none; } .codes-famille > summary::-webkit-details-marker { display: none; }
.codes-famille > summary h2::before { content: '▸ '; color: var(--gris, #888); } .codes-famille[open] > summary h2::before { content: '▾ '; }
select.finition { margin-left: 8px; max-width: 320px; font-size: 12px; }

/* suivi des clients */
textarea.message { width: 100%; font: inherit; line-height: 1.45; padding: 10px; box-sizing: border-box; }
.risque { display: inline-block; min-width: 34px; padding: 2px 6px; border-radius: 4px; text-align: center; font-weight: 600;
  background: linear-gradient(90deg, #f3d4cf var(--r), #f4f1ec var(--r)); }

/* documents imprimes (A4) */
.barre-impression { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.feuille { background: #fff; color: #111; max-width: 210mm; min-height: 270mm; margin: 0 auto; padding: 14mm 13mm; box-shadow: 0 1px 4px rgba(0,0,0,.15); font-size: 12px; display: flex; flex-direction: column; }
.f-tete { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #1f3a5f; padding-bottom: 10px; }
.f-raison { font-size: 19px; font-weight: 700; color: #1f3a5f; } .f-societe div { line-height: 1.45; } .f-ids { font-size: 10.5px; color: #444; margin-top: 3px; }
.f-titre { text-align: right; } .f-titre h1 { margin: 0 0 6px; font-size: 21px; text-transform: uppercase; letter-spacing: .02em; }
.f-infos { margin-left: auto; border-collapse: collapse; } .f-infos th { text-align: right; font-weight: 400; color: #555; padding: 1px 8px 1px 0; } .f-infos td { text-align: right; font-weight: 600; }
.f-client { margin: 14px 0 12px auto; width: 48%; border: 1px solid #c9d1db; border-radius: 4px; padding: 8px 12px; line-height: 1.5; } .f-nom { font-size: 15px; font-weight: 700; }
.f-lignes { width: 100%; border-collapse: collapse; } .f-lignes th { background: #eef2f6; text-align: left; padding: 6px; border-bottom: 1px solid #9aa8b8; font-size: 11px; }
.f-lignes td { padding: 5px 6px; border-bottom: 1px solid #e3e7ec; vertical-align: top; } .f-lignes .n { text-align: right; white-space: nowrap; } .f-lignes tfoot td { font-weight: 700; border-top: 1px solid #9aa8b8; }
.f-lignes tr.report td { font-style: italic; color: #444; } .f-detail { font-size: 10px; color: #666; }
.f-bas { display: flex; justify-content: space-between; gap: 20px; margin-top: 14px; } .f-lettres { flex: 1; } .f-somme { font-weight: 600; margin-top: 2px; } .f-conditions { margin-top: 8px; font-size: 11px; color: #333; }
.f-totaux { border-collapse: collapse; min-width: 240px; } .f-totaux th { text-align: left; font-weight: 400; padding: 3px 10px 3px 0; } .f-totaux td { text-align: right; padding: 3px 0; white-space: nowrap; }
.f-totaux .f-net th, .f-totaux .f-net td { font-weight: 700; font-size: 14px; border-top: 2px solid #1f3a5f; padding-top: 6px; }
.f-signatures { display: flex; justify-content: space-between; margin-top: 26px; } .f-signatures > div { width: 45%; height: 70px; border-top: 1px solid #888; padding-top: 4px; font-size: 11px; } .f-signatures span { display: block; color: #777; font-size: 10px; }
.f-pied { margin-top: auto; padding-top: 10px; border-top: 1px solid #c9d1db; font-size: 10px; color: #555; text-align: center; }
.mentions textarea { width: 100%; font: inherit; }
@media print {
  @page { size: A4; margin: 0; }
  .impression .feuille { box-shadow: none; margin: 0; max-width: none; min-height: 297mm; padding: 12mm; }
  .impression ~ *, .bandeau-copie { display: none !important; }
}

/* ---------- Master Sales sur iPhone et iPad ---------- */
.bandeau-copie { cursor: pointer; } .bandeau-copie.vif { background: #e6f2ea; color: #1d5a35; border-bottom-color: #c6e0cf; }
.bandeau-copie.vif::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2f8f55; margin-right: 8px; vertical-align: 1px; }
#menu nav .tout-menu { display: none; }
@media (max-width: 900px) {
  #menu { padding-bottom: env(safe-area-inset-bottom); }
  #menu nav { overflow: visible; justify-content: space-around; }
  #menu nav a:not(.principal) { display: none; }
  #menu nav .tout-menu { display: flex; flex-direction: column; align-items: center; justify-content: center; background: none; border: 0; border-top: 3px solid transparent; color: #dfe7f2; font: inherit; font-size: 11.5px; padding: 9px 13px; }
  #menu.ouvert { inset: 0; flex-direction: column; overflow-y: auto; padding-top: env(safe-area-inset-top); }
  #menu.ouvert .marque { display: block; }
  #menu.ouvert nav { flex-direction: column; justify-content: flex-start; }
  #menu.ouvert nav a, #menu.ouvert nav a:not(.principal) { display: flex; flex-direction: row; font-size: 15px; padding: 11px 20px; border-top: 0; border-left: 3px solid transparent; }
  #menu.ouvert nav .groupe { display: block; }
  #menu.ouvert nav .tout-menu { position: sticky; bottom: 0; background: var(--atelier-2); font-size: 15px; padding: 14px; border: 0; }
  #menu.ouvert .pied { display: block; }
  #vue { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .bandeau-copie { font-size: 12px; padding: 6px 12px; }
  table.liste { font-size: 13px; }
}
@media (display-mode: standalone) { #corps { padding-top: env(safe-area-inset-top); } }
.installer ol { line-height: 1.7; padding-left: 20px; } .installer code { font-size: 15px; background: #eef2f6; padding: 2px 6px; border-radius: 4px; }

#menu nav a .court { display: none; }
@media (max-width: 900px) {
  #menu nav a.principal .long { display: none; } #menu nav a.principal .court { display: inline; }
  #menu.ouvert nav a.principal .long { display: inline; } #menu.ouvert nav a.principal .court { display: none; }
  #menu nav a, #menu nav .tout-menu { flex: 1; align-items: center; padding: 12px 4px; font-size: 13px; }
  #menu.ouvert nav a, #menu.ouvert nav .tout-menu { flex: none; align-items: flex-start; }
}

/* lecture du matin (IA locale) */
.lecture-ia .tete { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; }
.lecture-ia .tete .bouton { margin-left: auto; }
.lecture-clients { margin: 8px 0 4px; padding-left: 1.4em; }
.lecture-clients li { margin: 0 0 10px; }

.bandeau-copie.arret { background: #fde8c8; color: #7a4100; }

/* clients par densite sur telephone */
.fiches-densite { display: grid; gap: 10px; }
.fiche-densite { display: block; background: #fff; border: 1px solid #dde3ec; border-radius: 10px; padding: 10px 12px; color: inherit; text-decoration: none; }
.fiche-densite.total { background: #f3f6fa; }
.fd-chiffres { margin: 4px 0 6px; }
.fd-ligne { display: grid; grid-template-columns: 1fr auto 4.5em; gap: 8px; align-items: center; font-size: 0.92em; padding: 3px 0; border-top: 1px solid #eef1f5; }
.fd-ligne .n { text-align: right; }

/* tournees */
.ville-tournee { padding: 8px 0 12px; border-top: 1px solid #eef1f5; }
.vt-tete { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin: 0 0 6px; }
@media print { .feuille-tournee .imprimable { border: none; } }

/* tendances chiffrees des clients (relances, 26/11/2026) */
.tendance { min-width: 190px; line-height: 1.5; } .tendance .courbe-mois { vertical-align: middle; margin-left: 4px; } .tendance .etiq { white-space: nowrap; }

/* tendance mise en evidence (26/11/2026) */
.badge-tendance { margin-top: 3px; white-space: nowrap; } .badge-tendance .etiq { font-weight: 600; }
.encadre-tendance { border-left: 5px solid var(--bleu, #2d5679); margin-bottom: 14px; }
.encadre-tendance.sens-hausse { border-left-color: var(--vert, #1e7f53); } .encadre-tendance.sens-baisse { border-left-color: var(--rouge, #b3261e); }
.encadre-tendance .trois-ans { font-size: 14px; line-height: 1.7; } .encadre-tendance .tendance { font-size: 14px; }
