/* ================================================================
   CARTES DE LIVRAISON — feuille commune (2026-10-02)

   Demande : « je veux que les cartes des livraisons client soient les
   mêmes que les courses livreur ». Ces règles vivaient dans livreur.html ;
   elles sont sorties ici, MOT POUR MOT, pour que la liste des courses du
   livreur (livreur.html) et « Mes livraisons » du client
   (portail-compte.html) aient la même présentation : bandeau de chiffres,
   filtres en pastilles, cartes, prix, pied d'actions, état vide.

   Chargée par les deux pages AVANT leur <style> : une règle propre à une
   page (fenêtre de la course, rappel des propositions…) garde donc le
   dernier mot, comme avant le déplacement. Ce qui ne sert qu'à une page
   reste dans la page.

   Code couleur commun (ERP, application, site livreur, espace client) :
   bordure gauche de 4 px à la couleur de la FAMILLE —
     · fam-cours   bleu nuit : en cours ;
     · fam-propose orange    : une action est attendue (accepter, décider,
                               confirmer la réception) ;
     · fam-ok      vert      : livrée ;
     · fam-stop    rouge     : annulée, refusée, échec, rendue au vendeur.

   Dépend de css/variables.css, css/base.css (.btn, .btn-primary,
   .btn-ghost, .btn-sm) et css/portail.css (--green, --font-head), chargés
   avant par les deux pages.
   ================================================================ */

/* ── Tons sémantiques ──
   Un seul endroit où l'on décide ce que « attention » ou « bloquant »
   veut dire visuellement. Chaque ton a un fond, un texte et un accent,
   pour ne jamais improviser un rgba() au fil des composants. Posés sur
   <body> : la barre du haut du site livreur vit hors des vues et s'en sert. */
body {
  --lv-ok-fond:    #E9F7EF;  --lv-ok-texte:    #0F6B3F;  --lv-ok-accent:    #15803D;
  --lv-info-fond:  #EEF3FA;  --lv-info-texte:  #1B3B6F;  --lv-info-accent:  #2E5490;
  --lv-attn-fond:  #FEF3E2;  --lv-attn-texte:  #8A5310;  --lv-attn-accent:  #C77B12;
  --lv-stop-fond:  #FDECEA;  --lv-stop-texte:  #96261B;  --lv-stop-accent:  #C0392B;

  --lv-trait:      #E4E8EF;
  --lv-trait-fort: #CBD3DF;
  --lv-encre:      #0F1B2D;
  --lv-encre2:     #55637A;
  --lv-fond:       #F5F7FA;
  --lv-rayon:      14px;
  --lv-rayon-sm:   10px;
}

/* ── Une course ── */
.lv-course {
  border: 1px solid var(--lv-trait); border-radius: var(--lv-rayon);
  padding: 15px; margin-bottom: 12px; background: #fff;
  transition: border-color .16s, box-shadow .16s;
}
.lv-course:hover { border-color: var(--lv-trait-fort); }

/* ── Bandeau de chiffres ──
   Quatre tuiles, deux par ligne sur téléphone : à 360 px, quatre côte à
   côte rendraient les chiffres illisibles. Chaque tuile ouvre le filtre
   qu'elle compte — un chiffre qu'on ne peut pas toucher pour voir le
   détail oblige à chercher ailleurs. */
