/* Dépannage (Auto, MekaDepa, Gestion) — composants communs. Couleurs MekaGarage : le bleu reste la couleur d'action ;
   le rouge est réservé au danger et au 112 ; l'orange/jaune signale une attention. */
:root { --depa-sos: #B42318; --depa-sos-tint: #FDE2E1; }
[data-theme="dark"] { --depa-sos: #FFB4AB; --depa-sos-tint: #3A1614; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --depa-sos: #FFB4AB; --depa-sos-tint: #3A1614; } }

/* Fiche basse (dialogue natif) */
.depa-sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 88dvh; border-radius: 22px 22px 0 0;
  background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow); }
.depa-sheet::backdrop { background: rgba(11, 24, 48, .45); }
.depa-sheet-in { padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
.depa-sheet h2 { margin: 0; font: 600 1.25rem/1.2 var(--font-display); letter-spacing: normal; }
.depa-sheet p { margin: 0; line-height: 1.5; }
.depa-sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.depa-sheet-actions .btn { width: 100%; justify-content: center; min-height: 48px; }
@media (min-width: 700px) { .depa-sheet { margin: auto; border-radius: 22px; } }
@media (prefers-reduced-motion: no-preference) {
  .depa-sheet[open] { animation: depa-up 300ms cubic-bezier(.2, .8, .2, 1); }
  @keyframes depa-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Bouton « i » : 44 px de cible, nom accessible, utilisable au clavier */
.depa-i { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--brand-strong);
  font: 600 15px/1 var(--font-display); display: inline-grid; place-items: center; cursor: pointer; position: relative; }
.depa-i::before { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; border: 2px solid currentColor; }
.depa-i:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Mise en page commune : titre court, état, une carte, une action principale, une secondaire au plus */
.depa { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.depa-titre { display: flex; align-items: center; gap: 4px; }
.depa-titre h1 { margin: 0; font: 600 clamp(1.4rem, 1.25rem + .6vw, 1.55rem)/1.15 var(--font-display); letter-spacing: normal; }
.depa > h1, .depa form > h1 { margin: 0; font: 600 clamp(1.4rem, 1.25rem + .6vw, 1.55rem)/1.15 var(--font-display); }
.depa-titre .depa-lien { margin-left: auto; font-weight: 500; }
.depa-etat { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font: 600 1rem/1.2 var(--font-display); letter-spacing: .01em;
  background: var(--surface-raised); border: 1px solid var(--border); color: var(--ink-muted); }
.depa-etat::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.depa-etat.on { background: var(--success-tint); color: var(--success-ink); border-color: transparent; }
.depa-etat.wait { background: var(--warning-tint); color: var(--warning-ink); border-color: transparent; }
.depa-etat.off { color: var(--ink-muted); }
.depa-carte { background: var(--surface-raised); border: 1px solid var(--border); border-radius: 18px; padding: 6px 16px; display: flex; flex-direction: column; }
.depa-carte.note { padding: 14px 16px; gap: 4px; }
.depa-carte.attention { background: var(--warning-tint); color: var(--warning-ink); border-color: transparent; }
.depa-carte.bloque { background: var(--depa-sos-tint); color: var(--ink); border-color: transparent; }
.depa-carte h2 { margin: 8px 0 2px; font: 600 1.1rem/1.25 var(--font-display); }
.depa-carte p { margin: 0; line-height: 1.45; }
.depa-kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); font-size: .97rem; }
.depa-kv:first-child, .depa-carte h2 + .depa-kv { border-top: 0; }
.depa-kv > span { color: var(--ink-muted); }
.depa-kv > b { text-align: right; font-weight: 500; overflow-wrap: anywhere; }
/* break-ui : un texte libre long (véhicule) ou un petit téléphone (360 px et moins) : le libellé passe au-dessus de
   la valeur, alignée à gauche, au lieu de trois lignes serrées alignées à droite. Le total reste sur une ligne. */
