/* ╔══════════════════════════════════════════════════════════════╗
   ║   RESTAURANT — admin/css/admin.css                             ║
   ║   Le back-office du restaurant. Aucune bibliothèque,           ║
   ║   aucune police distante, aucune image : tout est dessiné.   ║
   ╚══════════════════════════════════════════════════════════════╝
   Écrite en « mobile d'abord » : ce qui suit vaut à 375 px, et les media
   queries n'ajoutent que ce qu'un grand écran permet en plus. Le restaurant
   consulte ses commandes depuis la cuisine, une main sur le téléphone :
   à cette largeur, le menu passe en bas, à portée de pouce.
   Les couleurs de la charte du restaurant sont posées par le JavaScript sur
   l'élément racine (--principale, --secondaire) ; ici, des valeurs de repli. */

:root {
  --principale: #1d3557;
  --secondaire: #d9512c;

  --encre: #131c2b;
  --encre-douce: #55617a;
  --fond: #f2f5f9;
  --carte: #ffffff;
  --trait: #dfe5ee;
  --trait-fort: #c5cfdd;

  --vert: #2f6d4f;      --vert-clair: #e7f2ec;
  --rouge: #a33a28;     --rouge-clair: #fbeae7;
  --bleu: #33608f;      --bleu-clair: #e9f0f8;
  --orange: #9a6412;    --orange-clair: #fbf0dd;
  --gris-clair: #e8edf3;

  --rayon: 14px;
  --rayon-s: 9px;
  --ombre: 0 1px 2px rgba(20, 35, 60, .06), 0 8px 24px rgba(20, 35, 60, .07);
  --ombre-forte: 0 2px 6px rgba(20, 35, 60, .1), 0 18px 40px rgba(20, 35, 60, .16);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.22; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
a { color: var(--principale); text-underline-offset: 2px; }
img { max-width: 100%; display: block; }
.discret { color: var(--encre-douce); font-size: .87rem; }
.cache { display: none !important; }
#btn-creer-boutique, #btn-acheter-boutique { background: #1baf7a; border-color: #1baf7a; color: #fff; }
#btn-acheter-boutique { background: #eb6834; border-color: #eb6834; }
@media (max-width: 640px) { .entete-appli .txt-long { display: none; } }
.centre { text-align: center; }
.n { text-align: right; white-space: nowrap; }
.rien { color: var(--encre-douce); font-style: italic; padding: 1rem 0; }

/* ── Écran de connexion ───────────────────────────────────────── */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; }
.connexion .boite {
  background: var(--carte); border: 1px solid var(--trait); border-radius: 18px;
  box-shadow: var(--ombre); padding: 1.6rem; width: min(420px, 100%);
}
.connexion .logo {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--principale), var(--secondaire));
  color: #fff; font-size: 1.4rem; margin-bottom: .9rem;
}
.connexion h1 { margin-bottom: .1rem; }
.acces-demo {
  margin: .4rem 0 1.1rem; padding: .8rem 1rem; border: 1px solid var(--trait);
  border-left: 4px solid var(--principale); border-radius: 10px;
  background: var(--fond); text-align: left; font-size: .9rem;
}
.acces-demo p { margin: 0 0 .4rem; }
.acces-demo dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 .6rem; }
.acces-demo dt { color: var(--encre-douce); }
.acces-demo dd { margin: 0; }
code {
  background: var(--fond); border: 1px solid var(--trait); border-radius: 6px;
  padding: .05rem .35rem; font-size: .9em;
}
.acces-demo code { background: var(--carte); }

