/* ALIZE SOLUTION — feuille de style */
/* Couleurs : clair par défaut, sombre au choix ou selon l'appareil */
:root {
  --fond: #F3F1EE; --surface: #FBFAF8; --menu: #ECE8E3; --survol: #F1ECE6; --entete-tableau: #F7F4F0;
  --encre: #2F2A26; --encre-douce: #6F665E; --trait: #E3DDD6; --trait-fort: #CDC4BA;
  --accent: #7A6550; --accent-fonce: #5F4E3E; --accent-pale: #EFE8DF; --sur-accent: #FFFDF9;
  --cafe: #6B4A2E; --cafe-pale: #F2EAE0;
  --rouge: #A3443A; --rouge-pale: #F8E9E6; --vert: #4F7A4C; --vert-pale: #E8F0E5; --ambre: #8A6420; --ambre-pale: #F7EDDA;
  --voile: rgba(47, 42, 38, .4); --ombre: 0 1px 2px rgba(47, 42, 38, .05), 0 6px 20px rgba(47, 42, 38, .06);
  --police: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --titre: 'Cormorant Garamond', 'Cormorant', Garamond, Georgia, serif;
  --r: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --fond: #1B1917; --surface: #23201D; --menu: #1F1C1A; --survol: #2A2622; --entete-tableau: #26231F;
    --encre: #E9E3DB; --encre-douce: #A89D91; --trait: #36312C; --trait-fort: #4B443D;
    --accent: #C9AE8E; --accent-fonce: #DCC4A6; --accent-pale: #332B23; --sur-accent: #1B1917;
    --cafe: #D9B48C; --cafe-pale: #3A2E22;
    --rouge: #E58A7E; --rouge-pale: #3D2421; --vert: #9CC59A; --vert-pale: #243324; --ambre: #E2B866; --ambre-pale: #3A2F1A;
    --voile: rgba(0, 0, 0, .55); --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="sombre"] {
  --fond: #1B1917; --surface: #23201D; --menu: #1F1C1A; --survol: #2A2622; --entete-tableau: #26231F;
  --encre: #E9E3DB; --encre-douce: #A89D91; --trait: #36312C; --trait-fort: #4B443D;
  --accent: #C9AE8E; --accent-fonce: #DCC4A6; --accent-pale: #332B23; --sur-accent: #1B1917;
  --cafe: #D9B48C; --cafe-pale: #3A2E22;
  --rouge: #E58A7E; --rouge-pale: #3D2421; --vert: #9CC59A; --vert-pale: #243324; --ambre: #E2B866; --ambre-pale: #3A2F1A;
  --voile: rgba(0, 0, 0, .55); --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 16px/1.55 var(--police); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; }
h1 { font-family: var(--titre); font-size: 2.15rem; font-weight: 600; letter-spacing: .005em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent-fonce); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.attente { padding: 2rem; color: var(--encre-douce); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 40px; padding: .45rem .95rem; border-radius: var(--r);
  border: 1px solid var(--trait-fort); background: var(--surface); color: var(--encre);
  font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--encre-douce); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-principal { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.btn-principal:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.btn-danger { background: var(--rouge); border-color: var(--rouge); color: var(--sur-accent); }
.btn-large { width: 100%; min-height: 46px; font-size: 1rem; }
.btn-petit { min-height: 32px; padding: .2rem .6rem; font-size: .875rem; }
.btn-lien { background: none; border: 0; padding: .25rem 0; color: var(--accent-fonce); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-icone { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; background: none; border-radius: var(--r); color: inherit; font-size: 1.5rem; cursor: pointer; }
.btn-icone:hover { background: var(--menu); }
.btn-icone svg { width: 22px; height: 22px; }

/* ---------- Connexion ---------- */
.appli-connexion { min-height: 100vh; }
.connexion { min-height: 100vh; display: grid; grid-template-columns: 1.15fr minmax(340px, 460px); }
.connexion-marque {
  display: grid; place-items: center; padding: 3rem; position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 30% 20%, var(--surface) 0%, var(--menu) 70%);
}
.connexion-marque .logo-complet { width: min(380px, 70%); height: auto; }
.connexion-marque p { position: absolute; bottom: 2.5rem; left: 0; right: 0; text-align: center; color: var(--encre-douce); font-family: var(--titre); font-size: 1.35rem; font-style: italic; margin: 0; }
.connexion-form { align-self: center; padding: 3rem; display: grid; gap: 1.1rem; }
.connexion-form h1 { margin-bottom: .25rem; }
.alerte { background: var(--rouge-pale); color: var(--rouge); padding: .6rem .8rem; border-radius: var(--r); margin: 0; }
@media (max-width: 800px) {
  .connexion { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .connexion-marque { padding: 2rem 1rem 1.25rem; }
  .connexion-marque .logo-complet { width: 200px; }
  .connexion-marque p { display: none; }
  .connexion-form { padding: 1.5rem 1.25rem; align-self: start; }
}

/* Logo selon le thème */
.pour-sombre { display: none; }
:root[data-theme="sombre"] .pour-clair { display: none; }
:root[data-theme="sombre"] .pour-sombre { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .pour-clair { display: none; }
  :root:not([data-theme="clair"]) .pour-sombre { display: inline-block; }
}

/* ---------- Structure ---------- */
.appli { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.menu {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--menu);
  display: flex; flex-direction: column; padding: 1.25rem .75rem; border-right: 1px solid var(--trait);
}
.menu-marque { display: flex; align-items: center; gap: .75rem; padding: .25rem .5rem 1.5rem; color: var(--encre); text-decoration: none; }
.menu-marque img { width: 46px; height: 46px; }
.marque-texte { display: grid; line-height: 1; }
.marque-nom { font-family: var(--titre); font-size: 1.6rem; font-weight: 600; letter-spacing: .14em; }
.marque-sous { font-size: .62rem; letter-spacing: .42em; color: var(--accent); margin-top: .3rem; font-weight: 600; }
.theme { display: flex; gap: .25rem; margin-top: .75rem; }
.theme button { flex: 1; padding: .3rem .2rem; border: 1px solid var(--trait-fort); background: none; color: var(--encre-douce); border-radius: 6px; font: inherit; font-size: .78rem; cursor: pointer; }
.theme button[aria-pressed="true"] { background: var(--surface); color: var(--encre); border-color: var(--accent); }
.menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.menu a {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: var(--r);
  color: var(--encre); text-decoration: none; font-weight: 500;
}
.menu a svg { width: 20px; height: 20px; color: var(--encre-douce); flex: none; }
.menu a:hover { background: var(--survol); }
.menu a.actif { background: var(--surface); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent), var(--ombre); }
.menu a.actif svg { color: var(--accent); }
.menu-profil { margin-top: auto; padding: 1rem .5rem 0; border-top: 1px solid var(--trait); display: grid; gap: .1rem; font-size: .875rem; }
.menu-profil span { color: var(--encre-douce); }
.menu-profil .btn-lien { justify-self: start; margin-top: .5rem; }
.barre-mobile { display: none; }
.voile { display: none; }
.contenu { padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; min-width: 0; outline: none; max-width: 1280px; }

@media (max-width: 900px) {
  .appli { grid-template-columns: 1fr; }
  .barre-mobile {
    display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 20;
    padding: .4rem .75rem; background: var(--surface); border-bottom: 1px solid var(--trait);
  }
  .barre-titre { font-family: var(--titre); font-weight: 600; letter-spacing: .14em; font-size: 1.2rem; }
.barre-mobile img { width: 32px; height: 32px; }
  .menu { position: fixed; z-index: 40; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--ombre); }
  .menu-ouvert .menu { transform: none; }
  .menu-ouvert .voile { display: block; position: fixed; inset: 0; z-index: 30; background: var(--voile); }
  .contenu { padding: 1.25rem 1rem 3rem; }
}
@media (prefers-reduced-motion: reduce) { .menu { transition: none; } }

