/* Espace « SAV & interventions » du terrain : accueil, fiche ticket, fiche d'intervention et rapport à remplir, feuille de signature plein écran.
   Classes .tn-* : le même rendu sert la version mobile interne ET l'espace du compte externe (installateur) : AUCUN préfixe d'attribut ici ; les réglages propres à la version mobile
   (décalage au-dessus de la barre du bas) sont dans mobile-signature.css. Que des var(--…) : aucune couleur, taille de police fixe ni ombre en dur hors tokens. */

.tn { display: flex; flex-direction: column; gap: var(--s-3); width: 100%; max-width: 40rem; margin-inline: auto; --tn-cible: 44px; }
.tn-recherche { width: 100%; min-height: var(--tn-cible); box-sizing: border-box; }
.tn-liste { display: flex; flex-direction: column; gap: var(--s-1); }
.tn-sec { display: flex; flex-direction: column; gap: var(--s-2); }
.tn-h { margin: var(--s-4) var(--s-1) var(--s-1); font: 500 11px var(--font-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tn-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: var(--s-1); padding: 0 var(--s-1); box-sizing: border-box; border-radius: 10px; background: var(--surface2); color: var(--fg); font-size: 11px; }
.tn-t1 { display: block; font-size: 16px; font-weight: 600; line-height: 1.3; }
.tn-t2 { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; }
.tn-texte { margin: 0; white-space: pre-wrap; line-height: 1.45; }
.tn-mini { width: 14px; height: 14px; margin-right: var(--s-1); vertical-align: -2px; }
.tn-vide { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-7) var(--s-4); color: var(--muted); text-align: center; }
.tn-vide .mb-i { width: 40px; height: 40px; color: var(--accent); }

