/* Atelia — base : reset, typographie, coque (grille app / sidebar / topbar / contenu) */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--cream);
  accent-color: var(--blue);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
.num, .val, td .n { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Bandeau démonstration — FIGÉ en haut, toujours visible (sticky, ne disparaît pas au scroll). */
.demobar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px; justify-content: center;
  height: var(--demobar-h);
  background: var(--navy); color: #fff; font-size: 12px; font-weight: 600;
  padding: 0 14px; letter-spacing: .2px;
}
.demobar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange-bd); box-shadow: 0 0 0 3px rgba(150,101,15,.25); }
.demobar b { font-weight: 800; }
.demobar-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 16px; }
.demobar .demobar-x { opacity: .75; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.demobar .demobar-x:hover { opacity: 1; }
.demobar .demobar-x:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }
.demobar .fb-count { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px; background: var(--orange-bd); color: #16243F; font-size: 10.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
/* U-05 (Saleh, 23/09) · app du restaurateur : le bandeau ne dit plus « Démonstration … » (sur
   toutes ses pages) ; il ne garde que ses commandes, discrètes, sur fond clair. Le Réseau et le
   back-office gardent leur bandeau. */
#root:has(.fr-root) > .demobar { background: var(--surface); color: var(--muted); border-bottom: 1px solid var(--line); font-weight: 500; }
#root:has(.fr-root) > .demobar .dot, #root:has(.fr-root) > .demobar .demobar-label { display: none; }
#root:has(.fr-root) > .demobar .demobar-x:focus-visible { outline-color: var(--navy); }

/* ---- Coque desktop (seryz / franchiseur) ---- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }

.side {
  position: sticky; top: var(--demobar-h); align-self: start; height: calc(100vh - var(--demobar-h));
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 2px 8px 16px; }
.brand-word { font-family: 'Atelia Wordmark', var(--font); font-size: 30px; line-height: 1; letter-spacing: -.5px; display: inline-flex; }
.brand-word .w-ate { color: var(--navy); }
.brand-word .w-lia { color: var(--brand-green); }
.brand .by { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 4px; letter-spacing: .1px; }

/* Sélecteur de persona */
.persona { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 4px; margin: 2px 4px 12px; }
.persona button { border: 0; background: transparent; color: var(--ink-2); font-size: 11.5px; font-weight: 700; padding: 7px 4px; border-radius: 8px; cursor: pointer; }
.persona button.on { background: var(--navy); color: #fff; }

/* Sélecteur de rôle interne (console seryz) */
.rolebar { margin: 0 4px 12px; }
.rolebar .rl-lb { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .9px; color: var(--muted); margin: 0 4px 6px; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }   /* 2×2 (retour Saleh, au lieu de 3+1) */
.roles button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 11.5px; font-weight: 700; padding: 7px 9px; border-radius: 10px; cursor: pointer; text-align: center; }
.roles button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Navigation */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-2); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.nav a.on svg { color: var(--accent); }
.nav a svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.nav a .badge { margin-left: auto; background: var(--rouge); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; }
.nav a.on .badge { background: var(--rouge); color: #fff; }
/* Corrections 27/09 · UX-console-autres-15 : sur un écran bas (1280×900), le menu de la console tient
   jusqu'à l'utilisatrice sans défiler : entrées et intertitres resserrés (≈ 110 px gagnés). */
@media (min-width: 901px) and (max-height: 960px) {
  [data-surface="console"] .nav a { padding: 6px 10px; }
  [data-surface="console"] .nav-label { padding: 8px 10px 4px; }
}

.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 2px; border-top: 1px solid var(--line-2); }
.side-foot .av { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 800; display: grid; place-items: center; flex: none; }
.side-foot .who b { display: block; font-size: 13px; font-weight: 700; color: var(--navy); }
.side-foot .who span { font-size: 11px; color: var(--muted); }

/* Zone principale */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: var(--demobar-h); z-index: 5; height: var(--topbar-h);
  background: var(--cream); /* opaque : pas de backdrop-filter (fluidité au défilement) */
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 28px;
}
.topbar .search { position: relative; flex: 1; max-width: 320px; }
.topbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.topbar .search input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px 8px 32px; font-size: 13px; color: var(--ink); }
.topbar .spacer { flex: 1; }

.selctl { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.selctl .cd { width: 7px; height: 7px; border-radius: 50%; background: var(--vert); }
.selctl svg { width: 14px; height: 14px; color: var(--muted); }

.content { padding: var(--content-pad); overflow: auto; }

/* En-tête de page */
.h-row { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.h-row h1 { font-size: 23px; font-weight: 800; letter-spacing: -.5px; color: var(--navy); margin: 0; }
.h-row .sub { font-size: 13px; color: var(--muted); }
.h-row .h-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Responsive : la sidebar devient une barre horizontale qui wrap (jamais de scroll qui cache) */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: column; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label { width: 100%; padding: 8px 10px 2px; }
  .nav a { flex: 0 0 auto; }
  .side-foot { border-top: 0; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
}

/* Fluidité : n'animer que transform/opacity ; couper toute animation si l'OS le demande. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
