/* =====================================================================
   CMG ONE — système de design (charte CMG SOL : terracotta, vert, olive, noir)
   Une seule feuille pour les modules parc, outillage et pointage.
   Habillage : celui de Parc CMG SOL (26/11/2026), rétabli à la demande de
   Benjamin le 27/11/2026 — émoticônes, police système, tons contrastés,
   bande tricolore, bordures colorées, fond uni.
   ===================================================================== */
:root {
  /* Couleurs de la charte (tons de l'habillage historique) */
  --terre: #a2401d; --terre-fonce: #7e3116; --terre-clair: #f6e6df; --terre-doux: #fbf3ee;
  --vert: #5fae8c; --vert-fonce: #3f8a6a; --vert-clair: #e3f3ec; --vert-doux: #f1f8f3;
  --taupe: #9c9668; --taupe-fonce: #6f6a3e; --taupe-clair: #efeee2; --taupe-doux: #f7f6ee;
  --olive: var(--taupe); --olive-clair: var(--taupe-clair);
  --noir: #141414; --encre: #141414; --gris-9: #2b2b2b; --gris-6: #6b6b6b; --gris-4: #a3a3a3; --gris-3: #cfcfcf; --gris-2: #e6e4dc; --gris-1: #f3f2ee; --blanc: #fff;
  --beige: #f7f6f2; --fond: var(--beige); --carte: #fff; --texte: var(--encre);
  /* Couleurs fonctionnelles (erreurs, alertes, informations) */
  --rouge: #c8381f; --rouge-clair: #fbe5e0; --orange: #d9881b; --orange-clair: #fdeedb; --bleu: #3570b5; --bleu-clair: #e3edf9;
  /* Accent : terracotta partout, comme dans l'habillage historique (data-module reste posé sur <body> pour un usage futur) */
  --accent: var(--terre); --accent-fonce: var(--terre-fonce); --accent-clair: var(--terre-clair); --accent-doux: var(--terre-doux);
  /* Formes */
  --radius: 14px; --radius-s: 10px; --ombre: 0 2px 10px rgba(20, 20, 20, .08); --ombre-haute: 0 10px 30px rgba(20, 20, 20, .16);
  --bordure: 1px solid var(--gris-2);
  --nav-h: 64px; --header-h: 58px; --sidebar-w: 224px;
  --police: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--police); background: var(--fond); color: var(--texte); font-size: 16px; line-height: 1.4; }
a { color: var(--terre); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.5rem; font-weight: 700; } h2 { font-size: 1.2rem; font-weight: 700; } h3 { font-size: 1.05rem; font-weight: 700; }
h1 .ic, h2 .ic { width: 1.1em; height: 1.1em; vertical-align: -.15em; margin-right: .3rem; color: var(--accent); }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }
.muted { color: var(--gris-6); } .small { font-size: .86rem; } .xs { font-size: .78rem; }
.nowrap { white-space: nowrap; } .hidden { display: none !important; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .mt-s { margin-top: .5rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .grow { flex: 1; } .right { text-align: right; } .center { text-align: center; }
.rouge { color: var(--rouge); } .orange { color: var(--orange); } span.vert, .small.vert, .muted .vert { color: var(--vert-fonce); }
.ic { width: 1.25em; height: 1.25em; flex-shrink: 0; vertical-align: -.25em; }
.ic.lg { width: 1.6em; height: 1.6em; }

/* ---------- Structure : en-tête, navigation, contenu ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
header.top { background: var(--blanc); border-bottom: var(--bordure); position: sticky; top: 0; z-index: 20; height: var(--header-h); }
header.top .inner { display: flex; align-items: center; gap: .75rem; padding: 0 1rem; height: 100%; max-width: 1200px; margin: 0 auto; }
header.top .marque { display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--encre); min-width: 0; }
header.top img.logo { height: 34px; width: auto; display: block; }
header.top .one { font-weight: 700; font-size: 1rem; line-height: 1; }
header.top .one small { display: none; } /* la signature « Une équipe. Une application. » reste sur la page de connexion */
@media (max-width: 560px) { header.top img.logo { height: 30px; } header.top .user .chip { display: none; } }
header.top .titre { font-weight: 700; font-size: .95rem; color: var(--gris-6); }
header.top .user { margin-left: auto; font-size: .85rem; color: var(--gris-6); display: flex; align-items: center; gap: .5rem; min-width: 0; }
header.top .user .nowrap { overflow: hidden; text-overflow: ellipsis; max-width: 28vw; }
main { flex: 1; padding: 1rem; max-width: 1200px; width: 100%; margin: 0 auto; padding-bottom: calc(var(--nav-h) + 1.5rem); }
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--blanc); border-top: var(--bordure); display: flex; z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--gris-6); font-size: .72rem; font-weight: 600; position: relative; min-width: 0; padding: 0 2px; }
nav.bottom a .ico { display: flex; align-items: center; justify-content: center; width: 38px; height: 28px; border-radius: 9px; font-size: 1.45rem; line-height: 1; }
nav.bottom a .ico .ic { width: 23px; height: 23px; }
nav.bottom a.active { color: var(--terre); }
nav.bottom a.active .ico { transform: scale(1.1); }
nav.bottom a .badge { position: absolute; top: 4px; right: calc(50% - 24px); background: var(--rouge); color: #fff; border-radius: 10px; font-size: .62rem; font-weight: 800; padding: 0 5px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; }
nav.bottom .grp, nav.bottom a.d { display: none; }
nav.bottom .lib { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Ordinateur : barre latérale des modules */
@media (min-width: 900px) {
  nav.bottom { position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--sidebar-w); height: auto; flex-direction: column; border: 0; border-right: var(--bordure); padding: 1rem .75rem; gap: .15rem; overflow-y: auto; }
  nav.bottom .grp { display: block; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gris-4); padding: .9rem .75rem .35rem; }
  nav.bottom .grp:first-child { padding-top: .2rem; }
  nav.bottom a.m { display: none; }
  nav.bottom a.d { display: flex; }
  nav.bottom a { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: .7rem; padding: .6rem .8rem; border-radius: 10px; font-size: .93rem; font-weight: 600; color: var(--gris-9); }
  nav.bottom a .ico { width: 26px; height: 26px; border-radius: 0; font-size: 1.2rem; }
  nav.bottom a .ico .ic { width: 20px; height: 20px; }
  nav.bottom a:hover { background: var(--gris-1); }
  nav.bottom a.active { background: var(--terre-clair); color: var(--terre); }
  nav.bottom a.active .ico { transform: none; }
  nav.bottom a .badge { position: static; margin-left: auto; }
  nav.bottom a.mobile-only { display: none; }
  main { margin-left: var(--sidebar-w); width: auto; max-width: none; padding: 1.5rem 2rem 2.5rem; }
  header.top .inner { max-width: none; padding: 0 1.5rem; }
  header.top .user .nowrap { max-width: none; }
}
@media (min-width: 1400px) { main { padding-left: 3rem; padding-right: 3rem; } }