/* ── Ossature ─────────────────────────────────────────────────── */
.appli { display: block; min-height: 100vh; }
.cote {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; gap: .15rem; overflow-x: auto; padding: .35rem .3rem;
  background: var(--carte); border-top: 1px solid var(--trait);
  box-shadow: 0 -2px 14px rgba(20, 35, 60, .08);
}
.cote .titre, .cote .bas { display: none; }
.cote button {
  position: relative; flex: 1 0 auto; display: flex; flex-direction: column;
  align-items: center; gap: .1rem; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: .68rem; color: var(--encre-douce);
  padding: .4rem .5rem; border-radius: 10px; white-space: nowrap; min-width: 62px;
}
.cote button .pict { font-size: 1.1rem; line-height: 1; }
.cote button.actif { background: var(--principale); color: #fff; font-weight: 600; }
.cote .pastille {
  position: absolute; top: .1rem; right: .35rem; background: var(--rouge); color: #fff;
  border-radius: 999px; font-size: .62rem; font-weight: 700; padding: .02rem .3rem;
}
.principal { padding: 1rem 16px 5.6rem; min-width: 0; }

.entete-appli {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .7rem 16px; background: var(--carte); border-bottom: 1px solid var(--trait);
}
.entete-appli .marque { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.entete-appli .rond {
  width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--principale), var(--secondaire)); color: #fff;
  flex: 0 0 auto;
}
.entete-appli .droite { margin-left: auto; display: flex; gap: .4rem; align-items: center; }

@media (min-width: 900px) {
  .appli { display: grid; grid-template-columns: 232px 1fr; }
  .entete-appli { grid-column: 1 / -1; padding: .7rem 1.4rem; }
  .cote {
    position: sticky; top: 0; left: auto; right: auto; bottom: auto;
    height: 100vh; flex-direction: column; overflow-y: auto; gap: .1rem;
    padding: 1rem .7rem; border-top: 0; border-right: 1px solid var(--trait); box-shadow: none;
  }
  .cote .titre { display: flex; align-items: center; gap: .55rem; font-weight: 700; padding: .2rem .6rem 1rem; }
  .cote .bas { display: block; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--trait); }
  .cote button {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: .6rem;
    width: 100%; font-size: .95rem; padding: .55rem .7rem; min-width: 0;
  }
  .cote button:hover { background: var(--fond); color: var(--encre); }
  .cote button.actif:hover { background: var(--principale); color: #fff; }
  .cote .pastille { position: static; margin-left: auto; }
  .principal { padding: 1.4rem 1.8rem 4rem; }
}

