/* Commande Décanteurs — design system Les Décanteurs.
   Fond ivoire, cartes blanches, encre bleu nuit, corail en accent rare.
   Rayons 12/16/24, ombres teintées bleu nuit (jamais rgba(0,0,0,…)). */

:root {
  --ivoire: #FAF7F0;
  --blanc: #FFFFFF;
  --encre: #172A3A;
  --encre-deep: #0E1C28;
  --corail: #FF5A45;
  --corail-dark: #E64B38;
  --menthe: #8FE3CF;
  --menthe-soft: #DDF8F1;

  --line: rgba(23, 42, 58, .12);
  --line-strong: rgba(23, 42, 58, .22);
  --muted: rgba(23, 42, 58, .55);
  --muted-soft: rgba(23, 42, 58, .40);

  --shadow-md: 0 8px 20px rgba(23, 42, 58, .06);
  --shadow-card: 0 22px 55px rgba(23, 42, 58, .14);
  --shadow-corail: 0 14px 36px rgba(255, 90, 69, .28);
  --focus-ring: 0 0 0 3px rgba(255, 90, 69, .25);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --titre: 'DM Sans', system-ui, sans-serif;
  --corps: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Plusieurs classes de ce fichier posent `display:flex`, ce qui l'emporterait sur la
   règle par défaut de l'attribut hidden. On tranche une fois pour toutes. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--ivoire);
  color: var(--encre);
  font-family: var(--corps);
  /* Empêche le zoom au double-tap et le rebond de scroll pendant le service. */
  overscroll-behavior-y: none;
}

button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 150px;
}

/* ── Typographie ── */
h1 { font-family: var(--titre); font-weight: 900; font-size: 26px; letter-spacing: -.04em; margin: 0; }
.sous { font-size: 13px; color: var(--muted); margin: 4px 0 16px; line-height: 1.5; }
.gras { font-family: var(--titre); font-weight: 800; }
.chiffre { font-family: var(--titre); font-weight: 900; letter-spacing: -.03em; }
.muted { color: var(--muted); }
.legal { font-size: 10px; color: var(--muted-soft); text-align: center; margin: 22px 0 0; }

/* ── En-tête ── */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 247, 240, .85);
  backdrop-filter: blur(18px);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.marque { font-family: var(--titre); font-weight: 700; font-size: 18px; letter-spacing: -.05em; white-space: nowrap; flex: none; }

/* Les trois repères du service — événement, poste, moment — se partagent la largeur à
   parts égales et se tronquent. Ils servent à SAVOIR OÙ L'ON EST, pas à tout lire : le
   détail est disponible en les touchant. Sur téléphone la marque s'efface pour leur
   laisser toute la place. */
