/* 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 28px; font-size: 11px; 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: 34px; border-radius: 50%;
  border: 1px solid hsl(var(--band-line) / .2); background: hsl(var(--band-line) / .07);
  color: hsl(212 35% 86%); font-weight: 750; font-size: 15px;
}
.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: 5px;
  border: 1px solid hsl(var(--bord)); background: hsl(var(--background)); color: hsl(var(--muted-foreground));
  font-family: inherit; font-size: 11px; font-weight: 600; 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: 14px; overflow: hidden;
  box-shadow: 0 24px 70px -20px hsl(216 70% 10% / .55), 0 0 0 1px hsl(var(--bord));
}
.ux-palette-champ { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid hsl(var(--bord)); }
.ux-palette-champ input { flex: 1; border: 0; outline: none; font-size: 17px; padding: 6px 2px; background: transparent; color: hsl(var(--foreground)); }
.ux-palette-liste { overflow: auto; padding: 6px; }
.ux-palette-vide, .ux-palette-erreur { padding: 18px 14px; margin: 0; color: hsl(var(--muted-foreground)); }
.ux-palette-erreur { color: hsl(var(--destructive-fort)); }
.ux-palette-ligne { border-radius: 10px; }
.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: 10px; text-align: left;
  background: none; border: 0; padding: 8px 10px; color: inherit; border-radius: 10px;
}
.ux-palette-photo { width: 52px; height: 36px; border-radius: 6px; flex-shrink: 0; overflow: hidden; }
.ux-palette-etiquette { flex-shrink: 0; min-width: 74px; font-size: 11px; font-weight: 700; 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: 14px; 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 10px 10px 96px; }
.ux-palette-gestes.visible { display: flex; }
.ux-palette-gestes .btn { padding: 5px 10px; font-size: 13px; }
.ux-palette-pied { display: flex; gap: 16px; margin: 0; padding: 8px 14px; border-top: 1px solid hsl(var(--bord)); color: hsl(var(--muted-foreground)); font-size: 12px; }
.ux-palette-pied .ux-kbd { margin-right: 3px; }
.ux-aide .panel-title { padding: 14px 16px; }
.ux-aide-liste { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 0; padding: 16px; }
.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: 24px; }
.ux-poste-apercu { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: hsl(var(--muted-foreground)); }
.ux-poste-apercu select { padding: 7px 10px; border-radius: 8px; border: 1px solid hsl(var(--bord)); background: hsl(var(--card)); }
.ux-sous-titre { margin: -4px 0 12px; color: hsl(var(--muted-foreground)); font-size: 13px; }

.ux-tuiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ux-tuile {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 12px;
  background: hsl(var(--card)); border: 1px solid hsl(var(--bord)); color: hsl(var(--foreground));
  box-shadow: 0 3px 12px #163d6610; transition: border-color .15s, transform .15s;
}
.ux-tuile:hover { border-color: hsl(var(--choisi-cerne)); transform: translateY(-1px); }
.ux-tuile strong { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ux-tuile span { font-size: 13px; color: hsl(var(--muted-foreground)); font-weight: 600; }
.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: 14px; align-items: start; }
/* Titre de section et « Tout voir » sur une ligne, même en 390 px. */
.ux-section .panel-title { gap: 10px; }
.ux-section h2 { min-width: 0; flex: 1; }
.ux-tout-voir { flex-shrink: 0; white-space: nowrap; }
.ux-section .panel-title { padding: 11px 16px; }
.ux-section h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ux-compte { font-size: 12px; font-weight: 750; padding: 1px 8px; border-radius: 10px; background: hsl(var(--background)); color: hsl(var(--muted-foreground)); }
.ux-tout-voir { padding: 5px 10px; font-size: 12px; }
.ux-vide { margin: 0; padding: 12px 16px; color: hsl(var(--muted-foreground)); font-size: 13px; }
.ux-lignes { display: flex; flex-direction: column; }
.ux-ligne { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 14px; border-top: 1px solid #edf1f6; 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: 10px; color: inherit; }
.ux-ligne-photo { width: 56px; height: 40px; border-radius: 7px; 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: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-ligne-textes small { font-size: 12px; color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-ligne-quand { flex-shrink: 0; font-size: 12px; font-weight: 650; 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 11px; font-size: 13px; }

/* ---------- 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: 16px 16px 0 0; padding: 14px 16px calc(78px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.ux-plus-liens { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ux-plus .btn { justify-content: center; }
.ux-plus .ux-icone { width: 18px; height: 18px; }
.ux-plus-session { margin: 0; font-size: 12px; 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: 10px; 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: 750; letter-spacing: .03em;
    padding: 3px 7px; border-radius: 10px; 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: 10px;
    color: hsl(212 30% 76%); font-size: 11px; font-weight: 650;
  }
  .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: 20px; }
  .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: 22px; }
  .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; }
}
