/* KMAR — couleurs du logo (rouge et noir), chargé après les autres feuilles de style */
:root { --brand: #b41e1f; --brand-2: #8f1718; --dark: #1f1f1f; --red-soft: #f8e9e9; }

/* En-tête blanc, logo en couleur, filet rouge */
.top { background: #fff; color: var(--dark); border-bottom: 3px solid var(--brand); box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.brand { color: var(--dark); }
.brand img { background: transparent; padding: 0; border-radius: 0; width: 36px; height: 36px; }
.brand span { letter-spacing: .01em; }
.nav a, .nav .linkbtn { color: #3d3d3d; }
.nav a:hover, .nav .linkbtn:hover { background: #f1f1f1; color: var(--dark); }
.nav a.on { background: var(--red-soft); color: var(--brand); font-weight: 600; }
.burger { color: var(--dark); }

/* Titres en noir, accents en rouge */
h2, legend { color: var(--dark); }
a { color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
input:focus, select:focus, textarea:focus { outline: 2px solid #e8a5a5; border-color: var(--brand); }

/* Statuts « planifiée » et « ouvert » : gris anthracite au lieu du bleu */
.b-planifiee, .b-ouvert { background: #ececec; color: var(--dark); }
.s-planifiee, .s-t-ouvert { border-left-color: var(--dark); }

/* Pointage et récompenses */
.punch .clock { color: var(--dark); }
.pb-reprise { background: var(--dark); }
.ev-reprise { background: #ececec; color: var(--dark); }
.an-info { background: #f1f1f1; color: #3d3d3d; }
.c-plan-set { border-left-color: var(--dark); }
.mw.is-today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.week thead th.is-today { color: var(--brand); }
.timeline li { border-left-color: var(--brand); }
.board .rank.r2, .board .rank.r3 { background: var(--red-soft); color: var(--brand); }
.score .big { color: var(--brand); }
progress.progress::-webkit-progress-value { background: var(--brand); }
progress.progress::-moz-progress-bar { background: var(--brand); }
.subnav .count { background: var(--brand); }
.btn.primary .count { background: #fff; color: var(--brand); }

/* Page de connexion */
.login-body { background: #f4f4f4; }
.login .login-logo { display: block; width: 180px; max-width: 70%; height: auto; margin: 0 auto 4px; }

/* Choix de la langue */
.lang-switch { display: inline-flex; gap: 2px; margin-inline-start: 6px; border: 1px solid #e5e5e5; border-radius: 99px; padding: 2px; }
.nav .lang-switch a, .lang-switch a { padding: .25rem .65rem; border-radius: 99px; font-size: .85rem; color: #3d3d3d; text-decoration: none; }
html[lang="fr"] .lang-switch a[lang="fr"], html[lang="ar"] .lang-switch a[lang="ar"] { background: var(--dark); color: #fff; }
.login-lang { display: flex; width: max-content; margin: 0 auto 16px; }
@media (max-width: 860px) { .nav .lang-switch { align-self: flex-start; margin: 6px 0 0; } }
.login h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Carnet de clients : suggestions sous le champ « client » */
.ac-holder { position: relative; }
.ac-list { position: absolute; z-index: 30; inset-inline: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid #d4d4d4; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto; font-weight: 400; }
.ac-list li { padding: .5rem .65rem; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.ac-list li b { color: var(--dark); }
.ac-list li small { color: #6b6b6b; }
.ac-list li:hover, .ac-list li.on { background: var(--red-soft); }
.ac-note { display: block; margin-top: 4px; font-weight: 400; color: #6b6b6b; }
.mt { margin-top: 12px; }

/* Menu « Gestion » (administrateur) */
.nav-more { position: relative; }
.nav-more > summary { list-style: none; cursor: pointer; color: #3d3d3d; padding: .45rem .7rem; border-radius: 6px; font-size: .92rem; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: " ▾"; font-size: .75em; }
.nav-more.on > summary, .nav-more[open] > summary { background: var(--red-soft); color: var(--brand); font-weight: 600; }
.nav-menu { position: absolute; z-index: 40; top: 100%; inset-inline-end: 0; min-width: 220px; background: #fff; border: 1px solid #e5e5e5; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; display: flex; flex-direction: column; }
.nav-menu a { padding: .55rem .75rem !important; }
@media (max-width: 860px) { .nav-menu { position: static; box-shadow: none; border: 0; padding: 0 0 0 12px; } }

/* Participants d'une fiche */
.participants { margin-bottom: 12px; }
.participants .plabel { display: block; font-size: .88rem; font-weight: 600; color: #3d3d3d; margin-bottom: 6px; }
.pchecks { display: flex; flex-wrap: wrap; gap: 4px 4px; }
.pchecks label.check { border: 1px solid #e5e5e5; border-radius: 99px; padding: .3rem .7rem; margin: 0; background: #fff; }
.pchecks label.check:has(input:checked) { border-color: var(--brand); background: var(--red-soft); color: var(--brand); }

/* SAV matériel */
.badge.sav-recupere { background: #fff3dd; color: var(--warn); }
.badge.sav-depot { background: #ececec; color: var(--dark); }
.badge.sav-fournisseur { background: var(--red-soft); color: var(--brand); }
.badge.sav-retour { background: #fff3dd; color: var(--warn); }
.badge.sav-rendu, .badge.sav-clos { background: #e3f4ea; color: var(--ok); }
.sav-stats { grid-template-columns: repeat(5, 1fr); }
.s-sav-retard { border-left-color: var(--bad); } .s-sav-recupere, .s-sav-retour { border-left-color: var(--warn); }
.s-sav-depot { border-left-color: var(--dark); } .s-sav-fournisseur { border-left-color: var(--brand); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.tabs a { padding: .4rem .8rem; border-radius: 99px; border: 1px solid #e5e5e5; background: #fff; color: #3d3d3d; text-decoration: none; font-size: .9rem; }
.tabs a.on { background: var(--dark); border-color: var(--dark); color: #fff; }
tr.row-late td { background: #fdf6f6; }
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 16px; counter-reset: st; }
.steps li { counter-increment: st; flex: 1 1 120px; padding: .5rem .7rem; border-radius: 8px; background: #efefef; color: #6b6b6b; font-size: .85rem; font-weight: 600; }
.steps li::before { content: counter(st) ". "; }
.steps li.done { background: #e3f4ea; color: var(--ok); }
.steps li.now { background: var(--brand); color: #fff; }
.sav-actions { display: grid; gap: 12px; }
.sav-act { border: 1px solid #e5e5e5; border-radius: 10px; padding: 12px; }
@media (max-width: 620px) { .sav-stats { grid-template-columns: repeat(2, 1fr); } }

/* Finances */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.pos { color: var(--ok); } .money.neg { color: var(--bad); }
.quick { margin-bottom: 14px; }
.card.result { display: flex; align-items: center; border-left: 6px solid #c2c2c2; }
.card.result .big { font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 800; line-height: 1.15; margin: 4px 0; }
.card.result.gain { border-left-color: var(--ok); } .card.result.gain .big { color: var(--ok); }
.card.result.perte { border-left-color: var(--bad); } .card.result.perte .big { color: var(--bad); }
.card.result .big .money { color: inherit; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.s-fin-in { border-left-color: var(--ok); } .s-fin-out { border-left-color: var(--bad); }
.stat b .money { font-size: 1.15rem; }
.badge.fin-vente, .badge.fin-encaissement, .badge.fin-recette, .badge.fin-ok { background: #e3f4ea; color: var(--ok); }
.badge.fin-achat, .badge.fin-paiement, .badge.fin-depense, .badge.fin-due { background: var(--red-soft); color: var(--brand); }
.badge.fin-part { background: #fff3dd; color: var(--warn); }
.fin-chart { width: 100%; height: auto; display: block; }
.fin-chart .bar-pos { fill: #177a45; } .fin-chart .bar-neg { fill: #b41e1f; }
.fin-chart .zero { stroke: #c2c2c2; stroke-width: 1; }
.fin-chart .axis { fill: #6b6b6b; font-size: 11px; }
.pv-chart .pv-line { fill: none; stroke: #1f5fa8; stroke-width: 2.2; stroke-linejoin: round; }
.pv-chart .pv-dot { fill: #1f5fa8; } .pv-chart .pv-dot.neg { fill: #b41e1f; }
.pv-chart .pv-neg { fill: #b41e1f; opacity: .07; } .pv-chart .axis.neg { fill: #b41e1f; }
@media (max-width: 620px) { .stats.four { grid-template-columns: 1fr 1fr; } }

/* Écran de chargement au démarrage */
.splash { position: fixed; inset: 0; z-index: 1000; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; transition: opacity .4s ease; }
.splash.out { opacity: 0; pointer-events: none; }
.splash-logo { width: 150px; max-width: 45vw; height: auto; }
.splash-anim { width: 220px; max-width: 60vw; height: auto; }

/* Tableau de bord */
.stats.dash { grid-template-columns: repeat(6, 1fr); }
.stats.dash .stat b { font-size: 1.35rem; }
.stats.dash .stat b small { font-size: .75rem; font-weight: 600; }
.s-d-ok { border-left-color: var(--ok); } .s-d-bad { border-left-color: var(--bad); } .s-d-dark { border-left-color: var(--dark); }
.dash-cols { align-items: start; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alerts > li { border-radius: 8px; padding: .6rem .8rem; border-left: 4px solid; }
.alerts > li.al-bad { background: #fdf1f1; border-color: var(--bad); } .alerts > li.al-warn { background: #fff7e8; border-color: var(--warn); }
.alerts > li.al-info { background: #f4f4f4; border-color: #c2c2c2; }
.alerts .al-head { font-weight: 700; color: var(--dark); text-decoration: none; }
.alerts ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.alerts ul li { font-size: .9rem; display: flex; flex-direction: column; }
.alerts ul small, .mini-list small { color: #6b6b6b; }
.all-good { margin: 0; padding: .8rem 1rem; border-radius: 8px; background: #e3f4ea; color: var(--ok); font-weight: 600; }
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mini-list li { display: flex; flex-direction: column; border-bottom: 1px solid #f0f0f0; padding-bottom: 6px; }
.mini-list li:last-child { border-bottom: 0; }
.big-num { font-size: 2.2rem; font-weight: 800; color: var(--brand); }
.big-num small { font-size: 1rem; color: #6b6b6b; }
.big-btn { min-height: 52px; font-size: 1.05rem; width: 100%; }
.warn-card { border-left: 4px solid var(--warn); }
.digest-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.digest-bar .hint { margin: 0; }
@media (max-width: 1100px) { .stats.dash { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .stats.dash { grid-template-columns: 1fr 1fr; } }

/* ---------- v1.6 : rôles, annuaire, parc auto ---------- */
form.role-form, .list form.role-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
form.role-form select { width: auto; min-width: 0; }
.role-form .btn { margin: 0; }
.role-form select { padding: .25rem .4rem; }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.ac-note.ac-warn { color: var(--brand); font-weight: 600; }
.nav-user > summary { font-weight: 600; }
.nav-menu form { margin: 0; }
.nav-menu .linkbtn { width: 100%; text-align: start; padding: .55rem .75rem; }

/* Plaque d'immatriculation tunisienne : fond noir, filet blanc, série à gauche, numéro à droite */
.plaque, .plaque .pl-in { direction: ltr; unicode-bidi: isolate; }
.plaque { display: inline-block; background: #2e3033; border-radius: 9px; padding: 3px; line-height: 1; vertical-align: middle; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.plaque .pl-in { display: inline-flex; align-items: center; gap: .55em; border: 2px solid #fff; border-radius: 6px; padding: .22em .6em; color: #fff;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif; font-size: 1.15rem; white-space: nowrap; }
.plaque b { font-weight: 500; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.plaque .pl-tn { font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, Arial, sans-serif; font-size: .95em; }
.plaque [hidden] { display: none !important; }
.plaque-xs .pl-in { font-size: .8rem; padding: .15em .45em; gap: .4em; border-width: 1.5px; }
.plaque-xs { border-radius: 6px; padding: 2px; }
.plaque-lg .pl-in { font-size: 2rem; padding: .25em .7em; gap: .7em; border-width: 3px; border-radius: 9px; }
.plaque-lg { border-radius: 14px; padding: 5px; }
a:has(> .plaque) { text-decoration: none; }
.plate-edit { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.plate-preview { padding: 10px; }
@media (max-width: 760px) { .plate-edit { grid-template-columns: 1fr; } .plate-preview { justify-self: center; } .plaque-lg .pl-in { font-size: 1.5rem; } }

/* Niveaux de consommation : vert → jaune → orange → rouge */
.lvl { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.lvl-ok { background: #e3f4ea; color: #1b6b3a; border-color: #b9e2c8; }
.lvl-jaune { background: #fff8d6; color: #7a5d00; border-color: #f0dc7a; }
.lvl-orange { background: #ffe9d4; color: #9a4a00; border-color: #f7bf8a; }
.lvl-rouge { background: #fbe0e0; color: #9f1414; border-color: #ef9f9f; }
.lvl-suspect { background: #ececec; color: #4a4a4a; border-color: #cfcfcf; }
.lvl-aucun, .lvl-partiel { background: #f4f4f4; color: #6b6b6b; font-weight: 600; }
.lvl-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; color: #6b6b6b; margin: .5rem 0 1rem; }
.list tr.row-orange td { background: #fff6ee; } .list tr.row-rouge td { background: #fdeeee; } .list tr.row-suspect td { background: #f6f6f6; }
.stat.s-lvl-ok { border-left-color: #1b6b3a; } .stat.s-lvl-jaune { border-left-color: #d9b100; } .stat.s-lvl-orange { border-left-color: #e07a12; } .stat.s-lvl-rouge { border-left-color: #c41c1c; }

/* Cartes véhicules */
.veh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.veh-card { border-top: 4px solid #d6d6d6; display: flex; flex-direction: column; gap: 6px; margin: 0; }
.veh-card.lvl-b-ok { border-top-color: #2e9a5a; } .veh-card.lvl-b-jaune { border-top-color: #e2bb12; }
.veh-card.lvl-b-orange { border-top-color: #e07a12; } .veh-card.lvl-b-rouge { border-top-color: #c41c1c; } .veh-card.lvl-b-suspect { border-top-color: #8a8a8a; }
.veh-card h3 { margin: .3rem 0 0; font-size: 1.05rem; } .veh-card h3 a { color: inherit; text-decoration: none; }
.veh-card p { margin: 0; }
.veh-plate { align-self: flex-start; }
.veh-dl { margin: .3rem 0; display: grid; gap: 4px; }
.veh-dl div { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.veh-dl dt { color: #6b6b6b; } .veh-dl dd { margin: 0; text-align: end; }
.veh-act { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chips.col { flex-direction: column; align-items: flex-start; }
.chip.ch-warn { background: #fff3dd; color: #8a5300; font-weight: 600; font-size: .82rem; padding: .3rem .65rem; }
.chip.ch-bad { background: #fbe0e0; color: #9f1414; font-weight: 700; font-size: .82rem; padding: .3rem .65rem; }
.chip.ch-ok { background: #f1f1f1; color: #3d3d3d; font-weight: 500; font-size: .82rem; padding: .3rem .65rem; }
.veh-head > div:first-child { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.veh-head h1 { margin: .2rem 0 0; }
.map-pin { font-size: .8rem; white-space: nowrap; }
.geo-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.my-veh-in { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.my-veh-in p { margin: 0 0 4px; }
.hint.err { color: var(--brand); font-weight: 600; }

/* Graphique de consommation */
.conso-chart { width: 100%; height: auto; max-height: 240px; }
.conso-chart .cb-ok { fill: #2e9a5a; } .conso-chart .cb-jaune { fill: #e2bb12; } .conso-chart .cb-orange { fill: #e07a12; }
.conso-chart .cb-rouge { fill: #c41c1c; } .conso-chart .cb-suspect, .conso-chart .cb-aucun { fill: #9a9a9a; }
.conso-chart .cb-axis { stroke: #cfcfcf; } .conso-chart .cb-ref { stroke: #1f1f1f; stroke-dasharray: 5 4; stroke-width: 1.5; }
.conso-chart text { font-size: 11px; fill: #555; font-family: inherit; } .conso-chart .cb-v { font-weight: 700; fill: #333; }
.nowrap { white-space: nowrap; }
.parc-ops td { vertical-align: top; }
