/* Bibliothèque produits 7G — même langage que le logiciel 7G, Sentinelle et l'Inventaire :
   bleu 7G, Lexend, surfaces douces, coins arrondis, clair / sombre. */
@font-face { font-family: "Lexend"; src: url(/polices/lexend.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
:root {
  --bleu: #0C3D63; --bleu-2: #15507F;
  --bg: #EEF2F6; --surface: #FFFFFF; --surface2: #F4F7FA; --ink: #0E2233; --ink-soft: #43566A; --muted: #6B7D90;
  --line: #DDE4EC; --line-2: #C9D4DE; --accent: #0C3D63; --accent-doux: #DCE8F2;
  --vert: #1F8A55; --vert-doux: #DDF3E6; --rouge: #C23A3E; --orange: #B8741A;
  --shadow: 0 1px 0 rgba(12,61,99,.04), 0 10px 24px -16px rgba(12,61,99,.30); --shadow-sm: 0 1px 2px rgba(12,61,99,.08);
  --shadow-lg: 0 2px 6px rgba(12,61,99,.10), 0 30px 60px -28px rgba(12,61,99,.45);
  --r: 12px; --f: "Lexend", "Segoe UI", system-ui, -apple-system, sans-serif; color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0A1724; --surface: #112233; --surface2: #0E1D2C; --ink: #E6EEF5; --ink-soft: #B6C4D2; --muted: #8FA2B4;
  --line: #1E3347; --line-2: #27405A; --accent: #8DC0EA; --accent-doux: #16304A; --vert: #4CC486; --vert-doux: #123325; --rouge: #F07378; --orange: #E3A450;
  --shadow: 0 1px 0 rgba(0,0,0,.25), 0 12px 26px -16px rgba(0,0,0,.7); --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 2px 6px rgba(0,0,0,.35), 0 30px 60px -28px rgba(0,0,0,.8);
  color-scheme: dark;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--f); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid #2E6DA4; outline-offset: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--accent); }
.btn.primaire { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.btn.primaire:hover { background: var(--bleu-2); }
.btn.danger { color: var(--rouge); border-color: transparent; background: none; }
.btn.danger:hover { border-color: var(--rouge); }
.btn.petit { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
input[type=text], input[type=search], input[type=password], input[type=url], input:not([type]), select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); outline: none; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }

/* connexion */
.connexion { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px;
  background: radial-gradient(120% 85% at 50% 0%, #17568A 0%, #0C3D63 45%, #061A2B 100%); color: #EAF2F9; }
.logo-grand { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(145deg, #3B7FC0, #0C3D63); box-shadow: 0 18px 36px -14px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.3); }
.logo-grand svg { width: 32px; height: 32px; stroke: #fff; }
.connexion h1 { margin: 6px 0 0; font-size: 24px; font-weight: 600; color: #fff; }
.connexion .sous { margin: -4px 0 8px; color: rgba(234,242,249,.7); font-size: 13px; }
.carte-connexion { width: 100%; max-width: 380px; display: grid; gap: 12px; padding: 22px; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 40px 80px -30px rgba(0,0,0,.55); }
.carte-connexion label { display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.erreur { color: var(--rouge); font-size: 13px; min-height: 1em; margin: 0; text-align: center; }
.aide { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }

/* en-tête */
.entete { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 18px;
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.marque { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(145deg, #3B7FC0, #0C3D63); }
.logo svg { stroke: #fff; width: 20px; height: 20px; }
.nom { display: grid; font-weight: 600; font-size: 15px; line-height: 1.1; }
.nom small { font-weight: 400; font-size: 11px; color: var(--muted); }
.onglets { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--line); }
.onglets a { padding: 6px 14px; border-radius: 7px; color: var(--muted); font-weight: 500; font-size: 13px; }
.onglets a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.espace { flex: 1; }
.moi { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bleu); color: #fff; font-weight: 600; font-size: 12.5px; cursor: pointer; }
html.dans-logiciel .moi { display: none; }

/* page */
.liste, .fiche { min-width: 0; }
.principal { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1320px; margin: 0 auto; padding: 16px 18px 110px; gap: 18px; }
.principal.avec-fiche { grid-template-columns: minmax(340px, 1fr) minmax(0, 1.15fr); }
.recherche { position: relative; }
.recherche svg { position: absolute; left: 14px; top: 13px; color: var(--muted); }
.recherche input { min-height: 46px; padding-left: 42px; font-size: 15px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.filtres { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; }
.puces { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; padding-bottom: 4px; scrollbar-width: thin; }
.puce { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px; cursor: pointer; color: var(--ink-soft); }
.puce i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.puce em { font-style: normal; color: var(--muted); font-size: 11.5px; }
.puce.on { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.puce.on em { color: rgba(255,255,255,.75); }
.bascule { flex: none; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; }
.bascule input { accent-color: var(--bleu); }
.compte { font-size: 12px; color: var(--muted); margin: 6px 2px 8px; }
.resultats { display: grid; gap: 6px; }
.prod { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 10px 12px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s; color: var(--ink); }
.prod:hover { border-color: var(--line-2); transform: translateY(-1px); }
.prod.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vignette { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, #526477) 16%, var(--surface)); color: var(--c, #526477); overflow: hidden; font-weight: 700; font-size: 12px; }
.vignette img { width: 100%; height: 100%; object-fit: cover; }
.prod b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.prod small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--surface2); color: var(--ink-soft); white-space: nowrap; }
.badge.stock { background: var(--vert-doux); color: var(--vert); }
.badge.epuise { background: color-mix(in srgb, var(--orange) 14%, var(--surface)); color: var(--orange); }
.plus { margin: 12px auto 0; display: flex; }
.vide { padding: 30px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r); }

/* fiche */
.fiche:empty { display: none; }
.fiche { position: sticky; top: 76px; align-self: start; max-height: calc(100dvh - 92px); overflow: auto; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); padding: 20px 22px; }
.fiche-tete { display: flex; gap: 16px; align-items: flex-start; }
.photo { width: 96px; height: 96px; border-radius: 14px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--c, #526477) 14%, var(--surface)); color: var(--c, #526477); overflow: hidden; font-weight: 700; font-size: 20px; }
.photo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.fiche h2 { margin: 2px 0 6px; font-size: 19px; font-weight: 600; line-height: 1.25; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.fermer { margin-left: auto; width: 34px; height: 34px; border-radius: 9px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none; }
.fermer:hover { background: var(--surface2); color: var(--ink); }
.bloc { margin-top: 18px; }
.bloc h3 { margin: 0 0 8px; font: 600 11px/1 var(--f); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.lignes { display: grid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lignes div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.lignes div:last-child { border-bottom: 0; }
.lignes span { color: var(--muted); font-size: 12.5px; }
.stock-carte.epuise { background: color-mix(in srgb, var(--orange) 14%, var(--surface)); color: var(--orange); }
.ajout-offre { margin-top: 10px; }
.ajout-offre summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: 13px; list-style: none; }
.ajout-offre summary::before { content: '+ '; }
.ajout-offre[open] summary::before { content: '− '; }
.stock-carte { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--vert-doux); color: var(--vert); font-weight: 500; }
table.offres { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.offres th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--muted); background: var(--surface2); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.offres td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.offres tr:last-child td { border-bottom: 0; }
table.offres td.prix { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pastille { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, #6366f1); margin-right: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.trace { margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.defil { overflow-x: auto; }

/* formulaire */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spec { display: grid; grid-template-columns: 1fr 1.4fr 34px; gap: 6px; }
.spec button { border: 0; background: none; color: var(--muted); cursor: pointer; }
.depot { display: flex; gap: 8px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
html.dans-logiciel .toast { bottom: 100px; }

@media (max-width: 900px) {
  .principal.avec-fiche { grid-template-columns: minmax(0, 1fr); }
  .principal.avec-fiche .liste { display: none; }
  .fiche { position: static; max-height: none; }
  .onglets a { padding: 6px 10px; }
  .nom small, #btn-nouveau span { display: none; }
}
@media (max-width: 560px) {
  .entete { gap: 8px; padding: 8px 12px; }
  .nom { display: none; }
  .onglets a { padding: 6px 9px; font-size: 12.5px; }
  .filtres { flex-wrap: wrap; }
  .nom { font-size: 14px; }
  .principal { padding: 12px 12px 100px; }
  .lignes div { grid-template-columns: 1fr; gap: 2px; }
  .grille2 { grid-template-columns: 1fr; }
  .fiche { padding: 16px; }
  .photo { width: 72px; height: 72px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