/* ---------- En-tête de page ---------- */
.entete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.entete p { color: var(--encre-douce); margin: .35rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.fil { font-size: .9rem; margin-bottom: .5rem; display: inline-block; }

/* ---------- Panneaux, onglets ---------- */
.panneau { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); padding: 1.35rem 1.4rem; }
.panneau + .panneau { margin-top: 1rem; }
.panneau > h2 { margin-bottom: 1rem; }
.onglets { display: flex; gap: .25rem; border-bottom: 1px solid var(--trait); margin-bottom: 1rem; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.onglets::-webkit-scrollbar { display: none; }
.onglets a, .onglets button {
  padding: .6rem .9rem; border: 0; background: none; font: inherit; color: var(--encre-douce); text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; font-weight: 600;
}
.onglets .actif { color: var(--encre); border-bottom-color: var(--accent); }
.onglets .compte { display: inline-block; min-width: 1.4rem; padding: 0 .35rem; margin-left: .35rem; border-radius: 999px; background: var(--menu); font-size: .78rem; text-align: center; }

/* ---------- Indicateurs d'accueil ---------- */
.indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.indicateur { display: block; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); padding: 1rem 1.1rem; text-decoration: none; color: inherit; }
.indicateur:hover { border-color: var(--trait-fort); }
.indicateur strong { display: block; font-family: var(--titre); font-size: 2.4rem; font-weight: 600; line-height: 1.05; }
.indicateur span { color: var(--encre-douce); }
.indicateur.alerte-rouge strong { color: var(--rouge); }
.indicateur.montant strong { color: var(--cafe); }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1rem; }
@media (max-width: 500px) { .grille-2 { grid-template-columns: 1fr; } }

/* ---------- Tableaux ---------- */
.tableau-conteneur { overflow-x: auto; border: 1px solid var(--trait); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--trait); vertical-align: middle; }
th { font-size: .82rem; color: var(--encre-douce); font-weight: 600; letter-spacing: .01em; background: var(--entete-tableau); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.cliquable { cursor: pointer; }
tbody tr.cliquable:hover { background: var(--survol); }
td.nombre, th.nombre { text-align: right; white-space: nowrap; }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }
.secondaire { color: var(--encre-douce); font-size: .875rem; }

/* Étiquettes de statut */
.etiquette { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--menu); color: var(--encre-douce); white-space: nowrap; }
.etiquette.brouillon { background: var(--menu); color: var(--encre-douce); }
.etiquette.emis, .etiquette.accepte { background: var(--accent-pale); color: var(--accent-fonce); }
.etiquette.refuse, .etiquette.retard, .etiquette.bloque { background: var(--rouge-pale); color: var(--rouge); }
.etiquette.transforme { background: var(--cafe-pale); color: var(--cafe); }
.etiquette.paye { background: var(--vert-pale); color: var(--vert); }
.etiquette.attention { background: var(--ambre-pale); color: var(--ambre); }

/* ---------- Barre de filtres ---------- */
.filtres { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.filtres input[type=search] { flex: 1 1 260px; max-width: 420px; }

/* ---------- Formulaires ---------- */
input, select, textarea {
  width: 100%; min-height: 40px; padding: .45rem .65rem; border: 1px solid var(--trait-fort); border-radius: var(--r);
  background: var(--surface); color: var(--encre); font: inherit; font-size: 1rem;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); outline-offset: 0; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
.champ { display: grid; gap: .3rem; align-content: start; }
.champ label { font-weight: 600; font-size: .9rem; }
.champ small { color: var(--encre-douce); }
.requis { color: var(--rouge); }
.formulaire { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem 1.25rem; }
.champ-plein { grid-column: 1 / -1; }
.choix { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.choix label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }

/* ---------- Fenêtres ---------- */
dialog.fenetre { border: 0; padding: 0; border-radius: 10px; width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: 0 24px 70px rgba(0, 0, 0, .28); color: var(--encre); }
dialog.fenetre-large { width: min(860px, calc(100vw - 2rem)); }
dialog::backdrop { background: var(--voile); }
.fenetre-corps { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
.fenetre-corps header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem .5rem; }
.fenetre-contenu { padding: .5rem 1.25rem 1rem; overflow-y: auto; }
.fenetre-corps footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; padding: .9rem 1.25rem; border-top: 1px solid var(--trait); background: var(--entete-tableau); }
.liste-choix { list-style: none; margin: .75rem 0 0; padding: 0; max-height: 50vh; overflow-y: auto; border: 1px solid var(--trait); border-radius: var(--r); }
.liste-choix button { display: block; width: 100%; text-align: left; padding: .6rem .8rem; border: 0; border-bottom: 1px solid var(--trait); background: none; font: inherit; cursor: pointer; }
.liste-choix li:last-child button { border-bottom: 0; }
.liste-choix button:hover, .liste-choix button:focus-visible { background: var(--accent-pale); }

