/* ERP Motomatch : reprend la maquette (fond clair, menu sombre, accent orange). */
:root {
  --fond: #F4F4F1; --carte: #FFFFFF; --bord: #E2E2DC; --texte: #17181C; --discret: #5B5F66;
  --menu: #17181C; --menu-texte: #E6E7EA; --accent: #C2410C; --accent-fonce: #9A3412;
  --bleu: #1E40AF; --bleu-clair: #DBEAFE; --rouge: #991B1B; --rouge-clair: #FEE2E2;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--texte); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; }
a { color: var(--accent); }
a:hover { color: var(--accent-fonce); }
h1 { margin: 4px 0 0; font-size: 30px; line-height: 1.15; }
h2 { font-size: 16px; margin: 0 0 8px; }
.discret { color: var(--discret); }
.fort { font-weight: 600; }

/* Cadre */
.cadre { min-height: 100vh; display: flex; flex-wrap: wrap; }
.menu { flex: 1 1 240px; max-width: 100%; background: var(--menu); color: var(--menu-texte); padding: 24px 16px; display: flex; flex-direction: column; gap: 18px; }
.contenu { flex: 999 1 560px; min-width: 0; padding: 32px; display: flex; flex-direction: column; gap: 16px; max-width: 1240px; }
.marque { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.marque strong, .marque small { display: block; }
.marque small, .moi small { color: #A3A7AF; font-size: 12px; display: block; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.recherche-lien { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: #fff; color: var(--discret); font: inherit; cursor: pointer; text-align: left; }
kbd { font: inherit; font-size: 11px; border: 1px solid #D6D6CF; border-radius: 6px; padding: 1px 5px; }
.modules { display: flex; flex-wrap: wrap; gap: 4px; }
.modules a { flex: 1 1 150px; min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 9px; color: var(--menu-texte); text-decoration: none; font-weight: 500; }
.modules a.sous { padding-left: 26px; min-height: 40px; font-size: 13px; color: #C9CBD0; }
.modules a.actif { background: var(--accent); color: #fff; font-weight: 600; }
.modules .groupe { flex: 1 1 100%; padding: 6px 12px 2px; font-weight: 600; }
.moi { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 8px 0; border-top: 1px solid #2E3038; margin-top: auto; }
.moi .lien { color: #C9CBD0; }

/* Blocs */
.entete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.entete p { margin: 0; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.onglets { display: flex; flex-wrap: wrap; gap: 4px; background: #E8E8E2; border-radius: 12px; padding: 4px; align-self: flex-start; }
.onglets a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 9px; color: var(--texte); text-decoration: none; font-weight: 600; }
.onglets a.actif { background: #fff; }
.bandeau { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--bleu-clair); color: var(--bleu); font-weight: 600; }

/* Listes */
.barre-outils, .barre-filtres { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.recherche-liste { flex: 1 1 260px; }
.recherche-liste input, input.grand { width: 100%; min-height: 44px; border: 1px solid #D6D6CF; border-radius: 10px; padding: 0 12px; font: inherit; }
.puce { min-height: 34px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; border: 1px solid #D6D6CF; background: #fff; color: var(--texte); text-decoration: none; font-size: 13px; font-weight: 600; }
.puce.choisie { background: var(--texte); color: #fff; border-color: var(--texte); }
.puce.pointillee { border-style: dashed; border-color: var(--texte); }
.pastille { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 6px 0 12px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; }
.pastille a { color: #fff; text-decoration: none; font-size: 16px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.compteur { margin-left: auto; color: var(--discret); font-size: 13px; }
.panneau-filtres { border: 2px solid var(--texte); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.panneau-filtres > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.valeur { min-height: 38px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 10px; border: 1px solid #D6D6CF; background: var(--fond); color: var(--texte); text-decoration: none; font-weight: 600; font-size: 13px; }
.tableau-defilant { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--discret); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; padding: 8px; }
td { padding: 10px 8px; border-top: 1px solid #EEEEE9; vertical-align: top; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.bouton { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; border-radius: 10px; border: 1px solid #D6D6CF; background: #fff; color: var(--texte); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.grand { min-height: 56px; font-size: 17px; }
.lien { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.matrice td { text-align: center; }
.matrice td.fort { text-align: left; }
.niveau { min-width: 92px; min-height: 34px; border-radius: 9px; border: 1px solid #D6D6CF; background: #fff; color: var(--discret); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.niveau-1 { background: #EFF6FF; color: var(--bleu); border-color: #BFDBFE; }
.niveau-2 { background: var(--bleu); color: #fff; border-color: var(--bleu); }

/* Recherche globale */
dialog#recherche { width: min(640px, 92vw); border: 0; border-radius: 16px; padding: 16px; }
dialog#recherche::backdrop { background: rgba(23, 24, 28, 0.45); }
dialog#recherche input { width: 100%; min-height: 52px; border: 2px solid var(--texte); border-radius: 12px; padding: 0 14px; font: inherit; font-size: 17px; }
.groupe-resultats { margin-top: 12px; }
.groupe-resultats h2 { font-size: 13px; color: var(--discret); text-transform: uppercase; }
.resultat { display: flex; justify-content: space-between; gap: 10px; padding: 10px 8px; border-top: 1px solid #EEEEE9; color: var(--texte); text-decoration: none; }
.resultat:hover { background: var(--fond); }

/* Pages de connexion */
.page-simple { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.boite { width: min(420px, 100%); background: #fff; border: 1px solid var(--bord); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.boite.large { width: min(720px, 100%); }
.marque.sombre { padding: 0; }
.formulaire { display: flex; flex-direction: column; gap: 12px; }
.formulaire label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--discret); font-size: 13px; }
.formulaire input[type=text], .formulaire input[type=password] { min-height: 48px; border: 1px solid #D6D6CF; border-radius: 10px; padding: 0 14px; font: inherit; font-size: 16px; color: var(--texte); }
.code { letter-spacing: 0.3em; font-size: 22px !important; text-align: center; }
.erreur { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--rouge-clair); color: var(--rouge); font-weight: 600; }
.qr { align-self: center; }
.choix-personnes { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.personne { flex: 1 1 180px; }
.personne input { position: absolute; opacity: 0; }
.personne span { display: flex; align-items: center; justify-content: center; min-height: 72px; border-radius: 14px; border: 2px solid var(--bord); font-size: 18px; font-weight: 700; color: var(--texte); cursor: pointer; }
.personne input:checked + span { border-color: var(--accent); background: #FFF7ED; }
.personne input:focus-visible + span { outline: 3px solid var(--bleu); }

/* Formulaires des écrans (fiches, création) */
.entete .actions { display: flex; flex-wrap: wrap; gap: 8px; }
tr.cliquable td:first-child a { color: var(--texte); font-weight: 600; text-decoration: none; }
tr.cliquable td:first-child a:hover { color: var(--accent); text-decoration: underline; }
tr.cliquable:hover { background: var(--fond); }
.formulaire-erp h2 { margin: 4px 0 0; }
.formulaire-erp p { margin: 0; }
.grille-champs { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; }
.champ { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--discret); font-size: 13px; }
.champ input:not([type=checkbox]), .champ select { min-height: 44px; border: 1px solid #D6D6CF; border-radius: 10px; padding: 0 12px; font: inherit; font-size: 15px; font-weight: 400; color: var(--texte); background: #fff; }
.champ input:disabled, .champ select:disabled, fieldset:disabled .champ input, fieldset:disabled .champ select { background: var(--fond); color: var(--discret); }
.champ.case { flex-direction: row; flex-wrap: wrap; align-items: center; align-self: end; min-height: 44px; }
.champ.case input { width: 20px; height: 20px; accent-color: var(--accent); order: -1; }
.champ.case small { flex: 1 1 100%; }
.champ small { font-weight: 400; }
.champ.en-erreur input, .champ.en-erreur select { border-color: var(--rouge); }
.erreur-champ { color: var(--rouge); font-weight: 600 !important; }
.boutons { display: flex; flex-wrap: wrap; gap: 8px; }
.carte.alerte { background: var(--rouge-clair); border-color: #FECACA; color: var(--rouge); flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.carte.alerte p { margin: 0; }