:root, [data-theme="clair"] {
  --fond: #fafafa; --carte: #ffffff; --texte: #1a1d21; --texte2: #5c636b;
  --bord: #e3e6ea; --accent: #1e6fd9; --survol: #f0f3f7;
}
[data-theme="sombre"] {
  --fond: #15181c; --carte: #1e2228; --texte: #e8eaed; --texte2: #9aa2ad;
  --bord: #2d333b; --accent: #4d94ff; --survol: #262c34;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--fond); color: var(--texte); font-size: 15px; }
main { max-width: 1280px; margin: 0 auto; padding: 18px; }

.topbar { display: flex; align-items: center; gap: 22px; padding: 10px 22px; background: var(--carte); border-bottom: 1px solid var(--bord); position: sticky; top: 0; z-index: 5; }
.marque { font-weight: 700; font-size: 17px; }
.topbar { display: block; }
.ligne-haut { display: flex; align-items: center; gap: 10px; }
.ligne-haut .recherche-globale { flex: 1; display: flex; justify-content: center; }
.ligne-haut .recherche-globale input[type=search] { max-width: 420px; width: 100%; }
.topbar nav { display: flex; gap: 0; flex-wrap: nowrap; align-items: center;
  width: 100%; margin-top: 8px; overflow-x: auto; white-space: nowrap;
  font-size: 13.5px; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
#menu > a:not(:first-of-type)::before { content: "|"; color: var(--muted);
  margin: 0 9px; font-weight: 400; opacity: .55; pointer-events: none; }
/* TEAMSPACE-HEADER */
.logo-app { width: 38px; height: 38px; flex-shrink: 0; }
.topbar { display: block; }
.ligne-haut { display: flex; align-items: center; gap: 12px; }
.marque { display: flex; flex-direction: column; line-height: 1.05; white-space: nowrap; }
.marque .nom-app { font-weight: 800; font-size: 20px; letter-spacing: 1px; color: var(--accent); }
.marque .slogan { font-size: 11px; color: var(--muted); font-weight: 500; }
.ligne-haut .recherche-globale { flex: 1; display: flex; justify-content: center; margin: 0; }
.ligne-haut .recherche-globale input[type=search] { max-width: 420px; width: 100%; }
.topbar nav { display: flex; gap: 0; flex-wrap: nowrap; align-items: center;
  width: 100%; margin-top: 8px; overflow-x: auto; white-space: nowrap;
  font-size: 14px; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav > a { padding: 6px 2px; }
#menu > a:not(:first-of-type)::before { content: "|"; color: var(--muted);
  margin: 0 10px; font-weight: 400; opacity: .5; pointer-events: none; }
@media (min-width: 769px) and (max-width: 1240px) {
  .topbar nav { font-size: 12.5px; }
  #menu > a:not(:first-of-type)::before { margin: 0 6px; }
  .marque .nom-app { font-size: 18px; }
}
/* FIN-TEAMSPACE-HEADER */

@media (min-width: 769px) and (max-width: 1180px) {
  .topbar nav { font-size: 12px; }
  #menu > a:not(:first-of-type)::before { margin: 0 6px; }
}
.topbar a { color: var(--texte2); text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 500; }
.topbar a:hover { background: var(--survol); color: var(--texte); }
#theme { border: 1px solid var(--bord); background: var(--carte); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 15px; }
#burger { display: none; border: 1px solid var(--bord); background: var(--carte); color: var(--texte);
          border-radius: 8px; padding: 6px 12px; font-size: 19px; cursor: pointer; }
#voile { display: none; }

