:root {
  --bleu: #1f4e78; --bleu-clair: #e8f0f8; --fond: #f5f6f8; --carte: #fff; --texte: #1d2430; --gris: #5f6875; --ligne: #d9dee5;
  --rouge: #b42318; --rouge-fond: #fdecea; --orange: #a5480b; --orange-fond: #fff4e5; --vert: #05603a; --vert-fond: #e7f6ee; --info-fond: #eef4ff;
  --rayon: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--bleu); }
h1 { font-size: 1.45rem; margin: 0.4rem 0 1rem; }
h1 small { font-size: 0.9rem; color: var(--gris); font-weight: normal; }
h2 { font-size: 1.1rem; margin: 0 0 0.6rem; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }
code { font-size: 0.85em; }

.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--bleu); color: #fff; }
.marque { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.marque span { opacity: 0.75; font-weight: 400; }
.btn-nouvelle { background: #fff; color: var(--bleu); padding: 8px 14px; min-height: 0; }
.nav { display: flex; gap: 2px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--ligne); padding: 0 8px; scrollbar-width: none; }
.nav a { flex: none; padding: 11px 12px; text-decoration: none; color: var(--gris); border-bottom: 3px solid transparent; font-size: 0.95rem; }
.nav a.actif { color: var(--bleu); border-bottom-color: var(--bleu); font-weight: 600; }
.contenu { max-width: 1180px; margin: 0 auto; padding: 16px; }
.pied { text-align: center; color: var(--gris); font-size: 0.85rem; padding: 24px 16px 40px; }
.en-ligne { display: inline; }

.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 16px; margin: 0 0 16px; }
.carte.etroite { max-width: 380px; margin: 12vh auto; }
fieldset.carte { min-width: 0; }
legend { font-weight: 700; padding: 0 6px; color: var(--bleu); }
.grille2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
.grille3 { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grille2 { grid-template-columns: 1fr 1fr; } .grille3 { grid-template-columns: 1fr 1fr 1fr; } section.grille2 { gap: 16px; } }
.titre-ligne { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--bleu); border-radius: 8px;
  background: var(--bleu); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.large { min-height: 52px; font-size: 1.05rem; padding: 12px 20px; }