/* ── Blocs ────────────────────────────────────────────────────── */
.carte {
  background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 1rem; margin-bottom: 1rem;
}
.carte > h2:first-child, .carte > h3:first-child { margin-top: 0; }
.grille { display: grid; gap: .9rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.ligne { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.ligne.fin { justify-content: flex-end; }
.entete-page { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .9rem; }
.entete-page h1 { margin: 0; }
.entete-page .droite { margin-left: auto; display: flex; gap: .45rem; flex-wrap: wrap; }

.chiffre {
  background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: .85rem .95rem; box-shadow: var(--ombre);
}
.chiffre .valeur { font-size: 1.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.chiffre .libelle { color: var(--encre-douce); font-size: .82rem; margin-top: .15rem; }
.chiffre .detail { color: var(--encre-douce); font-size: .78rem; margin-top: .3rem; }
.chiffre.vedette { border-color: var(--trait-fort); background: linear-gradient(180deg, #fff, var(--fond)); }
.chiffre.alerte .valeur { color: var(--rouge); }

/* ── Boutons et formulaires ───────────────────────────────────── */
button, .bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  background: var(--principale); color: #fff; border: 0; border-radius: var(--rayon-s);
  padding: .55rem 1rem; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; line-height: 1.3;
}
button:hover, .bouton:hover { filter: brightness(1.08); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--secondaire); outline-offset: 2px;
}
button[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.clair { background: var(--carte); color: var(--encre); border: 1px solid var(--trait-fort); }
.clair:hover { background: var(--fond); filter: none; }
.danger { background: var(--rouge-clair); color: var(--rouge); border: 1px solid #edcdc6; }
.danger:hover { background: #f6ded9; filter: none; }
.petit { padding: .32rem .65rem; font-size: .84rem; border-radius: 8px; }
.lien { background: none; border: 0; color: var(--principale); padding: 0; font-weight: 600; text-decoration: underline; }
.lien:hover { filter: none; color: var(--secondaire); }

label { display: block; font-size: .84rem; font-weight: 600; margin: .7rem 0 .22rem; color: var(--encre-douce); }
input:not([type]), input[type=text], input[type=tel], input[type=email], input[type=date],
input[type=time], input[type=number], input[type=password], input[type=search],
input[type=color], select, textarea {
  width: 100%; padding: .52rem .65rem; border: 1px solid var(--trait-fort);
  border-radius: var(--rayon-s); font: inherit; background: var(--carte); color: var(--encre);
}
input[type=color] { padding: .12rem; height: 38px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--principale); }
.case { display: flex; gap: .5rem; align-items: flex-start; margin: .45rem 0; font-weight: 400; font-size: .92rem; color: var(--encre); }
.case input { width: auto; margin-top: .22rem; flex: 0 0 auto; }
.champ-court { max-width: 180px; }
fieldset { border: 1px solid var(--trait); border-radius: var(--rayon-s); padding: .7rem .9rem; margin: 0 0 .9rem; }
legend { font-weight: 700; font-size: .92rem; padding: 0 .3rem; }

/* ── Tableaux ─────────────────────────────────────────────────── */
.tableau-defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Sur un téléphone, cinq colonnes dans 343 px se tassent jusqu'à couper les
   mots en trois. On préfère une largeur plancher et un glissement latéral :
   le tableau reste lisible, on le fait défiler du pouce. */
@media (max-width: 700px) { .tableau-defile table { min-width: 540px; } }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .5rem .45rem; text-align: left; border-bottom: 1px solid var(--trait); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--encre-douce); font-weight: 700; }
tbody tr:hover td { background: var(--fond); }
tr.cliquable { cursor: pointer; }
td .sous { display: block; color: var(--encre-douce); font-size: .84rem; }

/* ── Jetons de statut ─────────────────────────────────────────── */
.jeton {
  display: inline-block; border-radius: 999px; padding: .1rem .55rem;
  font-size: .74rem; font-weight: 700; white-space: nowrap;
}
.jeton.nouvelle    { background: var(--orange-clair); color: var(--orange); }
.jeton.confirmee   { background: var(--bleu-clair); color: var(--bleu); }
.jeton.preparation { background: var(--bleu-clair); color: var(--bleu); }
.jeton.prete       { background: var(--vert-clair); color: var(--vert); }
.jeton.livraison   { background: var(--bleu-clair); color: var(--bleu); }
.jeton.livree      { background: var(--vert-clair); color: var(--vert); }
.jeton.terminee    { background: var(--gris-clair); color: var(--encre-douce); }
.jeton.annulee     { background: var(--rouge-clair); color: var(--rouge); }
.jeton.oui         { background: var(--vert-clair); color: var(--vert); }
.jeton.non         { background: var(--gris-clair); color: var(--encre-douce); }
.jeton.promo       { background: var(--rouge-clair); color: var(--rouge); }

/* ── Messages ─────────────────────────────────────────────────── */
.avis { padding: .6rem .85rem; border-radius: var(--rayon-s); margin: .6rem 0; font-size: .9rem; }
.avis.ok { background: var(--vert-clair); color: var(--vert); }
.avis.erreur { background: var(--rouge-clair); color: var(--rouge); }
.avis.info { background: var(--bleu-clair); color: var(--bleu); }
.avis:empty { display: none; }

/* Bandeau flottant de confirmation, en haut de l'écran. */
.flash {
  position: fixed; top: .7rem; left: 50%; transform: translateX(-50%); z-index: 90;
  background: var(--encre); color: #fff; padding: .55rem 1rem; border-radius: 999px;
  box-shadow: var(--ombre-forte); font-size: .9rem; font-weight: 600; max-width: 92vw;
}
.flash.erreur { background: var(--rouge); }

/* ── Graphique en barres (aucune image, aucun script de dessin) ── */
.graphe {
  display: flex; align-items: flex-end; gap: 3px; height: 160px;
  padding-top: .5rem; overflow-x: auto;
}
.graphe .colonne { flex: 1 0 14px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.graphe .tige {
  background: linear-gradient(180deg, var(--secondaire), var(--principale));
  border-radius: 4px 4px 0 0; min-height: 2px; transition: none;
}
/* Un jour sans commande garde tout de même sa barre, en gris : un trou dans
   le graphique se lirait comme une donnée manquante, pas comme un zéro. */
.graphe .tige.vide { background: var(--trait); min-height: 3px; }
.graphe-legende { display: flex; gap: 3px; font-size: .64rem; color: var(--encre-douce); margin-top: .25rem; }
.graphe-legende span { flex: 1 0 14px; text-align: center; overflow: hidden; white-space: nowrap; }

/* Barre horizontale : meilleures ventes, répartition par catégorie. */
.barre { display: grid; grid-template-columns: minmax(90px, 1.3fr) 1fr auto; gap: .55rem; align-items: center; margin: .35rem 0; font-size: .88rem; }
.barre .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre .piste { background: var(--gris-clair); border-radius: 999px; height: 9px; overflow: hidden; }
/* display:block indispensable : sur un <span> resté en ligne, ni la largeur
   ni la hauteur ne s'appliqueraient et la barre ne se verrait pas. */
.barre .remplie { display: block; background: var(--principale); height: 100%; border-radius: 999px; }
.barre .val { font-weight: 700; white-space: nowrap; font-size: .85rem; }

/* ── Fenêtre modale ───────────────────────────────────────────── */
.voile {
  position: fixed; inset: 0; background: rgba(36, 26, 19, .5); z-index: 80;
  display: grid; place-items: end center; padding: 0;
}
.modale {
  background: var(--carte); border-radius: 18px 18px 0 0; width: 100%;
  max-height: 92vh; overflow: auto; padding: 1.1rem 16px 1.4rem; position: relative;
  box-shadow: var(--ombre-forte);
}
.modale h2 { margin-top: 0; padding-right: 2.2rem; }
.modale .fermer {
  position: absolute; top: .55rem; right: .6rem; background: var(--fond); color: var(--encre);
  border: 1px solid var(--trait); width: 32px; height: 32px; padding: 0; border-radius: 50%;
  font-size: 1.1rem; line-height: 1;
}
@media (min-width: 700px) {
  .voile { place-items: center; padding: 1.2rem; }
  .modale { border-radius: 18px; width: min(700px, 100%); padding: 1.4rem; }
  .modale.large { width: min(940px, 100%); }
}

/* Fenêtre « Créer / Acheter ma boutique » : la page des tarifs en cadre. */
.modale.modale-boutique { width: min(1180px, 100%); padding-bottom: .8rem; }
.cadre-boutique { display: block; width: 100%; height: calc(92vh - 5rem); border: 0; border-radius: 12px; background: #fff; }

/* ── Détail d'une commande ────────────────────────────────────── */
.recap { border-top: 1px solid var(--trait); margin-top: .7rem; padding-top: .6rem; }
.recap .l { display: flex; justify-content: space-between; gap: 1rem; padding: .12rem 0; }
.recap .l.total { font-size: 1.15rem; font-weight: 700; border-top: 1px solid var(--trait); margin-top: .35rem; padding-top: .45rem; }
.option-ligne { font-size: .85rem; color: var(--encre-douce); }
.suivi { list-style: none; margin: .4rem 0 0; padding: 0; font-size: .86rem; }
.suivi li { padding: .2rem 0 .2rem .9rem; border-left: 2px solid var(--trait); }
.suivi li:first-child { border-left-color: var(--principale); font-weight: 600; }

/* ── Photo d'un article ───────────────────────────────────────── */
.apercu-photo {
  width: 100%; max-width: 260px; aspect-ratio: 3 / 2; object-fit: cover;
  border-radius: var(--rayon-s); border: 1px solid var(--trait); background: var(--fond);
}
.sans-photo {
  width: 100%; max-width: 260px; aspect-ratio: 3 / 2; border-radius: var(--rayon-s);
  border: 1px dashed var(--trait-fort); display: grid; place-items: center;
  color: var(--encre-douce); font-size: .85rem; background: var(--fond); text-align: center; padding: .5rem;
}

/* ── Horaires et zones (réglages) ─────────────────────────────── */
.jour-horaire { display: grid; grid-template-columns: 1fr; gap: .35rem; padding: .5rem 0; border-bottom: 1px solid var(--trait); }
.jour-horaire > strong { text-transform: capitalize; }
.jour-horaire .plages { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.jour-horaire input[type=time] { width: auto; }
@media (min-width: 700px) {
  .jour-horaire { grid-template-columns: 120px 1fr; align-items: center; }
}
.zone-livraison { border: 1px solid var(--trait); border-radius: var(--rayon-s); padding: .7rem .8rem; margin-bottom: .6rem; background: var(--fond); }
.zone-livraison .ligne.champs > * { flex: 1 1 130px; }
/* Legende des colonnes d'un choix : elle disparait sous 560 px, ou la
   grille se replie et ou les titres ne tomberaient plus en face. */
.legende-choix { color: var(--encre-douce); font-size: .76rem; font-weight: 600; margin-top: .4rem; }
@media (max-width: 560px) { .legende-choix { display: none; } }

/* ── Option d'un article (formulaire produit) ─────────────────── */
.bloc-option { border: 1px solid var(--trait); border-radius: var(--rayon-s); padding: .7rem .8rem; margin-bottom: .6rem; background: var(--fond); }
.choix-option { display: grid; grid-template-columns: 1fr 88px 88px auto; gap: .35rem; align-items: center; margin: .3rem 0; }
.choix-option input { padding: .38rem .5rem; font-size: .88rem; }
@media (max-width: 560px) {
  .choix-option { grid-template-columns: 1fr 1fr; }
  .choix-option > :first-child { grid-column: 1 / -1; }
}

/* ── Journal ──────────────────────────────────────────────────── */
.trace { display: grid; grid-template-columns: 1fr; gap: .1rem; padding: .5rem 0; border-bottom: 1px solid var(--trait); font-size: .9rem; }
.trace .quand { color: var(--encre-douce); font-size: .8rem; }
.trace .par { color: var(--encre-douce); font-size: .8rem; }

/* ── Pagination ───────────────────────────────────────────────── */
.pages { display: flex; gap: .4rem; align-items: center; justify-content: center; margin-top: .9rem; flex-wrap: wrap; }

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

/* Carte Leaflet (Clients) : ses calques portent des z-index de 400 à 1000,
   plus hauts que les fenêtres (80) — la carte passait par-dessus la fiche
   client. Un contexte d'empilement propre les garde dans la carte. */
.leaflet-container { isolation: isolate; z-index: 0; }

/* Modes d'emploi repliés (écran Paiement) */
.mode-emploi { margin: .6rem 0 0; padding: .5rem .8rem; border: 1px solid var(--trait);
  border-radius: 10px; background: var(--fond); font-size: .9rem; }
.mode-emploi > summary { cursor: pointer; font-weight: 600; list-style: none; }
.mode-emploi > summary::-webkit-details-marker { display: none; }
.mode-emploi[open] > summary { margin-bottom: .5rem; }
.mode-emploi ol { margin: 0; padding-left: 1.3rem; }
.mode-emploi li { margin-bottom: .45rem; line-height: 1.45; }
.mode-emploi p { margin: .5rem 0 0; }