.flash { max-width: 1280px; margin: 12px auto 0; padding: 11px 16px; border-radius: 9px; font-weight: 500; }
.flash.ok { background: #e4f5e9; color: #19733a; }
.flash.erreur { background: #fdeaea; color: #b32424; }
[data-theme="sombre"] .flash.ok { background: #1b3325; color: #7fd49a; }
[data-theme="sombre"] .flash.erreur { background: #3a2022; color: #f29d9d; }

.onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.onglets a { text-decoration: none; color: var(--texte2); background: var(--carte); border: 1px solid var(--bord); border-radius: 20px; padding: 7px 14px; font-weight: 500; font-size: 14px; }
.onglets a.actif { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.onglets .n { opacity: .65; font-size: 12.5px; }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; overflow: hidden; }
th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--texte2); padding: 10px 12px; border-bottom: 1px solid var(--bord); }
td { padding: 10px 12px; border-bottom: 1px solid var(--bord); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--survol); }
tr.sel { outline: 2px solid var(--accent); outline-offset: -2px; }

.badge { display: inline-block; padding: 3px 11px; border-radius: 14px; font-size: 12.5px; font-weight: 700; color: #fff; white-space: nowrap; }
.b-en_cours { background: #1e6fd9; }
.b-payee { background: #1f9d4d; }
.b-retournee { background: #d63031; }
.b-alerte { background: #5f6770; }
.b-reclamee { background: #e0a800; color: #2b2300; }
.b-annulee { background: #2b2f35; }
.b-rembours { background: #1f9d4d; }
.b-ecart { background: #e67e22; }
.b-ech-attendu { background: #e67e22; }

.barre-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
button, .btn { border: 1px solid var(--bord); background: var(--carte); color: var(--texte); padding: 8px 16px; border-radius: 9px; font-weight: 600; cursor: pointer; font-size: 14px; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--survol); }
.btn-bleu { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-rouge { background: #d63031; border-color: #d63031; color: #fff; }
.btn-vert { background: #1f9d4d; border-color: #1f9d4d; color: #fff; }
.btn-jaune { background: #e0a800; border-color: #e0a800; color: #2b2300; }

input[type=text], input[type=number], input[type=date], textarea, select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--bord); border-radius: 9px;
  background: var(--fond); color: var(--texte); font-size: 14.5px; font-family: inherit;
}
label { display: block; font-weight: 600; font-size: 13.5px; margin: 12px 0 5px; color: var(--texte2); }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.muted { color: var(--texte2); font-size: 13.5px; }
h1 { font-size: 21px; margin: 4px 0 16px; }
h2 { font-size: 17px; }
.zone-depot { border: 2px dashed var(--bord); border-radius: 12px; padding: 36px; text-align: center; }
.verif { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.verif div { padding: 13px; border-radius: 10px; border: 1px solid var(--bord); }
.ok-v { border-color: #1f9d4d !important; }
.ko-v { border-color: #d63031 !important; }
/* ---------- Version mobile ---------- */
@media (max-width: 820px) {
  .grille2 { grid-template-columns: 1fr; }
  .verif { grid-template-columns: 1fr 1fr !important; }
  main { padding: 10px; }
  /* Menu hamburger : panneau latéral */
  .topbar { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  #burger { display: block; }
  .marque { font-size: 15px; flex: 1; }
  #menu { position: fixed; top: 0; left: -290px; width: 270px; height: 100vh;
          background: var(--carte); border-right: 1px solid var(--bord);
          display: flex; flex-direction: column; gap: 2px; padding: 18px 12px;
          transition: left .25s ease; z-index: 60; overflow-y: auto; }
  #menu a { white-space: nowrap; padding: 13px 14px; font-size: 16px; border-radius: 10px; }
  #menu > a:not(:first-of-type)::before { content: none; }
  .topbar nav { margin-top: 0; flex-wrap: nowrap; font-size: 16px; }
  .ligne-haut { width: 100%; }
  body.menu-ouvert #menu { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  body.menu-ouvert #voile { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; }
  /* Tableaux : défilement horizontal sans casser la page */
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  td, th { padding: 9px 8px; font-size: 13.5px; }
  /* Boutons et champs plus grands pour le tactile */
  button, .btn { padding: 11px 16px; min-height: 44px; }
  input[type=text], input[type=number], input[type=date], select { min-height: 44px; font-size: 16px; }
  .barre-actions { gap: 8px; }
  .barre-actions form { flex: 1 1 auto; }
  .onglets { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
  .onglets::-webkit-scrollbar { display: none; }
  .onglets a { white-space: nowrap; padding: 9px 14px; }
  h1 { font-size: 18px; }
  .flash { margin: 10px; }
}
@media (max-width: 480px) {
  .verif { grid-template-columns: 1fr !important; }
}

.pastille { background:#d63031; color:#fff; border-radius:10px; padding:1px 7px; font-size:11.5px; font-weight:800; vertical-align:2px; }
.recherche-globale input { min-height:34px; width:170px; padding:6px 10px; }
@media (max-width:820px){ .recherche-globale { order:4; width:100%; } .recherche-globale input { width:100%; } }
@media print {
  .topbar, .barre-actions, .onglets, form, button, .btn, .flash { display:none !important; }
  body { background:#fff; color:#000; }
  .carte, table { border:1px solid #999; page-break-inside:avoid; }
}