.pastilles { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.pastilles > * { flex: 1 1 0; min-width: 0; }
/* La marque cède la place : l'application tient dans une colonne de 520 px, et trois
   repères tronqués valent mieux qu'un logo. Elle reparaît dans la vue large des
   statistiques, où la largeur ne manque pas. */
header .marque { display: none; }

/* Changer de poste en cours de service doit se voir : le libellé est une pastille
   bordée avec un chevron, pas un texte gris qu'il faudrait deviner cliquable. */
.terminal {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 5px 10px; background: var(--blanc);
  font-family: var(--titre); font-weight: 800; font-size: 12px; color: var(--encre);
  white-space: nowrap; overflow: hidden;
  transition: border-color .2s var(--ease);
}
.terminal:active { border-color: var(--corail); }
.terminal .chevron { font-size: 8px; opacity: .5; flex: none; }
.terminal .lieu { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Le numéro de terminal est secondaire — il figure sur chaque commande de l'historique.
   Il cède la place dès que l'écran est étroit. */
.terminal .tnum { display: none; color: var(--muted-soft); font-weight: 700; font-size: 11px; }

.pastille-hh {
  display: flex; align-items: center; gap: 7px;
  background: var(--encre); color: #fff; border: none; border-radius: 999px;
  padding: 6px 12px; font-family: var(--titre); font-weight: 800; font-size: 12px;
  white-space: nowrap; overflow: hidden;
}
.pastille-hh span:last-child { overflow: hidden; text-overflow: ellipsis; }
/* Moment activé, mais pas sur ce poste : signalé sans être présenté comme actif ici. */
.pastille-hh.inactive {
  background: none; color: var(--muted);
  border: 1px solid var(--line-strong); font-weight: 700;
}
.pastille-hh .point { width: 7px; height: 7px; border-radius: 50%; background: var(--corail); flex: none; }

/* Bandeau d'état réseau : discret, mais visible quand ça compte. */
.reseau {
  display: none; align-items: baseline; gap: 8px;
  background: var(--encre); color: #fff;
  font-family: var(--titre); font-weight: 800; font-size: 12px;
  padding: 8px 18px;
}
.reseau > span:first-child { white-space: nowrap; flex: none; }
body.hors-ligne .reseau { display: flex; }

.vue { padding: 16px 18px 0; }

/* ── Cartes ── */
.carte {
  background: var(--blanc);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

/* ── Grille produits ── */
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.produit {
  position: relative; text-align: left;
  background: var(--blanc); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; min-height: 92px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  box-shadow: var(--shadow-md);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.produit:active { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.produit .nom {
  font-family: var(--titre); font-weight: 800; font-size: 15px;
  letter-spacing: -.02em; line-height: 1.1; padding-right: 30px;
}
.produit .prix-ligne { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.produit .prix { font-family: var(--titre); font-weight: 900; font-size: 17px; }
.produit .prix.promo { color: var(--corail); }
.produit .ancien { font-size: 12px; color: var(--muted-soft); text-decoration: line-through; }
.produit .moins {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--blanc);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--titre); font-weight: 800; font-size: 18px; flex: none;
}
.badge-qty {
  position: absolute; top: 10px; right: 10px;
  min-width: 24px; height: 24px; border-radius: 999px;
  background: var(--encre); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--titre); font-weight: 800; font-size: 13px; padding: 0 6px;
}

/* ── Boutons ── */
.btn {
  border: none; border-radius: 999px; padding: 12px 20px;
  font-family: var(--titre); font-weight: 800; font-size: 14px;
  transition: transform .2s var(--ease), background-color .2s var(--ease);
}
.btn:active { transform: translateY(-3px); }
.btn-primaire { background: var(--corail); color: #fff; box-shadow: var(--shadow-corail); }
.btn-primaire:hover { background: var(--corail-dark); }
.btn-sombre { background: var(--encre); color: #fff; }
.btn-neutre { background: var(--blanc); border: 1px solid var(--line-strong); }
.btn-fantome { background: none; border: none; color: var(--muted); font-size: 12px; padding: 8px; }
.btn-danger { background: none; border: none; color: var(--corail); font-size: 12px; padding: 8px; }
.btn-petit { padding: 8px 16px; font-size: 12px; }
.btn:disabled { opacity: .5; }

.pill {
  border: none; border-radius: 999px; padding: 7px 13px;
  font-family: var(--titre); font-weight: 800; font-size: 12px;
  background: rgba(23, 42, 58, .07); color: var(--encre);
}
.pill.on { background: var(--encre); color: #fff; }
.pill.on-corail { background: var(--corail); color: #fff; }

.etiquette {
  font-family: var(--titre); font-weight: 800; font-size: 10px;
  border-radius: 999px; padding: 3px 8px; background: var(--menthe-soft);
}
.etiquette.terminal { background: none; border: 1px solid var(--line); color: var(--muted-soft); padding: 2px 7px; }
.etiquette.lieu { background: var(--encre); color: #fff; }
.etiquette.annulee { background: var(--corail); color: #fff; }
.etiquette.attente { background: rgba(23, 42, 58, .07); color: var(--muted); }

/* ── Champs ── */
label.champ {
  display: block; font-family: var(--titre); font-weight: 800; font-size: 11px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
input[type=text], input[type=number], input[type=date], input[type=password] {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 11px 12px; font-size: 16px; background: var(--ivoire); outline: none;
}
input:focus { border-color: var(--corail); box-shadow: 0 0 0 3px rgba(255, 90, 69, .15); }
input.court { width: 110px; }

/* ── Historique ── */
.commande { padding: 14px; }
.commande + .commande { margin-top: 10px; }
.commande.annulee { opacity: .55; }
.commande .entete { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.commande .heure { font-family: var(--titre); font-weight: 800; font-size: 15px; }
.commande .total { font-family: var(--titre); font-weight: 900; font-size: 17px; white-space: nowrap; }
.commande.annulee .total { text-decoration: line-through; }
.commande .etiquettes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.commande .resume { font-size: 13px; color: rgba(23, 42, 58, .6); margin-top: 6px; line-height: 1.5; }
.commande .actions { display: flex; gap: 8px; margin-top: 12px; }

.vide {
  background: var(--blanc); border: 1px dashed var(--line-strong); border-radius: 16px;
  padding: 26px; text-align: center; color: var(--muted); font-size: 14px;
}

/* ── Happy hour ── */
.moment { padding: 14px; }
.moment + .moment { margin-top: 10px; }
.moment.actif { border: 1.5px solid var(--corail); }
.moment .actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.ajouter {
  margin-top: 14px; width: 100%;
  border: 1px dashed rgba(23, 42, 58, .3); background: none; border-radius: 16px;
  padding: 14px; font-family: var(--titre); font-weight: 800; font-size: 14px; color: var(--encre);
}
.formulaire {
  margin-top: 14px; background: var(--blanc);
  border: 1px solid var(--line-strong); border-radius: 24px;
  padding: 18px; box-shadow: var(--shadow-card);
}
.formulaire .titre { font-family: var(--titre); font-weight: 800; font-size: 16px; letter-spacing: -.02em; margin-bottom: 12px; }

/* ── Fenêtre flottante ──
   Les formulaires s'ouvrent par-dessus la vue, pas en bas de la liste : on clique
   « Modifier » et le formulaire arrive sous les yeux, sans défilement. */
@keyframes feuilleIn { from { transform: translateY(100%) } to { transform: translateY(0) } }

.modale-fond {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(23, 42, 58, .45);
  /* Aucune animation d'opacité ici : un onglet en arrière-plan ou un réglage « mouvement
     réduit » peut figer une animation à son image de départ — le voile resterait alors
     invisible et le formulaire flotterait sans contexte. Seule la fenêtre s'anime, et
     uniquement en position. */
}
.modale {
  position: fixed; z-index: 80; left: 0; right: 0; bottom: 0;
  max-width: 520px; margin: 0 auto;
  max-height: 88vh; overflow: auto;
  background: var(--blanc);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-card);
  animation: feuilleIn .24s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}
.modale .poignee + .entete { padding-top: 8px; }
.modale .formulaire { margin: 0; border: none; box-shadow: none; border-radius: 0; }
.modale .entete {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px 10px;
  /* Sur un formulaire long (les prix spéciaux couvrent tout le catalogue), le titre et
     la croix restent accessibles sans remonter. */
  position: sticky; top: 0; z-index: 2; background: var(--blanc);
}
/* Idem pour Enregistrer / Annuler : toujours sous le pouce, jamais à chercher. */
.modale .pied-formulaire {
  position: sticky; bottom: 0; z-index: 2;
  background: var(--blanc);
  margin: 16px -18px -18px; padding: 12px 18px;
  border-top: 1px solid var(--line);
}
/* Hors fenêtre flottante, le pied reste un simple bloc. */
.pied-formulaire { margin-top: 16px; }
.modale .entete .titre { font-family: var(--titre); font-weight: 800; font-size: 18px; letter-spacing: -.03em; }
.modale .fermer {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  border: 1px solid var(--line-strong); background: var(--blanc);
  font-size: 18px; line-height: 1; color: var(--muted);
}
/* La poignée rappelle qu'on peut refermer d'un geste vers le bas — ici en touchant
   le fond ou la croix, le geste de glissement n'étant pas implémenté. */
.modale .poignee {
  width: 38px; height: 4px; border-radius: 99px; background: var(--line-strong);
  margin: 8px auto 0;
}
body.modale-ouverte { overflow: hidden; }

@keyframes dialogueIn { from { transform: translateY(10px) } to { transform: translateY(0) } }

@media (min-width: 640px) {
  .modale {
    top: 7vh; bottom: auto; max-height: 86vh;
    border-radius: 24px;
    /* On n'anime que la position, jamais l'opacité : si l'animation ne s'exécute pas
       (mouvement réduit, onglet en arrière-plan), la fenêtre reste visible. */
    animation: dialogueIn .2s var(--ease);
  }
  .modale .poignee { display: none; }
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ligne-prix { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ligne-prix input { width: 84px; text-align: right; padding: 8px 10px; font-size: 15px; }

/* ── Statistiques ── */
.tuiles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.tuile { background: var(--blanc); border: 1px solid var(--line); border-radius: 16px; padding: 14px 12px; }
.tuile.sombre { background: var(--encre); border-color: var(--encre); color: #fff; }
.tuile .val { font-family: var(--titre); font-weight: 900; font-size: 21px; letter-spacing: -.03em; }
.tuile.sombre .val { color: var(--menthe); }
.tuile .lib { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tuile.sombre .lib { color: rgba(255, 255, 255, .75); }

.bloc { background: var(--blanc); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-top: 10px; }
.bloc .titre { font-family: var(--titre); font-weight: 800; font-size: 13px; margin-bottom: 12px; }
.barre-fond { height: 10px; border-radius: 999px; background: rgba(23, 42, 58, .07); overflow: hidden; }
.barre { height: 100%; border-radius: 999px; transition: width .3s var(--ease); }
.barre.corail { background: var(--corail); }
.barre.menthe { background: var(--menthe); }
.barre.encre { background: var(--encre); }
.legende { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }

.histogramme { display: flex; align-items: flex-end; gap: 6px; height: 130px; overflow-x: auto; }
.colonne { flex: 1; min-width: 34px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.colonne .val { font-size: 10px; font-family: var(--titre); font-weight: 800; color: rgba(23, 42, 58, .6); }
.colonne .tige { width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: var(--corail); min-height: 3px; transition: height .3s var(--ease); }
.colonne .lib { font-size: 10px; color: var(--muted); }

/* ── Barre panier + navigation ── */
.bas { position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; max-width: 520px; margin: 0 auto; }
.panier {
  margin: 0 10px 8px; background: var(--blanc);
  border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow-card); overflow: hidden;
}
.panier .detail { padding: 14px 16px 4px; display: flex; flex-direction: column; gap: 10px; max-height: 34vh; overflow: auto; }
.panier .ligne { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panier .pied { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; }
.panier .total { font-family: var(--titre); font-weight: 900; font-size: 18px; letter-spacing: -.03em; }
.rond {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--blanc);
  font-family: var(--titre); font-weight: 800; font-size: 16px; flex: none;
}
nav {
  display: flex; background: rgba(250, 247, 240, .92); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding: 6px 0 max(12px, env(safe-area-inset-bottom));
}
nav button {
  flex: 1; background: none; border: none; padding: 10px 2px;
  font-family: var(--titre); font-weight: 800; font-size: 11px; color: var(--muted);
}
nav button.actif { color: var(--corail); }

/* ── Bandeau d'édition ── */
.edition {
  background: var(--menthe-soft); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 14px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

/* ── Toast ── */
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0 } to { transform: translate(-50%, 0); opacity: 1 } }
.toast {
  position: fixed; bottom: 170px; left: 50%; transform: translateX(-50%);
  background: var(--encre); color: #fff; border-radius: 999px;
  padding: 10px 18px; font-family: var(--titre); font-weight: 800; font-size: 13px;
  z-index: 100; box-shadow: var(--shadow-card);
  animation: toastIn .22s var(--ease); max-width: 92vw; text-align: center;
}
.toast.alerte { background: var(--corail); }

/* ── Écran de code d'accès ── */
.porte {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; padding: 32px 24px;
  max-width: 420px; margin: 0 auto; text-align: center;
}
.porte h1 { font-size: 30px; }

/* ── Poste en cave : deux colonnes à partir de 900 px ──
   L'appli reste une colonne étroite sur téléphone ; sur un écran large, seules les
   statistiques se déploient — c'est la vue qu'on consulte depuis la cave. */
@media (min-width: 900px) {
  .app.large { max-width: 1100px; padding-bottom: 110px; }
  /* Ici seulement la largeur ne manque pas : la marque et le numéro de terminal
     reparaissent sans écraser les trois repères. */
  .app.large header .marque { display: block; }
  .app.large .terminal .tnum { display: inline; }
  .app.large .vue-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .app.large .vue-stats .pleine-largeur { grid-column: 1 / -1; }
  .app.large .vue-stats .bloc { margin-top: 0; }
  .app.large .tuile .val { font-size: 28px; }
}