.btn.petit { min-height: 32px; padding: 4px 10px; font-size: 0.9rem; }
.btn-sec { background: #fff; color: var(--bleu); }
.btn-danger { background: #fff; color: var(--rouge); border-color: var(--rouge); }
.lien { background: none; border: 0; padding: 6px 0; color: var(--bleu); text-decoration: underline; font: inherit; cursor: pointer; }
.actions-rapides, .actions-fiche { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.actions-fiche form { margin: 0; }
.barre-actions { position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end; padding: 10px 16px; margin: 0 -16px; background: rgba(245, 246, 248, 0.96); border-top: 1px solid var(--ligne); }
.barre-actions .btn.large { min-height: 46px; }
.bureau { display: none; }
@media (max-width: 759px) { .barre-actions .btn { flex: 1 1 0; padding: 8px 10px; } }
@media (min-width: 760px) { .mobile { display: none; } .bureau { display: inline; } }
table.liste td:first-child a { white-space: nowrap; }
table.registre td:nth-child(3) { min-width: 230px; }
table.registre td:nth-child(13) { min-width: 120px; }

.champ { display: block; margin: 0 0 12px; }
.champ > span { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.champ small, .aide { display: block; color: var(--gris); font-size: 0.85rem; margin-top: 3px; }
.req { color: var(--rouge); margin-left: 2px; }
input[type=text], input[type=date], input[type=email], input[type=tel], input[type=password], input[type=search], input:not([type]), input[inputmode], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #b9c1cc; border-radius: 8px; background: #fff; font: inherit; color: inherit; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--bleu); outline-offset: 1px; border-color: var(--bleu); }
.case { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; }
.case input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--bleu); }
.cases { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 760px) { .cases { grid-template-columns: 1fr 1fr; } }
.bascule { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 0 0 12px; }
.bascule label { display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.bascule input { width: 20px; height: 20px; accent-color: var(--bleu); }
.ligne-qte { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 760px) { .ligne-qte { grid-template-columns: 1fr 1.6fr 1.2fr; } .ligne-fuite { display: grid; grid-template-columns: 3fr 1fr; gap: 0 12px; } }
.total { font-weight: 700; margin: 4px 0; }
.attention { color: var(--orange); font-weight: 600; }
.cache { display: none !important; }
details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.filtres { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 12px; }
.filtres .champ { margin: 0; min-width: 140px; }
.filtres input[type=search] { max-width: 420px; }
.raccourcis a { margin-right: 8px; }

.choix-eq { max-height: 260px; overflow-y: auto; border: 1px solid var(--ligne); border-radius: 8px; margin: 8px 0; background: #fff; }
.choix-eq:empty { display: none; }
.choix-eq button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--ligne); background: #fff; font: inherit; cursor: pointer; }
.choix-eq button:hover, .choix-eq button:focus { background: var(--bleu-clair); }
.choix-eq small { color: var(--gris); display: block; }
.resume-eq { background: var(--bleu-clair); border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; }
.resume-eq:empty { display: none; }
.signature { position: relative; margin: 6px 0 4px; }
.signature canvas { display: block; width: 100%; height: 170px; border: 1px dashed #8a94a3; border-radius: 8px; background: #fff; touch-action: none; }
.signature [data-effacer] { position: absolute; top: 4px; right: 10px; }
.bloc-sign { min-width: 0; }

.flash { padding: 12px 14px; border-radius: 8px; margin: 0 0 16px; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.flash.ok { background: var(--vert-fond); color: var(--vert); }
.flash.ko { background: var(--rouge-fond); color: var(--rouge); }
.flash.attention { background: var(--orange-fond); color: var(--orange); }
.flash.info { background: var(--info-fond); color: #173f7a; }
.alertes { list-style: none; margin: 0; padding: 0; }
.alertes li { border-left: 4px solid var(--gris); padding: 8px 10px; margin: 0 0 6px; background: var(--fond); border-radius: 0 6px 6px 0; }
.alertes li.rouge { border-color: var(--rouge); background: var(--rouge-fond); }
.alertes li.orange { border-color: var(--orange); background: var(--orange-fond); }
.alertes li.info { border-color: var(--bleu); background: var(--info-fond); }
.alertes a { color: inherit; text-decoration: none; }
.rien { color: var(--gris); }
.stock + .stock { border-top: 1px solid var(--ligne); margin-top: 12px; padding-top: 12px; }
.stock-tete { display: flex; justify-content: space-between; align-items: baseline; }
.gros { font-size: 1.6rem; font-weight: 700; color: var(--bleu); }
.compte { color: var(--gris); margin: 0 0 6px; }
.obs { white-space: pre-wrap; background: var(--fond); padding: 8px 10px; border-radius: 6px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge.vert { background: var(--vert-fond); color: var(--vert); }
.badge.rouge { background: var(--rouge-fond); color: var(--rouge); }
.badge.orange { background: var(--orange-fond); color: var(--orange); }
.badge.bleu { background: var(--bleu-clair); color: var(--bleu); }
.badge.gris { background: #eceef1; color: var(--gris); }

.defile { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid var(--ligne); border-radius: var(--rayon); margin: 0 0 16px; }
table.liste { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.liste th, table.liste td { padding: 8px 10px; border-bottom: 1px solid var(--ligne); text-align: left; vertical-align: top; }
table.liste thead th { background: #f0f2f5; font-size: 0.82rem; white-space: nowrap; position: sticky; top: 0; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.barre td { color: var(--gris); text-decoration: line-through; }
tr.estime td { background: var(--orange-fond); }
tr.pesee td { background: var(--info-fond); }
tr.ouverture td { background: #f0f2f5; font-weight: 600; }
table.mini { width: 100%; font-size: 0.9rem; border-collapse: collapse; margin: 6px 0; }
table.mini td { padding: 4px 4px; border-bottom: 1px solid var(--ligne); }
table.bilan th { width: 48%; font-weight: 500; }
table.bilan tr.fort th, table.bilan tr.fort td.num { font-weight: 700; }
table.bilan tr.sous th { padding-left: 26px; color: var(--gris); }
table.bilan tr.section th { background: var(--bleu); color: #fff; font-weight: 700; }
table.totaux { background: #fff; border: 1px solid var(--ligne); border-radius: var(--rayon); margin: 0 0 12px; }
table.pesee input { min-width: 90px; }
.signature-papier, .impression-entete { display: none; }
.envoi-doc { margin-top: 12px; }

@media print {
  @page { size: A4; margin: 12mm; }
  body.paysage { }
  .entete, .nav, .pied, .ecran-seul, .btn, .flash, form.filtres, details { display: none !important; }
  body { background: #fff; font-size: 10pt; }
  .contenu { max-width: none; padding: 0; }
  .carte, .defile { border: 0; padding: 0; overflow: visible; }
  .impression-entete { display: block; }
  .impression-entete h2 { text-align: center; font-size: 13pt; }
  .signature-papier { display: flex; justify-content: space-between; margin-top: 18mm; }
  table.liste { font-size: 8pt; }
  table.liste th, table.liste td { padding: 3px 4px; }
  table.liste thead th { position: static; }
  a { color: inherit; text-decoration: none; }
}
@media print { body.paysage { } }
@page paysage { size: A4 landscape; }
body.paysage .contenu { page: paysage; }