/* ---------- Notifications ---------- */
#notifications { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.notif { padding: .75rem 1rem; border-radius: var(--r); box-shadow: var(--ombre); background: var(--encre); color: var(--sur-accent); font-weight: 500; }
.notif-erreur { background: var(--rouge); }

/* ---------- États vides ---------- */
.vide { padding: 2.5rem 1rem; text-align: center; color: var(--encre-douce); display: grid; justify-items: center; gap: .5rem; }

/* ---------- Document de vente : la feuille ---------- */
.document-zone { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1.25rem; align-items: start; }
@media (max-width: 1500px) {
  .document-zone { grid-template-columns: 1fr; }
  .document-zone .cote { order: -1; position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
  .document-zone .cote .actions { display: flex; flex-wrap: wrap; }
  .document-zone .cote .actions .btn { width: auto; }
}
.feuille {
  position: relative; background: var(--surface); border: 1px solid var(--trait); border-radius: 4px;
  box-shadow: var(--ombre); padding: clamp(1rem, 3vw, 2.25rem); overflow: hidden;
}
.feuille-entete { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.5rem; }
.feuille-type { font-size: .95rem; color: var(--encre-douce); font-weight: 600; }
.feuille-numero { font-family: var(--titre); font-size: 2.3rem; font-weight: 600; letter-spacing: .01em; }
.feuille-numero.sans-numero { color: var(--encre-douce); font-weight: 500; font-size: 1.35rem; }
.feuille-client { min-width: 220px; max-width: 320px; padding: .75rem 1rem; border-left: 3px solid var(--accent); background: var(--accent-pale); }
.feuille-client a { font-weight: 700; font-size: 1.05rem; }
.bas-feuille { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1.5rem; margin-top: 1.5rem; }
.tampon {
  display: inline-block; transform: rotate(-7deg); margin: 0 0 .5rem .5rem;
  border: 3px solid currentColor; border-radius: 6px; padding: .2rem .8rem;
  font-weight: 700; font-size: 1.15rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; pointer-events: none;
}
.tampon.brouillon { color: var(--encre-douce); border-style: dashed; }
.tampon.emis { color: var(--accent); }
.tampon { font-family: var(--titre); letter-spacing: .14em; }
.tampon.transforme { color: var(--cafe); }
.tampon.refuse, .tampon.annule { color: var(--rouge); }
.tampon.accepte { color: var(--vert); }
.verrou { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .9rem; border-radius: var(--r); background: var(--accent-pale); color: var(--accent-fonce); margin-bottom: 1.25rem; font-size: .95rem; }
.verrou svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.lignes td input, .lignes td select { min-height: 36px; padding: .3rem .45rem; font-size: .95rem; }
.lignes td.col-designation { min-width: 260px; width: 100%; }
.lignes td.col-nb input { width: 80px; text-align: right; }
.lignes td.col-prix input { width: 104px; }
.lignes td.col-tva select { width: 150px; }
.lignes td, .lignes th { padding-left: .45rem; padding-right: .45rem; }
.lignes .ajout td { background: var(--accent-pale); }
.totaux { margin-left: auto; width: min(100%, 340px); display: grid; gap: .25rem; }
.totaux div { display: flex; justify-content: space-between; gap: 1rem; }
.totaux .ttc { border-top: 2px solid var(--encre); margin-top: .35rem; padding-top: .45rem; font-weight: 700; font-size: 1.2rem; }
.totaux .net { color: var(--cafe); font-weight: 700; font-size: 1.15rem; }
.mentions { margin-top: 1.5rem; font-size: .85rem; color: var(--encre-douce); white-space: pre-line; }
.cote { display: grid; gap: 1rem; position: sticky; top: 1rem; }
.cote .panneau { padding: 1rem; }
.cote h2 { font-size: 1rem; margin-bottom: .75rem; }
.cote .actions { display: grid; gap: .5rem; }
.cote .actions .btn { width: 100%; justify-content: flex-start; }
.cote dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; font-size: .9rem; }
.cote dt { color: var(--encre-douce); }
.cote dd { margin: 0; text-align: right; }
.historique { list-style: none; margin: 0; padding: 0; font-size: .875rem; display: grid; gap: .4rem; }
.historique li { display: flex; justify-content: space-between; gap: .5rem; }

/* ---------- Fiche ---------- */
.fiche-infos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem 1.5rem; margin: 0; }
.fiche-infos dt { font-size: .85rem; color: var(--encre-douce); }
.fiche-infos dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.chiffres div { border-left: 3px solid var(--trait-fort); padding-left: .75rem; }
.chiffres strong { display: block; font-family: var(--titre); font-size: 1.7rem; font-weight: 600; }
.chiffres span { color: var(--encre-douce); font-size: .875rem; }
.chiffres .depasse { border-color: var(--rouge); }
.chiffres .depasse strong { color: var(--rouge); }