.lv-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
@media (min-width: 560px) { .lv-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.lv-kpi {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0;
  border: 1px solid var(--lv-trait); border-radius: var(--lv-rayon-sm); background: #fff;
  padding: 10px 12px; cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.lv-kpi:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.lv-kpi-lbl {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--lv-encre2); display: flex; align-items: center; gap: 5px;
}
.lv-kpi-val {
  font-family: var(--font-head); font-weight: 800; font-size: 19px; letter-spacing: -.02em;
  color: var(--lv-encre); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lv-kpi-val small { font-size: 11px; font-weight: 700; color: var(--lv-encre2); margin-left: 3px; }
.lv-kpi.attn { background: var(--lv-attn-fond); border-color: rgba(199,123,18,.3); }
.lv-kpi.attn .lv-kpi-val, .lv-kpi.attn .lv-kpi-lbl { color: var(--lv-attn-texte); }
.lv-kpi.ok .lv-kpi-val { color: var(--lv-ok-texte); }

/* ── Filtres en pastilles ── */
.lv-filtres { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.lv-filtre {
  border: 1px solid var(--lv-trait-fort); background: #fff; color: var(--lv-encre2);
  border-radius: 999px; padding: 7px 12px; min-height: 36px; font: inherit;
  font-size: 12.5px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.lv-filtre .n {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px;
  line-height: 20px; text-align: center; background: var(--lv-fond); color: var(--lv-encre2);
}
.lv-filtre.actif { background: var(--lv-info-texte); border-color: var(--lv-info-texte); color: #fff; }
.lv-filtre.actif .n { background: rgba(255,255,255,.2); color: #fff; }
/* Ce qui attend une réponse (course proposée au livreur, décision ou
   réception à confirmer pour le client) : son compteur se voit même quand
   on regarde un autre filtre. */
.lv-filtre.urgent:not(.actif) { border-color: var(--lv-attn-accent); color: var(--lv-attn-texte); }
.lv-filtre.urgent:not(.actif) .n { background: var(--lv-attn-accent); color: #fff; }
.lv-filtre:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ── Carte ──
   La bordure gauche de 4 px porte la FAMILLE (voir l'en-tête). Elle se
   lit sans lire. */
.lv-carte { border-left-width: 4px; padding: 13px 14px; }
.lv-carte.fam-cours { border-left-color: var(--lv-info-texte); }
.lv-carte.fam-propose { border-left-color: var(--lv-attn-accent); }
.lv-carte.fam-ok { border-left-color: var(--lv-ok-accent); }
.lv-carte.fam-stop { border-left-color: var(--lv-stop-accent); }
/* La course la plus urgente (première de « En cours ») et celle dont la
   fenêtre est ouverte ressortent : c'est elle qu'on cherche des yeux. */
.lv-carte.fam-cours.lv-prioritaire, .lv-carte.lv-ouverte { box-shadow: 0 8px 24px rgba(27,59,111,.12); border-color: var(--lv-trait-fort); border-left-color: var(--lv-info-texte); }
.lv-carte.fam-stop.lv-ouverte { border-left-color: var(--lv-stop-accent); }
.lv-carte.fam-ok.lv-ouverte { border-left-color: var(--lv-ok-accent); }
.lv-carte-tete { display: flex; align-items: flex-start; gap: 10px; }
.lv-carte-tete > div:first-child { min-width: 0; flex: 1; }
.lv-carte-ref {
  font-family: var(--font-head); font-weight: 800; font-size: 14px; color: var(--lv-encre);
  overflow-wrap: anywhere;
}
.lv-pastille-st {
  display: inline-block; margin-top: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.4;
}
.lv-pastille-st.fam-cours   { background: var(--lv-info-fond); color: var(--lv-info-texte); }
.lv-pastille-st.fam-propose { background: var(--lv-attn-fond); color: var(--lv-attn-texte); }
.lv-pastille-st.fam-ok      { background: var(--lv-ok-fond);   color: var(--lv-ok-texte); }
.lv-pastille-st.fam-stop    { background: var(--lv-stop-fond); color: var(--lv-stop-texte); }
.lv-carte .lv-course-prix { font-size: 16px; }
/* Une course annulée ou en échec ne se paie pas : son prix passe au gris. */
.lv-carte.fam-stop .lv-course-prix { color: var(--lv-encre2); }
.lv-carte-corps { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.lv-carte-info {
  display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px;
  color: var(--lv-encre2); line-height: 1.5; min-width: 0;
}
.lv-carte-info i.ti { font-size: 15px; flex: none; margin-top: 1px; }
.lv-carte-info span { min-width: 0; overflow-wrap: anywhere; }
.lv-carte-info.fort { color: var(--lv-encre); font-weight: 600; }
.lv-carte-motif {
  margin-top: 8px; padding: 8px 11px; border-radius: var(--lv-rayon-sm);
  background: var(--lv-stop-fond); color: var(--lv-stop-texte); font-size: 12.5px; line-height: 1.5;
  overflow-wrap: anywhere;
}
.lv-carte-argent {
  margin-top: 8px; padding: 8px 11px; border-radius: var(--lv-rayon-sm);
  background: var(--lv-attn-fond); color: var(--lv-attn-texte); font-size: 12.5px; font-weight: 600;
}
.lv-carte .lv-course-actions { margin-top: 12px; }
/* Ouvrir / Détail : bouton secondaire, pleine largeur — c'est la seule
   action de la carte, elle doit tomber sous le pouce. */
.lv-carte-bascule { width: 100%; min-height: 44px; }

/* Le prix est l'information qu'on cherche en premier sur une proposition :
   il est aligné à droite, en gros, dans l'orange de la marque. */
.lv-course-prix {
  margin-left: auto; flex: none; text-align: right;
  font-family: var(--font-head); font-weight: 800; font-size: 17px;
  color: var(--green-dark); letter-spacing: -.02em; white-space: nowrap;
}
.lv-course-actions { display: flex; gap: 9px; margin-top: 14px; }
/* Une action dominante par état : le bouton principal prend deux fois la
   place du secondaire, on ne peut pas se tromper d'un coup de pouce. */
.lv-course-actions .btn { flex: 1; min-height: 46px; font-size: 13px; }
.lv-course-actions .btn-primary { flex: 2; }

/* État vide : jamais un simple « aucun élément ». On dit ce qui manque et
   pourquoi, sinon on croit à une panne. */
.lv-vide {
  text-align: center; padding: 34px 20px; color: var(--lv-encre2);
  font-size: 13px; line-height: 1.65;
}

/* Écrans étroits : les boutons du pied s'empilent plutôt que de couper
   leur libellé. */
@media (max-width: 400px) {
  .lv-course-actions { flex-direction: column; }
  .lv-course-actions .btn { flex: none; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .lv-course { transition: none; }
}
