/* Refonte UX — poste « accueil » : Aujourd'hui par poste, menu filtré, recherche et palette
   ⌘K, aide des raccourcis, bandeau d'essai discret, barre du bas sur téléphone.
   Palette marine et menthe existante (variables de identite.css) ; surcharges seulement. */

/* ---------- Menu filtré : le nombre d'entrées suit les droits ---------- */
header.v2-entete nav.v2-nav.ux-nav { grid-template-columns: repeat(var(--n, 6), minmax(0, 116px)); }
nav.v2-nav.ux-nav .v2-nav-indic { width: calc((100% - 8px) / var(--n, 6)); }

/* ---------- Bandeau d'essai : une ligne fine ---------- */
.demo.ux-bandeau { padding:3px var(--ap-e5); font-size:var(--ap-t-xs); line-height: 1.5; min-height: 0; }
.demo.ux-bandeau .v2-detail { display: none; }
.ux-pastille-essai { display: none; }

/* ---------- Recherche dans la barre ---------- */
header.v2-entete .ux-barre-recherche { position: relative; display: flex; align-items: center; }
.ux-barre-recherche .ux-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: hsl(var(--band-line) / .12); color: hsl(212 30% 82%); border-color: hsl(var(--band-line) / .2); }
.ux-barre-recherche input { padding-right: 46px; }
.ux-loupe { display: none; }
.ux-aide-bouton {
  flex-shrink: 0; width: 34px; height:var(--ap-h-ctrl); border-radius: 50%;
  border: 1px solid hsl(var(--band-line) / .2); background: hsl(var(--band-line) / .07);
  color: hsl(212 35% 86%); font-weight:var(--ap-g-chiffre); font-size:var(--ap-t-l);
}
.ux-aide-bouton:hover { color: #fff; background: hsl(var(--band-line) / .14); }
.ux-kbd {
  display: inline-block; min-width: 18px; padding: 1px 6px; border-radius:var(--ap-r-s);
  border: 1px solid hsl(var(--bord)); background: hsl(var(--background)); color: hsl(var(--muted-foreground));
  font-family: inherit; font-size:var(--ap-t-xs); font-weight:var(--ap-g-titre); line-height: 1.6; text-align: center; white-space: nowrap;
}

/* ---------- Palette ⌘K et aide ---------- */
.ux-palette-fond {
  position: fixed; inset: 0; z-index: 60; background: hsl(216 56% 11% / .42);
  display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.ux-palette {
  width: min(640px, 100%); max-height: 76vh; display: flex; flex-direction: column;
  background: hsl(var(--card)); border-radius:var(--ap-r-l); overflow: hidden;
  box-shadow:var(--ap-ombre-1);
}
.ux-palette-champ { display: flex; align-items: center; gap:var(--ap-e2); padding:var(--ap-e3) var(--ap-e3); border-bottom: 1px solid hsl(var(--bord)); }
.ux-palette-champ input { flex: 1; border: 0; outline: none; font-size:var(--ap-t-xl); padding: 6px 2px; background: transparent; color: hsl(var(--foreground)); }
.ux-palette-liste { overflow: auto; padding: 6px; }
.ux-palette-vide, .ux-palette-erreur { padding:var(--ap-e4) var(--ap-e3); margin: 0; color: hsl(var(--muted-foreground)); }
.ux-palette-erreur { color: hsl(var(--destructive-fort)); }
.ux-palette-ligne { border-radius:var(--ap-r-l); }
.ux-palette-ligne.actif { background: hsl(var(--choisi-fond)); box-shadow: inset 0 0 0 1px hsl(var(--choisi-cerne) / .6); }
.ux-palette-principal {
  width: 100%; display: flex; align-items: center; gap:var(--ap-e2); text-align: left;
  background: none; border: 0; padding:6px var(--ap-e2); color: inherit; border-radius:var(--ap-r-m);
}
.ux-palette-photo { width: 44px; height: 30px; border-radius:var(--ap-r-s); flex-shrink: 0; overflow: hidden; }
.ux-palette-etiquette { flex-shrink: 0; min-width: 74px; font-size:var(--ap-t-xs); font-weight:var(--ap-g-titre); color: hsl(var(--menthe-fort)); text-transform: uppercase; letter-spacing: .03em; }
.ux-palette-textes { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ux-palette-textes strong { font-size:var(--ap-t-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-palette-textes small { color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-palette-ligne .ux-entree { visibility: hidden; }
.ux-palette-ligne.actif .ux-entree { visibility: visible; }
.ux-palette-gestes { display: none; flex-wrap: wrap; gap: 6px; padding:0 var(--ap-e2) var(--ap-e2) 96px; }
.ux-palette-gestes.visible { display: flex; }
.ux-palette-gestes .btn { padding:5px var(--ap-e2); font-size:var(--ap-t-m); }
.ux-palette-pied { display: flex; gap:var(--ap-e4); margin: 0; padding:var(--ap-e2) var(--ap-e3); border-top: 1px solid hsl(var(--bord)); color: hsl(var(--muted-foreground)); font-size:var(--ap-t-s); }
.ux-palette-pied .ux-kbd { margin-right: 3px; }
.ux-aide .panel-title { padding:var(--ap-e3) var(--ap-e4); }
.ux-aide-liste { display: grid; grid-template-columns: max-content 1fr; gap:var(--ap-e2) var(--ap-e4); margin: 0; padding:var(--ap-e4); }
.ux-aide-liste dt { margin: 0; }
.ux-aide-liste dd { margin: 0; color: hsl(var(--foreground)); }

/* ---------- Aujourd'hui par poste ---------- */
.intro.ux-acc-tete { margin-bottom: 12px; align-items: center; }
.intro.ux-acc-tete h1 { margin: 0; font-size:var(--ap-t-titre); }
.ux-poste-apercu { display: inline-flex; align-items: center; gap:var(--ap-e2); font-size:var(--ap-t-m); color: hsl(var(--muted-foreground)); }
.ux-poste-apercu select { padding:7px var(--ap-e2); border-radius:var(--ap-r-s); border: 1px solid hsl(var(--bord)); background: hsl(var(--card)); }
.ux-sous-titre { margin: -4px 0 12px; color: hsl(var(--muted-foreground)); font-size:var(--ap-t-m); }

.ux-tuiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:var(--ap-e3); margin-bottom: 16px; }
.ux-tuile {
  display: flex; flex-direction: column; gap: 2px; padding:var(--ap-e3) var(--ap-e4); border-radius:var(--ap-r-l);
  background: hsl(var(--card)); border: 1px solid hsl(var(--bord)); color: hsl(var(--foreground));
  box-shadow:var(--ap-ombre-1); transition: border-color .15s, transform .15s;
}
.ux-tuile:hover { border-color: hsl(var(--choisi-cerne)); transform:none; }
.ux-tuile strong { font-size:var(--ap-t-chiffre); line-height: 1.1; font-variant-numeric: tabular-nums; }
.ux-tuile span { font-size:var(--ap-t-m); color: hsl(var(--muted-foreground)); font-weight:var(--ap-g-titre); }
.ux-tuile.ux-ton-rouge strong { color: hsl(var(--destructive-fort)); }
.ux-tuile.ux-ton-ambre strong { color: hsl(var(--warning-fort)); }
.ux-tuile.ux-ton-vert strong { color: hsl(var(--success-fort)); }

.ux-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:var(--ap-e3); align-items: start; }
/* Titre de section et « Tout voir » sur une ligne, même en 390 px. */
.ux-section .panel-title { gap:var(--ap-e2); }
.ux-section h2 { min-width: 0; flex: 1; }
.ux-tout-voir { flex-shrink: 0; white-space: nowrap; }
.ux-section .panel-title { padding:var(--ap-e2) var(--ap-e4); }
.ux-section h2 { font-size:var(--ap-t-l); display: flex; align-items: center; gap:var(--ap-e2); }
.ux-compte { font-size:var(--ap-t-s); font-weight:var(--ap-g-titre); padding:1px var(--ap-e2); border-radius:var(--ap-r-l); background: hsl(var(--background)); color: hsl(var(--muted-foreground)); }
.ux-tout-voir { padding:5px var(--ap-e2); font-size:var(--ap-t-s); }
.ux-vide { margin: 0; padding:var(--ap-e3) var(--ap-e4); color: hsl(var(--muted-foreground)); font-size:var(--ap-t-m); }
.ux-lignes { display: flex; flex-direction: column; }
.ux-ligne { display: flex; align-items: center; gap:var(--ap-e2); padding:var(--ap-e2) var(--ap-e3) var(--ap-e2) var(--ap-e3); border-top:1px solid hsl(var(--ap-trait)); border-left: 3px solid transparent; }
.ux-ligne:first-child { border-top: 0; }
.ux-ligne.ux-ton-rouge { border-left-color: hsl(var(--destructive)); }
.ux-ligne.ux-ton-ambre { border-left-color: hsl(var(--warning)); }
.ux-ligne.ux-ton-vert { border-left-color: hsl(var(--success)); }
.ux-ligne-corps { flex: 1; min-width: 0; display: flex; align-items: center; gap:var(--ap-e2); color: inherit; }
.ux-ligne-photo { width: 56px; height: 40px; border-radius:var(--ap-r-s); flex-shrink: 0; overflow: hidden; }
.ux-ligne-puce { width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--bord)); flex-shrink: 0; margin: 0 4px; }
.ux-ligne-textes { min-width: 0; display: flex; flex-direction: column; }
.ux-ligne-textes strong { font-size:var(--ap-t-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-ligne-textes small { font-size:var(--ap-t-s); color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-ligne-quand { flex-shrink: 0; font-size:var(--ap-t-s); font-weight:var(--ap-g-titre); color: hsl(var(--muted-foreground)); white-space: nowrap; }
.ux-ton-rouge .ux-ligne-quand { color: hsl(var(--destructive-fort)); }
.ux-ton-ambre .ux-ligne-quand { color: hsl(var(--warning-fort)); }
.ux-geste { flex-shrink: 0; padding:6px var(--ap-e2); font-size:var(--ap-t-m); }

/* ---------- Barre du bas (téléphone) ---------- */
.ux-barre-bas { display: none; }
.ux-plus-fond { position: fixed; inset: 0; z-index: 55; background: hsl(216 56% 11% / .35); display: flex; align-items: flex-end; }
.ux-plus { width: 100%; background: hsl(var(--card)); border-radius:var(--ap-r-l) var(--ap-r-l) 0 0; padding: 14px 16px calc(78px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap:var(--ap-e2); }
.ux-plus-liens { display: grid; grid-template-columns: 1fr 1fr; gap:var(--ap-e2); }
.ux-plus .btn { justify-content: center; }
.ux-plus .ux-icone { width: 18px; height: 18px; }
.ux-plus-session { margin: 0; font-size:var(--ap-t-s); color: hsl(var(--muted-foreground)); text-align: center; }
.ux-icone { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 1100px) {
  .ux-sections { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  /* Barre du haut ramenée à 56 px : marque, garage, loupe, aide, pastille d'essai. */
  header.v2-entete { min-height: 56px; height: 56px; padding: 0 12px; gap: 8px; flex-wrap: nowrap; }
  header.v2-entete nav.v2-nav.ux-nav { display: none; }
  header.v2-entete .ux-barre-recherche { display: none; }
  .brand.v2-marque .v2-marque-texte { display: none; }
  .v2-garage-actif { min-width: 0; flex: 1; }
  .v2-garage-actif .v2-garage-sous { display: none; }
  .v2-garage-actif .v2-garage-nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .ux-loupe {
    display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; margin-left: auto;
    border-radius:var(--ap-r-m); border: 1px solid hsl(var(--band-line) / .2); background: hsl(var(--band-line) / .08);
    position: relative;
  }
  .ux-loupe span { width: 14px; height: 14px; border: 2px solid hsl(212 35% 86%); border-radius: 50%; position: relative; margin: -3px 0 0 -3px; }
  .ux-loupe span::after { content: ""; position: absolute; width: 7px; height: 2px; background: hsl(212 35% 86%); right: -6px; bottom: -3px; transform: rotate(45deg); border-radius: 2px; }
  .ux-aide-bouton { display: none; }
  .ux-pastille-essai {
    display: inline-block; flex-shrink: 0; font-size: 10px; font-weight:var(--ap-g-titre); letter-spacing: .03em;
    padding: 3px 7px; border-radius:var(--ap-r-l); background: hsl(var(--menthe) / .2); color: hsl(var(--menthe));
  }
  .ux-pastille-essai.serveur { background: hsl(152 52% 60% / .22); color: hsl(152 60% 78%); }
  .demo.ux-bandeau { display: none; }

  .ux-barre-bas {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 57;
    background: hsl(var(--sport-marine-bas)); border-top: 1px solid hsl(var(--band-line) / .1);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .ux-barre-bas a, .ux-barre-bas button {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; border: 0; background: none; border-radius:var(--ap-r-s);
    color: hsl(212 30% 76%); font-size:var(--ap-t-xs); font-weight:var(--ap-g-titre);
  }
  .ux-barre-bas span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .ux-barre-bas a.active, .ux-barre-bas button.active { color: #fff; background: hsl(var(--band-line) / .08); }
  .ux-barre-bas a.active .ux-icone { stroke: hsl(var(--menthe)); }
  main.page { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

  .ux-palette-fond { padding: 8px; align-items: flex-start; }
  .ux-palette { max-height: calc(100vh - 16px); }
  .ux-palette-gestes { padding-left: 10px; }
  .ux-palette-etiquette, .ux-palette-ligne .ux-entree, .ux-palette-ligne.actif .ux-entree { display: none; }
  .ux-palette-pied { display: none; }

  .intro.ux-acc-tete h1 { font-size:var(--ap-t-titre); }
  .ux-tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .ux-tuile { padding: 9px 12px; }
  .ux-tuile strong { font-size:var(--ap-t-titre); }
  .ux-ligne { flex-wrap: wrap; padding: 8px 10px; }
  .ux-ligne-corps { flex-basis: 100%; }
  .ux-ligne-quand { margin-left: 66px; }
  .ux-geste { margin-left: auto; }
}