.depa-kv.pile { flex-direction: column; align-items: flex-start; gap: 2px; }
.depa-kv.pile > b { text-align: left; }
@media (max-width: 360px) {
  .depa-kv:not(.total) { flex-direction: column; align-items: flex-start; gap: 2px; }
  .depa-kv:not(.total) > b { text-align: left; }
}
.depa-kv.total > b { font: 600 1.3rem/1.1 var(--font-display); }
.depa-actions { display: flex; flex-direction: column; gap: 8px; }
.depa-actions .btn { width: 100%; justify-content: center; min-height: 52px; font-size: 1rem; }
.depa-actions.deux { flex-direction: row; }
.depa-actions.deux .btn { flex: 1 1 0; }
.depa-muted { margin: 0; color: var(--ink-muted); font-size: .92rem; line-height: 1.45; }
.depa-test { margin: 0; align-self: flex-start; font-size: .82rem; font-weight: 600; padding: 5px 10px; border-radius: 8px;
  background: var(--warning-tint); color: var(--warning-ink); }
.depa-erreur { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--depa-sos-tint); color: var(--ink); line-height: 1.45; }
.depa-erreur strong { display: block; }

/* Ligne 112 (secondaire, jamais l'action principale d'une liste vide) et bloc sécurité */
.depa-sos-line { margin: 0; font-weight: 500; }
.depa-112 { color: var(--depa-sos); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.depa-sos { border-radius: 18px; padding: 16px; background: var(--depa-sos-tint); display: flex; flex-direction: column; gap: 10px; }
.depa-sos p { margin: 0; font-size: 1.05rem; line-height: 1.45; font-weight: 600; }
.depa-sos .btn { background: var(--depa-sos); border-color: var(--depa-sos); color: #fff; min-height: 52px; justify-content: center; }
[data-theme="dark"] .depa-sos .btn { color: #3A1614; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .depa-sos .btn { color: #3A1614; } }

/* Code d'arrivée à 4 chiffres */
.depa-code { margin: 0; display: flex; gap: 10px; }
.depa-code span { width: 54px; height: 64px; border-radius: 14px; display: grid; place-items: center; font: 600 2rem/1 var(--font-display);
  background: var(--navy); color: var(--on-navy); }
.depa-code-bloc { border-radius: 20px; padding: 16px; background: var(--surface-raised); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.depa-code-bloc h2 { margin: 0; font: 600 1.05rem/1.2 var(--font-display); }
.depa-champ-code { font: 600 1.8rem/1 var(--font-display) !important; letter-spacing: .4em; text-align: center; max-width: 220px; min-height: 56px; }

/* Étapes */
.depa-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; counter-reset: s; }
.depa-steps li { flex: 1 1 0; counter-increment: s; font-size: .82rem; font-weight: 600; color: var(--ink-muted); padding-top: 8px; border-top: 4px solid var(--border); }
.depa-steps li.done { border-color: var(--success-ink); color: var(--ink); }
.depa-steps li.cur { border-color: var(--brand); color: var(--ink); }

/* Choix (besoin, véhicule) */
.depa-choix { display: flex; flex-direction: column; gap: 8px; }
.depa-choix > button, .depa-choix > a { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 16px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--surface-raised); color: var(--ink); font: 500 1.02rem/1.3 var(--font-sans); text-align: left; text-decoration: none; cursor: pointer; }
.depa-choix > button small, .depa-choix > a small { display: block; font-weight: 400; color: var(--ink-muted); font-size: .88rem; }
@media (hover:hover) and (pointer:fine){.depa-choix > button:hover,.depa-choix > a:hover{ border-color: var(--brand); }}

/* Liste des dépanneurs : cartes de même poids, entièrement ouvrables */
.depa-liste { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.depa-option { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding-right: 40px !important; align-items: center; width: 100%; padding: 14px 16px; border-radius: 18px;
  border: 1px solid var(--border); background: var(--surface-raised); color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
@media (hover:hover) and (pointer:fine){.depa-option:hover{ border-color: var(--brand); }}
.depa-option strong { font-size: 1.05rem; font-weight: 600; }
.depa-option .prix { font: 600 1.2rem/1.1 var(--font-display); text-align: right; }
.depa-option .type, .depa-option .dist { grid-column: 1 / -1; font-size: .92rem; color: var(--ink-muted); }
.depa-option .depa-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 26px; line-height: 1; color: var(--ink-muted); }
.depa-option small { color: var(--ink-muted); }
.depa-option .dispo { grid-column: 1 / -1; justify-self: start; font-size: .8rem; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: var(--success-tint); color: var(--success-ink); }
/* break-ui : un nom long (« Garage et Carrosserie Vandenbroucke-Van Steenwinckel & Fils ») était écrasé dans une colonne
   étroite à côté du prix, sur 6 à 7 lignes à 320 px. Le nom prend toute la largeur ; le prix passe sur la ligne du type. */
.depa-option { grid-template-columns: minmax(0, 1fr) auto; }
.depa-option strong { grid-column: 1 / -1; overflow-wrap: anywhere; }
.depa-option .type { grid-column: 1; grid-row: 2; }
.depa-option .prix { grid-column: 2; grid-row: 2; white-space: nowrap; }

/* Bandeau Auto « Je suis bloqué » (au-dessus des 4 actions, jamais une 5e carte) */
.depa-bandeau { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 18px; background: var(--navy); color: var(--on-navy);
  text-decoration: none; min-height: 64px; }
.depa-bandeau strong { display: block; font: 600 1.15rem/1.2 var(--font-display); letter-spacing: normal; }
.depa-bandeau small { display: block; color: var(--on-navy-muted); font-size: .9rem; margin-top: 2px; }
.depa-bandeau .go { margin-left: auto; font-size: 1.4rem; line-height: 1; }
.depa-bandeau:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }

/* Action principale : toujours dans le fil de la page, après le contenu (jamais posée par-dessus, même clavier ouvert ou texte agrandi) */
.depa-pied { margin-top: 4px; }
.depa-pied .btn { width: 100%; justify-content: center; min-height: 52px; font-size: 1rem; }

/* 101 : style institutionnel, distinct du 112 */
.depa-101 { background: var(--navy); border-color: var(--navy); color: var(--on-navy); min-height: 52px; width: 100%; justify-content: center; }
.depa-question { margin: 4px 0 0; font: 600 1.15rem/1.3 var(--font-display); letter-spacing: normal; }
.depa-retour { align-self: flex-start; display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; font-weight: 500; }
.depa .linkish, .depa-sheet .linkish { background: none; border: 0; padding: 0; min-height: 44px; color: var(--brand-strong); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.depa-etapes-liste { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.45; }
.depa-choix label.check { min-height: 48px; align-items: center; padding: 6px 4px; }
.depa-sheet fieldset { border: 0; margin: 0; padding: 0; }

/* Connexion interrompue */
.depa-net { position: fixed; left: 12px; right: 12px; top: calc(10px + var(--env-h, env(safe-area-inset-top, 0px))); z-index: 50; max-width: 520px; margin: 0 auto;
  padding: 10px 14px; border-radius: 14px; background: var(--warning-tint); color: var(--warning-ink); box-shadow: var(--shadow); display: flex; flex-direction: column; font-size: .92rem; }
.depa-net strong { font-weight: 600; }

/* Attente */
.depa-attente { display: flex; align-items: center; gap: 12px; }
.depa-spin { width: 28px; height: 28px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--brand); flex: none; }
@media (prefers-reduced-motion: no-preference) { .depa-spin { animation: depa-tourne 900ms linear infinite; } @keyframes depa-tourne { to { transform: rotate(1turn); } } }

.depa-champ { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .95rem; }
.depa-champ input, .depa-champ textarea { font: inherit; font-weight: 400; font-size: 1rem; min-height: 48px; border-radius: 12px; border: 1px solid var(--border-control);
  padding: 10px 12px; background: var(--surface-raised); color: var(--ink); }
.depa-champ textarea { min-height: 84px; resize: vertical; }
.depa-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Position du véhicule (mission) : adresse ou coordonnées lisibles, puis « Ouvrir la position » */
.depa-position { display: flex; flex-direction: column; gap: 2px; padding: 11px 0; border-top: 1px solid var(--border); }
.depa-position-t { color: var(--ink-muted); font-size: .97rem; }
.depa-position b { font-weight: 500; font-size: 1.02rem; overflow-wrap: anywhere; }
.depa-position small { color: var(--ink-muted); font-size: .9rem; }
.depa-position-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.depa-position-actions .btn { min-height: 44px; }
.depa-position .depa-erreur { margin-top: 8px; }

.depa-insecable { white-space: nowrap; }
