:root {
  --bg: #f4f5f7; --carte: #fff; --texte: #14213d; --doux: #5b6577; --bord: #e3e6ec;
  --bleu: #0b5fff; --bleu-fond: #e8f0ff; --vert: #1a7f37; --vert-fond: #e3f6e8; --rouge: #c0392b; --rouge-fond: #fdecea;
  --or: #b45309; --or-fond: #fff3cd; --gris-fond: #eceff4; --rayon: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1420; --carte: #172033; --texte: #eef1f7; --doux: #9aa6bd; --bord: #26334d;
    --bleu: #5b93ff; --bleu-fond: #1a2b52; --vert: #4cc26b; --vert-fond: #153324; --rouge: #ff7b6b; --rouge-fond: #3a1a18;
    --or: #f5b34a; --or-fond: #3a2d0d; --gris-fond: #202c44;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--texte); font: 16px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
body.simple { padding: 16px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 0 0 10px; }
a { color: var(--bleu); }
.contenu { max-width: 760px; margin: 0 auto; padding: 12px 16px 24px; }
.haut { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--bord); padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; }
.haut h1 { margin: 0; font-size: 19px; flex: 1; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; margin: 0 0 12px; }
.cliquable { display: block; color: inherit; text-decoration: none; }
.carte.cliquable:active, a.cliquable:active { background: var(--gris-fond); }
.ligne { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entre { justify-content: space-between; }
.doux { color: var(--doux); font-size: 14px; }
.gras { font-weight: 700; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--gris-fond); color: var(--doux); white-space: nowrap; }
.badge.nouveau { background: var(--bleu-fond); color: var(--bleu); }
.badge.gagne { background: var(--vert-fond); color: var(--vert); }
.badge.perdu, .badge.spam { background: var(--rouge-fond); color: var(--rouge); }
.badge.gros { background: var(--or-fond); color: var(--or); }
.badge.devis, .badge.envoye, .badge.contacte, .badge.qualifie { background: var(--bleu-fond); color: var(--bleu); }
button, .bouton { font: inherit; font-weight: 700; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--bord); background: var(--carte); color: var(--texte); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
button.primaire, .bouton.primaire { background: var(--bleu); border-color: var(--bleu); color: #fff; }
button.vert, .bouton.vert { background: var(--vert); border-color: var(--vert); color: #fff; }
button.danger { color: var(--rouge); border-color: var(--rouge); }
button.petit, .bouton.petit { min-height: 38px; padding: 0 12px; font-size: 14px; }
button:disabled { opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }
input, select, textarea { font: inherit; width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--bord); background: var(--carte); color: var(--texte); }
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--doux); margin: 10px 0 4px; }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grille3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grille-statuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.grille-statuts button.actif { background: var(--bleu); color: #fff; border-color: var(--bleu); }
.actions3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: var(--carte); border-top: 1px solid var(--bord); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--doux); font-size: 12px; font-weight: 700; gap: 2px; position: relative; }
.nav a.actif { color: var(--bleu); }
.nav a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pastille { position: absolute; top: 6px; left: calc(50% + 6px); background: var(--rouge); color: #fff; font-size: 11px; font-weight: 800; min-width: 19px; height: 19px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.tuile { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 12px; }
.tuile b { display: block; font-size: 26px; line-height: 1.1; }
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 6px 10px; font-size: 15px; }
.kv dt { color: var(--doux); } .kv dd { margin: 0; word-break: break-word; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--bord); cursor: zoom-in; }
.zoom { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 20; display: flex; align-items: center; justify-content: center; }
.zoom img { max-width: 100%; max-height: 100%; }
.barres { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin: 8px 0 4px; }
.barres div { flex: 1; background: var(--bleu); border-radius: 5px 5px 0 0; min-height: 2px; position: relative; }
.barres span { position: absolute; top: -17px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--doux); }
.legende-barres { display: flex; gap: 4px; font-size: 10px; color: var(--doux); }
.legende-barres span { flex: 1; text-align: center; overflow: hidden; }
.feuille { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 15; display: flex; align-items: flex-end; justify-content: center; }
.feuille > div { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.alerte { border-radius: 12px; padding: 12px; margin: 0 0 12px; font-weight: 600; }
.alerte.erreur { background: var(--rouge-fond); color: var(--rouge); }
.alerte.info { background: var(--bleu-fond); color: var(--bleu); }
.alerte.ok { background: var(--vert-fond); color: var(--vert); }
.centre { max-width: 420px; margin: 0 auto; padding: 48px 16px; }
.liste-hist { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.liste-hist li { padding: 6px 0; border-bottom: 1px solid var(--bord); }
.note { background: var(--gris-fond); border-radius: 12px; padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; word-break: break-word; }
.filtres { display: grid; gap: 8px; }
details > summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
code, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }
@media (min-width: 720px) { .actions3 button, .actions3 .bouton { min-height: 52px; } .tuiles { grid-template-columns: repeat(4, 1fr); } }