@media print {
  .menu, .barre-mobile, .cote, .actions, #notifications { display: none !important; }
  .appli { display: block; }
  .feuille { box-shadow: none; border: 0; }
}
.case { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 900px) {
  .document-zone .cote { order: 1; }
  .lignes td:first-child { min-width: 180px; }
}
.connexion-form .aide { color: var(--encre-douce); margin: 0; }
.filtres select { width: auto; flex: 0 1 240px; }
@media (max-width: 600px) { .filtres select, .filtres input[type=search] { flex: 1 1 100%; max-width: none; } }
table:not(.lignes) td:first-child { white-space: nowrap; }
/* Photos des articles */
.vignette { display: inline-block; border-radius: 6px; object-fit: cover; background: var(--surface); border: 1px solid var(--trait); vertical-align: middle; }
.vignette-vide { background: repeating-linear-gradient(135deg, var(--menu) 0 6px, transparent 6px 12px); }
td.col-photo, th.col-photo { width: 56px; padding-right: 0; }
.zone-photo { display: flex !important; align-items: center; gap: 1rem; }
.zone-photo > div { display: grid; gap: .35rem; justify-items: start; }
.ligne-article { display: flex; align-items: center; gap: .6rem; }
.ligne-article > div { flex: 1; min-width: 0; }
td.col-photo + td { white-space: nowrap; }
#notifications .notif:nth-last-child(n+3) { display: none; }
/* Abonnement consommables sur le devis */
.abonnement { margin-top: 1.75rem; padding: 1.25rem; border-radius: var(--r); background: var(--accent-pale); }
.abonnement h2 { font-family: var(--titre); font-size: 1.45rem; font-weight: 600; margin-bottom: .35rem; }
.abonnement .formulaire { margin-top: .75rem; }
.abonnement .tableau-conteneur { background: var(--surface); }
.abonnement-total { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem 1.5rem; margin-top: .75rem; }
.abonnement-total strong { color: var(--cafe); }
dialog.fenetre { background: var(--surface); }
/* Présentation commerciale */
.resume-offre { margin: 0 0 1.5rem; padding: 1rem 1.25rem 1rem 1.4rem; border-left: 3px solid var(--accent); background: var(--accent-pale); border-radius: 0 var(--r) var(--r) 0; }
.resume-offre h2 { font-family: var(--titre); font-size: 1.4rem; font-weight: 600; color: var(--accent-fonce); margin-bottom: .4rem; }
.resume-offre ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .2rem; }
.resume-offre li::marker { color: var(--accent); }
.lignes tr.groupe td { font-family: var(--titre); font-weight: 600; font-size: 1.15rem; color: var(--accent-fonce); }
.etiquette.offert { background: var(--accent-pale); color: var(--accent-fonce); }
.rien-a-regler { font-family: var(--titre); font-size: 1.6rem; font-weight: 600; color: var(--accent-fonce); text-align: right; }
.lignes tr.groupe td { background: var(--accent-pale); border-top: 0; border-bottom: 0; padding-top: .45rem; padding-bottom: .45rem; }
.lignes tr.groupe td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.lignes tr.groupe + tr td { border-top: 0; }
.lignes tbody tr.groupe:not(:first-child) td { border-top: .6rem solid var(--surface); }
.lignes tr.groupe td.sous-total { font-family: var(--police); font-size: .95rem; font-weight: 700; color: var(--encre); }
.resume-offre { background: var(--surface); border: 1px solid var(--accent); border-left-width: 4px; border-radius: var(--r); margin-bottom: 2rem; }

/* En-tête du tableau des lignes : discret, distinct des rubriques */
.lignes thead th { background: none; text-transform: uppercase; font-size: .74rem; font-weight: 700; color: var(--encre); letter-spacing: .06em; border-bottom: 1.5px solid var(--accent); }

/* Version finale : total TTC en bandeau bronze, offre en bref sur fond beige */
.totaux .ttc { background: var(--accent); color: var(--sur-accent); border-top: 0; border-radius: 6px; padding: .55rem .8rem; margin-top: .5rem; }
.resume-offre { background: var(--accent-pale); border: 0; border-left: 4px solid var(--accent); }

/* Recherche d'entreprise dans l'annuaire */
.recherche-entreprise { display: grid; gap: .35rem; padding: 1rem 1.1rem; background: var(--accent-pale); border-left: 3px solid var(--accent); border-radius: 0 var(--r) var(--r) 0; position: relative; }
.recherche-entreprise > label { font-weight: 600; font-size: .9rem; }
.recherche-entreprise small { color: var(--encre-douce); }
.recherche-ligne { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.recherche-ligne input[type=search] { flex: 1 1 260px; }
.case { display: inline-flex; gap: .45rem; align-items: center; font-size: .9rem; cursor: pointer; }
.resultats-entreprises { list-style: none; margin: .25rem 0 0; padding: 0; display: grid; gap: .35rem; max-height: 320px; overflow: auto; }
.resultats-entreprises li.secondaire { padding: .5rem .25rem; }
.resultats-entreprises button { width: 100%; text-align: left; display: grid; gap: .1rem; padding: .6rem .8rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); cursor: pointer; font: inherit; color: inherit; }
.resultats-entreprises button:hover, .resultats-entreprises button:focus-visible { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.bloc-contact { border: 1px solid var(--trait); border-radius: var(--r); padding: 1rem 1.1rem; }
.bloc-contact legend { font-weight: 600; padding: 0 .35rem; }

/* Contacts du client */
#contacts .actions-ligne { white-space: nowrap; text-align: right; }
#contacts .actions-ligne .btn { margin-left: .25rem; }
#contacts tr.contact-defaut td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
#contacts a { color: inherit; }
#contacts td a[href^="tel:"] { white-space: nowrap; }

/* Ventes : compteurs, menu « Autre… », onglet À traiter */
.compte { display: inline-block; min-width: 1.4rem; padding: 0 .4rem; margin-left: .4rem; border-radius: 999px; background: var(--menu); color: var(--encre); font-size: .78rem; font-weight: 700; text-align: center; line-height: 1.4rem; }
.compte.alerte { background: var(--accent); color: var(--sur-accent); }
.menu-plus { position: relative; }
.menu-plus summary { list-style: none; }
.menu-plus summary::-webkit-details-marker { display: none; }
.menu-plus-liste { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20; min-width: 260px; display: grid; padding: .35rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); box-shadow: 0 10px 30px rgb(0 0 0 / .12); }
.menu-plus-liste button { text-align: left; padding: .6rem .75rem; border: 0; background: none; font: inherit; color: inherit; border-radius: 6px; cursor: pointer; }
.menu-plus-liste button:hover { background: var(--accent-pale); }
.a-traiter { padding-top: 1rem; }
.a-traiter-titre { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.a-traiter-titre h2 { margin: 0; }
.a-traiter-titre p { margin: 0; font-size: .9rem; }
.a-traiter table td { vertical-align: middle; }
.a-traiter td:first-child { white-space: nowrap; }
.a-traiter .actions-ligne { text-align: right; white-space: nowrap; }
.a-traiter .actions-ligne .btn + .btn { margin-left: .35rem; }
.compte[hidden] { display: none; }

/* Frise du parcours de la vente */
.parcours { list-style: none; margin: .25rem 0 1.25rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0; }
.parcours li { flex: 1 1 0; min-width: 110px; position: relative; }
.parcours li > a, .parcours li > span { display: grid; justify-items: center; gap: .15rem; padding: 0 .25rem; text-decoration: none; color: inherit; text-align: center; }
.parcours li::before { content: ""; position: absolute; top: 9px; left: calc(-50% + 12px); right: calc(50% + 12px); height: 2px; background: var(--trait); }
.parcours li:first-child::before { display: none; }
.parcours li.faite::before, .parcours li.en-cours::before { background: var(--accent); }
.parcours-point { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--trait-fort, var(--trait)); background: var(--surface); box-sizing: border-box; }
.parcours li.faite .parcours-point { background: var(--accent); border-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E"); background-size: 12px; background-repeat: no-repeat; background-position: center; }
.parcours li.en-cours .parcours-point { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-pale); background: var(--accent-pale); }
.parcours-libelle { font-weight: 600; font-size: .9rem; color: var(--encre-douce); }
.parcours li.faite .parcours-libelle, .parcours li.en-cours .parcours-libelle { color: var(--encre); }
.parcours li.ici .parcours-libelle { color: var(--accent-fonce); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; text-decoration-thickness: 2px; }
.parcours-num { font-size: .78rem; color: var(--encre-douce); }
.parcours li > a:hover .parcours-libelle { color: var(--accent-fonce); }