/* ── Cartes de l'accueil ── */
.tn-carte { display: flex; flex-direction: column; gap: var(--s-1); min-height: var(--tn-cible); padding: var(--s-3) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--e-2); color: var(--fg); text-decoration: none; }
.tn-carte:active { background: var(--surface2); }
.tn-l1 { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-1) var(--s-2); }
.tn-ref { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.tn-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-1); }
.tn-titre { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.tn-titre1 { margin: 0; font-size: 22px; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }

/* ── Entrées de l'espace (Tickets SAV | Interventions) et rapport de chaque intervention ── */
.tn-entrees { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s-1); padding: var(--s-1); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.tn-entree { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--tn-cible); padding: 0 var(--s-2); box-sizing: border-box; border-radius: var(--r-md); color: var(--muted); font-weight: 600; text-decoration: none; }
.tn-entree .mb-i { width: 18px; height: 18px; }
.tn-entree[aria-current="page"] { background: var(--accent-d); color: var(--accent); }
.tn-item { display: flex; flex-direction: column; gap: var(--s-1); }
.tn-rapport { display: inline-flex; align-items: center; gap: var(--s-2); min-height: var(--tn-cible); margin: 0 var(--s-1); padding: 0 var(--s-3); box-sizing: border-box; border: 0; border-radius: var(--r-md); background: var(--accent-d); color: var(--accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; align-self: flex-start; }
.tn-rapport .mb-i { width: 18px; height: 18px; }

/* ── Fiches ── */
.tn-tete { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--e-2); }
.tn-tete .tn-l1 { justify-content: flex-start; }
.tn-bloc { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.tn-bloc > .tn-h { margin: 0 0 var(--s-1); }
.tn-kv { display: flex; justify-content: space-between; gap: var(--s-3); font-size: 14px; }
.tn-kv > span:first-child { color: var(--muted); }
.tn-kv > span:last-child { text-align: right; overflow-wrap: anywhere; }
.tn-adr { display: flex; align-items: flex-start; gap: var(--s-1); font-size: 14px; }
.tn-acts { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tn-act { display: inline-flex; flex: 1 1 auto; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--tn-cible); padding: 0 var(--s-4); box-sizing: border-box; border: 0; border-radius: var(--r-md); background: var(--accent-d); color: var(--accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.tn-act .mb-i { width: 18px; height: 18px; }
.tn-contact { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-2) 0; }
.tn-contact + .tn-contact { border-top: 1px solid var(--border); }
.tn-etat { display: inline-flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: var(--tn-cible); padding: 0 var(--s-3); box-sizing: border-box; border: 1px solid var(--tn-c, var(--border)); border-radius: var(--r-md); background: var(--surface2); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; }
.tn-etat .tn-bas { width: 18px; height: 18px; rotate: 90deg; color: var(--muted); }
.tn-ligne { display: grid; grid-template-columns: 1fr auto; gap: 0 var(--s-2); align-items: center; min-height: var(--tn-cible); padding: var(--s-2) 0; color: var(--fg); text-decoration: none; }
.tn-ligne + .tn-ligne { border-top: 1px solid var(--border); }
.tn-ligne .tn-t2 { grid-column: 1; }
.tn-ligne > .badge { grid-column: 2; grid-row: 1 / span 2; }
.tn-plein { width: 100%; min-height: var(--tn-cible); justify-content: center; gap: var(--s-2); }
.tn-b { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--tn-cible); }
.tn-b .mb-i { width: 18px; height: 18px; }

/* ── Notes, photos, pièces ── */
.tn-saisie { display: flex; flex-direction: column; gap: var(--s-2); }
.tn-note { width: 100%; box-sizing: border-box; resize: vertical; }
.tn-saisie-b { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tn-saisie-b > .tn-b { flex: 1 1 auto; }
.tn-histo { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-2); }
.tn-j { padding-left: var(--s-3); border-left: 2px solid var(--border); overflow-wrap: anywhere; }
.tn-vignettes, .tn-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
.tn-vig { position: relative; aspect-ratio: 1; overflow: hidden; padding: 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface2); cursor: pointer; }
.tn-vig img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tn-vig-x { position: absolute; top: var(--s-1); right: var(--s-1); width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--bg); color: var(--fg); cursor: pointer; }
.tn-vig-x .mb-i { width: 16px; height: 16px; }
.tn-ajout { display: grid; place-items: center; gap: var(--s-1); aspect-ratio: 1; padding: var(--s-2); box-sizing: border-box; border: 2px dashed var(--accent); border-radius: var(--r-md); background: var(--accent-d); color: var(--accent); font-size: 13px; font-weight: 600; text-align: center; cursor: pointer; }
.tn-ajout .mb-i { width: 26px; height: 26px; }
.tn-fichier { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: var(--tn-cible); padding: 0 var(--s-2); border: 0; background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.tn-fichier .mb-i { flex: none; width: 18px; height: 18px; }
.tn-fichier span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Choix d'un état ── */
.tn-choix { display: flex; flex-direction: column; gap: var(--s-2); }
.tn-opt { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: 52px; padding: 0 var(--s-4); border: 1px solid var(--tn-c, var(--border)); border-radius: var(--r-md); background: var(--surface2); color: var(--fg); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.tn-opt.tn-sel { background: var(--accent-d); }
.tn-opt .mb-i { width: 20px; height: 20px; color: var(--accent); }

/* ── Fiche d'intervention et rapport ── */
.tn-travail { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-1) 0; }
.tn-travail + .tn-travail { border-top: 1px solid var(--border); }
.tn-ck { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tn-cible); cursor: pointer; }
.tn-ck input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tn-ck-i { flex: none; display: grid; place-items: center; width: 32px; height: 32px; box-sizing: border-box; border: 2px solid var(--border); border-radius: var(--r-md); color: var(--accent-text); }
.tn-ck-i .mb-i { width: 18px; height: 18px; opacity: 0; }
.tn-ck input:checked + .tn-ck-i { border-color: var(--accent); background: var(--accent); }
.tn-ck input:checked + .tn-ck-i .mb-i { opacity: 1; }
.tn-ck input:focus-visible + .tn-ck-i { outline: 2px solid var(--accent); outline-offset: 2px; }
.tn-ck input:disabled + .tn-ck-i { opacity: .55; }
.tn-ck-t { flex: 1; min-width: 0; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.tn-ck input:checked ~ .tn-ck-t { color: var(--muted); }
.tn-lien { align-self: flex-start; min-height: var(--tn-cible); padding: 0 var(--s-1); border: 0; background: none; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tn-remarque { width: 100%; box-sizing: border-box; }
.tn-ajout-ligne { display: flex; gap: var(--s-2); margin-top: var(--s-2); }
.tn-ajout-ligne input { flex: 1; min-width: 0; }
.tn-mesure { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem 4.5rem var(--tn-cible); gap: var(--s-2); align-items: center; }
.tn-mesure input { width: 100%; min-width: 0; box-sizing: border-box; }
.tn-equip { display: grid; grid-template-columns: minmax(0, 1fr) auto var(--tn-cible); gap: var(--s-2); align-items: center; padding: var(--s-1) 0; }
.tn-equip + .tn-equip { border-top: 1px solid var(--border); }
.tn-qte { display: inline-flex; align-items: center; gap: var(--s-1); }
.tn-qte button { width: var(--tn-cible); height: var(--tn-cible); display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface2); color: var(--fg); font: inherit; font-size: 20px; cursor: pointer; }
.tn-qte output { min-width: 2ch; text-align: center; font-weight: 600; }
.tn-icone { width: var(--tn-cible); height: var(--tn-cible); display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--r-md); background: none; color: var(--muted); cursor: pointer; }
.tn-icone .mb-i { width: 20px; height: 20px; }
.tn-verrou { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface2); color: var(--muted); font-size: 14px; }
.tn-resultats { display: flex; flex-direction: column; gap: var(--s-1); max-height: 46dvh; overflow-y: auto; }
.tn-resultat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: var(--tn-cible); padding: var(--s-2) var(--s-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface2); color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.tn-resultat span:first-child { font-weight: 600; }
.tn-signe { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-2) 0; }
.tn-signe + .tn-signe { border-top: 1px solid var(--border); }
.tn-signe img { width: 100%; max-width: 16rem; height: 5rem; object-fit: contain; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface2); }
.tn-refus { padding: var(--s-2) var(--s-3); border-left: 3px solid var(--danger); border-radius: var(--r-sm); background: var(--surface2); }
.tn-hash { display: block; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface2); color: var(--muted); font: 12px var(--font-mono); overflow-wrap: anywhere; }
.tn-stick { position: sticky; bottom: calc(var(--tn-decal, 0px) + var(--s-3)); z-index: 1; display: flex; gap: var(--s-2); padding-top: var(--s-2); }
.tn-stick .btn { flex: 1; min-height: 52px; justify-content: center; gap: var(--s-2); }
.tn-stick .mb-i { width: 20px; height: 20px; }

