/* Labo Moulin - styles communs */
body { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid #C08A2E; outline-offset: 2px; }

.nav-link { display: flex; align-items: center; gap: .75rem; padding: .55rem 1.25rem; color: #d6d3d1; border-left: 3px solid transparent; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-active { background: rgba(192,138,46,.16); color: #fff !important; border-left-color: #C08A2E; }
.nav-group { cursor: pointer; padding: .5rem 1.25rem; color: #a8a29e; font-size: .85rem; font-weight: 600; list-style: none; }
.nav-group::-webkit-details-marker { display: none; }
.nav-group::after { content: '+'; float: right; }
details[open] > .nav-group::after { content: '–'; }
.nav-sub { display: block; padding: .35rem 1.25rem .35rem 2.25rem; color: #d6d3d1; font-size: .92rem; border-left: 3px solid transparent; }
.nav-sub:hover { color: #fff; background: rgba(255,255,255,.05); }

.card { background: #fff; border: 1px solid #D6DCD3; border-radius: 10px; }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .95rem; border-radius: 7px; font-weight: 600; font-size: .95rem; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.btn-primary { background: #2F6B4F; color: #fff; }
.btn-primary:hover { background: #255840; }
.btn-ble { background: #C08A2E; color: #fff; }
.btn-ble:hover { background: #a87822; }
.btn-light { background: #fff; color: #1B2A22; border-color: #D6DCD3; }
.btn-light:hover { background: #EEF1EC; }
.btn-danger { background: #fff; color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: .3rem .65rem; font-size: .85rem; }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }

.lbl { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.inp { width: 100%; border: 1px solid #c9d0c5; border-radius: 7px; padding: .5rem .7rem; background: #fff; font-size: .97rem; }
.inp:focus { border-color: #2F6B4F; outline: none; box-shadow: 0 0 0 3px rgba(47,107,79,.15); }
.inp[readonly], .inp:disabled { background: #f3f4f1; color: #57534e; }
.hint { font-size: .82rem; color: #78716c; margin-top: .2rem; }

.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
.tbl th { text-align: left; font-weight: 600; color: #57534e; background: #f6f8f5; padding: .6rem .75rem; border-bottom: 1px solid #D6DCD3; white-space: nowrap; }
.tbl td { padding: .55rem .75rem; border-bottom: 1px solid #edf0eb; vertical-align: middle; }
.tbl tr:hover td { background: #fafbf9; }
.tbl .num { text-align: right; }
.tbl-wrap { overflow-x: auto; }

.flash { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info { background: #F6ECD9; border-color: #e8d2a8; color: #6b4b12; }

/* Bande de spécification : zone conforme entre min et max, repère = valeur mesurée */
.spec-band { position: relative; height: 10px; border-radius: 5px; background: #f3d6d3; min-width: 140px; }
.spec-band .ok { position: absolute; top: 0; bottom: 0; background: #bfe3cc; }
.spec-band .warn { position: absolute; top: 0; bottom: 0; background: #f4dfb3; }
.spec-band .mark { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; background: #1B2A22; border-radius: 2px; transition: left .2s; display: none; }
.res-ok td { background: #f0faf3 !important; }
.res-nc td { background: #fdf0ef !important; }
.res-alerte td { background: #fdf7ea !important; }
@media (prefers-reduced-motion: reduce) { .spec-band .mark { transition: none; } }
@media print { aside, header, .no-print { display: none !important; } }

/* ---------- Popups ---------- */
.popup-fond { position: fixed; inset: 0; z-index: 100; background: rgba(27, 42, 34, .45); display: flex; align-items: center; justify-content: center; padding: 1rem; animation: popup-fond .15s ease-out; }
.popup { background: #fff; border-radius: 12px; width: 100%; max-width: 30rem; overflow: hidden; box-shadow: 0 18px 50px rgba(27, 42, 34, .3); animation: popup-entree .18s ease-out; }
.popup-barre { height: 5px; }
.popup-corps { padding: 1.25rem 1.4rem 1.2rem; }
.popup-titre { font-family: 'Barlow Semi Condensed', Barlow, sans-serif; font-size: 1.3rem; font-weight: 600; margin-bottom: .5rem; }
.popup-message { color: #44403c; line-height: 1.5; max-height: 55vh; overflow-y: auto; }
.popup-message ul { margin: .5rem 0 0; padding-left: 1.2rem; list-style: disc; }
.popup-boutons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
.manquant td { background: #fdf7ea !important; }
.manquant .saisie { border-color: #C08A2E; box-shadow: 0 0 0 3px rgba(192, 138, 46, .2); }
@keyframes popup-fond { from { opacity: 0; } }
@keyframes popup-entree { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .popup-fond, .popup { animation: none; } }

/* ---------- Fiches reprises des formulaires papier ---------- */
.fiche-section { color: #fff; font-family: "Barlow Semi Condensed", Barlow, sans-serif; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; font-size: 15px; padding: 6px 12px; border-radius: 4px; margin: 22px 0 12px; }
.fiche-cases { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.fiche-case { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; cursor: pointer; }
.fiche-case input[type=radio], .fiche-case input[type=checkbox] { width: 17px; height: 17px; accent-color: #2F6B4F; }
.fiche-autre { border: 0; border-bottom: 1px dotted #a8a29e; background: transparent; padding: 0 2px; width: 9rem; font-size: 14px; }
.fiche-autre:focus { outline: none; border-bottom-color: #2F6B4F; }
.fiche-grille td, .fiche-grille th { padding-top: 6px; padding-bottom: 6px; }
.fiche-entreprise { border: 2px dashed #8B5A2B; border-radius: 8px; padding: 16px; margin-top: 22px; }
@media print { .fiche-section { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- Listes déroulantes en popup avec recherche ---------- */
.cb-natif { position: absolute !important; opacity: 0 !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; pointer-events: none; }
.cb-bouton { display: flex !important; align-items: center; gap: .5rem; text-align: left; cursor: pointer; min-height: 2.45rem; }
.cb-bouton .cb-texte { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-bouton .cb-fleche { width: 1.1rem; height: 1.1rem; flex: none; color: #78716c; }
.cb-bouton.cb-vide .cb-texte { color: #a8a29e; }
.cb-bouton:focus { border-color: #2F6B4F; outline: none; box-shadow: 0 0 0 3px rgba(47,107,79,.15); }
.cb-bouton:disabled { background: #f3f4f1; color: #57534e; cursor: default; }
.cb-bouton.cb-invalide { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.cb-fond { position: fixed; inset: 0; z-index: 70; background: rgba(27,42,34,.45); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 1rem 1rem; }
.cb-panneau { background: #fff; width: min(560px, 100%); max-height: 80vh; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); display: flex; flex-direction: column; overflow: hidden; border-top: 5px solid #2F6B4F; }
.cb-entete { display: flex; align-items: center; padding: .8rem 1rem .4rem; }
.cb-titre { flex: 1; font-family: "Barlow Semi Condensed", Barlow, sans-serif; font-weight: 600; font-size: 1.15rem; }
.cb-x { font-size: 1.7rem; line-height: 1; color: #78716c; background: none; border: 0; cursor: pointer; padding: 0 .3rem; }
.cb-recherche { display: flex; align-items: center; gap: .5rem; margin: .2rem 1rem .6rem; border: 1px solid #c9d0c5; border-radius: 9px; padding: .45rem .7rem; }
.cb-recherche:focus-within { border-color: #2F6B4F; box-shadow: 0 0 0 3px rgba(47,107,79,.15); }
.cb-recherche svg { width: 1.15rem; height: 1.15rem; color: #78716c; flex: none; }
.cb-recherche input { border: 0; outline: none; flex: 1; font-size: 1rem; background: transparent; min-width: 0; }
.cb-recherche.cb-petite { opacity: .75; }
.cb-liste { list-style: none; margin: 0; padding: 0 .4rem .4rem; overflow-y: auto; flex: 1; }
.cb-groupe { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #78716c; font-weight: 700; padding: .7rem .7rem .25rem; position: sticky; top: 0; background: #fff; }
.cb-option { display: flex; align-items: center; gap: .6rem; padding: .62rem .7rem; border-radius: 8px; cursor: pointer; font-size: 1rem; }
.cb-option.cb-actif { background: #EEF1EC; }
.cb-option.cb-choisi { font-weight: 700; color: #2F6B4F; }
.cb-option.cb-neutre { color: #78716c; font-style: italic; }
.cb-coche { width: 1rem; color: #2F6B4F; visibility: hidden; flex: none; }
.cb-choisi .cb-coche { visibility: visible; }
.cb-case { width: 1.05rem; height: 1.05rem; border: 2px solid #a8a29e; border-radius: 4px; flex: none; position: relative; }
.cb-choisi .cb-case { border-color: #2F6B4F; background: #2F6B4F; }
.cb-choisi .cb-case::after { content: ''; position: absolute; left: 3px; top: 0; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.cb-option mark { background: #F6ECD9; color: inherit; border-radius: 3px; padding: 0 1px; }
.cb-rien { padding: 1.2rem; text-align: center; color: #78716c; }
.cb-pied { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem 1rem; border-top: 1px solid #E3E7E0; font-size: .85rem; color: #78716c; }
@media (max-width: 640px) {
  .cb-fond { padding: 0; align-items: flex-end; }
  .cb-panneau { max-height: 88vh; border-radius: 16px 16px 0 0; width: 100%; }
  .cb-option { padding: .8rem .7rem; }
}
@media print { .cb-bouton .cb-fleche { display: none; } }

.cb-avec-loupe { position: relative; }
.cb-avec-loupe > input { padding-right: 2.6rem; }
.cb-loupe { position: absolute; right: .3rem; top: .3rem; bottom: .3rem; width: 2.1rem; border: 0; border-radius: 6px; background: #EEF1EC; color: #2F6B4F; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cb-loupe svg { width: 1.1rem; height: 1.1rem; }
.cb-loupe:hover { background: #E3EEE7; }

/* ---------- Menu regroupé ---------- */
.menu-recherche { display: flex; align-items: center; gap: .45rem; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: .38rem .6rem; color: #a8a29e; }
.menu-recherche:focus-within { border-color: #C08A2E; background: rgba(255,255,255,.1); }
.menu-recherche input { background: transparent; border: 0; outline: none; color: #fff; font-size: .9rem; width: 100%; min-width: 0; }
.menu-recherche input::placeholder { color: #a8a29e; }
.menu-section { margin-bottom: .15rem; }
.menu-titre { list-style: none; display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: .7rem 1.25rem .35rem; color: #C08A2E;
  font-size: .74rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; user-select: none; }
.menu-titre::-webkit-details-marker { display: none; }
.menu-titre:hover { color: #E6C27A; }
.menu-chevron { width: .95rem; height: .95rem; transition: transform .15s; opacity: .8; }
details[open] > .menu-titre .menu-chevron { transform: rotate(90deg); }
.menu-sous-titre { padding: .55rem 1.25rem .15rem 1.25rem; font-size: .72rem; color: #78716c; text-transform: uppercase; letter-spacing: .06em; }
.menu-section[data-section="accueil"] { padding-bottom: .3rem; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: .3rem; }

/* ---------- Pesée des sacs ---------- */
.pesee-case { display: flex; flex-direction: column; gap: 2px; }
.pesee-case input { font-size: 1.05rem; }

/* ---------- Brouillon automatique ---------- */
.brouillon-bandeau { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; border-radius: 10px; padding: .6rem .9rem; margin-bottom: .9rem; font-size: 15px; }
.brouillon-bandeau span { flex: 1; min-width: 14rem; }

/* ---------- Historique des modifications ---------- */
.hist > summary { list-style: none; }
.hist > summary::-webkit-details-marker { display: none; }
.hist-titre { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; padding: 1rem 1.25rem; cursor: pointer; }
.hist-titre::after { content: '+'; margin-left: auto; font-size: 1.3rem; color: #78716c; }
.hist[open] .hist-titre::after { content: '–'; }
.hist-liste { list-style: none; margin: 0; padding: 0 1.25rem 1rem; border-top: 1px solid #E3E7E0; }
.hist-liste > li { padding: .65rem 0 .65rem 1.1rem; border-left: 2px solid #E3E7E0; position: relative; margin-left: .3rem; }
.hist-liste > li::before { content: ''; position: absolute; left: -6px; top: 1rem; width: 10px; height: 10px; border-radius: 50%; background: #C08A2E; }
.hist-entete { display: flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: baseline; }
.hist-corps { font-size: 14px; margin-top: .15rem; }
.hist-diff { list-style: none; margin: .2rem 0 0; padding: 0; }
.hist-diff li { padding: .1rem 0; }
.hist-champ { color: #57534e; font-weight: 600; }
.hist-champ::after { content: ' :'; }
.hist-avant { color: #991b1b; text-decoration: line-through; text-decoration-color: rgba(153,27,27,.4); }
.hist-apres { color: #065f46; font-weight: 600; }

/* ---------- Listes paginées ---------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; padding: .8rem .25rem; font-size: 14px; color: #57534e; }
.pg-info strong { color: #1B2A22; }
.pg-pages { display: flex; align-items: center; gap: .25rem; }
.pg-num { min-width: 2.1rem; height: 2.1rem; padding: 0 .5rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px;
  border: 1px solid #D6DCD3; background: #fff; color: #1B2A22; font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.pg-num:hover { border-color: #2F6B4F; color: #2F6B4F; }
.pg-actif { background: #2F6B4F; border-color: #2F6B4F; color: #fff; }
.pg-off { opacity: .35; }
.pg-trou { padding: 0 .2rem; color: #a8a29e; }
.pg-par { margin-left: auto; display: inline-flex; align-items: center; gap: .4rem; }
.pg-par select { border: 1px solid #D6DCD3; border-radius: 8px; padding: .3rem .4rem; background: #fff; }
.th-tri { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.th-tri:hover { color: #2F6B4F; }
.th-actif { color: #2F6B4F; }
.th-fleche { font-size: .7em; }