/* ---------- Cartes & boutons ---------- */
.card { background: var(--carte); border-radius: var(--radius); box-shadow: var(--ombre); padding: 1rem; margin-bottom: 1rem; }
.card.flat { box-shadow: none; border: 1px solid #e8e6df; }
.card.alerte { border-left: 4px solid var(--rouge); } .card.attention { border-left: 4px solid var(--orange); } .card.ok { border-left: 4px solid var(--vert); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 1px solid transparent; border-radius: 12px; padding: .7rem 1.1rem; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--gris-1); color: var(--encre); min-height: 46px; transition: transform .05s, filter .15s, background .15s; line-height: 1.2; }
.btn:active { transform: scale(.98); }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--terre); color: #fff; }
.btn.accent { background: var(--accent); color: #fff; }
.btn.vert { background: var(--vert-fonce); color: #fff; }
.btn.olive, .btn.taupe { background: var(--taupe); color: #fff; }
.btn.noir { background: var(--encre); color: #fff; }
.btn.danger { background: var(--rouge-clair); color: var(--rouge); }
.btn.ghost { background: transparent; border-color: var(--gris-3); }
.btn.sm { min-height: 38px; padding: .4rem .8rem; font-size: .88rem; border-radius: 10px; }
.btn.xs { min-height: 32px; padding: .2rem .6rem; font-size: .8rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.big { font-size: 1rem; min-height: 72px; flex-direction: column; gap: .3rem; border-radius: 16px; }
.btn.big .ico .ic, .btn.big > .ic { width: 1.7rem; height: 1.7rem; }
.btn.big.block { flex-direction: row; min-height: 56px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 1.15em; height: 1.15em; }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: 1rem; }
@media (min-width: 700px) { .actions-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Chips de statut ---------- */
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .62rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: var(--gris-1); color: var(--gris-9); }
.chip.ok, .chip.disponible, .chip.en_service, .chip.neuf, .chip.bon, .chip.valide, .chip.approuvee, .chip.actif { background: var(--vert-clair); color: var(--vert-fonce); }
.chip.proche, .chip.attribue, .chip.moyen, .chip.a_verifier { background: var(--orange-clair); color: #8d5210; }
.chip.depasse, .chip.perdu, .chip.immobilise, .chip.mauvais, .chip.retard, .chip.a_corriger, .chip.a_valider, .chip.bloquant { background: var(--rouge-clair); color: var(--rouge); }
.chip.reparation, .chip.envoye, .chip.info { background: var(--bleu-clair); color: var(--bleu); }
.chip.reforme, .chip.hors_service, .chip.aucune, .chip.neutre, .chip.brouillon, .chip.termine, .chip.archive { background: var(--gris-1); color: var(--gris-6); }
.chip.remplace { background: var(--gris-1); color: var(--gris-6); text-decoration: line-through; }
.chip.exporte { background: var(--taupe-clair); color: var(--taupe-fonce); }
.chip.zone { background: var(--terre-clair); color: var(--terre-fonce); }
.chip.admin { background: var(--terre-clair); color: var(--terre-fonce); }
.chip.responsable, .chip.role, .chip.administratif { background: var(--taupe-clair); color: var(--taupe-fonce); }
.chip.salarie { background: var(--gris-1); color: var(--gris-6); }
.chip.big { font-size: .95rem; padding: .4rem .9rem; }

/* ---------- Listes ---------- */
.list, .liste { display: flex; flex-direction: column; gap: .5rem; }
.item { display: flex; align-items: center; gap: .8rem; background: var(--carte); border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--ombre); text-decoration: none; color: inherit; border-left: 6px solid transparent; }
a.item:hover { filter: brightness(.98); }
.item.depasse, .item.bloquant { border-left-color: var(--rouge); }
.item.proche, .item.a_verifier { border-left-color: var(--orange); }
.item.ok { border-left-color: var(--vert); }
.item.info { border-left-color: var(--bleu); }
.item .ico { display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; color: var(--gris-9); flex-shrink: 0; font-size: 1.6rem; line-height: 1; }
.item .ico .ic { width: 22px; height: 22px; }
.item .body, .item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 700; }
.item .d, .item .s { color: var(--gris-6); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; }
.item .chev { color: var(--gris-4); display: flex; }
.item .chev .ic { width: 20px; height: 20px; }
.item .thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--gris-1); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--gris-6); font-size: 1.5rem; }
.item .thumb .ic { width: 24px; height: 24px; }
.drapeaux { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .3rem; }

