/* Application Commerce — même habillage que l'espace Livraisons (charte de l'intranet : /style.css), pensée d'abord pour le téléphone. */

/* ---------- connexion ---------- */
.lv-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--marine) linear-gradient(160deg, var(--marine) 0 60%, var(--marine-fonce) 60%); }
.lv-auth-carte { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; border-top: 6px solid var(--jaune); padding: 28px 24px; display: flex; flex-direction: column; gap: 16px; }
.lv-auth-logo { width: 180px; height: auto; align-self: center; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.lv-auth-titre { margin: -10px 0 0; text-align: center; font-family: var(--f-titre); font-weight: 900; text-transform: uppercase; letter-spacing: .2em; color: var(--marine); font-size: 14px; }
.lv-auth-carte form { display: flex; flex-direction: column; gap: 14px; }
.lv-auth-carte h1 { font-size: 26px; font-weight: 900; }
.installer-auth { display: flex; flex-direction: column; gap: 14px; }
#p-message { gap: 12px; }
#p-message .btn { align-self: flex-start; }

/* ---------- en-tête ---------- */
.lv-entete { position: sticky; top: 0; z-index: 10; background: var(--marine); padding-top: env(safe-area-inset-top, 0px); border-bottom: 4px solid var(--jaune); }
.lv-entete-in { max-width: 1120px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lv-marque { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.lv-marque img { width: 84px; height: auto; display: block; background: #fff; border-radius: 6px; padding: 3px 6px; }
.lv-marque span { font-family: var(--f-titre); font-weight: 900; font-size: 20px; color: #fff; }
.lv-profil { display: flex; align-items: center; gap: 8px; }
.lv-profil b { color: #fff; font-family: var(--f-titre); font-weight: 800; margin-right: 4px; }
@media (max-width: 640px) { .lv-profil b { display: none; } .lv-marque img { width: 70px; } .lv-profil .btn.petit { padding: 4px 10px; font-size: 12px; } }

.lv-main { max-width: 1120px; margin: 0 auto; padding: 16px 16px 110px; display: flex; flex-direction: column; gap: 16px; }
.lv-onglets { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 2px solid var(--trait); padding-bottom: 8px; }
.lv-onglets button { border: 1.5px solid var(--trait); background: var(--surface); font-family: var(--f-titre); font-weight: 800; font-size: 15px; color: var(--marine); padding: 8px 16px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.lv-onglets button[aria-current="page"] { background: var(--marine); border-color: var(--marine); color: #fff; }
.lv-profil .btn[aria-pressed="true"] { background: var(--jaune); border-color: var(--jaune); color: var(--marine-fonce); }
.lv-profil .moi-btn { color: #fff; }
.lv-profil .moi-btn:hover, .lv-profil .moi-btn[aria-expanded="true"] { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }
.lv-profil .moi-initiales { background: var(--jaune); color: var(--marine-fonce); }
.lv-profil .moi-fleche { color: #C9D1F0; }
.lv-profil .profil-texte b { color: #fff; margin: 0; }
.lv-profil .cloche-btn { border-color: transparent; }
@media (max-width: 640px) { .lv-profil .profil-texte, .lv-profil .moi-fleche { display: none; } .lv-profil .moi-btn { padding: 3px; } }
.txt-court { display: none; }
@media (max-width: 640px) { .txt-long { display: none; } .txt-court { display: inline; } .lv-profil { gap: 6px; } .lv-entete-in { gap: 8px; padding-inline: 12px; } .lv-marque span { font-size: 17px; } }

/* ---------- rubriques ---------- */
.cm-rubrique { display: flex; flex-direction: column; gap: 16px; }
.cm-rubrique[hidden] { display: none; }
.lv-onglets button { min-height: 40px; }
:root[data-theme="sombre"] .lv-auth-carte, :root[data-theme="sombre"] .lv-onglets button:not([aria-current]) { color: var(--texte); }
:root[data-theme="sombre"] .lv-onglets button:not([aria-current]) { color: var(--marine-txt); }

/* ---------- À visiter (3.27) ---------- */
.cm-resume { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 860px) { .cm-resume { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cm-compteur { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--trait); background: var(--surface); cursor: pointer; font: inherit; color: var(--texte); text-align: left; border-left-width: 5px; }
.cm-compteur b { font-family: var(--f-titre); font-size: 24px; line-height: 1.1; }
.cm-compteur span { font-size: 12.5px; color: var(--gris); font-weight: 600; }
.cm-compteur.critique { border-left-color: var(--critique); } .cm-compteur.attention { border-left-color: var(--attention); } .cm-compteur.jaune { border-left-color: var(--jaune); }
.cm-compteur.info { border-left-color: var(--info); } .cm-compteur.ok { border-left-color: var(--ok); } .cm-compteur.neutre { border-left-color: var(--trait); }
.cm-compteur.actif { background: var(--marine); border-color: var(--marine); color: #fff; }
.cm-compteur.actif span { color: #DCE2F5; }
.cm-freq { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.cm-freq select, .cm-freq input, .cm-ff-ligne input { background: var(--surface); border: 1.5px solid var(--trait); border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--texte); }
.cm-freq select { max-width: 100%; }
.cm-perso { display: inline-flex; gap: 6px; align-items: center; }
.cm-perso[hidden], .cm-note[hidden] { display: none; }
.cm-jours { width: 80px; }
.cm-note { flex: 1; min-width: 220px; display: flex; } .cm-note input { flex: 1; }
.cm-note-txt { font-style: italic; }
.cm-ff-ligne { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; }
.cm-ff-ligne b { width: 22px; font-family: var(--f-titre); font-size: 18px; }
.cm-ff-ligne input[type=text] { flex: 1; min-width: 160px; }
.cm-visite .cote { display: flex; align-items: center; }
.boutons-tete .champ { display: flex; flex-direction: column; gap: 4px; }
.boutons-tete .champ[hidden] { display: none; }
.boutons-tete .champ select { background: var(--surface); border: 1.5px solid var(--trait); border-radius: 8px; padding: 7px 10px; }
.liste > p.aide { padding: 10px 16px; margin: 0; border-bottom: 1px solid var(--trait); }

/* ---------- Fiche client complète (3.28) ---------- */
.en-fiche > .vue-tete, .en-fiche > .barre-outils, .en-fiche > #flt-clients, .en-fiche > #l-clients, .en-fiche > #clients-pied, .en-fiche > #f-import { display: none; }
.cm-fiche[hidden] { display: none; }
.cm-fiche { display: flex; flex-direction: column; gap: 14px; }
.cm-fiche-tete { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.cm-fiche-tete h1 { margin: 0; font-size: clamp(22px, 3.4vw, 30px); }
.cm-suppr { margin-left: auto; }
.cm-grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cm-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1000px) { .cm-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cm-col:last-child { grid-column: 1 / -1; } }
@media (max-width: 680px) { .cm-grille { grid-template-columns: minmax(0, 1fr); } }
.cm-carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.cm-carte > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 16px; border-bottom: 2px solid var(--jaune); }
.cm-carte > header h2 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--marine-txt); font-family: var(--f-titre); }
.cm-crayon { border: 0; background: none; color: var(--marine-txt); cursor: pointer; padding: 2px; border-radius: 6px; display: grid; place-items: center; }
.cm-crayon:hover { background: var(--survol); }
.cm-carte-corps { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cm-carte-corps p { margin: 0; }
.cm-identite { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cm-nom { font-size: 18px; font-family: var(--f-titre); }
.cm-adresse { white-space: pre-line; }
.cm-actions { display: flex; gap: 0; border-top: 1px solid var(--trait); margin: 4px -16px -14px; }
.cm-action { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 0; background: none; color: var(--marine-txt); font: inherit; font-size: 12.5px; text-align: center; cursor: pointer; text-decoration: none; }
.cm-action + .cm-action { border-left: 1.5px dotted var(--jaune); }
.cm-action:hover:not([disabled]) { background: var(--survol); }
.cm-action[disabled] { opacity: .35; cursor: default; }
.cm-proches ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cm-proches li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.cm-proches[hidden] { display: none; }
.cm-infos { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 14px; margin: 0; font-size: 14.5px; }
.cm-infos dt { color: var(--gris); }
.cm-infos dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.cm-infos a { color: var(--marine-txt); }
.cm-pre { white-space: pre-line; }
.cm-rouge { color: var(--critique-txt); }
.cm-jauge { height: 8px; border-radius: 4px; background: var(--fond); overflow: hidden; }
.cm-jauge i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.cm-jauge i.proche { background: var(--jaune); } .cm-jauge i.depasse { background: var(--critique); }
.cm-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cm-kpi { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 10px; background: var(--fond); }
.cm-kpi b { font-family: var(--f-titre); font-size: 19px; font-variant-numeric: tabular-nums; }
.cm-kpi .aide { font-size: 12px; }
.cm-ecart { font-size: 12px; font-weight: 700; } .cm-ecart.hausse { color: var(--ok-txt); } .cm-ecart.baisse { color: var(--critique-txt); }
.cm-erp { display: flex; flex-direction: column; gap: 10px; }
.cm-mois { display: flex; align-items: flex-end; gap: 3px; height: 100px; padding-top: 6px; }
.cm-mois-b { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; min-width: 0; }
.cm-mois-paire { flex: 1; width: 100%; display: flex; align-items: flex-end; gap: 1px; }
.cm-mois-paire i, .cm-mois-b > i { flex: 1; width: 100%; background: var(--trait); border-radius: 3px 3px 0 0; }
.cm-mois-b i.recent, .cm-mois-paire i.recent { background: var(--serie-1, #2a78d6); }
.cm-mois-b span { font-size: 9px; letter-spacing: -0.2px; color: var(--gris); white-space: nowrap; min-height: 12px; line-height: 12px; }
.cm-cr .galerie button { width: 96px; height: 72px; }
.cm-horaires { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 14.5px; }
.cm-horaires dt { color: var(--gris); }
.cm-horaires dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.cm-edit-horaires { display: flex; flex-direction: column; gap: 10px; }
.cm-h-grille { display: grid; grid-template-columns: max-content 1fr 1fr; gap: 6px 8px; align-items: center; }
.cm-h-jour { font-size: 13px; color: var(--gris); text-transform: capitalize; }
.cm-h-plage { display: flex; gap: 4px; align-items: center; }
.cm-h-plage input { width: 100%; min-width: 0; border: 1.5px solid var(--trait); border-radius: 6px; padding: 4px 4px; font: inherit; font-size: 13px; background: var(--surface); color: var(--texte); }
.cm-bas { display: flex; flex-direction: column; gap: 14px; }
.cm-histo { display: flex; flex-direction: column; gap: 10px; }
.visite.en-vain { opacity: .7; border-left-color: var(--trait); }
#cl-fiche .form-visite { margin-top: 6px; }

/* 3.29 : clients de System One */
.cm-erp-resume { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cm-erp-resume .cm-kpi b { font-size: 22px; }
.cm-erp-reglages { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin: 12px 0 6px; }
.cm-erp-reglages label:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cm-erp-reglages input[type=number], .cm-erp-reglages input[type=date], #p-erp-clients select { background: var(--surface); border: 1.5px solid var(--trait); border-radius: 8px; padding: 6px 9px; font: inherit; color: var(--texte); }
#p-erp-clients .tableau td { vertical-align: middle; }
#p-erp-clients .tableau td.aide { max-width: 360px; font-size: 13px; }
@media (max-width: 640px) { .cm-erp-resume { grid-template-columns: minmax(0, 1fr); } }
#erp-cl-contenu { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; }
#erp-cl-contenu .tableau-defile { width: 100%; }

/* 3.30 : encours, retours, familles */
:root { --serie-1: #2a78d6; --serie-2: #eb6834; --serie-3: #1baf7a; --serie-4: #eda100; --serie-5: #e87ba4; --serie-6: #008300; --serie-7: #6250d6; --serie-8: #e34948; }
.cm-encours, .cm-retours { display: flex; flex-direction: column; gap: 8px; }
.attention-txt { color: var(--attention-txt); font-weight: 700; }
.cm-familles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cm-familles li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "nom montant part" "piste piste piste"; gap: 3px 10px; align-items: center; font-size: 14px; }
.cm-fam-nom { grid-area: nom; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-familles b { grid-area: montant; font-variant-numeric: tabular-nums; }
.cm-familles .aide { grid-area: part; font-size: 12px; min-width: 42px; text-align: right; }
.cm-fam-piste { grid-area: piste; height: 8px; background: var(--fond); border-radius: 4px; overflow: hidden; }
.cm-fam-piste i { display: block; height: 100%; border-radius: 4px; }

/* ---------- Agenda (3.31) ---------- */
#ag-contenu { display: flex; flex-direction: column; gap: 12px; }
.ag-barre { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.ag-nav, .ag-outils { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-fleche { font-size: 18px; line-height: 1; padding: 4px 12px; }
.ag-titre { margin: 0 0 0 6px; font-size: 19px; }
.ag-outils select { background: var(--surface); border: 1.5px solid var(--trait); border-radius: 8px; padding: 7px 10px; font: inherit; color: var(--texte); }
.ag-alerte { background: var(--attention-pale); color: var(--attention-txt); border-radius: 8px; padding: 8px 12px; margin: 0; font-size: 14px; }
.ag-cal { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.ag-entete, .ag-journee, .ag-grille { display: grid; }
.ag-entete { border-bottom: 1px solid var(--trait); }
.ag-jour-tete { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 0; border: 0; border-left: 1px solid var(--trait); background: none; font: inherit; color: var(--gris); cursor: pointer; }
.ag-jour-tete b { font-size: 20px; color: var(--texte); font-family: var(--f-titre); }
.ag-jour-tete.auj b { background: var(--marine); color: #fff; border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; }
.ag-journee { border-bottom: 2px solid var(--trait); min-height: 26px; }
.ag-journee > span { font-size: 10.5px; align-self: center; text-align: center; }
.ag-journee > div { border-left: 1px solid var(--trait); padding: 2px; display: flex; flex-direction: column; gap: 2px; }
.ag-defile { max-height: 64vh; overflow-y: auto; }
.ag-grille { position: relative; }
.ag-heures { position: relative; }
.ag-heures span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--gris); }
.ag-heures span:first-child { transform: none; }
.ag-col { position: relative; border-left: 1px solid var(--trait); background-image: repeating-linear-gradient(to bottom, var(--trait) 0 1px, transparent 1px 36px); background-size: 100% 72px; cursor: copy; }
.ag-col.samedi { background-color: color-mix(in srgb, var(--fond) 60%, transparent); }
.ag-col.auj { background-color: color-mix(in srgb, var(--jaune-pale) 55%, transparent); }
.ag-maintenant { position: absolute; left: 0; right: 0; height: 2px; background: var(--critique); z-index: 3; pointer-events: none; }
.ag-maintenant::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--critique); }
.ag-ev { position: absolute; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; overflow: hidden; text-align: left; padding: 3px 6px; border-radius: 6px; border: 0; border-left: 4px solid; font: inherit; font-size: 12px; line-height: 1.25; cursor: pointer; color: var(--texte); touch-action: none; }
.ag-ev b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ag-ev span { color: var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ag-ev em { font-style: normal; font-size: 10.5px; font-weight: 700; opacity: .8; }
.ag-ev.glisse { opacity: .8; box-shadow: var(--ombre); z-index: 5; cursor: grabbing; }
.ag-ev-journee { position: static; width: 100%; flex-direction: row; gap: 6px; padding: 2px 6px; }
.ag-poignee { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.ag-visite { background: #dbe8fb; border-color: #2a78d6; } .ag-appel { background: #d9f2e7; border-color: #1baf7a; } .ag-rdv { background: #e6e2fb; border-color: #6250d6; }
.ag-relance { background: #fde5d9; border-color: #eb6834; } .ag-interne { background: #e9ebf0; border-color: #7a8197; } .ag-autre { background: #fbe1ec; border-color: #e87ba4; }
.ag-outlook { background: repeating-linear-gradient(135deg, #eef1f7 0 6px, #e3e8f2 6px 12px); border-color: #0f6cbd; }
:root[data-theme="sombre"] .ag-visite { background: #1d3557; } :root[data-theme="sombre"] .ag-appel { background: #173f31; } :root[data-theme="sombre"] .ag-rdv { background: #2c2858; }
:root[data-theme="sombre"] .ag-relance { background: #4a2a1c; } :root[data-theme="sombre"] .ag-interne { background: #2b2f3c; } :root[data-theme="sombre"] .ag-autre { background: #4a2534; }
:root[data-theme="sombre"] .ag-outlook { background: repeating-linear-gradient(135deg, #222a3d 0 6px, #1c2333 6px 12px); }
.ag-mois { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.ag-mois-tete { padding: 6px; font-size: 12px; color: var(--gris); text-align: center; border-bottom: 1px solid var(--trait); }
.ag-mois-j { min-height: 96px; border-top: 1px solid var(--trait); border-left: 1px solid var(--trait); padding: 3px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ag-mois-j:nth-child(7n+8) { border-left: 0; }
.ag-mois-j.autre { background: var(--fond); } .ag-mois-j.autre .ag-mois-num { color: var(--gris); }
.ag-mois-num { align-self: flex-end; border: 0; background: none; font: inherit; font-weight: 700; cursor: pointer; padding: 0 4px; border-radius: 10px; color: var(--texte); }
.ag-mois-j.auj .ag-mois-num { background: var(--marine); color: #fff; }
.ag-mois-ev { border: 0; border-left: 3px solid; border-radius: 4px; padding: 1px 4px; font: inherit; font-size: 11.5px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--texte); }
.ag-plus { font-size: 11.5px; text-align: left; }
.ag-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.ag-form .plein { grid-column: 1 / -1; }
.ag-form .champ { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--gris); font-weight: 600; }
.ag-form input:not([type=checkbox]), .ag-form select, .ag-form textarea { background: var(--surface); border: 1.5px solid var(--trait); border-radius: 8px; padding: 8px 10px; font: inherit; color: var(--texte); font-weight: 400; width: 100%; }
.ag-heures-ch > div { display: flex; align-items: center; gap: 6px; }
.ag-form .case { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.ag-form .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.ag-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ag-liste .lien { text-align: left; font-weight: 400; }
@media (max-width: 640px) { .ag-form { grid-template-columns: minmax(0, 1fr); } .ag-titre { font-size: 16px; width: 100%; margin: 4px 0 0; } .ag-mois-j { min-height: 70px; } .ag-mois-ev { font-size: 10px; } }

/* Fichier clients de System One (3.32) */
.cm-tiers { margin: 14px 0; padding: 10px 14px; border: 1px solid var(--bord, #e3e6ef); border-radius: 12px; background: var(--fond-carte, #fff); }
.cm-tiers summary { cursor: pointer; padding: 4px 0; }
.cm-tiers select { min-width: 230px; max-width: 100%; }
.cm-tiers td.aide { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-encours-maj { margin: 8px 0 0; text-align: right; }
.cm-avancement { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; background: #eef3ff; color: #1b2a6b; margin: 10px 0; }
.cm-tourne { width: 16px; height: 16px; flex: none; border: 3px solid #b9c6f0; border-top-color: #1b2a6b; border-radius: 50%; animation: cm-tourne 0.9s linear infinite; }
@keyframes cm-tourne { to { transform: rotate(360deg); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cm-avancement { background: #1e2747; color: #dfe6ff; } }
:root[data-theme="dark"] .cm-avancement { background: #1e2747; color: #dfe6ff; }
.cm-motif { display: block; margin-top: 4px; font-size: 0.92em; }
.cm-vue { margin-left: auto; }
@media (max-width: 700px) { .cm-vue { margin-left: 0; width: 100%; } }
.cm-table-mois td, .cm-table-mois th { padding: 5px 6px; } .cm-table-mois td.num { white-space: nowrap; }
/* Cartes réductibles (3.33.4) */
.cm-carte-boutons { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.cm-reduire { border: 0; background: none; color: var(--marine-txt); cursor: pointer; width: 28px; height: 26px; border-radius: 6px; font-size: 15px; font-weight: 800; line-height: 1; display: grid; place-items: center; }
.cm-reduire:hover { background: var(--survol); }
.cm-carte.reduite > .cm-carte-corps, .cm-carte.reduite > :not(header) { display: none; }
.cm-carte.reduite > header { border-bottom-color: transparent; }
.cm-erp-alertes { margin: 12px 0; padding: 10px 14px; border-radius: 10px; background: var(--fond, #f4f5f9); } .cm-erp-alertes label { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-weight: 600; } .cm-erp-alertes p { margin: 6px 0 0; }
.cm-alerte-qui { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.cm-alerte-qui .pa-case { font-weight: 400; }
/* État du client (3.35) */
.cm-etat { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 8px; border-radius: 999px; font-weight: 700; font-size: 13px; border: 1.5px solid; }
.cm-etat i { width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.cm-etat.vert { color: #1a7f37; background: #e7f6ec; border-color: #9fd8b0; }
.cm-etat.orange { color: #a85d00; background: #fff3e0; border-color: #f3c27a; }
.cm-etat.rouge { color: #c62828; background: #fdeaea; border-color: #f0a9a9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cm-etat.vert { background: #12301d; color: #7ddc98; } :root:not([data-theme="light"]) .cm-etat.orange { background: #3a2a10; color: #ffbe6b; } :root:not([data-theme="light"]) .cm-etat.rouge { background: #3a1616; color: #ff8a8a; } }
:root[data-theme="dark"] .cm-etat.vert { background: #12301d; color: #7ddc98; } :root[data-theme="dark"] .cm-etat.orange { background: #3a2a10; color: #ffbe6b; } :root[data-theme="dark"] .cm-etat.rouge { background: #3a1616; color: #ff8a8a; }
.ag-ev em.ag-pas-outlook { color: #c62828; font-style: normal; font-weight: 700; }
/* Tournées (3.37) */
.tr-reglages { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; margin: 14px 0; }
.tr-reglages > .cm-carte:nth-child(3) { grid-column: 1 / -1; }
.tr-prefs { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; margin-bottom: 8px; }
.tr-prefs > input { min-width: 0; flex: 1 1 120px; }
.tr-prefs .champ input, .tr-prefs .champ select { width: auto; }
.tr-prefs .tr-cp, .tr-cp { flex: 0 0 90px; width: 90px; }
.tr-jours td { vertical-align: middle; }
.tr-jours input[type=time] { width: 110px; }
.tr-imp { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.tr-imp li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.tr-ajout { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tr-ajout input[list] { flex: 1 1 200px; }
.tr-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 6px 0 10px; }
.tr-semaine { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; align-items: start; margin: 12px 0; }
.tr-etapes { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 0; }
.tr-etapes li { padding: 8px 0; border-top: 1px solid var(--trait); display: grid; gap: 2px; }
.tr-etapes li:first-child { border-top: 0; }
.tr-etapes .tr-bout, .tr-etapes .tr-pause, .tr-etapes .tr-bloc { color: var(--gris); font-size: 14px; display: block; }
.tr-etapes .tr-pause { font-style: italic; }
.tr-visite { grid-template-columns: 52px 1fr; }
.tr-visite > b { grid-row: span 3; }
.tr-visite.fixe { background: var(--fond); border-radius: 8px; padding-left: 6px; }
.tr-nom { font-weight: 600; }
.tr-det { font-size: 12.5px; }
.tr-act { display: flex; gap: 10px; align-items: center; margin-top: 2px; }
.tr-act select { font-size: 13px; padding: 2px 6px; max-width: 170px; }
.tr-qui { display: inline-flex; gap: 6px; align-items: center; }

/* 3.37.3 : rendez-vous courts sur une ligne */
.ag-ev.court { flex-direction: row; align-items: center; gap: 5px; padding: 1px 6px; }
.ag-ev.court .ag-h { flex: none; color: var(--gris); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ag-ev.court b { font-size: 12.5px; }
.ag-ev.court em { display: none; }
.cm-zero { border-color: #f0a9a9; } .cm-zero-conf { max-width: 200px; }

/* ---------- Tournées 3.38 : semaines, hôtels, visites faites, carte ---------- */
.tr-apercu { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: 10px 0 4px; }
.tr-sem { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 12px; border: 1px solid var(--trait); border-radius: var(--rayon); background: var(--surface); color: var(--texte); font: inherit; text-align: left; cursor: pointer; }
.tr-sem.actif { border-color: var(--marine); box-shadow: 0 0 0 2px var(--jaune); }
.tr-hotels { display: grid; gap: 6px; margin-bottom: 8px; }
.tr-liens { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 4px 0 6px; }
.tr-jour.aujourdhui { box-shadow: 0 0 0 2px var(--jaune); }
.tr-visite.faite .tr-nom { color: var(--gris); }
.tr-num { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--marine); color: #fff; font-size: 11px; font-weight: 800; vertical-align: 1px; }
.tr-visite.faite .tr-num { background: var(--ok-txt, #1E7B45); }
.tr-act .btn.petit { padding: 3px 10px; }
.tr-onglets-jours { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tr-carte { margin: 12px 0; }
.cm-duree { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.carte { position: relative; height: 460px; overflow: hidden; border-radius: var(--rayon); border: 1px solid var(--trait); background: #E5E3DF; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.carte.glisse { cursor: grabbing; }
@media (max-width: 640px) { .carte { height: 360px; } }
.carte-fond, .carte-reperes { position: absolute; inset: 0; }
.carte-reperes { pointer-events: none; }
.tuile { position: absolute; top: 0; left: 0; width: 256px; height: 256px; max-width: none; user-select: none; -webkit-user-drag: none; }
.carte-traces { position: absolute; top: 0; left: 0; pointer-events: none; }
.carte-zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.carte-zoom .btn { box-shadow: 0 1px 4px rgba(0,0,0,.2); min-width: 34px; }
.carte-credit { position: absolute; right: 0; bottom: 0; background: rgba(255,255,255,.85); color: #222; font-size: 11px; padding: 1px 6px; border-top-left-radius: 6px; }
.carte-credit a { color: #1B2A6B; }
.repere { position: absolute; left: 0; top: 0; }
.rp-garage { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #2A3F9E; color: #fff; border: 2px solid #fff; font-size: 12px; font-weight: 900; box-shadow: 0 1px 4px rgba(0,0,0,.35); pointer-events: auto; cursor: help; }
.rp-garage.fait { background: #1E7B45; }
.rp-depot { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 6px; background: var(--jaune); color: #1B2A6B; border: 2px solid #1B2A6B; font-size: 14px; font-weight: 900; box-shadow: 0 1px 4px rgba(0,0,0,.35); pointer-events: auto; cursor: help; }
.rp-depot.fin { background: #fff; }
.tr-jour p.pastille { white-space: normal; display: block; }
.tr-act .lien { white-space: nowrap; }

/* ---------- Tournée dans l'agenda (3.39) ---------- */
.ag-tournee { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 8px 0 10px; padding: 10px 12px; border: 1px solid var(--trait); border-radius: var(--rayon); background: var(--surface); }
.ag-tournee.propose { border-color: var(--attention-txt, #A36A00); border-style: dashed; }
.ag-tournee select { width: auto; }
.ag-ev.ag-propose { background: repeating-linear-gradient(135deg, var(--surface) 0 6px, var(--fond) 6px 12px); border: 1.5px dashed #2A3F9E; border-left: 4px dashed #2A3F9E; }
.ag-ev.ag-propose.fixe { border-style: solid; border-left-style: solid; }
.ag-tournee-bas { display: grid; gap: 16px; margin-top: 16px; }
.ag-tournee-bas .tr-jour { max-width: 760px; }
.tr-act { flex-wrap: wrap; }

/* ---------- Plan de RFA (3.40) ---------- */
.cm-rfa-total { display: flex; flex-direction: column; gap: 2px; margin: 10px 0 6px; padding: 10px 12px; border-radius: 10px; background: var(--fond); border-left: 4px solid var(--jaune); }
.cm-rfa-total b { font-size: 22px; }
.cm-rfa-paliers summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
.cm-rfa-paliers table { margin: 6px 0; width: 100%; }
.cm-rfa-paliers tr.actif td { font-weight: 800; background: var(--fond); }
.cm-rfa-paiement { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.cm-rfa-paiement select { width: auto; }
.cm-rfa-edit input { width: 100%; min-width: 70px; }
.cm-rfa-familles { display: grid; gap: 6px; }
.cm-rfa-cases { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cm-rfa-paliers { overflow-x: auto; } .cm-rfa-paliers .tableau th, .cm-rfa-paliers .tableau td { padding-left: 8px; padding-right: 8px; white-space: nowrap; }

/* ---------- Direction commerciale (3.41) ---------- */
.dir-outils { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.dir-outils select { width: auto; min-width: 180px; }
.dir-segment { display: inline-flex; gap: 4px; }
.dir-libelle { min-width: 180px; text-align: center; }
.dir-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.dir-hausse { color: var(--ok-txt, #1E7B45); }
.dir-baisse { color: var(--rouge, #B3261E); }
.dir-tableau td, .dir-tableau th { white-space: nowrap; }
.dir-ligne { cursor: pointer; }
.dir-ligne:hover td, .dir-ligne:focus td { background: var(--fond); }
.dir-obj { min-width: 170px; display: grid; gap: 2px; }
.dir-obj .cm-jauge { position: relative; margin: 0; }
.dir-prorata { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--texte); }
.dir-retard { color: var(--attention-txt, #A36A00); }
.dir-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin: 14px 0; align-items: start; }
.dir-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dir-liste li { padding: 6px 0; border-bottom: 1px solid var(--trait); }
.dir-titre { margin: 22px 0 0; font-size: 18px; }
tr.dir-alerte td { color: var(--rouge, #B3261E); font-weight: 700; }

/* 3.41.4 : détails de la vue direction en onglets + tableaux pleine largeur */
.dir-details { margin-top: 14px; }
.dir-onglets { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--trait); }
.dir-onglet { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--texte); font: inherit; font-weight: 600; cursor: pointer; }
.dir-onglet.actif { border-bottom-color: var(--jaune); color: var(--marine); }
.dir-compteur { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--fond); font-size: 12px; text-align: center; }
.dir-compteur.alerte { background: #FDE8E7; color: #B3261E; }
.dir-onglet-corps { padding: 12px 16px 16px; }
.dir-table td.num { text-align: right; white-space: nowrap; }
.dir-table td { vertical-align: top; }
.dir-mini { display: inline-block; width: 120px; margin: 0 8px 0 0; vertical-align: middle; }
.dir-vide { padding: 18px 0; }