/* Marges par famille */
.saisie-pct { display: inline-flex; align-items: center; gap: .35rem; }
.saisie-pct input { width: 6.5rem; text-align: right; }
input[readonly] { background: var(--accent-pale); color: var(--encre); cursor: default; }
.prix-auto .case { font-weight: 500; }
[hidden] { display: none !important; }
.titre-section { margin: .5rem 0 -.25rem; padding-top: .75rem; border-top: 1px solid var(--trait); font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-fonce); }
.nouveau-client-choix { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--trait); }

/* Ajout d'articles par rubrique */
.lignes tr.ajout-rubrique td { background: var(--fond, transparent); padding-top: .5rem; padding-bottom: .9rem; border-bottom: 0; }
.lignes tr.ajout-rubrique select { width: 100%; }
.lignes tr.ajout-rubrique .aide-ajout { font-size: .85rem; }
.lignes small.unite { display: block; text-align: right; font-size: .75rem; color: var(--encre-douce); margin-top: .15rem; white-space: nowrap; }
.aide-ajout .case, .abonnement .case { margin-left: .5rem; font-size: .85rem; }
.tampon.remplace { color: var(--encre-douce); }
.verrou .btn { margin-left: auto; flex-shrink: 0; }

/* Machines compatibles d'un consommable */
.compat { border: 1px solid var(--trait); border-radius: var(--r); padding: .9rem 1rem 1rem; display: grid; gap: .75rem; }
.compat legend { font-weight: 600; padding: 0 .35rem; }
.compat-groupe { display: grid; gap: .4rem; }
.compat-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .35rem 1rem; }
.libelle-info { font-weight: 600; font-size: .9rem; }
.aide-abo { margin: .75rem 0 0; font-size: .88rem; }
.abonnement small.unite { text-align: left; padding-left: .2rem; }

/* Formule du devis en cartes */
.formules { border: 0; padding: 0; margin: 0; }
.formules legend { font-weight: 600; font-size: .9rem; margin-bottom: .45rem; }
.formules-choix { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.formule { position: relative; display: grid; gap: .2rem; padding: .75rem .9rem .8rem 2.3rem; border: 1px solid var(--trait); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.formule input { position: absolute; left: .85rem; top: .95rem; accent-color: var(--accent); }
.formule span { font-size: .85rem; color: var(--encre-douce); }
.formule.choisie { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-pale); }
.guide-formule { margin: .7rem 0 0; padding: .6rem .85rem; border-left: 3px solid var(--accent); background: var(--surface); font-size: .9rem; color: var(--encre); }

/* Ligne d'ajout : liste + aide, sans débordement */
.ajout-zone { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.ajout-zone select { flex: 0 1 380px; min-width: 220px; }
.ajout-zone .aide-ajout { flex: 1 1 260px; font-size: .85rem; }
.tarifs-repli summary { cursor: pointer; font-weight: 600; color: var(--accent-fonce); padding: .2rem 0; }
.tarifs-repli[open] summary { margin-bottom: .75rem; }
.abonnement input[name=quantite]:invalid { border-color: var(--accent); background: var(--accent-pale); }

/* Rentabilité de la mise à disposition (interne) */
.rentabilite { margin-top: 1.5rem; padding: 1.1rem 1.25rem 1.25rem; border: 1px dashed var(--accent); border-radius: var(--r); background: var(--surface); }
.rentabilite h2 { font-family: var(--titre); font-size: 1.35rem; font-weight: 600; margin: 0 0 .75rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; }
.rentabilite .interne { font-family: var(--police); font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-fonce); background: var(--accent-pale); padding: .15rem .5rem; border-radius: 999px; }
.rentabilite-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .5rem 1.5rem; margin: 0 0 1rem; }
.rentabilite-chiffres div { display: grid; gap: .1rem; }
.rentabilite-chiffres dt { font-size: .82rem; color: var(--encre-douce); }
.rentabilite-chiffres dd { margin: 0; font-weight: 600; }
.rentabilite-chiffres .fort dd { font-size: 1.15rem; color: var(--accent-fonce); }
.rentabilite p.ok { margin: .9rem 0 0; padding: .6rem .85rem; border-left: 3px solid var(--vert); background: var(--accent-pale); }
.rentabilite p.alerte { margin: .9rem 0 0; }
@media print { .rentabilite { display: none; } }

