/* =====================================================================
   TOUTENVÉLO LE HAVRE — APP DOCUMENTS
   styles.css — thème sombre, accent vert lime TEV
   Cohérent avec Hub, Tournées et Maintenance.
   ===================================================================== */

:root {
  --fond:        #141509;   /* fond général, très sombre */
  --surface:     #262624;   /* cartes et panneaux */
  --surface-2:   #30302d;   /* survol, champs de saisie */
  --ligne:       #3d3d38;   /* bordures */
  --lime:        #a8c63c;   /* accent TEV */
  --lime-sombre: #8aa62f;
  --texte:       #f2f1ec;   /* texte principal */
  --texte-doux:  #a3a29a;   /* texte secondaire */
  --vert:        #6fa84a;   /* état OK */
  --orange:      #e0913a;   /* attention */
  --rouge:       #c05a5a;   /* bloquant */
  --rayon:       12px;
  --rayon-s:     8px;
  --ombre:       0 2px 12px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 40px; }

a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-variant-numeric: tabular-nums; }


/* ---------------------------------------------------------------------
   BARRE DU HAUT
   --------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--fond);
  border-bottom: 1px solid var(--ligne);
}

.topbar .dedans {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar .titre {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .titre .version {
  font-size: 11px;
  font-weight: 500;
  color: var(--texte-doux);
  margin-left: 6px;
}

.topbar nav { display: flex; align-items: center; gap: 8px; flex: none; }

.lien-hub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--texte-doux);
  font-size: 13px;
  cursor: pointer;
}
.lien-hub:hover { background: var(--surface-2); color: var(--texte); text-decoration: none; }

.compte {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--texte-doux);
}
.compte .rond {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--fond);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
  overflow: hidden;
}
.compte .rond img { width: 100%; height: 100%; object-fit: cover; }


/* ---------------------------------------------------------------------
   MISE EN PAGE
   --------------------------------------------------------------------- */
.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}

.bandeau-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.recherche {
  flex: 1;
  min-width: 180px;
  position: relative;
}
.recherche input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--texte);
  font-size: 15px;
}
.recherche input:focus {
  outline: none;
  border-color: var(--lime);
}
.recherche .loupe {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--texte-doux);
  font-size: 15px;
  pointer-events: none;
}


/* ---------------------------------------------------------------------
   FILTRES PAR CATÉGORIE
   --------------------------------------------------------------------- */
.filtres {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filtres button {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--ligne);
  border-radius: 999px;
  background: var(--surface);
  color: var(--texte-doux);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.filtres button:hover { background: var(--surface-2); color: var(--texte); }
.filtres button.actif {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--fond);
}
.filtres button .n {
  margin-left: 6px;
  opacity: .65;
  font-weight: 500;
}


/* ---------------------------------------------------------------------
   CARTE DE DOCUMENT
   --------------------------------------------------------------------- */
