/* =====================================================================
   TOUTENVÉLO LE HAVRE — APP COMMUNICATION
   styles.css — thème sombre, accent vert lime TEV (cohérent avec Hub,
   Tournée, Maintenance, Documents). Pensé téléphone d'abord.
   ===================================================================== */

:root {
  --fond:        #141509;
  --surface:     #262624;
  --surface-2:   #30302d;
  --ligne:       #3d3d38;
  --lime:        #a8c63c;
  --lime-sombre: #8aa62f;
  --texte:       #f2f1ec;
  --texte-doux:  #a3a29a;
  --vert:        #6fa84a;
  --orange:      #e0913a;
  --rouge:       #c05a5a;
  --ocean:       #3f9fbf;
  --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: 60px; }
a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-variant-numeric: tabular-nums; }
.doux { color: var(--texte-doux); }
.petit { font-size: 13px; }
.gros { font-size: 18px; font-weight: 700; }
.droite { text-align: right; }
.cache { display: none !important; }

/* ---------------------------------------------------------------------
   BARRE DU HAUT
   --------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--fond);
  border-bottom: 1px solid var(--ligne);
}
.topbar .dedans {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
}
.topbar .titre { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 0; white-space: nowrap; }
.topbar .version { font-size: 11px; color: var(--texte-doux); font-weight: 400; margin-left: 6px; }
.topbar nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.topbar nav a {
  color: var(--texte-doux); padding: 6px 10px; border-radius: var(--rayon-s);
  font-size: 14px; white-space: nowrap;
}
.topbar nav a.actif, .topbar nav a:hover { color: var(--texte); background: var(--surface); text-decoration: none; }

/* ---------------------------------------------------------------------
   PAGE
   --------------------------------------------------------------------- */
