/* Rance Sablage — gestion atelier. Pensé pour PC du bureau ET tablettes d'atelier (cibles tactiles ≥ 44px). */
:root {
    --fond: #f3f5f8;
    --carte: #ffffff;
    --texte: #1d2430;
    --muted: #667085;
    --ligne: #d9dee7;
    --primaire: #1f5fa8;
    --primaire-fonce: #174a84;
    --succes: #1e7b4f;
    --succes-fond: #e3f4ea;
    --danger: #b42318;
    --danger-fond: #fdecea;
    --alerte: #9a5b00;
    --alerte-fond: #fff4dc;
    --info: #1f5fa8;
    --info-fond: #e6effa;
    --rayon: 10px;
    --ombre: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fond); color: var(--texte); }
a { color: var(--primaire); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.inline { display: inline; }
.nowrap { white-space: nowrap; }
.droite { text-align: right; }
.rouge { color: var(--danger); font-weight: 600; }
.vert { color: var(--succes); font-weight: 600; }

/* --- En-tête et menu --- */
.entete { background: #17202e; color: #fff; display: flex; align-items: center; gap: 1rem; padding: 0 16px; position: sticky; top: 0; z-index: 20; }
.marque { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: .5rem; padding: 12px 0; white-space: nowrap; }
.menu { display: flex; align-items: center; gap: .25rem; flex: 1; flex-wrap: wrap; }
.menu > a, .sous-menu > summary { color: #cfd6e2; text-decoration: none; padding: 10px 12px; border-radius: 6px; cursor: pointer; list-style: none; }
.menu > a:hover, .sous-menu > summary:hover, .menu > a.actif, .sous-menu.actif > summary { background: #2a3547; color: #fff; }
.sous-menu { position: relative; }
.sous-menu > div { position: absolute; background: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px; min-width: 200px; z-index: 30; }
.sous-menu > div a { display: block; color: var(--texte); text-decoration: none; padding: 10px 12px; border-radius: 6px; }
.sous-menu > div a:hover { background: var(--fond); }
.menu-utilisateur { margin-left: auto; color: #cfd6e2; display: flex; align-items: center; gap: .5rem; }
.menu-utilisateur .btn-lien { color: #fff; }
.menu-bouton { display: none; margin-left: auto; background: none; color: #fff; border: 1px solid #44516a; border-radius: 6px; padding: 8px 12px; font: inherit; }
@media (max-width: 900px) {
    .entete { flex-wrap: wrap; }
    .menu-bouton { display: block; }
    .menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
    .menu.ouvert { display: flex; }
    .sous-menu > div { position: static; box-shadow: none; background: #222c3c; }
    .sous-menu > div a { color: #cfd6e2; }
    .menu-utilisateur { margin: .5rem 0 0; }
}

/* --- Page --- */
.page { max-width: 1400px; margin: 0 auto; padding: 20px 16px 48px; }
.page-etroite { max-width: 980px; }
.titre-page { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.titre-page .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 18px; box-shadow: var(--ombre); margin-bottom: 16px; }
.grille { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grille-2 { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* --- Messages --- */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 12px; border-left: 4px solid; }
.flash-success { background: var(--succes-fond); border-color: var(--succes); }
.flash-danger { background: var(--danger-fond); border-color: var(--danger); }
.flash-warning { background: var(--alerte-fond); border-color: var(--alerte); }
.flash-info { background: var(--info-fond); border-color: var(--info); }

/* --- Boutons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--ligne); background: #fff; color: var(--texte); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f0f3f7; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primaire { background: var(--primaire); border-color: var(--primaire); color: #fff; }
.btn-primaire:hover { background: var(--primaire-fonce); }
.btn-succes { background: var(--succes); border-color: var(--succes); color: #fff; }
.btn-succes:hover { filter: brightness(1.08); background: var(--succes); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-fond); }
.btn-alerte { background: var(--alerte-fond); border-color: var(--alerte); color: var(--alerte); }
.btn-lien { border: 0; background: none; color: var(--primaire); padding: 4px; min-height: 0; font-weight: 500; text-decoration: underline; }
.btn-petit { min-height: 32px; padding: 4px 10px; font-size: .9rem; }
.btn-grand { min-height: 52px; padding: 12px 22px; font-size: 1.05rem; }
@media (pointer: coarse) { .btn { min-height: 46px; } .btn-petit { min-height: 40px; } }

/* --- Badges, étapes, teintes --- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.badge-info { background: var(--info-fond); color: var(--info); }
.badge-success { background: var(--succes-fond); color: var(--succes); }
.badge-danger { background: var(--danger-fond); color: var(--danger); }
.badge-warning { background: var(--alerte-fond); color: var(--alerte); }
.badge-muted { background: #eef0f3; color: var(--muted); }
.urgent { background: var(--danger); color: #fff; }
.etape { display: inline-block; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.etape-ok { color: var(--succes); }
.etape-afaire { color: var(--alerte); }
.etape-attente, .etape-na { color: #a0a8b5; }
.teinte { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.pastille { width: 18px; height: 18px; border-radius: 4px; background: var(--c, #fff); border: 1px solid rgba(0,0,0,.25); flex: none; }
.pastille[data-vide] { background: repeating-linear-gradient(45deg, #fff 0 4px, #e5e7eb 4px 8px); }
.pastille-client { background: repeating-linear-gradient(45deg, #fff 0 4px, #c7d7ee 4px 8px); }

/* --- Tableaux --- */
.tableau-conteneur { overflow-x: auto; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); box-shadow: var(--ombre); }
table.tableau { width: 100%; border-collapse: collapse; }
.tableau th, .tableau td { padding: 9px 10px; border-bottom: 1px solid var(--ligne); text-align: left; vertical-align: middle; }
.tableau th { background: #f7f8fa; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); position: sticky; top: 0; white-space: nowrap; }
.tableau tbody tr:hover { background: #f9fbfd; }
.tableau tr.retard td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.tableau tr.nc { background: #fff8f7; }
.tableau .num a { font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.tableau .actions { white-space: nowrap; text-align: right; }
.tableau .actions > * + * { margin-left: .25rem; }
.tableau .desc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tableau tfoot td { font-weight: 600; background: #f7f8fa; }
.vide { padding: 32px; text-align: center; color: var(--muted); }
.tri a { color: inherit; text-decoration: none; }
.tri a.actif { color: var(--primaire); }

/* Liste OF en cartes sur petits écrans */
@media (max-width: 760px) {
    .tableau-cartes thead { display: none; }
    .tableau-cartes, .tableau-cartes tbody, .tableau-cartes tr, .tableau-cartes td { display: block; width: 100%; }
    .tableau-cartes tr { border-bottom: 8px solid var(--fond); padding: 8px 0; }
    .tableau-cartes td { border: 0; padding: 4px 12px; }
    .tableau-cartes td[data-label]::before { content: attr(data-label) " : "; color: var(--muted); font-size: .85rem; }
    .tableau-cartes .actions { text-align: left; }
    .tableau-cartes .desc { max-width: none; white-space: normal; }
}

/* --- Onglets / filtres --- */
.onglets { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 12px; }
.onglets a { padding: 10px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--ligne); text-decoration: none; color: var(--texte); font-weight: 600; }
.onglets a.actif { background: var(--primaire); border-color: var(--primaire); color: #fff; }
.filtres { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.filtres .champ { margin: 0; min-width: 150px; }

/* --- Formulaires --- */
.champ { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.champ label { font-weight: 600; font-size: .9rem; }
.obligatoire { color: var(--danger); }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%; font: inherit; padding: 9px 11px; border: 1px solid #c3cad6; border-radius: 8px; background: #fff; color: inherit; min-height: 42px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primaire); outline-offset: 0; border-color: var(--primaire); }
input[type=color] { width: 80px; height: 42px; padding: 2px; border: 1px solid #c3cad6; border-radius: 8px; }
.champ-erreur input, .champ-erreur select, .champ-erreur textarea { border-color: var(--danger); }
.erreurs { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: .88rem; }
.case { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; min-height: 36px; font-weight: 500; }
.case input { width: 20px; height: 20px; }
.cases { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.champ-case { justify-content: flex-end; }
.actions-formulaire { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.input-court { max-width: 110px; }
.filtre-select { margin-bottom: 4px; }

/* --- Fiche OF --- */
.fiche-entete { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.numero-of { font-size: 2rem; font-weight: 800; letter-spacing: .02em; }
.infos { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.infos dt { color: var(--muted); }
.infos dd { margin: 0; font-weight: 500; }
.workflow { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.workflow .bloc { border: 1px solid var(--ligne); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.workflow .bloc.ok { background: var(--succes-fond); border-color: #b5dfc6; }
.workflow .bloc.na { opacity: .55; }
.navigation-of { display: flex; gap: .35rem; }
.description { white-space: pre-line; }

/* --- Photos --- */
.photos-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photos-grille figure { margin: 0; position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--ligne); background: #eef0f3; aspect-ratio: 1; }
.photos-grille img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photos-grille figcaption { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-size: .75rem; padding: 14px 6px 4px; }
.photos-grille .retirer { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.photos-grille .en-cours { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; }
.photo-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 10px; }
.photo-actions .btn { min-height: 48px; }
.photo-info { font-size: .85rem; color: var(--muted); margin: 6px 0 10px; }
.zone-depot { border: 2px dashed #c3cad6; border-radius: var(--rayon); padding: 14px; }
.zone-depot.survol { border-color: var(--primaire); background: var(--info-fond); }
.webcam video { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; }
.visionneuse { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
.visionneuse img { max-width: 96vw; max-height: 88vh; display: block; border-radius: 6px; }
.visionneuse::backdrop { background: rgba(0,0,0,.85); }
.visionneuse .fermer { position: fixed; top: 12px; right: 16px; font-size: 28px; color: #fff; background: none; border: 0; cursor: pointer; }

/* --- Dialogues --- */
.dialogue { border: 0; border-radius: 12px; padding: 22px; max-width: min(520px, 94vw); width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.dialogue::backdrop { background: rgba(15, 23, 42, .45); }
.dialogue .actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 16px; }
.dialogue p { margin-top: 0; font-size: 1.05rem; }

/* --- Tableau de bord --- */
.indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.indicateur { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 16px; text-decoration: none; color: inherit; box-shadow: var(--ombre); }
.indicateur strong { display: block; font-size: 2rem; line-height: 1.1; }
.indicateur.alerte strong { color: var(--danger); }

/* --- Connexion --- */
.connexion { max-width: 380px; margin: 8vh auto; }
.connexion .marque-connexion { text-align: center; margin-bottom: 18px; }

/* --- Consommations --- */
.conso td { vertical-align: top; }
.conso .saisie { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.conso .saisie input { width: 100px; }
.conso select { min-width: 200px; }
.stock-info { font-size: .8rem; color: var(--muted); }

/* --- Espace client --- */
.espace-client .entete { flex-wrap: wrap; }
.carte-of { display: block; text-decoration: none; color: inherit; transition: border-color .15s; }
.carte-of:hover { border-color: var(--primaire); }
.carte-of-entete { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: 1.05rem; }
.carte-of-desc { margin: 6px 0 10px; }
.carte-of-pied { font-size: .88rem; margin-top: 8px; }
.progression { height: 8px; background: #e7ebf1; border-radius: 999px; overflow: hidden; }
.progression span { display: block; height: 100%; background: var(--succes); border-radius: 999px; }
.frise { list-style: none; margin: 0; padding: 0; }
.frise li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 8px 0; position: relative; }
.frise li:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 42px; bottom: -8px; width: 2px; background: var(--ligne); }
.frise-point { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: #eef0f3; color: var(--muted); position: relative; z-index: 1; }
.frise-fait .frise-point { background: var(--succes); color: #fff; }
.frise-fait::after { background: var(--succes) !important; }
.frise-en_cours .frise-point { background: var(--primaire); color: #fff; box-shadow: 0 0 0 4px var(--info-fond); }
.frise-en_cours .frise-libelle { font-weight: 700; }
.frise-a_venir .frise-libelle { color: var(--muted); }
.frise-date { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.pied-client { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 16px 32px; }
.acces-genere { border: 2px solid var(--succes); background: var(--succes-fond); }
.mdp { font-size: 1.3rem; font-weight: 700; letter-spacing: .08em; background: #fff; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--ligne); user-select: all; }

/* Photos dans l'espace client */
.carte-of-photos { display: flex; gap: 6px; margin: 0 0 10px; align-items: center; }
.carte-of-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--ligne); }
.carte-of-plus { width: 64px; height: 64px; border-radius: 6px; background: #eef0f3; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
.photos-client { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.photos-grille .telecharger { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; text-decoration: none; display: flex; align-items: center; justify-content: center; font-size: 16px; }

/* Carte de commande : lien étiré sur toute la carte, bouton « bon de livraison » au-dessus */
.carte-of { position: relative; }
.carte-of-lien { color: inherit; text-decoration: none; }
.carte-of-lien::after { content: ""; position: absolute; inset: 0; border-radius: var(--rayon); }
.lien-bl { position: relative; z-index: 1; margin-top: 10px; }

/* Temps passés */
.saisie-temps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; align-items: end; }
.saisie-temps .champ:has(button) { justify-content: flex-end; }
.tableau tr.sous-total td { background: #f7f8fa; font-weight: 600; font-size: .9rem; }

/* Pointage des tâches */
.tache-en-cours { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--succes-fond); border: 1px solid #b5dfc6; border-radius: var(--rayon); padding: 12px 14px; margin-bottom: 10px; }
.tache-en-cours.oubli { background: var(--alerte-fond); border-color: #f0c36d; }
.voyant { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--succes); margin-right: 6px; animation: clignote 1.6s infinite; }
.oubli .voyant { background: var(--alerte); }
@keyframes clignote { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .voyant { animation: none; } }
.demarrer-tache { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; align-items: end;
    border: 2px dashed #c3cad6; border-radius: var(--rayon); padding: 14px; margin-top: 6px; }
.demarrer-tache select { min-height: 52px; font-size: 1.05rem; }
.etapes-choix { border: 0; padding: 0; margin: 0 0 14px; }
.etapes-choix legend { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.etape-choix { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border: 1px solid var(--ligne); border-radius: 8px; margin-bottom: 6px; cursor: pointer; background: #fff; }
.etape-choix:has(input:checked) { border-color: var(--primaire); background: var(--info-fond); font-weight: 600; }
.etape-choix input { width: 20px; height: 20px; }
.etape-unique { display: flex; align-items: center; min-height: 52px; }
.pastille-nombre { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--succes); color: #fff; font-size: .78rem; text-align: center; }

/* Pilotage des étapes par les tâches */
.etape-encours { color: var(--succes); }
.etape-pause { color: var(--alerte); }
.pilotage-en-cours { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px;
    background: var(--succes-fond); border: 1px solid #b5dfc6; border-radius: 8px; padding: 6px 8px; }
.pilotage-en-cours.oubli { background: var(--alerte-fond); border-color: #f0c36d; }
.pilotage-boutons { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.pilotage-demarrer { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pilotage-demarrer select { flex: 1 1 160px; width: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tableau .actions .pilotage-en-cours { justify-content: flex-end; margin-bottom: 4px; text-align: left; }

/* --- Liste des OF : colonnes compactes et actions en icônes --- */
.liste-of td { vertical-align: top; }
.liste-of .sous-ligne { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.liste-of .pieces .desc { max-width: 260px; }
.liste-of th.actions, .liste-of td.actions { width: 1%; }
.legende { font-size: .82rem; margin-left: auto; }

.avancement { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pastille-etape { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; cursor: default; }
.pe-ok { background: var(--succes-fond); color: var(--succes); }
.pe-encours { background: var(--info-fond); color: var(--primaire); border-color: #b9cfea; }
.pe-pause { background: var(--alerte-fond); color: var(--alerte); }
.pe-afaire { background: #fff; color: var(--texte); border-color: #c3cad6; }
.pe-attente { background: #f2f4f7; color: #a0a8b5; }
.pe-nc { background: var(--danger-fond); color: var(--danger); }

.actions-icones { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; }
.actions-icones form { margin: 0; }
.btn-icone { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 38px; height: 38px; padding: 0 8px;
    border-radius: 8px; border: 1px solid var(--ligne); background: #fff; color: var(--texte); font: inherit; font-size: 1.05rem; line-height: 1;
    text-decoration: none; cursor: pointer; }
.btn-icone:hover { background: #f0f3f7; border-color: #b8c1cf; }
.btn-icone:focus-visible { outline: 2px solid var(--primaire); outline-offset: 1px; }
.btn-icone .libelle { display: none; font-size: .85rem; font-weight: 600; }
.icone-demarrer { background: var(--primaire); border-color: var(--primaire); color: #fff; }
.icone-demarrer:hover { background: var(--primaire-fonce); border-color: var(--primaire-fonce); }
.icone-ok { background: var(--succes); border-color: var(--succes); color: #fff; font-weight: 700; }
.icone-ok:hover { background: var(--succes); filter: brightness(1.08); }
.icone-danger { color: var(--danger); border-color: #f1b8b2; }
.icone-alerte { background: var(--alerte-fond); color: var(--alerte); border-color: #f0c36d; }
@media (pointer: coarse) { .btn-icone { min-width: 44px; height: 44px; } }

.tache-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; background: var(--succes-fond);
    border: 1px solid #b5dfc6; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tache-chip.oubli { background: var(--alerte-fond); border-color: #f0c36d; }
.tache-chip .voyant { width: 8px; height: 8px; margin: 0; }

/* Grand écran : les icônes d'action tiennent sur une ligne */
.liste-of td.c-act { min-width: 230px; }
.tri-boutons { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* Tablette / téléphone : chaque OF devient une carte compacte (plus de colonne coupée) */
@media (max-width: 900px) {
    .liste-of thead { display: none; }
    .liste-of, .liste-of tbody { display: block; }
    .liste-of tr {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px;
        grid-template-areas: "num date" "client client" "pieces teinte" "av av" "act act";
        align-content: start;
        border-bottom: 8px solid var(--fond);
    }
    .liste-of tr.retard td:first-child { box-shadow: none; }
    .liste-of tr.retard { box-shadow: inset 4px 0 0 var(--danger); }
    .liste-of td { display: block; width: auto; min-width: 0; padding: 0; border: 0; }
    .liste-of td[data-label]::before { content: none; }
    .liste-of .c-num { grid-area: num; }
    .liste-of .c-date { grid-area: date; text-align: right; }
    .liste-of .c-date::before { content: attr(data-label) " : " !important; color: var(--muted); font-size: .82rem; font-weight: 400; }
    .liste-of .c-client { grid-area: client; font-weight: 600; }
    .liste-of .c-client .sous-ligne { display: inline; margin-left: 6px; font-weight: 400; }
    .liste-of .c-pieces { grid-area: pieces; }
    .liste-of .c-pieces .desc { max-width: none; white-space: normal; }
    .liste-of .c-teinte { grid-area: teinte; text-align: right; }
    .liste-of .c-av { grid-area: av; margin-top: 4px; }
    .liste-of .c-act { grid-area: act; min-width: 0; margin-top: 6px; }
    .actions-icones { justify-content: flex-start; }
    .btn-icone { height: 44px; padding: 0 12px; }
    .btn-icone .libelle { display: inline; }
    .legende { margin-left: 0; flex-basis: 100%; }
}
/* Tablette en largeur : deux cartes par ligne */
@media (min-width: 640px) and (max-width: 900px) {
    .liste-of tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; background: var(--fond); }
    .liste-of tr { border: 1px solid var(--ligne); border-radius: var(--rayon); background: #fff; }
    .liste-of tr.retard { box-shadow: inset 4px 0 0 var(--danger); }
}

/* Horaires de travail (administration) */
.grille-horaires th[scope=row] { white-space: nowrap; }
.grille-horaires input[type=time] { min-width: 100px; }
.grille-horaires .sous-entete th { font-size: .75rem; padding-top: 0; }
.grille-horaires tr.jour-off th, .grille-horaires tr.jour-off td:last-child { color: #a0a8b5; }

/* --- Plan du rayonnage des poudres --- */
.segments { display: flex; gap: 6px; }
.plan-rayonnage { table-layout: fixed; }
.plan-rayonnage th[scope=row] { width: 64px; text-align: center; font-size: 1.1rem; background: #f8fafc; }
.plan-rayonnage thead th:first-child { width: 64px; }
.plan-rayonnage td.empl { padding: 0; height: 58px; vertical-align: top; border-left: 1px solid var(--ligne); }
.plan-rayonnage .empl-int { display: flex; flex-direction: column; gap: 2px; min-height: 58px; padding: 6px 8px; color: inherit; text-decoration: none; }
.plan-rayonnage a.empl-int:hover { box-shadow: inset 0 0 0 2px rgba(31, 95, 168, .6); }
.plan-rayonnage .empl.occupee { background: var(--c); color: var(--t); }
.plan-rayonnage .sm { display: none; }
.plan-rayonnage .empl-pos { font-size: .75rem; font-weight: 700; opacity: .75; }
.plan-rayonnage .empl-nom { font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.plan-rayonnage .empl.libre { color: #98a2b3; background: repeating-linear-gradient(45deg, #fff 0 6px, #f5f6f8 6px 12px); }
.plan-rayonnage .empl.libre .empl-nom { font-weight: 400; font-style: italic; }
.plan-rayonnage .empl.inactive { opacity: .55; }
.plan-rayonnage .empl-etat { font-size: .72rem; text-transform: uppercase; }
.plan-rayonnage .empl.trouvee { outline: 3px solid #f59e0b; outline-offset: -3px; box-shadow: 0 0 0 3px rgba(245, 158, 11, .35) inset; }
.plan-rayonnage .empl.estompee { opacity: .25; }
.liste-non-rangees { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.zone-non-rangees { margin-bottom: 16px; }
.zone-non-rangees h2 { margin-bottom: .5rem; }
.aide-rayonnage { margin: 0 0 10px; font-size: .9rem; }
/* Messages du plan : bandeau flottant (ne décale pas la grille pendant un glisser-déposer) */
#rayonnage-message { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60; width: max-content; max-width: calc(100% - 32px); margin: 0; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
#rayonnage-message:empty { display: none; }
/* Glisser-déposer (bureau) */
.plan-rayonnage td.empl { position: relative; }
.deplacable { cursor: grab; user-select: none; -webkit-user-select: none; }
.liste-non-rangees li.deplacable { padding: 6px 10px; border: 1px solid var(--ligne); border-radius: 8px; background: var(--carte); }
.liste-non-rangees li.deplacable:hover { border-color: var(--primaire); }
.deplacable:focus-visible, .plan-rayonnage td[data-emplacement]:focus-visible { outline: 3px solid var(--primaire); outline-offset: -3px; }
.empl-modifier { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; background: rgba(255, 255, 255, .85); color: #1d2430; text-decoration: none; font-size: .85rem; opacity: 0; }
.empl:hover .empl-modifier, .empl:focus-within .empl-modifier { opacity: 1; }
@media (hover: none) { .empl-modifier { opacity: .8; } }
.selectionnee, .glissee { outline: 3px dashed var(--primaire) !important; outline-offset: -3px; }
.glissee { opacity: .45; }
.en-selection .plan-rayonnage td[data-emplacement] { cursor: pointer; }
.en-selection .plan-rayonnage td.libre:hover, .plan-rayonnage td.cible, .zone-non-rangees.cible { outline: 3px solid var(--succes) !important; outline-offset: -3px; box-shadow: inset 0 0 0 999px rgba(30, 123, 79, .12); }
.glisser-en-cours, .glisser-en-cours * { cursor: grabbing !important; user-select: none; }
.fantome-teinte { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; background: var(--c); color: var(--t); border: 1px solid rgba(0, 0, 0, .25); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
#rayonnage.occupe { opacity: .6; pointer-events: none; }
.emplacement { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--info-fond); color: var(--info); font-size: .8rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
@media (max-width: 640px) {
    .plan-rayonnage td.empl { height: 52px; }
    .plan-rayonnage .empl-int { padding: 4px; min-height: 52px; }
    .plan-rayonnage .empl-nom { font-size: .78rem; }
    .plan-rayonnage .lg { display: none; }
    .plan-rayonnage .sm { display: inline; }
    .plan-rayonnage th[scope=row], .plan-rayonnage thead th:first-child { width: 40px; }
    .plan-rayonnage thead th { font-size: .72rem; }
}
@media print {
    .entete, .pas-impression, .flash { display: none !important; }
    body { background: #fff; }
    .page { padding: 0; max-width: none; }
    .tableau-conteneur { box-shadow: none; overflow: visible; }
    .plan-rayonnage { font-size: 11px; }
    .plan-rayonnage td.empl, .plan-rayonnage .empl-int { height: auto; min-height: 36px; }
    .plan-rayonnage tr { break-inside: avoid; }
    .plan-rayonnage .empl.occupee, .plan-rayonnage th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .plan-rayonnage .empl.estompee { opacity: 1; }
}

/* Formulaire OF : stock et rayonnage de la teinte choisie */
.info-teinte { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -6px 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--fond); border: 1px solid var(--ligne); font-size: .92rem; }
.info-teinte .emplacement { margin-left: 0; }
.stock-teinte { white-space: nowrap; }

/* Horaires : généraux / personnalisés par salarié */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.choix-horaires, .grille-horaires-zone { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.choix-horaires { display: flex; flex-direction: column; gap: 4px; }
.grille-horaires-zone[disabled] .tableau { opacity: .55; }
.info-personnalises { margin-bottom: 16px; }
.info-personnalises .muted { display: block; margin-top: 4px; }

/* Fiche client : clients ressemblants (doublons probables) */
.homonymes { background: var(--alerte-fond); border: 1px solid #f0c36d; border-radius: var(--rayon); padding: 10px 14px; margin-bottom: 14px; }
.homonymes[hidden] { display: none; }
.homonymes ul { margin: 6px 0; padding-left: 20px; }
.homonymes li { margin: 2px 0; }
.homonymes .case { margin-top: 6px; font-weight: 600; }

/* Récapitulatif à faire signer par le client (tablette) */
.page-signature .recap-signature .infos { margin: 0; align-content: start; }
.page-signature .description-pieces { font-size: 1.05rem; margin: 0 0 8px; }
.recap-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.recap-photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--ligne); cursor: zoom-in; }
.mention-signature { font-weight: 600; margin: 0 0 12px; }
.zone-signature { position: relative; margin: 12px 0; border: 2px dashed var(--ligne); border-radius: var(--rayon); background: #fff; }
.zone-signature canvas { display: block; width: 100%; height: 240px; touch-action: none; cursor: crosshair; }
.signature-indication { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: var(--muted); font-size: 1.2rem; pointer-events: none; }
.signature-indication[hidden] { display: none; }
.signature-actuelle { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.signature-actuelle img, .signature-fiche img { width: 320px; max-width: 100%; height: auto; border: 1px solid var(--ligne); border-radius: 6px; background: #fff; }
@media (max-width: 600px) { .zone-signature canvas { height: 200px; } }
.signature-fiche { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.signature-fiche img { width: 240px; }
.bandeau-signature { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Écran de pointage à la douchette (tablette d'atelier) */
.page-pointage { max-width: 1000px; }
.pointage h1 { font-size: 1.8rem; }
.pt-entete { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.pt-choix { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0; }
.pt-gros-bouton { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%;
    min-height: 220px; border: 0; border-radius: 18px; color: #fff; font-family: inherit; font-size: 3.2rem; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 24, 40, .18); touch-action: manipulation; }
.pt-gros-bouton span { font-size: 1.5rem; line-height: 1.2; text-align: center; }
.pt-gros-bouton:active { transform: scale(.98); }
.pt-gros-bouton:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.pt-demarrer { background: var(--succes); }
.pt-terminer { background: var(--danger); }
.pt-ok { background: var(--primaire); min-height: 110px; }
.pt-valider { min-height: 130px; margin-top: 16px; font-size: 2.4rem; }
.pt-aide { text-align: center; }
.pt-consigne { font-size: 1.45rem; margin: 10px 0 16px; }
.pt-numero-etape { display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; margin-right: 8px;
    border-radius: 50%; background: var(--primaire); color: #fff; font-weight: 700; }
.pt-scan-icone { text-align: center; font-size: 5rem; margin: 30px 0; }
.pt-of { border-left: 6px solid var(--primaire); }
.pt-of-numero { font-size: 2rem; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.pt-of-client { font-size: 1.3rem; font-weight: 600; }
.pt-of-description { font-size: 1.15rem; margin: 4px 0; white-space: pre-line; }
.pt-of-encours { color: var(--alerte); font-weight: 600; margin-top: 4px; }
.pt-etapes { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.pt-question { width: 100%; margin: 0; font-weight: 600; font-size: 1.15rem; }
.pt-liste-operateurs { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.pt-liste-operateurs li { display: inline-flex; align-items: center; gap: 10px; background: var(--info-fond); border-radius: 999px; padding: 8px 8px 8px 18px; font-size: 1.25rem; font-weight: 600; }
.pt-liste-operateurs li.pt-vide { background: none; padding: 0; font-weight: 400; }
.pt-retirer { border: 0; background: #fff; border-radius: 50%; width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; }
.pt-message { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(92vw, 760px); padding: 16px 22px;
    border-radius: 12px; font-size: 1.25rem; font-weight: 600; box-shadow: 0 6px 20px rgba(16, 24, 40, .25); z-index: 50; }
.pt-message[hidden] { display: none; }
.pt-message.pt-erreur { background: var(--danger); color: #fff; }
.pt-message.pt-info { background: var(--primaire); color: #fff; }
.pt-resultat { border-radius: 18px; padding: 24px; margin: 20px 0; text-align: center; font-size: 1.2rem; }
.pt-resultat p { margin: 6px 0; }
.pt-succes { background: var(--succes-fond); border: 2px solid var(--succes); }
.pt-echec { background: var(--danger-fond); border: 2px solid var(--danger); }
.pt-resultat-icone { font-size: 4rem; font-weight: 800; line-height: 1; }
.pt-succes .pt-resultat-icone { color: var(--succes); }
.pt-echec .pt-resultat-icone { color: var(--danger); }
.pt-resultat-titre { font-size: 1.5rem; font-weight: 700; }
.pt-resultat-info { color: var(--succes); font-weight: 600; }
.pt-resultat-erreur { color: var(--danger); font-weight: 600; }
.pt-saisie { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--ligne); }
.pt-saisie label { width: 100%; }
.pt-saisie input { flex: 1; min-width: 160px; }
@media (max-width: 700px) {
    .pt-choix { grid-template-columns: 1fr; }
    .pt-gros-bouton { min-height: 150px; }
}
.badge.qualite-plus { background: #f4f0ff; color: #5b34b5; border: 1px solid #c4b5fd; }

/* Logo Rance Sablage (fond blanc) : dans une pastille blanche sur le bandeau sombre */
.marque-logo { display: inline-flex; align-items: center; background: #fff; border-radius: 8px; padding: 3px 8px; }
.marque-logo img { display: block; height: 34px; width: auto; }
.connexion .logo-connexion { display: block; width: 240px; max-width: 75%; height: auto; margin: 0 auto 10px; padding: 14px 18px; background: #fff; border-radius: 14px; box-shadow: var(--ombre); box-sizing: content-box; }
@media print { .marque-logo { padding: 0; } }