/* Fiche client : historique en onglets */
.historique-client h3 { font-size: 1rem; margin: 1.25rem 0 .6rem; display: flex; align-items: center; gap: .25rem; }
.historique-client .contenu-onglet > h3:first-child, .entete-historique h3 { margin-top: .25rem; }
.entete-historique { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.entete-historique h3 { margin: 0; }
.historique-client .repli { margin-top: 1rem; }
.historique-client .repli summary { cursor: pointer; color: var(--encre-douce); font-weight: 600; margin-bottom: .6rem; }
.resume-historique { margin: .25rem 0 .9rem; }
.historique-client .actions-ligne { text-align: right; white-space: nowrap; }
.historique-client tr.a-prevoir td { background: var(--accent-pale); }
.journal-interventions { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.journal-interventions li { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--trait); }
.journal-interventions li:last-child { border-bottom: 0; }
.journal-interventions .ji-date { font-weight: 700; color: var(--accent-fonce); }
.journal-interventions p { margin: .35rem 0; }
.etiquette.type-preventif { background: var(--accent-pale); color: var(--accent-fonce); }
.etiquette.type-depannage { background: var(--ambre-pale, #f6ead6); color: var(--ambre, #8a5a12); }
@media (max-width: 600px) { .journal-interventions li { grid-template-columns: 1fr; gap: .2rem; } }

/* Ventes : bascule Liste / Par client */
.bascule { display: inline-flex; border: 1px solid var(--trait); border-radius: var(--r); overflow: hidden; margin-left: auto; }
.bascule button { border: 0; background: var(--surface); padding: .5rem .9rem; font: inherit; font-weight: 600; color: var(--encre-douce); cursor: pointer; }
.bascule button + button { border-left: 1px solid var(--trait); }
.bascule button.actif { background: var(--accent); color: var(--sur-accent); }
.resume-groupes { margin: 0 0 .6rem; }
.groupe-client { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); margin-bottom: .6rem; }
.groupe-client summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .75rem 1rem; cursor: pointer; list-style: none; }
.groupe-client summary::-webkit-details-marker { display: none; }
.groupe-client summary::before { content: '▸'; color: var(--accent); margin-right: .25rem; transition: transform .15s; }
.groupe-client[open] summary::before { transform: rotate(90deg); }
.groupe-client[open] summary { border-bottom: 1px solid var(--trait); }
.gc-nom { font-weight: 700; flex: 1 1 auto; }
.gc-infos { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.gc-total { font-weight: 600; }
.groupe-client .tableau-conteneur { border: 0; border-radius: 0; }
.lien-discret { color: inherit; text-decoration-color: var(--trait-fort, var(--trait)); }
.lien-discret:hover { color: var(--accent-fonce); }

/* Lignes du devis : toutes les cases alignées en haut, l'unité sous la quantité n'en décale plus aucune */
.lignes tr[data-ligne] td { vertical-align: top; padding-top: .7rem; padding-bottom: .7rem; }
.lignes tr[data-ligne] td.nombre, .lignes tr[data-ligne] td.montant-ligne { padding-top: calc(.7rem + 9px); }
.lignes tr[data-ligne] td:last-child { padding-top: calc(.7rem + 2px); }
.lignes td.col-designation { min-width: 210px; }
.lignes td.col-nb input { width: 72px; }
.lignes td.col-prix input { width: 96px; }
.lignes td.col-tva select { width: 150px; }
.sans-coupure { white-space: nowrap; }
.bloc-chorus { border: 1px solid var(--trait); border-radius: var(--r); padding: .8rem 1rem; display: grid; gap: .6rem; }
.bloc-chorus legend { font-weight: 600; padding: 0 .35rem; }
.info-chorus { margin: 0 0 .75rem; padding: .55rem .8rem; border-left: 3px solid var(--accent); background: var(--accent-pale); font-size: .9rem; }

/* Achats */
.lignes-achat td.col-ref input { width: 120px; }
.jauge { height: 8px; border-radius: 999px; background: var(--menu); overflow: hidden; }
.jauge span { display: block; height: 100%; background: var(--accent); }

/* Nouvelle version en ligne */
.menu-version { display: block; margin-top: .5rem; font-size: .75rem; opacity: .6; }
.nouvelle-version { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 1000;
  display: flex; gap: 1rem; align-items: center; padding: .75rem 1rem; border-radius: 10px;
  background: var(--surface, #fff); color: inherit; border: 1px solid var(--trait, #d8e1df);
  box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: calc(100vw - 2rem); }

/* Recherche d'article en tapant (commandes fournisseurs) */
.recherche-article { flex: 0 1 560px; min-width: 260px; display: grid; gap: .35rem; }
.recherche-article input { width: 100%; }
.ra-liste { list-style: none; margin: 0; padding: .25rem; max-height: 340px; overflow-y: auto; background: var(--surface); border: 1px solid var(--trait-fort); border-radius: var(--r); box-shadow: var(--ombre); }
.ra-liste [role=option] { display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; padding: .5rem .65rem; border-radius: 6px; cursor: pointer; }
.ra-liste [role=option][aria-selected=true], .ra-liste [role=option]:hover { background: var(--survol); }
.ra-nom { font-weight: 600; }
.ra-details { grid-column: 1; font-size: .85rem; color: var(--encre-douce); }
.ra-prix { grid-column: 2; grid-row: 1; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ra-libre { color: var(--accent-fonce); font-weight: 600; border-top: 1px solid var(--trait); margin-top: .25rem; }
.ra-vide { padding: .5rem .65rem; color: var(--encre-douce); }

/* Lignes de commande fournisseur : la désignation s'affiche en entier */
.lignes-achat td.col-designation textarea { width: 100%; min-height: 36px; padding: .3rem .45rem; font: inherit; font-size: .95rem; resize: vertical; field-sizing: content; line-height: 1.35; }
/* Sur téléphone : une carte par ligne au lieu d'un tableau coupé */
@media (max-width: 700px) {
  .lignes-achat thead { display: none; }
  .lignes-achat, .lignes-achat tbody { display: block; width: 100%; }
  .lignes-achat tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem .75rem; padding: .85rem .75rem; border-bottom: 1px solid var(--trait); }
  .lignes-achat tr > td { display: block; border: 0; padding: 0; min-width: 0; width: auto; text-align: left; }
  .lignes-achat td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; font-weight: 600; color: var(--encre-douce); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
  .lignes-achat td.col-designation { grid-column: 1 / -1; order: -2; font-weight: 600; min-width: 0; }
  .lignes-achat td.col-designation textarea { min-height: 3.1em; }
  .lignes-achat td.col-ref { grid-column: 1 / -1; order: -1; }
  .lignes-achat td.col-ref input { width: 100%; }
  .lignes-achat td.col-nb input, .lignes-achat td.col-prix input { width: 100%; }
  .lignes-achat td.montant-ligne { grid-column: 1 / 3; font-weight: 700; align-self: end; }
  .lignes-achat td.col-suppr { grid-column: 3; justify-self: end; align-self: end; }
  .lignes-achat tr.ajout { display: block; padding: .75rem; }
  .lignes-achat tr.ajout td { display: block; }
  .lignes-achat .recherche-article { min-width: 0; }
}

/* Stock, encaissements, comptabilité */
.negatif { color: var(--rouge); }
.positif { color: var(--vert); }
.petit { font-size: .85rem; }
.sous-titre { font-size: 1rem; font-weight: 700; margin: 1.25rem 0 .5rem; }
.champ-inline { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; }
.repli { margin-top: 1rem; }
.repli summary { cursor: pointer; color: var(--encre-douce); font-weight: 600; margin-bottom: .6rem; }
.actions-ligne { white-space: nowrap; text-align: right; }
.tableau-stock td { vertical-align: middle; }
table.balance tr.detail-client > td { background: var(--entete-tableau); padding: .25rem .75rem .75rem; }
table.sous-tableau { width: 100%; }
table.sous-tableau td { border: 0; padding: .35rem .5rem; }
#bloc-client .ra-liste, .fenetre .ra-liste { margin-top: .35rem; }
.fenetre .ra-liste li { display: grid; padding: .45rem .6rem; border-radius: 6px; cursor: pointer; }
.fenetre .ra-liste li:hover { background: var(--survol); }
.connexion-client { margin: .25rem 0 0; color: var(--encre-douce); font-size: .95rem; }

/* Espace client en ligne */
.portail-commande { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
.panier { position: sticky; top: 1rem; display: grid; gap: .9rem; }
.panier h2 { margin: 0; }
.produits { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.produit { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 1rem; align-items: center; background: var(--surface);
  border: 1px solid var(--trait); border-radius: var(--r); padding: .75rem 1rem; }
.produit.dans-panier { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.produit img, .produit-sans-photo { width: 64px; height: 64px; object-fit: contain; border-radius: 6px; background: var(--fond); display: block; }
.produit-texte { display: grid; gap: .2rem; min-width: 0; }
.produit-texte strong { line-height: 1.3; }
.produit-texte .etiquette { justify-self: start; }
.produit-prix { font-weight: 600; color: var(--accent-fonce); }
.quantite { display: inline-flex; align-items: center; gap: .35rem; }
.quantite input { width: 56px; text-align: center; padding: .4rem .2rem; }
.quantite .btn-icone { width: 40px; height: 40px; border: 1px solid var(--trait-fort); border-radius: 50%; font-size: 1.3rem; background: var(--surface); }
.lignes-panier { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; font-size: .95rem; }
.lignes-panier li { display: flex; justify-content: space-between; gap: .75rem; }
.totaux-panier { margin: 0; border-top: 1px solid var(--trait); padding-top: .6rem; display: grid; gap: .25rem; }
.totaux-panier div { display: flex; justify-content: space-between; }
.totaux-panier dt, .totaux-panier dd { margin: 0; }
.totaux-panier .total { font-weight: 700; font-size: 1.1rem; }
.cartes-machines { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.cartes-machines .panneau + .panneau { margin-top: 0; }
.infos-machine { display: grid; gap: .25rem; margin: .75rem 0; }
.infos-machine div { display: flex; justify-content: space-between; gap: 1rem; }
.infos-machine dt { color: var(--encre-douce); }
.infos-machine dd { margin: 0; font-weight: 600; }
.confirmation p { margin-top: 0; }
@media (max-width: 900px) {
  .portail-commande { grid-template-columns: minmax(0, 1fr); }
  .panier { position: static; }
}
@media (max-width: 520px) {
  .produit { grid-template-columns: 48px minmax(0, 1fr); padding: .7rem; gap: .75rem; }
  .produit img, .produit-sans-photo { width: 48px; height: 48px; }
  .produit .quantite { grid-column: 1 / -1; justify-self: end; }
}
.tableau-stock td.actions-ligne { white-space: normal; }
.tableau-stock td.actions-ligne .btn { display: block; width: 100%; margin: .15rem 0; text-align: center; }
button.indicateur { font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.indicateur.choisi { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tableau-stock td.actions-ligne { width: 1%; }
.tableau-stock td.actions-ligne .btn { white-space: nowrap; }

/* ---------- Lot 2026.10.17-6 : contrats, planning, terrain, tableau de bord, achats, import ---------- */
.etiquette.ok { background: var(--vert-pale); color: var(--vert); }
.etiquette.annule { background: var(--menu); color: var(--encre-douce); text-decoration: line-through; }
.indicateur.alerte-orange strong { color: var(--ambre); }
.cases { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
fieldset.champ-plein { border: 1px solid var(--trait); border-radius: var(--r); padding: .6rem .9rem; margin: 0; }
fieldset legend { font-weight: 600; padding: 0 .3rem; }
.formulaire h3.champ-plein { margin: .6rem 0 0; font-size: 1rem; color: var(--accent-fonce); }
.jauge { position: relative; min-width: 120px; }
.jauge i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--encre); opacity: .55; }

/* Tableaux qui deviennent des cartes sur téléphone */
@media (max-width: 700px) {
  .tableau-cartes thead { display: none; }
  .tableau-cartes, .tableau-cartes tbody { display: block; width: 100%; }
  .tableau-cartes tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .75rem; padding: .8rem .7rem; border-bottom: 1px solid var(--trait); }
  .tableau-cartes tr > td { display: block; border: 0; padding: 0; text-align: left; min-width: 0; }
  .tableau-cartes td[data-libelle]::before { content: attr(data-libelle); display: block; font-size: .72rem; font-weight: 600; color: var(--encre-douce); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .15rem; }
  .tableau-cartes td:first-child { grid-column: 1 / -1; }
  .tableau-cartes td.nombre { text-align: left; }
  .lignes-ff input, .lignes-ff select { width: 100%; }
}

/* Planning */
.nav-semaine { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.nav-semaine strong { margin: 0 .5rem; }
.grille-planning { display: grid; grid-template-columns: 150px repeat(var(--jours), minmax(130px, 1fr)); border: 1px solid var(--trait); border-radius: var(--r); overflow-x: auto; background: var(--surface); }
.grille-planning > div { border-right: 1px solid var(--trait); border-bottom: 1px solid var(--trait); padding: .45rem; min-width: 0; }
.gp-entete { font-weight: 600; font-size: .85rem; background: var(--entete-tableau); text-align: center; }
.gp-entete.aujourdhui, .jour.aujourdhui h3 { color: var(--accent-fonce); }
.gp-tech { display: flex; flex-direction: column; justify-content: center; background: var(--entete-tableau); }
.gp-case { display: flex; flex-direction: column; gap: .35rem; min-height: 72px; position: relative; }
.gp-ajout { align-self: flex-end; margin-top: auto; border: 1px dashed var(--trait-fort); background: none; color: var(--encre-douce); border-radius: 6px; width: 26px; height: 22px; cursor: pointer; opacity: .5; }
.gp-case:hover .gp-ajout, .gp-ajout:focus { opacity: 1; }
.carte-intervention { display: flex; flex-direction: column; gap: .1rem; padding: .4rem .5rem; border-radius: 6px; border: 1px solid var(--trait); border-left: 3px solid var(--accent); background: var(--fond); color: inherit; text-decoration: none; font-size: .85rem; }
.carte-intervention:hover { border-color: var(--trait-fort); }
.carte-intervention.type-depannage { border-left-color: var(--ambre); }
.carte-intervention.type-installation, .carte-intervention.type-livraison { border-left-color: var(--cafe); }
.carte-intervention.realisee { opacity: .65; }
.ci-haut { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; font-size: .78rem; }
.ci-tech { margin: -.2rem 0 .3rem .2rem; font-size: .8rem; }
.planning-mobile { display: none; }
.planning-jours, .planning-mobile { display: grid; gap: .75rem; }
.planning-mobile { display: none; }
.jour { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); padding: .7rem .8rem; display: flex; flex-direction: column; gap: .4rem; }
.jour h3 { margin: 0; font-size: 1rem; }
.jour .carte-intervention { font-size: .95rem; padding: .6rem .7rem; }
@media (max-width: 900px) { .planning-bureau { display: none; } .planning-mobile { display: grid; } }
.liste-a-planifier { list-style: none; margin: 0; padding: 0; }
.liste-a-planifier li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--trait); }
.liste-a-planifier li > span { display: flex; flex-direction: column; gap: .15rem; }

/* Fiche d'intervention (terrain) */
.terrain { display: grid; gap: 1rem; max-width: 760px; }
.terrain .panneau { margin: 0; }
.infos-terrain { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; }
.infos-terrain dt { color: var(--encre-douce); }
.infos-terrain dd { margin: 0; }
.ligne-bouton { display: flex; gap: .4rem; }
.ligne-bouton input { flex: 1; }
.qte-piece { width: 70px; }
.photos-terrain { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.photos-terrain figure { margin: 0; display: flex; flex-direction: column; gap: .2rem; }
.photos-terrain img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--trait); }
.zone-signature { width: 100%; max-width: 600px; aspect-ratio: 600 / 220; height: auto; border: 1px dashed var(--trait-fort); border-radius: var(--r); background: #fff; touch-action: none; display: block; margin-top: .6rem; }
.signature-image { max-width: 320px; width: 100%; background: #fff; border: 1px solid var(--trait); border-radius: 6px; }
.texte-libre { white-space: pre-wrap; }
.btn-large { padding: .8rem 1.4rem; font-size: 1.05rem; }
@media (max-width: 600px) { .terrain .btn { min-height: 44px; } .infos-terrain { grid-template-columns: 1fr; gap: .1rem; } .infos-terrain dd { margin-bottom: .45rem; } }

/* Tableau de bord */
.evolution { display: inline-block; margin-top: .35rem; font-size: .85rem; font-weight: 600; }
.evolution.hausse { color: var(--vert); }
.evolution.baisse { color: var(--rouge); }
.graphique { width: 100%; height: auto; display: block; }
.graphique .grille { stroke: var(--trait); stroke-width: 1; }
.graphique .axe { fill: var(--encre-douce); font-size: 10px; font-family: inherit; }
.graphique .barre-ca { fill: var(--accent); }
.graphique .barre-marge { fill: var(--vert); opacity: .8; }
.legende { display: flex; gap: 1rem; align-items: center; font-size: .85rem; color: var(--encre-douce); margin: .4rem 0 0; }
.pastille { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: -.6rem; }
.pastille.ca { background: var(--accent); } .pastille.marge { background: var(--vert); }
.barres { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.barres li { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr; gap: .15rem .7rem; align-items: center; }
.b-nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-barre { height: 10px; background: var(--menu); border-radius: 999px; overflow: hidden; }
.b-barre span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.b-val { grid-column: 2; font-size: .85rem; }
.classement { margin: 0; padding-left: 1.3rem; display: grid; gap: .4rem; }
.classement li span { float: right; }

/* Factures fournisseurs */
.lignes-ff input[name=libelle] { width: 100%; min-width: 180px; }
.lignes-ff input[name=montant_ht] { width: 110px; text-align: right; }
.totaux-ff { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; max-width: 320px; margin: .8rem 0 .5rem auto; }
.totaux-ff dd { margin: 0; text-align: right; }

/* Import */
.zone-depot { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1.6rem; border: 2px dashed var(--trait-fort); border-radius: var(--r); cursor: pointer; text-align: center; }
.zone-depot.survol, .zone-depot:hover { border-color: var(--accent); background: var(--accent-pale); }
tr.ligne-refusee td { color: var(--rouge); }
.liste-a-planifier li > span > .etiquette, .liste-a-planifier .etiquette { align-self: flex-start; }
.graphique rect, .graphique text { stroke: none; }
.graphique .axe { font-weight: 400; }
.info-connexion { background: var(--accent-pale); color: var(--accent-fonce); border-radius: var(--r); padding: .7rem .9rem; margin: 0 0 1rem; line-height: 1.45; }
.puces { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin: -.3rem 0 .8rem; scrollbar-width: thin; }
.puce { flex: none; border: 1px solid var(--trait-fort); background: var(--surface); color: var(--encre); border-radius: 999px; padding: .35rem .85rem; font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.puce.choisie { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.etiquette.compatible { background: var(--cafe-pale); color: var(--cafe); white-space: normal; }

/* Listes de documents : pastilles de statut de même largeur, colonne bien alignée */
td.col-statut { white-space: nowrap; }
td.col-statut > .etiquette:first-child { min-width: 6.6rem; text-align: center; }

/* Tableaux à colonnes fixes (listes de ventes) : alignés entre eux ; sur petit écran ils défilent dans leur cadre */
table.tableau-fixe { table-layout: fixed; min-width: 760px; }
table.tableau-fixe td { overflow-wrap: break-word; }
table.tableau-fixe td.col-date { white-space: nowrap; }
table.tableau-fixe td:first-child { overflow-wrap: normal; white-space: normal; }
table.tableau-fixe td:first-child a { white-space: nowrap; }