.page { max-width: 1080px; margin: 0 auto; padding: 14px 16px; }
h2 { font-size: 16px; margin: 22px 0 10px; color: var(--texte-doux); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
h2:first-child { margin-top: 6px; }

/* ---------------------------------------------------------------------
   BOUTONS
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--texte);
  border: 1px solid var(--ligne); border-radius: var(--rayon-s);
  padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; line-height: 1.2;
}
.btn:hover { border-color: var(--texte-doux); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primaire { background: var(--lime); color: #141509; border-color: var(--lime); }
.btn.primaire:hover { background: var(--lime-sombre); }
.btn.danger { color: var(--rouge); }
.btn.petit { padding: 6px 10px; font-size: 13px; }
.btn.lien { background: none; border: none; color: var(--lime); padding: 4px 6px; }

/* ---------------------------------------------------------------------
   BANDEAUX / MESSAGES
   --------------------------------------------------------------------- */
.bandeau {
  background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon);
  padding: 12px 14px; margin-bottom: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.bandeau .texte { flex: 1; min-width: 200px; font-size: 14px; }
.bandeau.attention { border-color: var(--orange); }
.bandeau.erreur { border-color: var(--rouge); }
.bandeau details { width: 100%; font-size: 13px; color: var(--texte-doux); }
.bandeau details summary { cursor: pointer; color: var(--texte); }
.bandeau ul { margin: 6px 0 0; padding-left: 18px; }
.bandeau li { margin: 2px 0; }

/* ---------------------------------------------------------------------
   FILTRES
   --------------------------------------------------------------------- */
.filtres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chip {
  background: var(--surface); border: 1px solid var(--ligne); color: var(--texte-doux);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.chip.actif { background: var(--lime); color: #141509; border-color: var(--lime); font-weight: 600; }
.recherche { position: relative; flex: 1; min-width: 180px; }
.recherche input {
  width: 100%; background: var(--surface); border: 1px solid var(--ligne); color: var(--texte);
  border-radius: 999px; padding: 8px 14px 8px 34px; font-size: 14px; font-family: inherit;
}
.recherche .loupe { position: absolute; left: 12px; top: 7px; color: var(--texte-doux); }

/* ---------------------------------------------------------------------
   LISTES ET CARTES
   --------------------------------------------------------------------- */
.jour { margin: 18px 0 8px; display: flex; align-items: baseline; gap: 10px; }
.jour .date { font-weight: 700; font-size: 15px; text-transform: capitalize; }
.jour .nb { color: var(--texte-doux); font-size: 13px; }
.jour.aujourdhui .date { color: var(--lime); }

.carte {
  background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon);
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
}
.carte:hover { border-color: var(--texte-doux); }
.carte .ligne1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.carte .nom { font-weight: 700; font-size: 16px; }
.carte .ligne2 { color: var(--texte-doux); font-size: 13px; grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.carte .statut { grid-column: 2; grid-row: 1; align-self: start; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 6px; text-transform: uppercase;
  background: var(--surface-2); color: var(--texte-doux);
}
.badge.ok { background: #2b4020; color: #b5e08a; }
.badge.attention { background: #4a3316; color: #f0b86a; }
.badge.erreur { background: #402424; color: #e09a9a; }

.vide { text-align: center; color: var(--texte-doux); padding: 40px 10px; }
.squelette { height: 64px; background: var(--surface); border-radius: var(--rayon); margin-bottom: 8px; opacity: .6; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------------------------------------------------------------------
   MODALE
   --------------------------------------------------------------------- */
.voile {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 50;
  display: none; align-items: flex-end; justify-content: center;
}
.voile.ouvert { display: flex; }
.modale {
  background: var(--fond); border: 1px solid var(--ligne); border-radius: var(--rayon) var(--rayon) 0 0;
  width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto; padding: 16px;
  box-shadow: var(--ombre);
}
@media (min-width: 700px) {
  .voile { align-items: center; }
  .modale { border-radius: var(--rayon); }
}
.modale .entete { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.modale .entete h3 { margin: 0; font-size: 18px; flex: 1; }
.modale .fermer { background: none; border: none; color: var(--texte-doux); font-size: 22px; cursor: pointer; padding: 0 6px; }

.fiche { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-bottom: 14px; }
.fiche .champ { background: var(--surface); border-radius: var(--rayon-s); padding: 8px 10px; }
.fiche .champ .etiquette { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); }
.fiche .champ .valeur { font-size: 15px; }
.fiche .champ.large { grid-column: 1 / -1; }

/* ---------------------------------------------------------------------
   TABLEAUX
   --------------------------------------------------------------------- */
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th, .tableau td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--ligne); vertical-align: middle; }
.tableau th { color: var(--texte-doux); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tableau td.num, .tableau th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tableau tr.sous-total td { background: var(--surface); font-weight: 700; }
.tableau tr.total td { font-weight: 700; border-top: 2px solid var(--ligne); }
.tableau tr.attention td { color: var(--orange); }
.defilable { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------------------------------------------------------------------
   FORMULAIRES
   --------------------------------------------------------------------- */
.formulaire { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.formulaire label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .04em; }
.formulaire label.large { grid-column: 1 / -1; }
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--ligne); color: var(--texte);
  border-radius: var(--rayon-s); padding: 9px 10px; font-size: 15px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lime); }
textarea { min-height: 70px; resize: vertical; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.tableau input, .tableau select { padding: 5px 7px; font-size: 14px; }
.tableau input.court { width: 80px; }

/* ---------------------------------------------------------------------
   ONGLETS
   --------------------------------------------------------------------- */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--ligne); margin-bottom: 14px; overflow-x: auto; }
.onglets button {
  background: none; border: none; color: var(--texte-doux); padding: 10px 14px; cursor: pointer;
  font-size: 14px; font-family: inherit; border-bottom: 2px solid transparent; white-space: nowrap;
}
.onglets button.actif { color: var(--texte); border-bottom-color: var(--lime); font-weight: 600; }

/* ---------------------------------------------------------------------
   TOAST
   --------------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); color: var(--texte); border: 1px solid var(--ligne);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 60; max-width: 90vw; text-align: center;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: var(--vert); }
.toast.erreur { border-color: var(--rouge); }

@media (max-width: 600px) {
  .fiche, .formulaire { grid-template-columns: 1fr; }
  .carte { grid-template-columns: 1fr; }
  .carte .statut { grid-column: 1; grid-row: auto; }
}

/* ---------------------------------------------------------------------
   PLAN DE COMMUNICATION
   --------------------------------------------------------------------- */
.barre-plan { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.barre-plan select { width: auto; padding: 7px 10px; font-size: 14px; }
.barre-plan .espace { flex: 1; }
.bascule { display: inline-flex; border: 1px solid var(--ligne); border-radius: 999px; overflow: hidden; }
.bascule button { background: none; border: none; color: var(--texte-doux); padding: 7px 14px; font-size: 13px; cursor: pointer; font-family: inherit; }
.bascule button.actif { background: var(--surface-2); color: var(--texte); font-weight: 600; }

.resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 16px; }
.resume .tuile { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 10px 12px; }
.resume .tuile .chiffre { font-size: 24px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.resume .tuile .etiquette { font-size: 12px; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.resume .tuile.retard .chiffre { color: var(--rouge); }
.resume .tuile.ok .chiffre { color: var(--lime); }

.progression { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.progression > span { display: block; height: 100%; background: var(--lime); border-radius: 999px; transition: width .3s; }
.progression.grande { height: 12px; }

.phases { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 8px; }
.phase { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 12px 14px; display: flex; flex-direction: column; }
.phase.en-cours { border-color: var(--lime); }
.phase .entete { display: flex; align-items: baseline; gap: 8px; }
.phase .entete .nom { font-weight: 700; font-size: 15px; flex: 1; }
.phase .dates { font-size: 12px; color: var(--texte-doux); }
.phase .objectif { margin: 6px 0 2px; font-size: 14px; }
.phase .objectif.vide { color: var(--texte-doux); font-style: italic; }
.phase .compteurs { font-size: 12px; color: var(--texte-doux); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.phase .compteurs .retard { color: var(--rouge); font-weight: 600; }
.phase ul.actions-phase { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--ligne); }
.phase ul.actions-phase li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--ligne); cursor: pointer; font-size: 14px; }
.phase ul.actions-phase li:hover .intitule { color: var(--lime); }
.phase ul.actions-phase li .intitule { flex: 1; min-width: 0; }
.phase ul.actions-phase li.termine .intitule { color: var(--texte-doux); text-decoration: line-through; }
.phase ul.actions-phase li .echeance { font-size: 12px; color: var(--texte-doux); white-space: nowrap; }
.phase ul.actions-phase li .echeance.retard { color: var(--rouge); font-weight: 600; }
.phase ul.actions-phase li .echeance.bientot { color: var(--orange); font-weight: 600; }
.phase .pied { margin-top: auto; padding-top: 8px; display: flex; gap: 6px; }

.pastille { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--texte-doux); flex: none; }
.pastille.a_faire { background: var(--texte-doux); }
.pastille.en_cours { background: var(--ocean); }
.pastille.en_suspens { background: var(--orange); }
.pastille.termine { background: var(--vert); }
.badge.a_faire { background: var(--surface-2); color: var(--texte-doux); }
.badge.en_cours { background: #1f3a46; color: #8fd0ea; }
.badge.en_suspens { background: #4a3316; color: #f0b86a; }
.badge.termine { background: #2b4020; color: #b5e08a; }
.badge.elevee { background: #402424; color: #e09a9a; }
.badge.faible { background: var(--surface-2); color: var(--texte-doux); }
.badge.jalon { background: #33321f; color: #d9d27a; }
.badge.linkedin { background: #1f3a46; color: #8fd0ea; }
.badge.instagram { background: #3d2f45; color: #d3a8ee; }

.objectifs { list-style: none; margin: 0; padding: 0; }
.objectifs li { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon-s); padding: 10px 12px; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; cursor: pointer; flex-wrap: wrap; }
.objectifs li:hover { border-color: var(--texte-doux); }
.objectifs li .texte { flex: 1; min-width: 160px; }
.objectifs li .texte .sous { font-size: 12px; color: var(--texte-doux); }

.tableau tr.cliquable { cursor: pointer; }
.tableau tr.cliquable:hover td { background: var(--surface); }
.tableau tr.retard td.echeance { color: var(--rouge); font-weight: 600; }
.tableau tr.bientot td.echeance { color: var(--orange); font-weight: 600; }
.tableau tr.termine td { color: var(--texte-doux); }
.entete-section { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 10px; }
.entete-section h2 { margin: 0; flex: 1; }
.formulaire label.ligne { flex-direction: row; align-items: center; gap: 8px; text-transform: none; font-size: 14px; color: var(--texte); }
.formulaire label.ligne input[type=checkbox] { width: auto; }
.modale .actions .gauche { margin-right: auto; }