/* ---------- Compteurs ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--carte); border-radius: var(--radius); padding: .8rem; box-shadow: var(--ombre); text-decoration: none; color: inherit; position: relative; overflow: hidden; }
.kpi .n { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.kpi .l { font-size: .8rem; color: var(--gris-6); margin-top: .25rem; }
.kpi.rouge .n { color: var(--rouge); } .kpi.orange .n { color: var(--orange); } .kpi.vert .n { color: var(--vert-fonce); } .kpi.terre .n { color: var(--terre); }
.kpi::after { content: ""; position: absolute; right: -12px; top: -12px; width: 44px; height: 44px; background: currentColor; opacity: .07; clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: .8rem; }
.form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 480px) { .form .grid2 { grid-template-columns: 1fr; } }
form:not(.form) .field { margin-bottom: .9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; } @media (max-width: 560px) { .grid2.auto { grid-template-columns: 1fr; } }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.field label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: .3rem; color: var(--gris-9); }
.field label .req { color: var(--terre); }
.field input, .field select, .field textarea { width: 100%; padding: .7rem .85rem; border: 1.5px solid var(--gris-3); border-radius: var(--radius-s); background: #fff; min-height: 48px; color: var(--encre); }
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field .help { font-size: .8rem; color: var(--gris-6); margin-top: .25rem; }
fieldset.section { border: var(--bordure); border-radius: 12px; padding: .9rem; margin: 0; }
fieldset.section legend { font-weight: 700; padding: 0 .4rem; color: var(--terre); font-size: .9rem; }
.segmented { display: flex; gap: .4rem; flex-wrap: wrap; }
.segmented label { flex: 1; min-width: 90px; }
.segmented input { display: none; }
.segmented span { display: block; text-align: center; padding: .6rem .5rem; border: 1.5px solid var(--gris-3); border-radius: var(--radius-s); font-weight: 600; cursor: pointer; font-size: .9rem; background: #fff; }
.segmented input:checked + span { border-color: var(--accent); background: var(--accent-clair); color: var(--accent-fonce); }
.search { display: flex; gap: .5rem; margin-bottom: .8rem; }
.search input { flex: 1; padding: .7rem .9rem; border: 1.5px solid var(--gris-3); border-radius: 12px; min-height: 48px; font-size: 1rem; background: #fff; }
.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.filters button { border: 1.5px solid transparent; background: var(--gris-1); border-radius: 999px; padding: .4rem .85rem; font-weight: 600; font-size: .85rem; cursor: pointer; min-height: 36px; }
.filters button.active { border-color: var(--accent); background: var(--accent-clair); color: var(--accent-fonce); }
.toggle { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border: 1.5px solid var(--gris-3); border-radius: 12px; cursor: pointer; background: #fff; }
.toggle input { width: 24px; height: 24px; accent-color: var(--vert-fonce); margin: 0; } .toggle.on { border-color: var(--vert); background: var(--vert-doux); }
.toggle .lab { font-weight: 700; } .toggle .lab small { display: block; font-weight: 400; color: var(--gris-6); font-size: .8rem; }

/* ---------- Tableaux ---------- */
.table-wrap, .scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--gris-2); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gris-6); font-weight: 700; background: var(--gris-1); }
tr.depasse td { background: #fff6f4; }
table.tab th { position: sticky; top: 0; }
table.tab td.num, table.tab th.num { text-align: right; }

/* ---------- Fiche ---------- */
.fiche-head { display: flex; gap: 1rem; align-items: flex-start; }
.fiche-head .photo { width: 96px; height: 96px; border-radius: 14px; object-fit: cover; background: var(--gris-1); display: flex; align-items: center; justify-content: center; color: var(--gris-6); flex-shrink: 0; }
.fiche-head .photo .ic { width: 40px; height: 40px; }
.plaque { display: inline-block; font-family: "Consolas", monospace; font-weight: 800; letter-spacing: .08em; background: #fff; border: 2px solid var(--encre); border-radius: 6px; padding: .15rem .5rem; font-size: 1.05rem; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; font-size: .93rem; }
.dl dt { color: var(--gris-6); } .dl dd { margin: 0; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .5rem 0 .5rem 1.2rem; border-left: 2px solid var(--gris-3); position: relative; font-size: .92rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .85rem; width: 10px; height: 10px; border-radius: 50%; background: var(--taupe); }
.timeline li.remise::before { background: var(--orange); } .timeline li.retour::before { background: var(--vert); } .timeline li.signalement::before { background: var(--rouge); }
.tabs { display: flex; gap: .3rem; overflow-x: auto; margin-bottom: .9rem; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: .6rem .9rem; font-weight: 700; border-bottom: 3px solid transparent; cursor: pointer; color: var(--gris-6); white-space: nowrap; }
.tabs button.active { color: var(--accent-fonce); border-bottom-color: var(--accent); }
.tabs a { padding: .45rem .9rem; border-radius: 999px; background: var(--gris-1); text-decoration: none; color: var(--encre); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.tabs a.active { background: var(--accent); color: #fff; }
.docs { display: flex; flex-wrap: wrap; gap: .5rem; }
.docs a { display: inline-flex; align-items: center; gap: .4rem; background: var(--gris-1); border-radius: 10px; padding: .4rem .7rem; text-decoration: none; color: var(--encre); font-size: .88rem; }
.histo { border-left: 2px solid var(--gris-3); padding-left: .8rem; margin: .5rem 0; } .histo .h { font-size: .8rem; color: var(--gris-6); }
details summary { cursor: pointer; font-weight: 600; }
pre.json, .pre { white-space: pre-wrap; font-family: Consolas, monospace; font-size: .8rem; background: var(--gris-1); padding: .6rem; border-radius: 8px; max-height: 300px; overflow: auto; }

/* ---------- Bandeaux, états vides, toasts, modales ---------- */
.bandeau, .banner { border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; font-weight: 600; font-size: .95rem; }
.bandeau.rouge, .banner.err { background: var(--rouge-clair); color: var(--rouge); }
.bandeau.orange, .banner.warn { background: var(--orange-clair); color: #7a4a04; }
.bandeau.vert { background: var(--vert-clair); color: var(--vert-fonce); }
.bandeau.bleu, .banner.info { background: var(--bleu-clair); color: var(--bleu); }
.empty { text-align: center; color: var(--gris-6); padding: 1.5rem; }
.empty .ico { display: flex; justify-content: center; color: var(--gris-4); margin-bottom: .3rem; } .empty .ico .ic { width: 36px; height: 36px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 14px); transform: translateX(-50%); background: var(--encre); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; z-index: 60; max-width: 92vw; box-shadow: var(--ombre-haute); font-weight: 600; display: none; }
#toast.err { background: var(--rouge); } #toast.ok { background: var(--vert-fonce); }
@media (min-width: 900px) { #toast { bottom: 24px; left: calc(50% + var(--sidebar-w) / 2); } }
.modal-bg { position: fixed; inset: 0; background: rgba(23, 21, 18, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; border-radius: 20px 20px 0 0; padding: 1.25rem 1.1rem calc(1rem + env(safe-area-inset-bottom)); width: 100%; max-width: 600px; max-height: 92vh; overflow-y: auto; box-shadow: var(--ombre-haute); }
@media (min-width: 700px) { .modal-bg { align-items: center; } .modal { border-radius: 20px; padding: 1.5rem; } }

/* ---------- Connexion ---------- */
body[data-module="connexion"] main { padding-bottom: 1.5rem; }
.login { max-width: 420px; margin: 1.5rem auto 2rem; padding: 1.5rem 1.4rem; position: relative; }
.login img.logo-connexion { display: block; margin: 0 auto 1.1rem; width: min(230px, 70%); height: auto; }
.login .one-titre { text-align: center; margin: 0 0 .15rem; font-size: 1.6rem; font-weight: 800; letter-spacing: .06em; }
.login .one-titre b { color: var(--terre); }
.login .signature { text-align: center; color: var(--gris-6); font-size: .92rem; margin: 0 0 1.4rem; font-weight: 500; }
.login .btn.block { min-height: 52px; font-size: 1.05rem; margin-top: .3rem; }
.login .pied { text-align: center; font-size: .78rem; color: var(--gris-4); margin-top: 1.4rem; }
.hex-band { height: 8px; background: linear-gradient(90deg, var(--terre) 0 33%, var(--vert) 33% 66%, var(--taupe) 66%); }
.texture { display: none !important; } /* filigrane retiré : fond uni comme dans l'habillage historique */

/* ---------- Accueil ---------- */
.hello { display: flex; align-items: center; gap: .6rem; margin-bottom: .2rem; }
.hello .ic { color: var(--terre); }
.hello .ic.emoji { font-size: 1.5rem; }
.pointage-home { border-left: 4px solid var(--terre); }
.pointage-home .row.mt-s .btn { min-height: 46px; }
.section-titre { display: flex; align-items: center; gap: .5rem; margin: 1.3rem 0 .6rem; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gris-6); }
.section-titre::after { content: ""; flex: 1; height: 1px; background: var(--gris-2); }

/* ---------- Ma journée ---------- */
.date-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.date-nav .jour { font-weight: 800; font-size: 1.05rem; text-align: center; flex: 1; }
.date-nav button { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--gris-3); background: #fff; font-size: 1.3rem; cursor: pointer; color: var(--encre); }
.semaine { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: .7rem; }
.semaine a { text-decoration: none; color: var(--encre); text-align: center; border-radius: 10px; padding: .35rem 0; font-size: .72rem; background: var(--gris-1); border: 2px solid transparent; font-weight: 600; }
.semaine a b { display: block; font-size: .95rem; font-weight: 800; } .semaine a.active { border-color: var(--terre); } .semaine a.valide { background: var(--vert-clair); } .semaine a.envoye { background: var(--bleu-clair); } .semaine a.a_corriger { background: var(--rouge-clair); } .semaine a.manquant { background: var(--orange-clair); } .semaine a.off { color: var(--gris-4); background: transparent; border: 1px dashed var(--gris-3); }
.stepper { display: flex; align-items: center; gap: .4rem; }
.stepper button { width: 56px; height: 56px; border-radius: 14px; border: 1.5px solid var(--gris-3); background: #fff; font-size: 1.5rem; font-weight: 700; cursor: pointer; color: var(--encre); }
.stepper button:active { background: var(--gris-1); }
.stepper .val { flex: 1; text-align: center; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.stepper .val small { display: block; font-size: .75rem; color: var(--gris-6); font-weight: 600; letter-spacing: 0; }
.total-box { background: var(--encre); color: #fff; border-radius: var(--radius); padding: .9rem 1rem; display: flex; justify-content: space-between; align-items: center; }
.total-box .big { font-size: 1.7rem; font-weight: 800; }
.total-box.ko { background: var(--rouge); }
.chantier-pick { display: flex; flex-direction: column; gap: .5rem; max-height: 55vh; overflow: auto; }
.chantier-pick button { text-align: left; border: 1.5px solid var(--gris-3); background: #fff; border-radius: 12px; padding: .75rem .9rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: .5rem; min-height: 52px; }
.chantier-pick button.sel { border-color: var(--terre); background: var(--terre-clair); }
.chantier-pick button .nom { font-weight: 700; } .chantier-pick button .ville { font-size: .8rem; color: var(--gris-6); display: block; }
.pick { justify-content: space-between; text-align: left; min-height: 60px; border: 1.5px solid var(--gris-3); background: #fff; }
.pick.primary { border-color: var(--terre); }
.zone-box { display: flex; align-items: center; justify-content: space-between; background: var(--taupe-clair); border-radius: 12px; padding: .8rem 1rem; }
.zone-box .z { font-size: 1.4rem; font-weight: 800; color: var(--terre-fonce); }
.recap dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; } .recap dt { color: var(--gris-6); } .recap dd { margin: 0; font-weight: 600; }
.btn.valider-journee { background: var(--terre); color: #fff; min-height: 58px; font-size: 1.05rem; border-radius: 14px; }

/* ---------- Planning ---------- */
.card.jour { padding: .8rem 1rem; border-left: 4px solid transparent; } .card.jour.auj { border-left-color: var(--vert); background: var(--vert-doux); } .card.jour.we { background: var(--gris-1); box-shadow: none; }
.aff { margin-top: .4rem; } .aff .t { font-weight: 700; } .aff .s { font-size: .85rem; color: var(--gris-6); }

/* ---------- Messagerie ---------- */
.conv { display: flex; flex-direction: column; gap: .5rem; background: var(--taupe-clair); border-radius: var(--radius); padding: .8rem; max-height: calc(100vh - 330px); min-height: 200px; overflow-y: auto; }
.msg { max-width: 85%; background: #fff; border-radius: 14px 14px 14px 4px; padding: .55rem .85rem; box-shadow: var(--ombre); align-self: flex-start; }
.msg.moi { align-self: flex-end; background: var(--vert-clair); border-radius: 14px 14px 4px 14px; }
.msg .meta { font-size: .72rem; color: var(--gris-6); margin-bottom: .15rem; } .msg .txt { white-space: pre-wrap; word-break: break-word; } .msg .mod { margin-left: .4rem; text-decoration: none; font-weight: 700; }
.saisie-msg { display: flex; gap: .5rem; margin-top: .7rem; align-items: flex-end; } .saisie-msg textarea { flex: 1; padding: .65rem .85rem; border: 1.5px solid var(--gris-3); border-radius: 12px; resize: none; min-height: 48px; }

/* ---------- Avatars ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--taupe-clair); color: var(--taupe-fonce); font-weight: 800; font-size: .85rem; vertical-align: middle; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--gris-2); }
.avatar.sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar.thumb { width: 52px; height: 52px; border-radius: 50%; }
.avatar.big { width: 88px; height: 88px; font-size: 1.6rem; }
.photo-wrap { position: relative; flex-shrink: 0; }
.photo-del { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: var(--rouge); color: #fff; font-weight: 800; font-size: .9rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; padding: 0; }
.photo-del:hover { filter: brightness(1.1); }

/* ---------- Étiquettes QR (outillage) ---------- */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.label { border: 1.5px dashed var(--gris-3); border-radius: 8px; padding: .6rem; text-align: center; background: #fff; break-inside: avoid; }
.label .qr { display: inline-block; }
.label .ref { font-family: Consolas, monospace; font-weight: 800; font-size: 1rem; }
.label .nm { font-size: .85rem; }
.labels-mini { display: grid; grid-template-columns: repeat(auto-fill, 20mm); gap: 3mm; justify-content: start; }
.label-mini { width: 20mm; height: 20mm; box-sizing: border-box; padding: 0.8mm; display: flex; flex-direction: column; align-items: center; outline: 0.15mm dashed #bbb; background: #fff; break-inside: avoid; }
.label-mini svg { width: 16mm; height: 16mm; display: block; }
.label-mini .ref { font-family: Consolas, monospace; font-weight: 700; font-size: 5.5pt; line-height: 1; margin-top: 0.4mm; white-space: nowrap; }
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 8mm; }
  header.top, nav.bottom, .no-print, #toast, .texture { display: none !important; }
  main { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .labels { grid-template-columns: repeat(3, 63.5mm); gap: 0; justify-content: center; }
  .label { width: 63.5mm; height: 38.1mm; border-color: #eee; border-radius: 0; }
  .labels-mini { grid-template-columns: repeat(8, 20mm); gap: 3mm; justify-content: center; }
  .label-mini { outline-color: #ddd; }
}

/* ---------- Sélection multiple (liste Outillage) ---------- */
.sel-row { display: flex; align-items: center; gap: .4rem; }
.sel-row .item { flex: 1; min-width: 0; }
.sel { display: flex; align-items: center; justify-content: center; width: 36px; height: 48px; flex-shrink: 0; }
.sel input, #sel-all { width: 22px; height: 22px; accent-color: var(--terre); cursor: pointer; }
.selbar { position: sticky; top: var(--header-h); z-index: 10; background: var(--terre-clair); border: 1px solid #ead3c6; border-radius: 12px; padding: .5rem .8rem; margin-bottom: .6rem; display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; font-weight: 600; }

/* =====================================================================
   Phase 2 — hiérarchie, mouvement, états (chargement, confirmations, erreurs)
   ===================================================================== */
/* Titres de page : sans barre d'accent (habillage historique) ; l'accueil garde « Bonjour » + date, sans surtitre ni motifs */
.eyebrow { display: none; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.hero h1 { margin: 0 0 .3rem; font-size: 1.5rem; }
.hero .motifs { display: none; }
p.muted.date { margin: 0; }

/* Entrée de page : fondu + glissement léger */
@keyframes entree { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main.enter > * { animation: entree .26s cubic-bezier(.2, .7, .2, 1); } /* sans fill-mode : le contenu reste visible si l'animation ne joue pas (onglet en arrière-plan) */

/* Chargement : trois hexagones aux couleurs de la charte */
.chargement { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem; padding: 3rem 1rem; color: var(--gris-6); font-weight: 600; font-size: .9rem; }
.chargement .hexs { display: flex; gap: 8px; }
.chargement .hex { width: 18px; height: 20px; clip-path: polygon(25% 2%, 75% 2%, 100% 50%, 75% 98%, 25% 98%, 0 50%); animation: pulse 1.1s ease-in-out infinite; }
.chargement .hex.t { background: var(--terre); } .chargement .hex.v { background: var(--vert); animation-delay: .18s; } .chargement .hex.o { background: var(--taupe); animation-delay: .36s; }
@keyframes pulse { 0%, 100% { transform: translateY(0) scale(1); opacity: .55; } 50% { transform: translateY(-5px) scale(1.08); opacity: 1; } }

/* Boutons : aplats francs (habillage historique), retour tactile, état en cours */
.btn:active { transform: scale(.98); }
.btn.en-cours { position: relative; color: transparent !important; pointer-events: none; }
.btn.en-cours::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff; animation: tourne .7s linear infinite; }
.btn:not(.primary):not(.accent):not(.vert):not(.noir):not(.taupe).en-cours::after { border-color: var(--gris-3); border-top-color: var(--terre); }
@keyframes tourne { to { transform: rotate(360deg); } }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .toggle:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* Cartes et listes : survol discret sur ordinateur */
@media (hover: hover) { .kpi[href]:hover { box-shadow: var(--ombre-haute); } }
.card > h2:first-child, .card > .row.between:first-child > h2 { display: flex; align-items: center; gap: .45rem; }
.card > h2:first-child .ic, .card > .row.between:first-child > h2 .ic { color: var(--accent); }
tr:hover td { background: var(--accent-doux); }

/* Navigation basse : retour tactile */
nav.bottom a .ico { transition: transform .18s; }
nav.bottom a:active .ico { transform: scale(.9); }

/* Toasts (confirmations, erreurs) : icône + glissement */
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
#toast { display: none; align-items: center; gap: .6rem; max-width: min(92vw, 480px); padding: .75rem 1.1rem .75rem .9rem; border-left: 4px solid rgba(255,255,255,.35); animation: toast-in .25s cubic-bezier(.2,.7,.2,1); }
#toast.visible { display: flex; }
#toast .ic { width: 22px; height: 22px; flex-shrink: 0; }
#toast.ok { background: var(--vert-fonce); } #toast.err { background: var(--rouge); } #toast.neutre { background: var(--encre); }

/* Modales : apparition douce */
@keyframes modal-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fond-in { from { opacity: 0; } to { opacity: 1; } }
.modal-bg { animation: fond-in .18s ease-out; }
.modal { animation: modal-in .24s cubic-bezier(.2,.7,.2,1); }
.modal h2 { display: flex; align-items: center; gap: .5rem; }
.modal h2 .ic { color: var(--accent); }
.modal .confirm-ico { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 16px; background: var(--rouge-clair); color: var(--rouge); margin-bottom: .6rem; }
.modal .confirm-ico .ic { width: 28px; height: 28px; }

/* Bandeaux : icône */
.bandeau, .banner { display: flex; align-items: flex-start; gap: .55rem; }
.bandeau > .ic, .banner > .ic { margin-top: .1rem; }
.empty { padding: 2rem 1rem; }
.empty .ico .ic { width: 42px; height: 42px; }

/* Journée : récapitulatif et zone */
.zone-box { gap: .6rem; } .zone-box > span:first-child { display: flex; align-items: center; gap: .5rem; }
.toggle .lab .ic { color: var(--vert-fonce); margin-right: .25rem; }

/* Accessibilité : mouvement réduit */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* =====================================================================
   Droits d'accès — questionnaire (préfixe dq-)
   ===================================================================== */
.dq-progress { height: 8px; background: var(--gris-2); border-radius: 999px; overflow: hidden; margin: .6rem 0 1rem; }
.dq-progress > div { height: 100%; background: linear-gradient(90deg, var(--terre), var(--vert)); border-radius: 999px; transition: width .3s; }
.dq-top { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.dq-top .dq-progress { margin: 0; }
.dq-fiche .field span.small { display: block; font-weight: 600; margin-bottom: .2rem; }
.dq-module { border-left: 5px solid var(--vert); transition: border-color .2s, opacity .2s; }
.dq-module.dq-ferme { border-left-color: var(--gris-3); opacity: .75; }
.dq-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.dq-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-clair); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dq-ico .ic { width: 24px; height: 24px; }
.dq-bloc { margin-top: .7rem; }
.dq-lib { font-weight: 700; font-size: .9rem; margin-bottom: .4rem; display: flex; align-items: center; gap: .3rem; }
.dq-lib .ic { width: 1em; height: 1em; color: var(--orange); }
.dq-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; }
.dq-cases .toggle { margin: 0; }
.dq-sensible { border-style: dashed; }
.dq-sensible.on { border-color: var(--orange); background: var(--orange-clair); }
.dq-nav { position: static; padding: .6rem .8rem; }
.dq-nav .row.between { gap: .4rem; flex-wrap: nowrap; }
.dq-nav .btn { min-height: 42px; padding: .5rem .7rem; font-size: .9rem; }
@media (min-width: 900px) { .dq-nav { position: sticky; bottom: 12px; z-index: 5; } .dq-nav .btn { min-height: 48px; font-size: 1rem; } }
.dq-matrice th, .dq-matrice td { vertical-align: top; font-size: .8rem; min-width: 120px; }
.dq-matrice thead th { position: sticky; top: 0; background: var(--carte); z-index: 2; }
.dq-matrice tbody th { text-align: left; white-space: nowrap; background: var(--carte); position: sticky; left: 0; z-index: 1; }
.dq-matrice tbody th .ic { width: 1em; height: 1em; vertical-align: -.15em; margin-right: .2rem; }
.dq-th { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.dq-c-aucun { color: var(--gris-4); }
.dq-c-soi { background: var(--gris-1); } .dq-c-chantiers { background: var(--taupe-doux); } .dq-c-equipe { background: var(--vert-doux); } .dq-c-tout { background: var(--terre-doux); }
.dq-sens { color: var(--orange); }
.dq-sens .ic { width: .9em; height: .9em; vertical-align: -.1em; }
@media print { .dq-matrice th, .dq-matrice td { font-size: 7pt; min-width: 0; } }

.dq-court { display: none; }
@media (max-width: 560px) {
  .dq-fiche .fiche-head .row { flex-direction: column; align-items: stretch; }
  .dq-module .segmented { display: grid; grid-template-columns: 1fr 1fr; }
  .dq-module .segmented label { min-width: 0; }
  .dq-cases { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .dq-nav .dq-nom { display: none; }
  .dq-nav .dq-court { display: inline; }
}

/* ---- Droits d'accès : mode aperçu « Voir comme ce salarié » et centre d'administration ---- */
#apercu-bar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; background: var(--orange-clair); color: #7a4a04; font-weight: 600; font-size: .92rem; border-bottom: 2px solid var(--orange); }
#apercu-bar .ic { width: 20px; height: 20px; flex-shrink: 0; }
#apercu-bar span { flex: 1; }
#apercu-bar .btn { background: #fff; }
body.apercu #main form button[type=submit], body.apercu #main .btn.danger { opacity: .45; pointer-events: none; }
.mdp-provisoire { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; letter-spacing: .08em; text-align: center; padding: .8rem; background: var(--gris-1); border-radius: 12px; user-select: all; }
.timeline li.depasse { color: var(--rouge); }
.rouge { color: var(--rouge); }
@media print { #apercu-bar { display: none; } }
/* =====================================================================
   Pictogrammes en émoticônes colorées (habillage historique)
   ic() rend <span class="ic emoji">, la taille suit le contexte.
   ===================================================================== */
.ic.emoji { width: auto !important; height: auto !important; display: inline-block; font-style: normal; line-height: 1; vertical-align: -.1em; }
h1 .ic.emoji, h2 .ic.emoji { font-size: 1em; margin-right: .35rem; }
.btn .ic.emoji { font-size: 1.15em; }
.btn.big .ico .ic.emoji, .btn.big > .ic.emoji { font-size: 1.7rem; }
nav.bottom a .ico .ic.emoji { font-size: 1.45rem; }
@media (min-width: 900px) { nav.bottom a .ico .ic.emoji { font-size: 1.2rem; } }
.item .ico .ic.emoji { font-size: 1.6rem; } .item .thumb .ic.emoji { font-size: 1.5rem; }
.item .chev .ic.emoji { font-size: 1.2rem; color: var(--gris-3); }
.fiche-head .photo .ic.emoji { font-size: 2.5rem; }
.empty .ico .ic.emoji { font-size: 2.2rem; }
#toast .ic.emoji { font-size: 1.3rem; }
.modal .confirm-ico .ic.emoji { font-size: 1.7rem; }
.dq-ico .ic.emoji { font-size: 1.5rem; }
.bandeau > .ic.emoji, .banner > .ic.emoji { font-size: 1.2rem; }
#apercu-bar .ic.emoji { font-size: 1.2rem; }
.section-titre .ic.emoji { font-size: 1rem; }