/* ── Signature : feuille plein écran, client puis technicien ── */
.tn-sheet { position: fixed; inset: 0; z-index: var(--z-visionneuse); display: flex; flex-direction: column; background: var(--bg); color: var(--fg); overflow: hidden; }
.tn-sheet-haut { display: flex; align-items: center; gap: var(--s-2); padding: env(safe-area-inset-top) var(--s-3) 0 var(--s-2); min-height: calc(56px + env(safe-area-inset-top)); flex: none; }
.tn-sheet-haut .tn-icone { color: var(--fg); }
.tn-sheet-titre { min-width: 0; }
.tn-sheet-titre small { display: block; font: 500 12px var(--font-mono); color: var(--muted); }
.tn-sheet-titre h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.tn-etapes { display: flex; gap: var(--s-2); padding: var(--s-2) var(--s-4) var(--s-3); flex: none; }
.tn-etapes i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface2); }
.tn-etapes i.on { background: var(--accent); }
.tn-sheet-corps { flex: 1; overflow-y: auto; padding: 0 var(--s-4) var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.tn-lbl { font: 500 11px var(--font-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tn-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tn-chip { min-height: var(--tn-cible); padding: 0 var(--s-4); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; }
.tn-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-d); color: var(--accent); }
.tn-sheet-corps input[type="text"], .tn-sheet-corps textarea { width: 100%; box-sizing: border-box; }
.tn-bascule { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 56px; padding: 0 var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--fg); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.tn-bascule .tn-tgl { flex: none; position: relative; width: 52px; height: 30px; border-radius: 15px; background: var(--surface2); border: 1px solid var(--border); }
.tn-bascule .tn-tgl::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--muted); }
.tn-bascule[aria-checked="true"] .tn-tgl { background: var(--danger); border-color: var(--danger); }
.tn-bascule[aria-checked="true"] .tn-tgl::after { left: 24px; background: var(--bg); }
.tn-padbox { position: relative; flex: 1 1 auto; min-height: 220px; border: 2px dashed var(--accent); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; touch-action: none; }
.tn-padbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.tn-padbox .tn-trait { position: absolute; left: var(--s-5); right: var(--s-5); bottom: 22%; border-top: 1px solid var(--border); pointer-events: none; }
.tn-padbox .tn-ph { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: var(--s-1); color: var(--muted); pointer-events: none; }
.tn-padbox .tn-ph .mb-i { width: 28px; height: 28px; }
.tn-padbox .tn-ph[hidden] { display: none; }
.tn-padbox .tn-effacer { position: absolute; top: var(--s-2); right: var(--s-2); display: inline-flex; align-items: center; gap: var(--s-1); min-height: var(--tn-cible); padding: 0 var(--s-3); border: 0; border-radius: var(--r-md); background: var(--surface2); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; }
.tn-padbox .tn-effacer .mb-i { width: 18px; height: 18px; }
.tn-sheet-bas { display: flex; gap: var(--s-2); flex: none; padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg); }
.tn-sheet-bas .btn { min-height: 52px; justify-content: center; gap: var(--s-2); }
.tn-sheet-bas .btn:first-child { flex: 1; }
.tn-sheet-bas .btn-primary { flex: 2; }
@media (orientation: landscape) and (max-height: 520px) {
  .tn-sheet-corps { flex-direction: row; flex-wrap: wrap; align-content: flex-start; }
  .tn-padbox { flex: 1 1 60%; min-height: 160px; }
}
.tn-fin { display: grid; justify-items: center; gap: var(--s-3); padding: var(--s-6) 0; text-align: center; }
.tn-fin-ok { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: var(--surface2); color: var(--success); }
.tn-fin-ok .mb-i { width: 46px; height: 46px; }
.tn-fin .tn-bloc { width: 100%; box-sizing: border-box; text-align: left; }
.tn-fin .btn { width: 100%; min-height: 52px; justify-content: center; }
.tn-motif, .tn-trace { display: flex; flex-direction: column; gap: var(--s-2); }
.tn-motif[hidden], .tn-trace[hidden] { display: none; }
.tn-trace { flex: 1 1 auto; }
