:root {
  --fond: #f4f6f8;
  --carte: #ffffff;
  --texte: #1d2733;
  --discret: #5f6b78;
  --bord: #d6dce2;
  --primaire: #1b5fa8;
  --primaire-fonce: #154b85;
  --ok: #217a3c;
  --erreur: #b3261e;
  --attente: #946200;
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texte); background: var(--fond); }
a { color: var(--primaire); }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; }
.carte h2:first-child { margin-top: 0; }
.discret { color: var(--discret); font-weight: normal; }

.barre { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; padding: .7rem 1.5rem; background: #17212b; color: #fff; }
.barre a { color: #dfe7ef; text-decoration: none; }
.marque { display: inline-flex; color: #fff !important; }
.marque .logo-gtmls { height: 30px; width: auto; }
.barre nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.barre nav a { padding: .35rem .7rem; border-radius: 6px; }
.barre nav a:hover, .barre nav a.actif { background: #2b3a4a; color: #fff; }
.compte { margin-left: auto; display: flex; align-items: center; gap: 1rem; font-size: .9rem; color: #b9c6d3; }
.compte strong { color: #fff; }
.lien { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
.barre .lien { color: #dfe7ef; }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.entete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions.bas { margin-top: 1.2rem; }
.actions form { margin: 0; }

.bouton { display: inline-block; padding: .55rem 1rem; border: 1px solid var(--bord); border-radius: 6px; background: #fff; color: var(--texte); font: inherit; text-decoration: none; cursor: pointer; }
.bouton:hover { border-color: #aab4be; }
.bouton.principal { background: var(--primaire); border-color: var(--primaire); color: #fff; font-weight: 600; }
.bouton.principal:hover { background: var(--primaire-fonce); }
.bouton.danger { color: var(--erreur); border-color: #e2b4b0; }
.bouton:disabled { opacity: .55; cursor: default; }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 8px; padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; }
@media (max-width: 520px) { .grille { grid-template-columns: 1fr; } main { padding: 1rem; } }

label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--discret); margin-bottom: .7rem; }
input, select, textarea { font: inherit; color: var(--texte); padding: .45rem .55rem; border: 1px solid var(--bord); border-radius: 5px; background: #fff; width: 100%; }
input:focus, select:focus { outline: 2px solid #9cc3ee; border-color: var(--primaire); }
.ligne { display: flex; flex-wrap: wrap; gap: 0 .8rem; }
.ligne .court { flex: 1 1 8rem; }
.ligne .long { flex: 3 1 12rem; }
.ligne .mini { flex: 0 0 4.5rem; }
.ligne.rapide { align-items: flex-end; }
.ligne.rapide label { flex: 1 1 9rem; }
.ligne.rapide .bouton { margin-bottom: .7rem; }
.en-erreur input { border-color: var(--erreur); }
.erreur { color: var(--erreur); font-size: .8rem; }

.tableau-defilant { overflow-x: auto; }
table.liste { width: 100%; border-collapse: collapse; background: #fff; }
.liste th, .liste td { padding: .5rem .6rem; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: middle; }
.liste th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--discret); background: #eef1f4; }
.liste tbody tr:hover { background: #f7f9fb; }
.liste .nombre { text-align: right; white-space: nowrap; }
.liste.colis input { max-width: 10rem; }
.liste.colis .rang { white-space: nowrap; font-weight: 600; }
.code { font-family: ui-monospace, Consolas, monospace; }

.pastille { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #e6ebf0; color: var(--discret); vertical-align: middle; text-decoration: none; }
.pastille.ok, .pastille.envoye { background: #dcefe2; color: var(--ok); }
.pastille.echec { background: #f7dedc; color: var(--erreur); }
.pastille.en_attente { background: #f6ecd4; color: var(--attente); }
.carte.ftp.echec { border-color: #e2b4b0; }

.message { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; background: #e3eefb; border: 1px solid #b9d3f0; }
.message.success { background: #e2f3e7; border-color: #b4dcc0; }
.message.error { background: #fbe6e4; border-color: #eab8b3; color: #7d1a13; }
.vide { padding: 2rem; text-align: center; color: var(--discret); background: #fff; border: 1px dashed var(--bord); border-radius: 8px; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dt { color: var(--discret); }
dd { margin: 0; }

.recherche { display: flex; flex-wrap: wrap; gap: 0 .8rem; align-items: flex-end; }
.recherche .long { flex: 3 1 18rem; }
.recherche .court { flex: 1 1 9rem; }
.recherche .bouton { margin-bottom: .7rem; }
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

.transporteur { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; color: var(--texte); vertical-align: middle; }
.transporteur img { height: 28px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px 4px; }
.compte .transporteur { color: #fff; }
h2 .transporteur img { height: 32px; }

.connexion { max-width: 380px; margin: 3rem auto; }
.connexion h1 { margin-bottom: .4rem; }
.connexion .bouton { width: 100%; margin-top: .5rem; }

/* Portail transporteur et suivi des colis */
.petit { font-size: .78rem; }
.indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.indicateur { display: block; margin: 0; color: var(--discret); text-decoration: none; }
a.indicateur:hover { border-color: var(--primaire); }
.indicateur .valeur { display: block; font-size: 2rem; font-weight: 700; color: var(--texte); line-height: 1.1; }
.indicateur.alerte { border-color: #e2b4b0; }
.indicateur.alerte .valeur { color: var(--erreur); }
.recherche-colis input { width: 15rem; padding: .35rem .6rem; border-color: #3b4b5b; background: #22303d; color: #fff; }
.recherche-colis input::placeholder { color: #9fb0c0; }
label.case { flex-direction: row; align-items: center; gap: .4rem; margin-bottom: 1.1rem; }
label.case input { width: auto; }
ol.historique { margin: 0; padding-left: 1.1rem; font-size: .85rem; }
ol.historique li + li { margin-top: .3rem; }
.signature { display: flex; align-items: center; gap: .6rem; margin-top: .35rem; font-size: .85rem; }
.signature img { height: 56px; max-width: 180px; object-fit: contain; background: #fff; border: 1px solid var(--bord); border-radius: 4px; }

/* Gestion transporteur : formulaires, tarifs, factures */
.aide-case { margin: -.6rem 0 .8rem 1.6rem; }
.liste-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 1rem; }
.resultat-simulation { padding: .6rem .8rem; background: #e2f3e7; border-radius: 6px; }
.lignes-facture td { vertical-align: top; }
.lignes-facture td.designation { min-width: 22rem; }
.lignes-facture input, .lignes-facture select { min-width: 6.5rem; }
.lignes-facture select[name$='categorie_tva'] { min-width: 10rem; }
.lignes-facture td.centre, td.centre { text-align: center; }
.lignes-facture input[type=checkbox] { min-width: 0; width: auto; }
.detail-transport { margin-top: .3rem; font-size: .8rem; color: var(--discret); line-height: 1.35; }
tr.ligne-alerte { background: #fff6e0; }
.totaux-facture { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: flex-start; }
.totaux-facture table { width: auto; min-width: 18rem; }
dl.totaux { grid-template-columns: max-content 8rem; background: #fff; border: 1px solid var(--bord); border-radius: 8px; padding: .8rem 1rem; }
dl.totaux dd { text-align: right; }
dl.totaux .fort { font-weight: 700; font-size: 1.1rem; color: var(--texte); }
.message ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.message.warning { background: #fdf3dc; border-color: #ecd59a; }
.carte-suivi { height: 360px; border-radius: 6px; border: 1px solid var(--bord); }

.pied-application { padding: 1.2rem 1.5rem 1.6rem; text-align: center; font-size: .8rem; color: var(--discret); }
.pied-application a { color: var(--discret); }
.saisie-statut form { max-width: 760px; }

.autre-format { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin: -.4rem 0 1.2rem; font-size: .88rem; }
.autre-format select { width: auto; }
.autre-format .case-depart { flex-direction: row; align-items: center; gap: .4rem; margin: 0; }

/* L'attribut hidden l'emporte toujours sur les règles d'affichage (display: flex…). */
[hidden] { display: none !important; }
