/* =========================================================================
   B2P — styles de l'application
   Reprend à l'identique le graphisme de la version WordPress (app.b-2p.fr).
   Toutes les couleurs et tailles passent par les variables ci-dessous.
   ========================================================================= */

:root {
  --b2p-nuit: #000c22;      /* barre du haut */
  --b2p-marine: #00205b;    /* bandeaux de titre, texte principal, tuile principale */
  --b2p-vert: #006747;      /* boutons d'action, éléments sélectionnés */
  --b2p-bordeaux: #680909;  /* déconnexion, suppression */
  --b2p-orange: #e8590c;    /* phase production (calendrier) */
  --b2p-fond: #f3f4f7;
  --b2p-blanc: #ffffff;
  --b2p-bordure: #d8d8d8;
  --b2p-texte-doux: #5b6478;
  --b2p-vert-pale: #e6f2ed;     /* message de confirmation */
  --b2p-bordeaux-pale: #fbeaea; /* message d'erreur */

  --b2p-rayon-cadre: 22px;
  --b2p-rayon-tuile: 14px;
  --b2p-largeur: 1136px;

  --b2p-titre: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --b2p-texte: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--b2p-fond);
  color: var(--b2p-marine);
  font-family: var(--b2p-texte);
  font-size: 16px;
  line-height: 1.45;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

h1, h2, h3 { font-family: var(--b2p-titre); font-weight: 700; margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--b2p-vert); outline-offset: 2px; }

/* ---------- Barre du haut ---------- */

