:root {
  --fond: #f4f5f2;
  --surface: #fcfcfb;
  --surface-2: #eef0ec;
  --bord: #dfe2dc;
  --encre: #182124;
  --encre-2: #4a5558;
  --muet: #6b7679;
  --accent: #14313a;
  --accent-ink: #ffffff;
  --accent-2: #f2b33d;
  --focus: #2b7a8c;
  --ok: #0ca30c;
  --attention: #fab219;
  --serieux: #ec835a;
  --critique: #d03b3b;
  --ombre: 0 1px 2px rgba(20, 30, 30, .05), 0 2px 8px rgba(20, 30, 30, .04);
  --r: 12px;
  --police: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121413;
    --surface: #1a1a19;
    --surface-2: #242624;
    --bord: #333634;
    --encre: #eceeea;
    --encre-2: #c3c8c4;
    --muet: #969d99;
    --accent: #e9edea;
    --accent-ink: #14313a;
    --focus: #6cc3d6;
    --ombre: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 15px/1.5 var(--police); }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 650; }
.muet { color: var(--muet); }
.encre { color: var(--encre); }
.petit { font-size: .82rem; }
.mono { font-family: var(--mono); font-size: .93em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
hr { border: 0; border-top: 1px solid var(--bord); margin: 18px 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- En-tête ---------- */
.entete { background: #14313a; color: #fff; position: sticky; top: 0; z-index: 20; }
.entete-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 10px 16px; }
.marque { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.marque span { display: flex; flex-direction: column; line-height: 1.1; }
.marque strong { font-size: .98rem; }
.marque small { font-size: .72rem; opacity: .7; text-transform: uppercase; letter-spacing: .08em; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-size: .92rem; color: rgba(255,255,255,.78); }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.actif { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.entete-droite { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-signaler { background: var(--accent-2) !important; color: #1d1a10 !important; border: 0 !important; font-weight: 650; }
.menu-compte { position: relative; }
.menu-compte summary { list-style: none; cursor: pointer; }
.menu-compte summary::-webkit-details-marker { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.16); display: grid; place-items: center; font-size: .78rem; font-weight: 700; }
.menu-compte-panneau { position: absolute; right: 0; top: 44px; background: var(--surface); color: var(--encre); border: 1px solid var(--bord); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); min-width: 210px; padding: 6px; }
.menu-compte-panneau a, .menu-compte-panneau button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 6px; text-decoration: none; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; }
.menu-compte-panneau a:hover, .menu-compte-panneau button:hover { background: var(--surface-2); }
.menu-qui { padding: 8px 10px 10px; border-bottom: 1px solid var(--bord); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-qui span { font-size: .8rem; color: var(--muet); }

.page { max-width: 1240px; margin: 0 auto; padding: 24px 16px 96px; }
.titre-page { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.titre-page p { margin: 4px 0 0; }
.titre-ico { display: flex; align-items: center; gap: 10px; }
.titre-ico .ico { width: 28px; height: 28px; color: var(--muet); }
.retour { display: inline-block; text-decoration: none; color: var(--muet); font-size: .9rem; margin-bottom: 10px; }
.boutons, .etiquettes-titre { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Boutons & champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--bord); background: var(--surface); color: var(--encre); font: 600 .9rem var(--police); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primaire { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primaire:hover { background: var(--accent); filter: brightness(1.15); }
.btn-large { padding: 12px 20px; font-size: 1rem; }
.btn-petit { padding: 5px 10px; font-size: .82rem; }
input, select, textarea { font: inherit; color: var(--encre); background: var(--surface); border: 1px solid var(--bord); border-radius: 9px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; }
input[type="radio"], input[type="file"] { width: auto; }
input[type="file"] { padding: 7px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .86rem; font-weight: 600; color: var(--encre-2); }
.pile { display: flex; flex-direction: column; gap: 12px; }
.aide { font-size: .82rem; color: var(--muet); margin: 4px 0 0; font-weight: 400; }
.actions-form { display: flex; justify-content: flex-end; gap: 10px; }

.alerte { padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; font-size: .92rem; border: 1px solid; }
.alerte-ok { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.alerte-erreur { background: color-mix(in srgb, var(--critique) 10%, var(--surface)); border-color: color-mix(in srgb, var(--critique) 40%, transparent); }

/* ---------- Cartes ---------- */
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--r); padding: 18px; box-shadow: var(--ombre); }
.carte-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.lien-discret { color: var(--muet); text-decoration: none; font-size: .85rem; font-weight: 500; }
.lien-discret:hover { color: var(--encre); }
.deux-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.deux-col-ticket { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); margin-top: 0; }
.pile-col { display: flex; flex-direction: column; gap: 18px; }
.vide { text-align: center; padding: 80px 16px; } .vide h1 { margin-bottom: 8px; } .vide .btn { margin-top: 16px; }
.vide-petit { color: var(--muet); text-align: center; padding: 24px 8px; margin: 0; }
.etroit { max-width: 460px; }
.sous-titre { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muet); margin: 18px 0 8px; font-weight: 650; }
.texte-libre { white-space: pre-wrap; margin: 4px 0 0; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; box-shadow: var(--ombre); }
.kpi-lien:hover { border-color: var(--encre-2); }
.kpi-lib { font-size: .8rem; color: var(--muet); font-weight: 600; }
.kpi-val { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-val small { font-size: 1rem; font-weight: 600; color: var(--muet); }
.kpi-sous { font-size: .8rem; color: var(--muet); }

/* ---------- Produits & barres empilées ---------- */
.grille-produits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.produit-tete { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.produit-tete h2 { flex: 1; font-size: 1.05rem; }
.produit-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; }
.produit-ico .ico { width: 22px; height: 22px; }
.produit-chiffres { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.gros { font-size: 2.2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.barre { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: visible; }
.barre-vide { background: var(--surface-2); }
.seg { min-width: 4px; position: relative; flex-basis: 0; }
.seg:first-child { border-radius: 4px 0 0 4px; } .seg:last-child { border-radius: 0 4px 4px 0; } .seg:only-child { border-radius: 4px; }
.seg-en_service, .ps-en_service { background: var(--ok); }
.seg-en_maintenance, .ps-en_maintenance { background: var(--attention); }
.seg-hors_service, .ps-hors_service { background: var(--critique); }
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: #182124; color: #fff; font-size: .78rem; font-weight: 500; padding: 5px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none; }
.legende { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 2px; }
.legende a { display: flex; align-items: center; gap: 8px; padding: 5px 6px; margin: 0 -6px; border-radius: 6px; text-decoration: none; font-size: .88rem; color: var(--encre-2); }
.legende a:hover { background: var(--surface-2); }
.legende b { margin-left: auto; color: var(--encre); font-variant-numeric: tabular-nums; }
.pastille { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

/* ---------- Listes de tickets ---------- */
.liste-tickets { list-style: none; margin: 0 -8px; padding: 0; }
.liste-tickets a { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; text-decoration: none; }
.liste-tickets a:hover { background: var(--surface-2); }
.liste-tickets li + li { border-top: 1px solid var(--bord); }
.lt-ico .ico { width: 22px; height: 22px; color: var(--muet); }
.lt-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lt-ligne1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-ligne2 { font-size: .8rem; }
.lt-etat { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.pipeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pipeline a { display: flex; justify-content: space-between; padding: 9px 12px; background: var(--surface-2); border-radius: 8px; text-decoration: none; font-size: .9rem; }
.pipeline a:hover { outline: 1px solid var(--bord); }
.pipeline b { font-variant-numeric: tabular-nums; }
.hbarres { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hbarres li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "lib val" "piste piste"; gap: 4px 10px; font-size: .86rem; }
.hb-lib { grid-area: lib; } .hb-val { grid-area: val; font-variant-numeric: tabular-nums; }
.hb-piste { grid-area: piste; height: 8px; }
.hb-barre { display: block; height: 100%; background: #2a6f80; border-radius: 0 4px 4px 0; }
@media (prefers-color-scheme: dark) { .hb-barre { background: #5fb3c6; } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--encre-2); border: 1px solid transparent; }
.badge i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ba-en_service i { background: var(--ok); } .ba-en_maintenance i { background: var(--attention); } .ba-hors_service i { background: var(--critique); }
.bt-nouveau { background: color-mix(in srgb, #2a6f80 16%, var(--surface)); color: var(--encre); border-color: color-mix(in srgb, #2a6f80 35%, transparent); }
.bt-pris_en_charge, .bt-en_reparation { background: color-mix(in srgb, var(--attention) 22%, var(--surface)); color: var(--encre); }
.bt-attente_piece { background: color-mix(in srgb, var(--serieux) 22%, var(--surface)); color: var(--encre); }
.bt-repare { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: var(--encre); }
.bt-hors_service { background: color-mix(in srgb, var(--critique) 16%, var(--surface)); color: var(--encre); }
.bt-annule { text-decoration: line-through; }
.prio { font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muet); }
.prio-haute { color: #b55a1c; } .prio-urgente { color: var(--critique); }
.prio-haute::before, .prio-urgente::before { content: "▲ "; font-size: .7em; }
@media (prefers-color-scheme: dark) { .prio-haute { color: var(--serieux); } .prio-urgente { color: #ff7b7b; } }

/* ---------- Tableaux & filtres ---------- */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin-bottom: 14px; overflow-x: auto; }
.onglets a { padding: 9px 14px; text-decoration: none; color: var(--muet); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.onglets a.actif { color: var(--encre); border-color: var(--encre); }
.filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filtres input[type="search"] { flex: 1 1 240px; width: auto; }
.filtres select { width: auto; flex: 0 1 auto; }
.filtre-inline select { min-width: 200px; }
.carte-table { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muet); font-weight: 650; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--bord); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[onclick] { cursor: pointer; }
.table tbody tr[onclick]:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a { text-decoration: none; }
.table tr.inactif { opacity: .55; }
.cell-app { display: flex; align-items: center; gap: 8px; }
.cell-app > span { display: flex; flex-direction: column; line-height: 1.25; }
.ico { width: 20px; height: 20px; flex-shrink: 0; }
.cell-app .ico { color: var(--muet); }
.cellule-form { padding: 8px 10px !important; }
.ligne-edit { display: flex; gap: 8px; align-items: center; }
.ligne-edit input { padding: 7px 9px; }
.ligne-edit .num { white-space: nowrap; min-width: 90px; }
.actions-ligne { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.mdp summary { list-style: none; } .mdp summary::-webkit-details-marker { display: none; }
.mdp[open] form { margin-top: 6px; }
.depliant { margin-bottom: 16px; }
.depliant summary { cursor: pointer; font-weight: 650; }
.depliant[open] summary { margin-bottom: 14px; }
.grille-form { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.grille-form-plein { grid-column: 1 / -1; }

/* ---------- Formulaire de ticket ---------- */
.formulaire-ticket { max-width: 760px; display: flex; flex-direction: column; gap: 22px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-weight: 700; font-size: 1rem; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; padding: 0; }
.etape { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: .8rem; }
.choix-produits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tuile input { position: absolute; opacity: 0; pointer-events: none; }
.tuile-in { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; border: 2px solid var(--bord); border-radius: 12px; cursor: pointer; font-size: .95rem; color: var(--encre); background: var(--surface); }
.tuile-in .ico { width: 34px; height: 34px; color: var(--encre-2); }
.tuile input:checked + .tuile-in { border-color: var(--accent); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--accent); }
.tuile input:focus-visible + .tuile-in { outline: 2px solid var(--focus); outline-offset: 2px; }
#select-app { padding: 4px; }
#select-app option { padding: 7px 8px; border-radius: 6px; }
.choix-pannes { display: flex; flex-wrap: wrap; gap: 8px; }
.puce input { position: absolute; opacity: 0; pointer-events: none; }
.puce span { display: inline-block; padding: 8px 13px; border: 1px solid var(--bord); border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--encre); background: var(--surface); }
.puce input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.puce input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.puce[hidden] { display: none; }
.ligne-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.appareil-choisi { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; text-decoration: none; }
.appareil-choisi .ico { width: 28px; height: 28px; color: var(--encre-2); }
.appareil-choisi > div { flex: 1; display: flex; flex-direction: column; }
.lien-bloc:hover { outline: 1px solid var(--bord); }

/* ---------- Ticket ---------- */
.photo { max-width: 100%; max-height: 360px; border-radius: 10px; border: 1px solid var(--bord); display: block; }
.mini-liste { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.mini-liste li { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.mini-liste a { text-decoration: none; }
.journal { list-style: none; margin: 0 0 16px; padding: 0 0 0 4px; }
.ev { display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 16px; position: relative; }
.ev::before { content: ""; position: absolute; left: 4px; top: 14px; bottom: 0; width: 2px; background: var(--bord); }
.ev:last-child::before { display: none; }
.ev-point { width: 10px; height: 10px; border-radius: 50%; background: var(--muet); margin-top: 6px; }
.ev-creation .ev-point { background: #2a6f80; }
.ev-commentaire .ev-point { background: var(--surface); border: 2px solid var(--muet); }
.ev-tete { font-size: .9rem; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ev .texte-libre { background: var(--surface-2); padding: 9px 12px; border-radius: 8px; margin-top: 6px; font-size: .92rem; }
.infos { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; font-size: .9rem; }
.infos dt { color: var(--muet); } .infos dd { margin: 0; }
.qr-carte { text-align: center; }
.qr { background: #fff; padding: 12px; border-radius: 10px; display: inline-block; border: 1px solid var(--bord); }
.qr svg { width: 168px; height: 168px; display: block; }
.qr-carte .aide { margin: 12px 0; }

/* ---------- Connexion ---------- */
.connexion { min-height: 80vh; display: grid; place-items: center; }
.connexion-carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 16px; padding: 32px 28px; width: 100%; max-width: 400px; box-shadow: var(--ombre); }
.connexion-carte h1 { margin: 14px 0 6px; font-size: 1.4rem; }
.connexion-carte .muet { margin: 0 0 20px; font-size: .92rem; }

.fab { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grille-produits { grid-template-columns: 1fr; }
  .deux-col, .deux-col-ticket { grid-template-columns: minmax(0, 1fr); }
  .grille-form { grid-template-columns: 1fr 1fr; }
  .grille-form-action { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .entete-in { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px 0; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -12px; padding: 0 8px 6px; }
  .entete-droite { margin-left: auto; }
  .btn-signaler { display: none !important; }
  .page { padding: 18px 12px 100px; }
  h1 { font-size: 1.35rem; }
  .kpi-val { font-size: 1.6rem; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; background: var(--accent-2); color: #1d1a10; font-size: 2rem; font-weight: 400; text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.22); z-index: 30; }
  .filtres select { flex: 1 1 140px; }
  /* tableaux en cartes */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--bord); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td[data-l]::before { content: attr(data-l); color: var(--muet); font-size: .8rem; text-align: left; }
  .table .num { text-align: right; }
  .cellule-form { padding: 0 !important; }
  .ligne-edit { flex-wrap: wrap; }
  .ligne-edit input { flex: 1 1 100%; }
  .choix-produits { gap: 8px; }
  .tuile-in { padding: 14px 6px; font-size: .88rem; }
  .ligne-2 { grid-template-columns: 1fr; }
  .grille-form { grid-template-columns: 1fr; }
  .actions-form .btn-large { flex: 1; }
  .liste-tickets a { flex-wrap: wrap; row-gap: 6px; }
  .lt-corps { flex-basis: calc(100% - 40px); }
  .lt-etat { margin-left: 34px; }
  .lt-ligne1 { white-space: normal; }
  .table-tickets td[data-l="Assigné à"] { display: none; }
}

/* ---------- v2 : USB, alertes, lots, tâches, rapport, PWA ---------- */
label.btn { flex-direction: row; display: inline-flex; color: var(--encre); font-size: .9rem; }
.btn-usb { background: rgba(255,255,255,.1) !important; color: #fff !important; border-color: rgba(255,255,255,.18) !important; font-weight: 600; }
.btn-usb .ico, .btn-usb-form .ico, .boutons .ico { width: 18px; height: 18px; }
.ligne-recherche { display: flex; gap: 8px; }
.ligne-recherche input { flex: 1; }
.badge.alerte { background: color-mix(in srgb, var(--serieux) 18%, var(--surface)); color: var(--encre); border-color: color-mix(in srgb, var(--serieux) 45%, transparent); }
.cell-app .badge.alerte { margin-top: 3px; align-self: flex-start; font-size: .7rem; padding: 1px 7px; }
.carte-alerte { border-color: color-mix(in srgb, var(--serieux) 45%, var(--bord)); }
.aide-alerte { color: var(--encre); background: color-mix(in srgb, var(--serieux) 12%, var(--surface)); border-radius: 8px; padding: 8px 11px; }
.aide-haut { margin: 0 0 12px; }
.note-non-id { display: block; margin-top: 10px; font-size: .82rem; color: var(--muet); text-decoration: none; }
.note-non-id:hover { color: var(--encre); }
.compteur { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--serieux); color: #1d1a10; font-size: .72rem; margin-left: 4px; }
.non-id { font-style: italic; }
.appareil-non-id { border: 1px dashed var(--bord); }
.rattacher { margin-top: 10px; }
.rattacher input { flex: 1; }
.case-ligne { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; color: var(--encre); }
.case-ligne input { width: 18px; height: 18px; }
#bloc-non-id { margin-top: 4px; display: flex; flex-direction: column; gap: 10px; }
#bloc-non-id[hidden], #champs-non-id[hidden] { display: none; }
.ligne-3 { display: grid; grid-template-columns: 110px 1fr 1.4fr; gap: 10px; }
.colle { position: sticky; top: 76px; }

/* Tâches */
.liste-taches { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.liste-taches li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.tache-coche { width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: .75rem; flex-shrink: 0; margin-top: 1px; }
.tache-corps { flex: 1; min-width: 0; }
.duree { font-size: .78rem; font-weight: 650; color: var(--encre-2); background: var(--surface); border: 1px solid var(--bord); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.btn-icone { background: none; border: 0; color: var(--muet); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.btn-icone:hover { color: var(--critique); }
.form-tache { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--bord); padding-top: 14px; }
.form-tache .puce span { padding: 6px 11px; font-size: .86rem; }
.tache-libre[hidden] { display: none; }

/* Traitement par lot */
.col-case { width: 40px; }
.col-case input { width: 18px; height: 18px; cursor: pointer; }
.barre-lot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--bord); box-shadow: 0 -8px 24px rgba(0,0,0,.12); }
.barre-lot[hidden] { display: none; }
.barre-lot-in { max-width: 1240px; margin: 0 auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.barre-lot-tete { display: flex; justify-content: space-between; align-items: center; }
.barre-lot-tete button { background: none; border: 0; cursor: pointer; }
.barre-lot-champs { display: grid; grid-template-columns: 1fr 1fr 1.2fr 110px 1.5fr auto; gap: 10px; align-items: end; }
.barre-lot-champs label { font-size: .78rem; }
.barre-lot-champs input, .barre-lot-champs select { padding: 7px 9px; }
.barre-lot-champs .tache-libre { margin-top: 4px; }
body.avec-barre-lot .page { padding-bottom: 200px; }
body.avec-barre-lot .fab { display: none; }

/* Rapport */
.rapport-outils { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.rapport-outils input[type="date"], .rapport-outils select { width: auto; }
.rapport-outils .espace { flex: 1; }
.rapport { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--r); padding: 28px; box-shadow: var(--ombre); }
.rapport-tete { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 2px solid var(--encre); padding-bottom: 16px; margin-bottom: 20px; }
.rapport-sur { margin: 0 0 4px; text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; font-weight: 700; color: var(--muet); }
.rapport-tete h1 { font-size: 1.5rem; }
.rapport-tete p { margin: 4px 0 0; }
.rapport-meta { text-align: right; }
.rapport-synthese { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 24px; }
.rapport-synthese > div { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; }
.rapport-synthese .kpi-val { font-size: 1.5rem; }
.rapport-bloc { margin-bottom: 24px; break-inside: auto; }
.rapport-bloc h2 { font-size: 1rem; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--bord); }
.rapport-bloc .vide-petit { text-align: left; padding: 6px 0; }
.table-rapport { border: 1px solid var(--bord); border-radius: 8px; overflow: hidden; border-collapse: separate; border-spacing: 0; }
.table-rapport td, .table-rapport th { padding: 8px 10px; }
.table-rapport tr { break-inside: avoid; }
.table-rapport a { color: inherit; }
.rapport-visas { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 32px; }
.rapport-visas div { border: 1px solid var(--bord); border-radius: 8px; height: 90px; padding: 8px 12px; }
.rapport-visas span { font-size: .8rem; color: var(--muet); font-weight: 600; }

/* Installation iOS */
.installer-ios { position: fixed; left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 50; background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 12px 14px; display: flex; gap: 12px; align-items: center; font-size: .88rem; }
.installer-ios[hidden] { display: none; }
.installer-ios p { margin: 0; flex: 1; }
.btn-installer[hidden] { display: none !important; }

@media (max-width: 1000px) {
  .barre-lot-champs { grid-template-columns: 1fr 1fr; }
  .barre-lot-champs .lot-note { grid-column: 1 / -1; }
  .rapport-synthese { grid-template-columns: repeat(3, 1fr); }
  .colle { position: static; }
}
@media (max-width: 760px) {
  .btn-usb { display: none !important; }
  .btn-usb-form { display: none; }
  .ligne-3 { grid-template-columns: 1fr 1fr; }
  .ligne-3 label:last-child { grid-column: 1 / -1; }
  .table-tickets td.col-case { justify-content: flex-start; }
  .rapport { padding: 16px; }
  .rapport-tete { flex-direction: column; }
  .rapport-meta { text-align: left; }
  .rapport-synthese { grid-template-columns: 1fr 1fr; }
  .table-rapport { border: 0; }
  .barre-lot-champs .btn { grid-column: 1 / -1; }
}

/* Impression du rapport */
@media print {
  @page { size: A4; margin: 12mm; }
  :root { --surface: #fff; --surface-2: #f3f4f2; --fond: #fff; --encre: #111; --muet: #555; --bord: #ccc; color-scheme: light; }
  body { background: #fff; font-size: 10pt; }
  .entete, .fab, .no-print, .installer-ios, .alerte, .barre-lot { display: none !important; }
  .page { padding: 0; max-width: none; }
  .rapport { border: 0; box-shadow: none; padding: 0; }
  .table thead { display: table-header-group !important; }
  .table, .table tbody, .table tr { display: revert !important; }
  .table td { display: table-cell !important; text-align: left; }
  .table td.num, .table th.num { text-align: right; }
  .table td::before { content: none !important; }
  .badge { border: 1px solid #bbb; background: #fff !important; }
  a { text-decoration: none; }
}
