/* =============================================================================
   Systeme visuel de l'espace client.

   Regles tenues, dans l'ordre de priorite :
   - une seule couleur d'accent (braise), pour les actions et les alertes ;
   - une seule famille de police, trois tailles, hierarchie par la graisse ;
   - de l'air entre les blocs : c'est ce qui distingue l'outil d'un vieux
     logiciel de caisse ;
   - mobile d'abord, le restaurateur pilote autant depuis son telephone.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Fond neutre pour que l'accent ressorte du premier coup d'oeil. */
  --ardoise: #1c1f24;
  --ardoise-clair: #2a2f37;
  --ardoise-trait: #363c45;
  --papier: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --encre: #16181d;
  --encre-2: #61656e;
  --encre-3: #868b95;
  --trait: #e4e4e6;
  --trait-fort: #c9cace;

  /* L'unique accent. Rien d'autre ne doit lui faire concurrence. */
  --braise: #c2412a;
  --braise-fonce: #a83722;
  --braise-fond: #fceeeb;

  /* Statuts : aplats legers seulement, jamais de fond plein. */
  --olive: #2f6b45;
  --olive-fond: #ecf4ef;
  --ambre: #8a6111;
  --ambre-fond: #faf2e0;

  /* Trois tailles dans tout le tableau de bord, pas une de plus. */
  --t-grand: 26px;
  --t-section: 17px;   /* les titres de section, demandes plus lisibles */
  --t-texte: 15px;
  --t-legende: 12.5px;

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --ombre: 0 1px 2px rgba(22, 24, 29, .05), 0 6px 20px rgba(22, 24, 29, .04);
  --ombre-forte: 0 14px 44px rgba(22, 24, 29, .18);

  --texte: 'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  /* La page produit garde sa personnalite : elle redefinit ces deux-la. */
  --titre: var(--texte);
  --data: var(--texte);

  /* Deux exceptions assumees au bareme de trois tailles : l'etiquette de la
     barre du bas sur telephone (11px, sinon elle ne tient pas) et les champs
     a 16px sur mobile (en dessous, iOS zoome tout seul). */
  --nav: 202px;
  --bond: .18s cubic-bezier(.32, .72, 0, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--texte);
  font-size: var(--t-texte);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration: none; }

/* Hierarchie par la graisse, pas par la taille. */
h1, h2, h3 { margin: 0; font-family: var(--titre); letter-spacing: -.015em; }
h1 { font-size: var(--t-grand); font-weight: 700; line-height: 1.15; }
h2 { font-size: var(--t-section); font-weight: 600; }
h3 { font-size: var(--t-texte); font-weight: 600; }

:focus-visible { outline: 2px solid var(--braise); outline-offset: 2px; border-radius: 4px; }

/* --- marque ---------------------------------------------------------------- */

