/* Application mobile QSSE ELLIPSE — thème clair, charte ELLIPSE (magenta #E5007E, Montserrat), gros boutons. */
@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url("fonts/Montserrat-Regular.woff") format("woff"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url("fonts/Montserrat-SemiBold.woff") format("woff"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("fonts/Montserrat-Bold.woff") format("woff"); }

:root {
  /* Charte ELLIPSE (mêmes tons que static/css/portail.css du portail) */
  --magenta: #e60c82; --magenta-fonce: #a8004e; --magenta-clair: #ff2e93; --magenta-pale: #fde7f2; --sur-magenta: #ffffff;
  --fond: #f3f4f6; --carte: #ffffff; --champ: #ffffff; --texte: #0b0b0b; --doux: #4a4a4a; --leger: #8a8189; --trait: #e6dfe3;
  --vert: #2e7d32; --vert-pale: #e7f4e8; --rouge: #c62828; --rouge-pale: #fdecea; --orange: #b26a00; --orange-pale: #fff3e0; --gris-pale: #eceff1; --gris-texte: #455a64;
  --rayon: 14px; --police: "Montserrat", "Helvetica Neue", Arial, system-ui, sans-serif;
  color-scheme: light;
}
/* Thème sombre : uniquement sur choix de l'utilisateur (le clair est le défaut, décision de la direction). */
:root[data-theme="dark"] {
  --magenta-pale: #3a0d24; --fond: #0d0b0d; --carte: #141014; --champ: #1d181c; --texte: #f1eef0; --doux: #dedede; --leger: #b6b6b6; --trait: #2b2429;
  --vert: #7bd17f; --vert-pale: #12301a; --rouge: #ff7b7b; --rouge-pale: #3a1416; --orange: #ffb547; --orange-pale: #3a2a0e; --gris-pale: #262126; --gris-texte: #c9c3c8;
  color-scheme: dark;
}
.logo-clair { display: block; } .logo-sombre { display: none; }
:root[data-theme="dark"] .logo-clair { display: none; } :root[data-theme="dark"] .logo-sombre { display: block; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 400 16px/1.45 var(--police); }
body { min-height: 100vh; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 4px 0 12px; font-weight: 700; }
h2 { font-size: 18px; margin: 18px 0 8px; font-weight: 700; }
p { margin: 0 0 10px; }
.cache { display: none !important; }

/* En-tête */
.entete { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--carte); border-bottom: 1px solid var(--trait); }
.entete .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--magenta); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 11px; letter-spacing: .5px; flex-shrink: 0; }
.entete .titre { flex: 1; min-width: 0; }
.entete .titre b { display: block; font-size: 15px; }
.entete .titre small { display: block; color: var(--doux); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete .retour { color: var(--texte); border: 0; background: none; padding: 6px; margin-left: -6px; border-radius: 10px; display: grid; place-items: center; }
.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--gris-pale); font-size: 13px; font-weight: 600; border: 0; text-decoration: none; color: var(--texte); white-space: nowrap; }
.pastille.attente { background: var(--orange-pale); color: var(--orange); }
.pastille.ok { background: var(--vert-pale); color: var(--vert); }
.pastille .point { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.bandeau-demo { background: var(--magenta); color: #fff; text-align: center; font-size: 13px; font-weight: 600; padding: 6px 12px; }

main { padding: 16px; max-width: 640px; margin: 0 auto; }

/* Accueil : tuiles */
.tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tuile { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; min-height: 118px; padding: 16px; border-radius: var(--rayon);
  background: var(--carte); border: 1px solid var(--trait); text-decoration: none; color: var(--texte); font-weight: 600; font-size: 15px; line-height: 1.25; position: relative; }
.tuile svg { width: 32px; height: 32px; color: var(--magenta); }
.tuile.principale { grid-column: span 2; min-height: 92px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 16px; background: var(--magenta); color: #fff; border-color: var(--magenta); font-size: 17px; }
.tuile.principale svg { color: #fff; width: 38px; height: 38px; }
.tuile .compte.associes { background: var(--magenta-pale); color: var(--magenta-fonce); }
.tuile .compte { position: absolute; top: 10px; right: 10px; background: var(--orange); color: #fff; border-radius: 999px; font-size: 12px; padding: 2px 8px; }
.tuile:active { transform: scale(.98); }
.pied { color: var(--doux); font-size: 13px; text-align: center; margin: 18px 0 6px; }
.pied a { color: var(--doux); }

/* Formulaires */
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px; margin-bottom: 14px; }
.champ { margin-bottom: 14px; }
.champ label, .lib { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.champ small, .aide { display: block; color: var(--doux); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=date], input[type=number], input[type=search], input[type=url], input:not([type]), select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--trait); background: var(--champ); font-size: 17px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 3px var(--magenta-pale); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bouton { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; padding: 14px 18px; border-radius: 14px; border: 0;
  background: var(--magenta); color: #fff; font-weight: 700; font-size: 17px; text-decoration: none; cursor: pointer; }
.bouton:active { background: var(--magenta-fonce); }
.bouton[disabled] { opacity: .5; }
.bouton.second { background: var(--carte); color: var(--texte); border: 1.5px solid var(--trait); }
.bouton.petit { min-height: 44px; font-size: 15px; padding: 10px 14px; width: auto; }
.bouton svg { width: 22px; height: 22px; }
.rangee { display: flex; gap: 10px; }
.rangee > * { flex: 1; }
.choix { display: grid; gap: 8px; margin-bottom: 14px; }
.choix button { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 60px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--trait); background: var(--carte); font-weight: 600; }
.choix button small { display: block; font-weight: 400; color: var(--doux); font-size: 13px; }
.choix button.actif { border-color: var(--magenta); background: var(--magenta-pale); }
.choix button .etoile { margin-left: auto; color: var(--magenta); font-size: 12px; font-weight: 700; }
.puces { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.puces button { border: 1.5px solid var(--trait); background: var(--carte); border-radius: 999px; padding: 9px 14px; font-size: 14px; font-weight: 600; min-height: 42px; }
.puces button.actif { border-color: var(--magenta); background: var(--magenta-pale); color: var(--magenta-fonce); }
:root[data-theme="dark"] .puces button.actif { color: var(--magenta-clair); }
.erreur { background: var(--rouge-pale); color: var(--rouge); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }
.info { background: var(--magenta-pale); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.avert { background: var(--orange-pale); color: var(--texte); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }

/* Grille C / NC / SO : un point par écran */
.progression { height: 6px; background: var(--trait); border-radius: 3px; overflow: hidden; margin: 2px 0 14px; }
.progression div { height: 100%; background: var(--magenta); transition: width .2s; }
.rubrique { color: var(--magenta); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.point { font-size: 21px; font-weight: 700; line-height: 1.3; margin: 8px 0 20px; min-height: 84px; }
.cns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.cns button { min-height: 86px; border-radius: 16px; border: 2px solid var(--trait); background: var(--carte); font-weight: 700; font-size: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.cns button small { font-size: 12px; font-weight: 600; color: var(--doux); }
.cns button.c.actif { background: var(--vert); border-color: var(--vert); color: #fff; }
.cns button.nc.actif { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.cns button.so.actif { background: #607d8b; border-color: #607d8b; color: #fff; }
.cns button.actif small { color: rgba(255,255,255,.85); }
.compteur-grille { display: flex; justify-content: space-between; color: var(--doux); font-size: 14px; margin-bottom: 4px; }
.recap { display: flex; gap: 8px; margin-bottom: 14px; }
.recap span { flex: 1; text-align: center; border-radius: 12px; padding: 10px 4px; font-weight: 700; }
.recap .c { background: var(--vert-pale); color: var(--vert); } .recap .nc { background: var(--rouge-pale); color: var(--rouge); } .recap .so { background: var(--gris-pale); color: var(--gris-texte); }

/* Photos et signature */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.photos figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--gris-pale); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos button { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 16px; line-height: 1; }
.fichier { position: relative; overflow: hidden; }
.rangee + small, .photos + .rangee { margin-bottom: 14px; }
.champ + .champ, .rangee + .aide { margin-top: 0; }
.fichier input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.signature { position: relative; border: 2px dashed var(--trait); border-radius: 14px; background: #fff; height: 190px; touch-action: none; margin-bottom: 8px; }
.signature canvas { width: 100%; height: 100%; display: block; border-radius: 12px; }
.signature span { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; color: var(--doux); font-size: 13px; pointer-events: none; }
.signature.signee { border-style: solid; border-color: var(--vert); }

/* Listes (DUER, mes véhicules, envois) */
.liste { list-style: none; margin: 0 0 14px; padding: 0; }
.liste li { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.liste li b { display: block; }
.liste li small { color: var(--doux); display: block; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.b-ok { background: var(--vert-pale); color: var(--vert); } .b-alerte { background: var(--rouge-pale); color: var(--rouge); }
.b-bientot { background: var(--orange-pale); color: var(--orange); } .b-neutre { background: var(--gris-pale); color: var(--gris-texte); }
details.unite { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; margin-bottom: 10px; }
details.unite summary { padding: 14px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
details.unite summary::-webkit-details-marker { display: none; }
details.unite summary::after { content: "›"; margin-left: auto; font-size: 22px; color: var(--doux); transition: transform .15s; }
details.unite[open] summary::after { transform: rotate(90deg); }
.risque { border-top: 1px solid var(--trait); padding: 12px 14px; }
.risque p { margin: 6px 0 0; font-size: 14px; white-space: pre-line; }
.risque .cot { color: var(--doux); font-size: 13px; }
.fait { text-align: center; padding: 26px 8px; }
.fait .rond { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; background: var(--vert-pale); color: var(--vert); display: grid; place-items: center; }
.fait .rond svg { width: 46px; height: 46px; }
.code-geant { font-size: 28px; font-weight: 700; letter-spacing: 3px; text-align: center; margin: 10px 0; font-variant-numeric: tabular-nums; }
@media (min-width: 560px) { .tuiles { grid-template-columns: 1fr 1fr 1fr; } .tuile.principale { grid-column: span 3; } }

/* Logo de la charte et interrupteur de thème */
.entete .marque { height: 66px; width: auto; flex-shrink: 0; }
.entete .marque img { height: 66px; width: auto; max-width: 62vw; object-fit: contain; }
.logo-ecran { display: flex; justify-content: center; margin: 18px 0 22px; }
.logo-ecran img { height: 100px; width: auto; max-width: 85vw; object-fit: contain; }
.theme { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px; font-size: 13px; font-weight: 600; color: var(--doux); cursor: pointer; }
.theme .rail { position: relative; width: 46px; height: 26px; border-radius: 13px; background: var(--trait); transition: background .2s; }
.theme .rail::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.theme[aria-checked="true"] .rail { background: var(--magenta); }
.theme[aria-checked="true"] .rail::after { transform: translateX(20px); }
.theme svg { width: 18px; height: 18px; }
.ligne-theme { display: flex; align-items: center; justify-content: space-between; }
.case { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--trait); border-radius: 12px; background: var(--carte); margin-bottom: 14px; font-weight: 600; }
.case input { width: 24px; height: 24px; accent-color: var(--magenta); }
.demarrage { display: grid; place-items: center; min-height: 70vh; }
.demarrage img { height: 120px; width: auto; max-width: 85vw; object-fit: contain; }
:root[data-theme="dark"] .cns button.actif, :root[data-theme="dark"] .cns button.actif small { color: #0b0b0b; }
:root[data-theme="dark"] .tuile .compte:not(.associes) { color: #0b0b0b; }
:root[data-theme="dark"] .bouton.second { background: var(--carte); }
.afaire { background: var(--carte); border: 1.5px solid var(--magenta); border-radius: var(--rayon); padding: 6px 0; margin-bottom: 14px; }
.afaire > b { display: block; padding: 8px 16px 4px; color: var(--magenta); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.afaire a { display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: var(--texte); text-decoration: none; font-weight: 600; font-size: 15px; border-top: 1px solid var(--trait); }
.afaire a:first-of-type { border-top: 0; }
.afaire a.alerte { color: var(--rouge); }
.afaire .fleche { margin-left: auto; color: var(--leger); font-size: 22px; }
.note h1 { font-size: 19px; }
.note ul { margin: 0; padding-left: 20px; }
.note li { margin-bottom: 10px; }

/* Boîte de dialogue intégrée (remplace les fenêtres natives du navigateur) */
.dialogue-fond { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: grid; place-items: end center; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.dialogue { width: 100%; max-width: 520px; background: var(--carte); color: var(--texte); border-radius: 18px; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.dialogue p { font-size: 17px; font-weight: 600; margin: 0 0 16px; }
