/* OMNIBOX (lot V3-1) — le champ de recherche qui remplace les listes déroulantes d'entités.
   Aucune dépendance : ni CDN, ni police tierce, ni variable inventée. Tout vient des jetons
   d'app.css.

   COULEURS ET ENSEIGNES SOMBRES — les libellés d'options n'utilisent JAMAIS le vert de marque
   comme couleur de TEXTE : sur un fond sombre il devient illisible (règle du parc). Les jetons
   locaux ci-dessous se redéfinissent d'un bloc sur `.omni.sur-sombre`, et le composant suit.

   360 px — la liste occupe toute la largeur du champ, les libellés PASSENT À LA LIGNE au lieu
   d'être rognés : sur un téléphone, « Cylindre Fichet 787 Z 30x40 » coupé à « Cylindre Fic… »
   ne permet pas de choisir (verrou G7). */

.omni {
  --omni-fg: var(--ink);
  --omni-fg-mut: var(--mut);
  --omni-bg: var(--card);
  --omni-bord: var(--line-2);
  --omni-actif: var(--soft);
  --omni-accent: var(--brand-ink);
  position: relative;
  display: block;
  max-width: 100%;
}
.omni.sur-sombre {
  --omni-fg: #fff;
  --omni-fg-mut: var(--side-mut);
  --omni-bg: #23262d;
  --omni-bord: #3a3f48;
  --omni-actif: #2f343d;
  --omni-accent: #cfe08a;     /* vert CLAIR : sur fond sombre, c'est le texte qui s'éclaircit */
}

.omni-champ { position: relative; display: flex; align-items: center; }
.omni-q {
  width: 100%; min-width: 0; padding: 9px 34px 9px 12px;
  border: 1px solid var(--omni-bord); border-radius: 8px;
  font: inherit; color: var(--omni-fg); background: var(--omni-bg);
}
.omni-q::placeholder { color: var(--omni-fg-mut); opacity: 1; }
.omni-q:focus-visible { outline: 2px solid var(--omni-fg); outline-offset: 1px; }
.omni-x {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border: none; background: none; cursor: pointer;
  color: var(--omni-fg-mut); font-size: 15px; line-height: 1; border-radius: 6px;
}
.omni-x:hover { color: var(--omni-fg); }

/* Liste des résultats : au-dessus de tout (les formulaires vivent dans des <dialog>). */
.omni-list {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px; list-style: none;
  background: var(--omni-bg); border: 1px solid var(--omni-bord); border-radius: 10px;
  box-shadow: 0 16px 34px -16px rgba(0, 0, 0, .35);
  max-height: min(58vh, 340px); overflow-y: auto;
}
.omni-list[hidden] { display: none; }
.omni-groupe {
  padding: 7px 10px 3px; font-size: 11px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: var(--omni-fg-mut);
}
.omni-opt {
  padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--omni-fg);
  display: block; overflow-wrap: anywhere;      /* on passe à la ligne, on ne rogne jamais */
}
.omni-opt .l { display: block; font-weight: 600; line-height: 1.35; }
.omni-opt .s { display: block; font-size: 12.5px; color: var(--omni-fg-mut); line-height: 1.35; }
.omni-opt[aria-selected="true"], .omni-opt:hover { background: var(--omni-actif); }
.omni-opt.neuf .l { color: var(--omni-accent); }
.omni-vide { padding: 10px; color: var(--omni-fg-mut); font-size: 13px; }

/* Ligne d'état : elle existe POUR LES LECTEURS D'ÉCRAN (aria-live), qui doivent entendre
   « 2 résultats » sans que le champ bouge. À l'œil elle reste invisible — un texte qui apparaît
   et disparaît sous le doigt décale la liste au moment où l'on vise une ligne (360 px). Seule
   une ERREUR s'affiche : là, il faut la lire. */
.omni-etat {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.omni-etat.err {
  position: static; width: auto; height: auto; margin: 4px 0 0; overflow: visible;
  clip: auto; white-space: normal; font-size: 12.5px; color: var(--err-ink); font-weight: 600;
}

.omni-noscript { font-size: 12.5px; color: var(--mut); margin-top: 4px; }
.omni-noscript a { color: var(--brand-ink); font-weight: 600; text-decoration: underline; }

/* Modale de création à la volée — reprend le gabarit des <dialog> du CRM. */
.omni-dlg { border: none; border-radius: 14px; padding: 0; max-width: 520px; width: 92vw;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .35); color: var(--ink); background: var(--card); }
.omni-dlg::backdrop { background: rgba(10, 12, 16, .45); }
.omni-dlg-hd { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line-3); font-weight: 700; }
.omni-dlg-x { border: none; background: none; font-size: 20px; cursor: pointer; line-height: 1; color: var(--mut); }
.omni-dlg form { padding: 16px 18px; }
.omni-dlg .f { margin-bottom: 12px; }
.omni-dlg label { display: block; font-size: 12px; font-weight: 600; color: var(--mut); margin-bottom: 4px; }
.omni-dlg input, .omni-dlg select { width: 100%; padding: 9px 10px; border: 1px solid var(--line-4);
  border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
.omni-dlg .frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.omni-dlg .omni-dlg-err { color: var(--err-ink); font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.omni-dlg .omni-dlg-ok { background: var(--soft); border-radius: 9px; padding: 10px 12px;
  font-size: 13px; margin-bottom: 10px; }
.omni-dlg-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.omni-dlg .coche { display: flex; align-items: flex-start; gap: 8px; font-weight: 400;
  color: var(--ink); font-size: 13px; }
.omni-dlg .coche input { width: auto; margin-top: 3px; }

@media (max-width: 560px) {
  .omni-dlg .frow { grid-template-columns: 1fr; }
  .omni-dlg { width: 96vw; }
}

/* Dispo lue au moment du choix, posée sous la ligne de devis : au comptoir, « 2 en boutique »
   se décide en écrivant la ligne, pas au moment d'encaisser. */
.l-dispo { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--mut); padding: 2px 0 4px; }

/* Barre du haut : l'omnibox prend la place que `.topsearch input` occupait, et sa ligne d'état
   reste lue par les lecteurs d'écran sans déformer une barre haute de 60 px. */
.omni-top { flex: 1; min-width: 0; max-width: 220px; }
.omni-top .omni-q { padding-top: 7px; padding-bottom: 7px; }
.omni-top .omni-list { min-width: 260px; right: auto; width: max(100%, 300px); }
@media (max-width: 820px) {
  .omni-top { max-width: none; }
  .omni-top .omni-list { width: 100%; min-width: 0; }
}

/* Formulaire de l'écran /recherche : plein écran sur téléphone, jamais deux champs serrés. */
.rech-form { display: flex; gap: 8px; margin-bottom: 16px; max-width: 560px; flex-wrap: wrap; }
.rech-form input { flex: 1 1 220px; min-width: 0; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: 8px; font: inherit; }