.logo { display: inline-flex; align-items: center; gap: 9px; }
.marque-accueil { margin-bottom: 20px; }
.logo .mot { font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.logo .baseline {
  font-size: var(--t-legende);
  font-weight: 500;
  color: var(--encre-2);
  border-left: 1px solid var(--trait);
  padding-left: 10px;
  margin-left: 2px;
}
.side .logo .baseline { color: #858b96; border-color: var(--ardoise-trait); }

/* --- ossature ------------------------------------------------------------- */

.app { display: grid; grid-template-columns: var(--nav) 1fr; min-height: 100vh; }

.side {
  background: var(--ardoise);
  color: #e8e9eb;
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.enseigne { padding: 0 8px; }
.enseigne .maison {
  font-size: var(--t-legende);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #858b96;
}
.enseigne strong {
  display: block;
  font-size: var(--t-texte);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.015em;
  margin-top: 6px;
  color: #fff;
}
.enseigne .pack {
  display: inline-block;
  margin-top: 9px;
  font-size: var(--t-legende);
  color: #a2a8b2;
  border: 1px solid var(--ardoise-trait);
  border-radius: 999px;
  padding: 2px 10px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #b8bcc4;
  font: inherit;
  font-weight: 500;
  padding: 9px 10px;
  border-radius: var(--r-s);
  cursor: pointer;
  transition: background var(--bond), color var(--bond);
}
.nav button svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav button .long { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav button .court { display: none; }
.nav button:hover { background: var(--ardoise-clair); color: #fff; }
.nav button[aria-current="true"] { background: #fff; color: var(--encre); font-weight: 600; }
.nav .compteur {
  margin-left: auto;
  font-size: var(--t-legende);
  font-weight: 600;
  background: var(--braise);
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
}

.side-pied { margin-top: auto; border-top: 1px solid var(--ardoise-trait); padding-top: 14px; }
.side-pied .qui { font-size: var(--t-legende); color: #a2a8b2; padding: 0 8px 8px; word-break: break-all; }

main { padding: 28px 32px 90px; max-width: 1200px; }

/* De l'air : c'est la premiere chose qui distingue l'outil d'une caisse. */
.entete {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.entete .sous { margin: 6px 0 0; color: var(--encre-2); font-size: var(--t-legende); }
.entete .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* --- surfaces ------------------------------------------------------------- */

.bloc {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-m);
  padding: 20px;
  box-shadow: var(--ombre);
}
.bloc.plat { box-shadow: none; }
.bloc-titre { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.grille { display: grid; gap: 16px; }
.grille.deux { grid-template-columns: repeat(auto-fit, minmax(288px, 1fr)); }
.grille.trois { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.pile { display: flex; flex-direction: column; gap: 16px; }
.ligne { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* --- chiffres cles -------------------------------------------------------- */

.chiffre { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r-m); padding: 16px 17px; }
.chiffre .etiquette { font-size: var(--t-legende); font-weight: 500; color: var(--encre-2); }
.chiffre .valeur { font-size: var(--t-grand); font-weight: 700; letter-spacing: -.02em; margin-top: 8px; }
.chiffre .note { font-size: var(--t-legende); color: var(--encre-2); margin-top: 4px; }

/* --- listes : le motif de toutes les pages -------------------------------- */

.liste { display: flex; flex-direction: column; }
.liste .item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 4px;
  border-top: 1px solid var(--trait);
  transition: background var(--bond);
}
.liste .item:first-child { border-top: 0; }
.liste .item.ouvrable { cursor: pointer; border-radius: var(--r-s); }
.liste .item.ouvrable:hover { background: var(--surface-2); }
.liste .quand { font-weight: 600; min-width: 46px; }
.liste .qui { flex: 1; min-width: 0; }
.liste .qui strong { display: block; font-weight: 600; }
.liste .qui .detail { font-size: var(--t-legende); color: var(--encre-2); margin-top: 2px; }
.liste .fin { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* Retour visuel d'une action reussie : la ligne s'eclaire brievement. */
@keyframes eclair {
  from { background: var(--olive-fond); }
  to { background: transparent; }
}
.liste .item.fait { animation: eclair .5s ease-out; }

/* --- ecran de service : lisible a deux metres ----------------------------- */

.service-tete {
  background: var(--ardoise);
  color: #fff;
  border-radius: var(--r-l);
  padding: 26px 28px;
}
.service-tete .rang {
  font-size: var(--t-legende);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #99a0ab;
}
.service-tete .titre {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.service-tete .numero { font-size: 52px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.service-tete .ou { font-size: 34px; font-weight: 600; letter-spacing: -.02em; color: #e8e9eb; }
.service-tete .depuis { margin-left: auto; font-size: var(--t-texte); color: #99a0ab; }

.service-articles { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.service-articles .article {
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-size: 24px;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ardoise-trait);
}
.service-articles .article:last-child { border-bottom: 0; padding-bottom: 0; }
.service-articles .qte {
  min-width: 46px;
  color: var(--braise);
  font-weight: 700;
}
.service-articles .note-client {
  font-size: var(--t-texte);
  font-weight: 400;
  color: #c9ced6;
  background: var(--ardoise-clair);
  border-radius: var(--r-s);
  padding: 10px 14px;
}
.service-tete .gestes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.service-tete .gestes button { padding: 13px 22px; font-size: 17px; }

.file-service { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.file-service .suivante {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-m);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color var(--bond), transform .08s ease;
}
.file-service .suivante:hover { border-color: var(--encre-3); }
.file-service .suivante .entete-suivante { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.file-service .suivante .num { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.file-service .suivante .table { font-size: var(--t-texte); font-weight: 600; color: var(--encre-2); }
.file-service .suivante .contenu { margin-top: 8px; font-size: var(--t-legende); color: var(--encre-2); line-height: 1.6; }

@media (max-width: 860px) {
  .service-tete { padding: 20px; }
  .service-tete .numero { font-size: 40px; }
  .service-tete .ou { font-size: 26px; }
  .service-articles .article { font-size: 20px; }
  .service-tete .gestes button { width: 100%; }
  .file-service { grid-template-columns: 1fr; }
}

/* --- barre d'une liste ---------------------------------------------------- */

.barre-liste { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.segment {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--trait-fort);
  border-radius: var(--r-s);
  padding: 3px;
  gap: 3px;
}
.segment button {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: var(--t-legende);
  font-weight: 500;
  color: var(--encre-2);
  transition: background var(--bond), color var(--bond);
}
.segment button:hover { background: var(--surface-2); }
.segment button[aria-pressed="true"] { background: var(--encre); color: #fff; }

.filtres { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); margin-bottom: 20px; }
.groupe-filtre { border: 1px solid var(--trait); border-radius: var(--r-s); background: var(--surface); }
.groupe-filtre summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: var(--t-legende);
  font-weight: 500;
}
.groupe-filtre summary::-webkit-details-marker { display: none; }
.groupe-filtre summary .chev { transition: transform var(--bond); color: var(--encre-2); }
.groupe-filtre[open] summary .chev { transform: rotate(180deg); }
.groupe-filtre .options { padding: 0 13px 12px; display: grid; gap: 9px; }
.groupe-filtre .options label { margin: 0; font-weight: 400; color: var(--encre); font-size: var(--t-legende); }

.aide { font-size: var(--t-legende); color: var(--encre-2); margin: 0 0 14px; }

/* --- controles ------------------------------------------------------------ */

button, .bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-weight: 500;
  border-radius: var(--r-s);
  border: 1px solid var(--trait-fort);
  background: var(--surface);
  color: var(--encre);
  padding: 9px 15px;
  cursor: pointer;
  transition: background var(--bond), border-color var(--bond), transform .08s ease, opacity var(--bond);
}
button:hover { background: var(--surface-2); border-color: var(--encre-3); }
button:active { transform: translateY(1px); }

/* L'action principale porte l'accent. Une seule par ecran. */
button.plein { background: var(--braise); border-color: var(--braise); color: #fff; font-weight: 600; }
button.plein:hover { background: var(--braise-fonce); border-color: var(--braise-fonce); }
button.sombre { background: var(--encre); border-color: var(--encre); color: #fff; }
button.sombre:hover { background: #2a2e36; }
button.discret { border-color: transparent; background: transparent; color: var(--encre-2); }
button.discret:hover { background: rgba(0, 0, 0, .04); color: var(--encre); }
button.rouge { color: var(--braise); }
button.petit { padding: 6px 12px; font-size: var(--t-legende); }
button:disabled { opacity: .5; cursor: progress; }
.side button.discret { color: #a2a8b2; }
.side button.discret:hover { background: var(--ardoise-clair); color: #fff; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--trait-fort);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--encre);
  transition: border-color var(--bond);
}
input:hover, select:hover, textarea:hover { border-color: var(--encre-3); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--braise); }
label { display: block; font-size: var(--t-legende); font-weight: 500; color: var(--encre-2); margin-bottom: 6px; }
.champ { margin-bottom: 14px; }
.champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 14px; }
.coche { display: flex; align-items: center; gap: 9px; margin: 0; font-size: var(--t-texte); color: var(--encre); font-weight: 400; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%2361656e' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* --- tableaux (detail seulement, jamais en premier ecran) ----------------- */

table { width: 100%; border-collapse: collapse; font-size: var(--t-texte); }
th {
  text-align: left;
  font-size: var(--t-legende);
  font-weight: 500;
  color: var(--encre-2);
  padding: 0 10px 10px;
  white-space: nowrap;
}
td { padding: 11px 10px; border-top: 1px solid var(--trait); vertical-align: middle; }
.nb { text-align: right; }
.mini { font-size: var(--t-legende); }
.discret-txt { color: var(--encre-2); }
.mono { font-weight: 500; }

/* --- pastilles de statut : aplats legers ---------------------------------- */

.pastille {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-legende);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--trait);
  background: var(--surface-2);
  color: var(--encre-2);
  white-space: nowrap;
}
.pastille.ok { color: var(--olive); border-color: #cfe2d7; background: var(--olive-fond); }
.pastille.attente { color: var(--ambre); border-color: #edddb9; background: var(--ambre-fond); }
.pastille.urgent { color: var(--braise); border-color: #eecfc8; background: var(--braise-fond); }
.pastille .point { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* --- alertes -------------------------------------------------------------- */

.avis {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--r-s);
  font-size: var(--t-texte);
  border: 1px solid #edddb9;
  background: var(--ambre-fond);
  color: #6f4e0e;
}
.avis.urgent { border-color: #eecfc8; background: var(--braise-fond); color: #97331f; }
.avis svg { width: 18px; height: 18px; flex: none; }
.avis .bouton-avis { margin-left: auto; }

/* --- etats vides : une invitation, jamais un vide silencieux -------------- */

.vide-bloc { padding: 38px 20px; text-align: center; }
.vide-bloc svg { width: 26px; height: 26px; color: var(--encre-3); }
.vide-bloc p { margin: 12px 0 0; color: var(--encre-2); }
.vide-bloc .action { margin-top: 16px; }

/* --- squelettes de chargement --------------------------------------------- */

@keyframes respire { 50% { opacity: .45; } }
.sq { background: var(--trait); border-radius: 6px; height: 13px; animation: respire 1.4s ease-in-out infinite; }
.sq.titre { height: 24px; width: 220px; }
.sq.carte { height: 88px; border-radius: var(--r-m); }
.squelette-item { display: flex; align-items: center; gap: 16px; padding: 15px 4px; border-top: 1px solid var(--trait); }
.squelette-item:first-child { border-top: 0; }

/* --- tiroir --------------------------------------------------------------- */

.voile {
  position: fixed;
  inset: 0;
  background: rgba(22, 24, 29, .4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--bond);
  z-index: 20;
}
.voile.ouvert { opacity: 1; pointer-events: auto; }
.tiroir {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(540px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--trait);
  padding: 24px 26px 70px;
  overflow-y: auto;
  z-index: 21;
  transform: translateX(100%);
  transition: transform .24s cubic-bezier(.32, .72, 0, 1);
  box-shadow: var(--ombre-forte);
}
.tiroir.ouvert { transform: none; }
.tiroir-tete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--trait);
  margin-bottom: 20px;
}

/* --- connexion ------------------------------------------------------------ */

.accueil-connexion {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1100px 520px at 50% -10%, #fff 0%, transparent 60%), var(--papier);
}

/* --- graphe --------------------------------------------------------------- */

.barres { display: flex; align-items: flex-end; gap: 5px; height: 92px; }
.barres div { flex: 1; background: var(--ardoise); border-radius: 3px 3px 0 0; min-height: 3px; opacity: .8; transition: opacity var(--bond); }
.barres div:hover { opacity: 1; }

/* --- notifications -------------------------------------------------------- */

#toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: var(--ardoise);
  color: #fff;
  padding: 11px 18px;
  border-radius: var(--r-s);
  font-size: var(--t-texte);
  box-shadow: var(--ombre-forte);
  animation: monte .2s ease;
}
.toast.erreur { background: var(--braise); }
@keyframes monte { from { opacity: 0; transform: translateY(8px); } }

/* --- tablette ------------------------------------------------------------- */

@media (min-width: 861px) and (max-width: 1180px) {
  :root { --nav: 184px; }
  main { padding: 24px 22px 70px; }
}

/* --- telephone : la barre passe en bas, a portee de pouce ----------------- */

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ardoise-trait);
    z-index: 15;
    overflow-x: auto;
  }
  .side .enseigne, .side .side-pied { display: none; }
  .nav { flex-direction: row; gap: 2px; width: 100%; }
  /* Sur telephone : toutes les cases a la meme largeur, assez larges pour que
     le libelle tienne en entier. La barre defile, ce n'est pas un probleme. */
  .nav button {
    position: relative;
    flex: 0 0 96px;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
    padding: 9px 6px;
    text-align: center;
    justify-content: center;
  }
  .nav button .long { display: none; }
  .nav button .court { display: block; white-space: nowrap; }
  .nav button svg { width: 21px; height: 21px; }
  .nav .compteur { position: absolute; top: 3px; right: 10px; margin: 0; }

  main { padding: 20px 15px 100px; }
  .entete { margin-bottom: 20px; }
  .tiroir { width: 100vw; border-left: 0; padding: 20px 16px 70px; }

  /* Doigts, pas souris. */
  button, .bouton { padding: 12px 17px; }
  button.petit { padding: 9px 14px; }
  input, select, textarea { padding: 12px; font-size: 16px; } /* 16px : pas de zoom iOS */
  .champs { grid-template-columns: 1fr; }
  .liste .item { flex-wrap: wrap; }
  .liste .fin { width: 100%; justify-content: flex-start; }
  td, th { padding-left: 6px; padding-right: 6px; }
  .bloc { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