.liste-docs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.doc:hover { border-color: #4d4d46; background: var(--surface-2); }
.doc:active { transform: scale(.995); }

.doc.epingle { border-left: 3px solid var(--lime); }
.doc.archive { opacity: .5; }

/* Pastille de type de fichier */
.doc .type {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: var(--rayon-s);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  background: var(--surface-2);
  color: var(--texte-doux);
  border: 1px solid var(--ligne);
}
.doc .type.pdf          { background: #4a2a2a; color: #e8a0a0; border-color: #5e3535; }
.doc .type.image        { background: #2a3f4a; color: #9ec8dd; border-color: #35505e; }
.doc .type.texte        { background: #2a344a; color: #a0b4e8; border-color: #35435e; }
.doc .type.tableur      { background: #2a4a35; color: #a0dcb4; border-color: #355e44; }
.doc .type.presentation { background: #4a3a2a; color: #e8c49e; border-color: #5e4a35; }
.doc .type.video        { background: #3f2a4a; color: #c9a0e8; border-color: #50355e; }
.doc .type.lien         { background: #3a3a1e; color: var(--lime); border-color: #4d4d28; }

.doc .corps { flex: 1; min-width: 0; }

.doc .titre-doc {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.doc .desc {
  font-size: 13.5px;
  color: var(--texte-doux);
  margin: 0 0 7px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc .meta {
  font-size: 12px;
  color: var(--texte-doux);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.doc .meta .sep { opacity: .4; }


/* ---------------------------------------------------------------------
   PASTILLES
   --------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}

.chip-nouveau {
  background: var(--lime);
  color: var(--fond);
}

.chip-restreint {
  background: transparent;
  border: 1px solid var(--orange);
  color: var(--orange);
}

.chip-archive {
  background: transparent;
  border: 1px solid var(--ligne);
  color: var(--texte-doux);
}

.chip-lecture {
  background: var(--surface-2);
  border: 1px solid var(--ligne);
  color: var(--texte-doux);
}
.chip-lecture.complet { border-color: var(--vert); color: var(--vert); }
.chip-lecture.partiel { border-color: var(--orange); color: var(--orange); }


/* ---------------------------------------------------------------------
   BOUTONS
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--texte);
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: default; }

.btn.primaire {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--fond);
}
.btn.primaire:hover:not(:disabled) {
  background: var(--lime-sombre);
  border-color: var(--lime-sombre);
}

.btn.danger { color: var(--rouge); border-color: #5e3535; }
.btn.danger:hover:not(:disabled) { background: #3a2424; }

.btn.pleine-largeur { width: 100%; }

.btn-icone {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--texte-doux);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.btn-icone:hover { background: var(--surface-2); color: var(--texte); }


/* ---------------------------------------------------------------------
   FORMULAIRES
   --------------------------------------------------------------------- */
.champ { margin-bottom: 14px; }

.champ label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--texte-doux);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.champ input[type="text"],
.champ input[type="url"],
.champ select,
.champ textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-s);
  background: var(--surface-2);
  color: var(--texte);
  font-size: 15px;
  font-family: inherit;
}
.champ textarea { min-height: 80px; resize: vertical; }

.champ input:focus,
.champ select:focus,
.champ textarea:focus {
  outline: none;
  border-color: var(--lime);
}

.champ .aide {
  font-size: 12px;
  color: var(--texte-doux);
  margin-top: 5px;
}

/* Bascule fichier / lien */
.bascule {
  display: flex;
  gap: 0;
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-s);
  overflow: hidden;
  margin-bottom: 14px;
}
.bascule button {
  flex: 1;
  height: 40px;
  border: none;
  background: var(--surface);
  color: var(--texte-doux);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.bascule button.actif { background: var(--lime); color: var(--fond); }

/* Zone de dépôt de fichier */
.depot {
  border: 2px dashed var(--ligne);
  border-radius: var(--rayon);
  padding: 26px 16px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.depot:hover, .depot.survol { border-color: var(--lime); background: #2e3020; }
.depot .gros { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.depot .petit { font-size: 12.5px; color: var(--texte-doux); }

.depot.rempli {
  border-style: solid;
  border-color: var(--lime);
  text-align: left;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Barre de progression du téléversement */
.progression {
  height: 4px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.progression .barre {
  height: 100%;
  background: var(--lime);
  width: 0;
  transition: width .2s;
}


/* ---------------------------------------------------------------------
   MODALES
   --------------------------------------------------------------------- */
.voile {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 60;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.voile.ouvert { display: flex; }

.modale {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon) var(--rayon) 0 0;
  padding: 18px;
  box-shadow: var(--ombre);
}

.modale .entete {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.modale .entete h2 {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.modale .entete .fermer {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--texte-doux);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.modale .pied {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--ligne);
}
.modale .pied .btn { flex: 1; }

@media (min-width: 640px) {
  .voile { align-items: center; }
  .modale { border-radius: var(--rayon); }
}


/* ---------------------------------------------------------------------
   LISTE DES LECTEURS (vue admin)
   --------------------------------------------------------------------- */
.lecteurs { display: flex; flex-direction: column; gap: 2px; }

.lecteur {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--ligne);
  font-size: 14px;
}
.lecteur:last-child { border-bottom: none; }
.lecteur .nom { flex: 1; min-width: 0; }
.lecteur .quand { font-size: 12px; color: var(--texte-doux); flex: none; }
.lecteur .puce {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--ligne);
}
.lecteur.lu .puce { background: var(--vert); }
.lecteur.pas-lu { color: var(--texte-doux); }


/* ---------------------------------------------------------------------
   ÉTATS VIDES ET CHARGEMENT
   --------------------------------------------------------------------- */
.vide {
  text-align: center;
  padding: 48px 20px;
  color: var(--texte-doux);
}
.vide .gros { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--texte); }
.vide .petit { font-size: 13.5px; }

.chargement {
  text-align: center;
  padding: 40px;
  color: var(--texte-doux);
  font-size: 14px;
}

.squelette {
  height: 74px;
  border-radius: var(--rayon);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: glisse 1.3s infinite;
  margin-bottom: 10px;
}
@keyframes glisse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ---------------------------------------------------------------------
   BANDEAU DE MESSAGE
   --------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(120%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-s);
  color: var(--texte);
  font-size: 14px;
  box-shadow: var(--ombre);
  z-index: 90;
  opacity: 0;
  transition: transform .22s, opacity .22s;
  pointer-events: none;
}
.toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.erreur  { border-color: var(--rouge); }
.toast.succes  { border-color: var(--vert); }


/* ---------------------------------------------------------------------
   BOUTON FLOTTANT DE DÉPÔT
   --------------------------------------------------------------------- */
.flottant {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--lime);
  color: var(--fond);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--ombre);
  z-index: 50;
}
.flottant:active { background: var(--lime-sombre); }


/* ---------------------------------------------------------------------
   PETITS ÉCRANS
   --------------------------------------------------------------------- */
@media (max-width: 520px) {
  .topbar .dedans { padding: 10px 12px; gap: 8px; }
  .topbar .titre { font-size: 15.5px; }
  .compte .texte { display: none; }
  .page { padding: 12px; }
  .doc { padding: 12px; gap: 11px; }
  .doc .type { width: 38px; height: 38px; }
}