.entete {
  max-width: var(--b2p-largeur);
  margin: 0 auto;
  background: var(--b2p-nuit);
  border-radius: 0 0 var(--b2p-rayon-cadre) var(--b2p-rayon-cadre);
  height: 86px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.entete__logo { height: 58px; width: auto; display: block; }

.entete__menu {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 0;
  background: var(--b2p-blanc);
  color: var(--b2p-nuit);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.entete__envois {
  margin-left: auto;
  margin-right: 16px;
  color: var(--b2p-blanc);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- Cadre de page : bandeau titre + contenu ---------- */

.page {
  max-width: var(--b2p-largeur);
  margin: 20px auto 40px;
  background: var(--b2p-blanc);
  border-radius: var(--b2p-rayon-cadre);
  overflow: hidden;
}

.page__bandeau {
  background: var(--b2p-marine);
  color: var(--b2p-blanc);
  min-height: 120px;
  padding: 24px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page__bandeau h1 { font-size: 44px; line-height: 1.1; }

.page__contenu { padding: 34px; }

/* ---------- Tableau de bord : tuiles ---------- */

.tuiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}

.tuile {
  min-height: 172px;
  border: 3px solid var(--b2p-bordure);
  border-radius: var(--b2p-rayon-tuile);
  background: var(--b2p-blanc);
  color: var(--b2p-marine);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-decoration: none;
  font-family: var(--b2p-titre);
  font-weight: 700;
  font-size: 22px;
  text-align: center;
  padding: 16px;
  cursor: pointer;
}

.tuile svg { width: 56px; height: 56px; }

.tuile:hover { border-color: var(--b2p-marine); }

.tuile--principale { background: var(--b2p-marine); border-color: var(--b2p-marine); color: var(--b2p-blanc); }
.tuile--danger { background: var(--b2p-bordeaux); border-color: var(--b2p-bordeaux); color: var(--b2p-blanc); }

/* ---------- Formulaires ---------- */

.champ { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }

.champ label { font-size: 12px; padding-left: 14px; }

.champ input,
.champ select,
.champ textarea,
.ligne-liste input,
.ligne-liste select {
  width: 100%;
  border: 1.5px solid var(--b2p-bordure);
  border-radius: 999px;
  background: var(--b2p-blanc);
  padding: 11px 16px;
  font-size: 16px; /* 16px minimum : évite le zoom automatique de Safari iPad */
}

.champ textarea { border-radius: var(--b2p-rayon-tuile); min-height: 140px; resize: vertical; }

.champ__mdp { position: relative; }
.champ__mdp input { padding-right: 52px; }
.champ__oeil {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--b2p-marine);
}

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  background: var(--b2p-vert);
  color: var(--b2p-blanc);
  font-weight: 700;
  font-size: 16px;
  padding: 12px 22px;
  min-height: 46px;
  cursor: pointer;
  text-decoration: none;
}

.bouton--marine { background: var(--b2p-marine); }
.bouton[disabled] { opacity: .6; cursor: wait; }

.message-erreur,
.message-ok {
  background: var(--b2p-bordeaux-pale);
  color: var(--b2p-bordeaux);
  border-radius: var(--b2p-rayon-tuile);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-weight: 600;
}

.message-ok { background: var(--b2p-vert-pale); color: var(--b2p-vert); }

.aide { display: block; font-size: 13px; color: var(--b2p-texte-doux); padding-left: 14px; margin: 0 0 18px; }
.champ .aide { margin: 0; }

.bouton-lien {
  border: 0;
  background: none;
  padding: 8px 6px;
  font-weight: 700;
  color: var(--b2p-vert);
  text-decoration: underline;
  cursor: pointer;
}

.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.actions--haut { margin: 0 0 24px; }

.case { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; cursor: pointer; }
.case input { width: 24px; height: 24px; accent-color: var(--b2p-vert); }

.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* ---------- Réglages ---------- */

.onglets { display: flex; gap: 8px; border-bottom: 3px solid var(--b2p-bordure); margin-bottom: 28px; }
.onglet {
  padding: 12px 20px;
  margin-bottom: -3px;
  border-bottom: 3px solid transparent;
  color: var(--b2p-texte-doux);
  font-family: var(--b2p-titre);
  font-weight: 700;
  font-size: 19px;
  text-decoration: none;
}
.onglet--actif { color: var(--b2p-marine); border-bottom-color: var(--b2p-vert); }

.pastilles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.pastille {
  border: 1.5px solid var(--b2p-bordure);
  border-radius: 999px;
  padding: 9px 18px;
  color: var(--b2p-marine);
  font-weight: 600;
  text-decoration: none;
}
.pastille--active { background: var(--b2p-vert); border-color: var(--b2p-vert); color: var(--b2p-blanc); }

.ligne-liste { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin-bottom: 10px; }
.ligne-liste--produit { grid-template-columns: 1fr 150px auto; }
.ligne-liste .bouton-lien { min-width: 100px; text-align: right; }
.ligne-liste--masquee input { color: var(--b2p-texte-doux); background: var(--b2p-fond); text-decoration: line-through; }
.ligne-liste__fixe { padding: 0 16px; color: var(--b2p-texte-doux); }

.formulaire { max-width: 720px; }
.formulaire + .formulaire { margin-top: 40px; padding-top: 30px; border-top: 3px solid var(--b2p-bordure); }
.formulaire h2 { font-size: 26px; margin-bottom: 20px; }

.cartes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.carte {
  border: 3px solid var(--b2p-bordure);
  border-radius: var(--b2p-rayon-tuile);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--b2p-marine);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.carte:hover { border-color: var(--b2p-marine); }
.carte strong { font-family: var(--b2p-titre); font-size: 19px; }
.carte--inactive { opacity: .6; }

.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.etiquette {
  background: var(--b2p-fond);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 600;
}
.etiquette--alerte { background: var(--b2p-bordeaux-pale); color: var(--b2p-bordeaux); }

.connexion { max-width: 520px; margin: 0 auto; }

.vide { text-align: center; font-style: italic; color: var(--b2p-texte-doux); padding: 40px 0; }

/* ---------- Menu latéral ---------- */

.menu-fond {
  position: fixed;
  inset: 0;
  background: rgb(0 12 34 / .45);
  z-index: 30;
}

.menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 86vw);
  background: var(--b2p-blanc);
  z-index: 31;
  padding: calc(24px + env(safe-area-inset-top)) 22px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu a,
.menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  color: var(--b2p-marine);
  font-family: var(--b2p-titre);
  font-weight: 700;
  font-size: 19px;
  padding: 12px 10px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
}

.menu a:hover, .menu button:hover { background: var(--b2p-fond); }
.menu .menu__danger { color: var(--b2p-bordeaux); margin-top: auto; }

.pied {
  text-align: right;
  font-size: 12px;
  padding: 0 16px 16px;
  color: var(--b2p-marine);
}

/* ---------- Tablette portrait / téléphone ---------- */

@media (max-width: 900px) {
  .tuiles { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .page { margin: 14px 10px 30px; }
  .entete { margin: 0 10px; }
  .page__bandeau h1 { font-size: 34px; }
  .page__contenu { padding: 24px 20px; }
}

@media (max-width: 520px) {
  .tuiles { grid-template-columns: 1fr; }
  .tuile { min-height: 120px; }
  .cartes, .grille-2 { grid-template-columns: 1fr; }
  .ligne-liste--produit { grid-template-columns: 1fr auto; }
  .ligne-liste--produit > :first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
