:root {
  --fond: #f8f3ea; --surface: #fffdf8; --surface-2: #f3ece0; --encre: #1f1b16; --doux: #6f665b; --trait: #e7dccb;
  --accent: #e8553a; --accent-doux: #fde3da; --vert: #1d8257; --vert-doux: #dcf1e5; --ambre: #b97b0c; --ambre-doux: #fbeccc;
  --gris: #948d84; --gris-doux: #ece7df; --ombre: 0 1px 2px rgba(60,40,10,.06), 0 6px 20px rgba(60,40,10,.06);
  --r: 14px; --titres: "Bricolage Grotesque", system-ui, sans-serif; --texte: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #15120e; --surface: #1f1b16; --surface-2: #29231c; --encre: #f3ece2; --doux: #a89e91; --trait: #3a3229;
    --accent: #ff7458; --accent-doux: #45231b; --vert: #5cc995; --vert-doux: #17352a; --ambre: #f0b54a; --ambre-doux: #3d2f14;
    --gris: #8a8379; --gris-doux: #2c2721; --ombre: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 15px/1.5 var(--texte); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--titres); letter-spacing: -0.01em; margin: 0 0 .6em; }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; margin-top: 1.2em; }
main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }
.discret { color: var(--doux); font-size: .88em; }
code { font-family: var(--mono); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* En-tête */
.entete { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 12px 20px;
  background: color-mix(in srgb, var(--fond) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--trait); }
.logo { display: flex; align-items: center; gap: 10px; font: 800 1.3rem var(--titres); text-decoration: none; }
.logo.grand { font-size: 2rem; justify-content: center; margin-bottom: 10px; }
.logo-tampon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff8ef;
  font-size: 1.15rem; transform: rotate(-8deg); box-shadow: 2px 2px 0 var(--encre); }
.onglets { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.onglets a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--doux); font-weight: 500; white-space: nowrap; }
.onglets a:hover { background: var(--surface-2); color: var(--encre); }
.onglets a.actif { background: var(--encre); color: var(--fond); }
.recherche input { width: 220px; }

/* Éléments de base */
input { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--trait); border-radius: 10px; padding: 9px 12px; width: 100%; min-width: 0; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--doux); font-weight: 500; flex: 1; }
label.large { flex: 2.4; } label.etroit { flex: .5; }
.bouton { font: 600 .92rem var(--texte); border: 1px solid var(--trait); background: var(--surface); color: var(--encre); padding: 9px 16px;
  border-radius: 10px; cursor: pointer; white-space: nowrap; transition: transform .1s, background .15s; }
.bouton:hover { background: var(--surface-2); } .bouton:active { transform: translateY(1px); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.principal:hover { filter: brightness(1.06); }
.bouton.discret-btn { color: var(--doux); }
.mini { font: 500 .82rem var(--texte); border: 1px solid var(--trait); background: var(--surface); color: var(--encre); padding: 5px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; }
.mini:hover { background: var(--surface-2); }
.lien-discret, .lien-danger { background: none; border: 0; color: var(--doux); font: inherit; font-size: .85rem; cursor: pointer; text-decoration: underline; padding: 0; }
.lien-danger { color: var(--accent); margin-top: 12px; }
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); padding: 18px; box-shadow: var(--ombre); }
.tag { font-size: .7rem; background: var(--gris-doux); color: var(--doux); padding: 1px 7px; border-radius: 999px; vertical-align: middle; font-weight: 600; }
.message { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; background: var(--vert-doux); color: var(--vert); font-weight: 500; }
.message.erreur { background: var(--accent-doux); color: var(--accent); }
.attention { color: var(--accent); }
.succes { color: var(--vert); font-weight: 600; margin: 6px 0; }
.conseil { background: var(--ambre-doux); color: var(--ambre); padding: 8px 12px; border-radius: 10px; font-size: .9rem; margin: 8px 0; }

/* Mises en page */
.bandeau { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.bandeau h1 { margin-bottom: 2px; } .bandeau p { margin: 0; }
.colonnes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.colonne h2 { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 2px solid var(--encre); }
.colonne > * + * { margin-top: 12px; }
.deux-colonnes { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 26px; margin-bottom: 30px; }
.deux-colonnes.egal { grid-template-columns: 1fr 1fr; }
.deux-colonnes aside > * + * { margin-top: 18px; }
.ligne { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.pile { display: flex; flex-direction: column; gap: 12px; }
.pile > .bouton { align-self: flex-start; }
.formulaire-ligne { margin-bottom: 24px; } .formulaire-ligne .ligne + .ligne { margin-top: 12px; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.titre-section { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.titre-section h2 { margin: 0; }
.etiquette { font-size: .78rem; color: var(--doux); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }

/* Boutons segmentés (à la place des menus déroulants) */
.segments { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.seg { border: 0; background: transparent; font: 500 .86rem var(--texte); color: var(--doux); padding: 6px 12px; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.seg:hover { color: var(--encre); }
.seg.actif, .segments.radio .seg:has(input:checked) { background: var(--surface); color: var(--encre); box-shadow: var(--ombre); font-weight: 600; }
.segments.radio input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; padding: 0; border: 0; }
.segments.radio .seg { flex-direction: row; }

/* Badges de fiabilité */
.badge { display: inline-block; font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.fiable { background: var(--vert-doux); color: var(--vert); }
.badge.douteux { background: var(--ambre-doux); color: var(--ambre); }
.badge.mort { background: var(--gris-doux); color: var(--gris); }

/* Tickets de code promo */
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 26px; }
.ticket { position: relative; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--ombre);
  border-left: 5px solid var(--gris); }
.ticket.fiable { border-left-color: var(--vert); } .ticket.douteux { border-left-color: var(--ambre); }
.ticket::before, .ticket::after { content: ""; position: absolute; left: -9px; width: 14px; height: 14px; border-radius: 50%; background: var(--fond); }
.ticket::before { top: 18px; } .ticket::after { bottom: 18px; }
.ticket-haut { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.ticket-marchand { font-weight: 700; font-family: var(--titres); text-decoration: none; }
.code { position: relative; display: block; width: 100%; font: 700 1.05rem var(--mono); letter-spacing: .06em; text-align: center; padding: 10px;
  background: var(--surface-2); border: 2px dashed var(--trait); border-radius: 10px; color: var(--encre); cursor: pointer; transition: border-color .15s; }
.code:hover { border-color: var(--accent); }
.code .copie { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 600 .68rem var(--texte); color: var(--doux); letter-spacing: 0; opacity: 0; transition: opacity .15s; }
.code:hover .copie { opacity: 1; }
.code.copie-ok { border-color: var(--vert); border-style: solid; }
.code.copie-ok .copie { opacity: 1; color: var(--vert); } .code.copie-ok .copie::after { content: " ✓"; }
.code.petit { font-size: .85rem; padding: 4px 8px; width: auto; display: inline-block; }
.ticket-titre { margin: 10px 0 6px; font-weight: 500; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .84rem; color: var(--doux); }
.pastille { background: var(--accent); color: #fff; font-weight: 700; padding: 1px 8px; border-radius: 6px; }
.ticket-pied { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: var(--doux); margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--trait); }
.retours { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: .8rem; color: var(--doux); }
.retours .lien { margin-left: auto; }
.retours { row-gap: 8px; }

/* Accueil */
.vente, .prevision { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--ombre); transition: transform .12s; }
.vente:hover, .prevision:hover, a.carte:hover { transform: translateY(-2px); }
.vente { border-top: 4px solid var(--accent); }
.vente-marchand { display: block; font: 700 .78rem var(--texte); text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.vente-titre { display: block; font-weight: 600; margin: 2px 0 4px; }
.prevision p { margin: 6px 0; }
.prevision-haut { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.confiance { font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--gris-doux); color: var(--doux); white-space: nowrap; }
.confiance.élevée { background: var(--vert-doux); color: var(--vert); }
.confiance.moyenne { background: var(--ambre-doux); color: var(--ambre); }
.alerte-prix { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.alerte-prix a { background: var(--vert-doux); color: var(--vert); padding: 12px 16px; border-radius: 12px; text-decoration: none; }
.vide { max-width: 640px; }

/* Marchands */
.grille-marchands { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.carte.marchand { display: flex; gap: 14px; align-items: center; text-decoration: none; transition: transform .12s; }
.carte.marchand.pause { opacity: .55; }
.monogramme { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--encre); color: var(--fond); font: 800 1.3rem var(--titres); }
.monogramme.grand { width: 60px; height: 60px; font-size: 1.7rem; border-radius: 16px; }
.compteurs { display: flex; gap: 6px; margin: 4px 0; }
.titre-marchand { display: flex; gap: 16px; align-items: center; }
.prevision-carte .gros, .gros { font-size: 1.08rem; font-weight: 500; margin: 8px 0 12px; }
.chiffres { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.chiffres div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.chiffres dt { font-size: .74rem; color: var(--doux); } .chiffres dd { margin: 0; font: 700 1.05rem var(--titres); }
.evenements { list-style: none; padding: 0; margin: 0; } .evenements li { padding: 6px 0; border-bottom: 1px dashed var(--trait); display: flex; flex-direction: column; }
.chemin { padding-left: 18px; margin: 6px 0 10px; } .chemin li { margin: 3px 0; }
details > summary { cursor: pointer; font-weight: 600; color: var(--doux); margin: 4px 0; }
details[open] > summary { margin-bottom: 12px; }

/* Listes et tableaux */
.liste { list-style: none; padding: 0; margin: 0; }
.liste li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--trait); }
.liste li > :first-child { flex: 1; }
.liste.compacte li { padding: 6px 0; font-size: .9rem; }
.liste li.passee { opacity: .55; }
.journal li.erreur span:nth-child(2) { color: var(--accent); }
.croix-form { display: inline; margin: 0; }
.croix { border: 0; background: transparent; color: var(--gris); font-size: 1.15rem; line-height: 1; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; opacity: .55; }
.croix:hover { opacity: 1; background: var(--accent-doux); color: var(--accent); }
.mini-form { display: flex; gap: 6px; margin-top: 8px; } .mini-form input { padding: 6px 10px; font-size: .88rem; }
.tableau { overflow-x: auto; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); padding: 10px 12px; border-bottom: 1px solid var(--trait); }
td { padding: 9px 12px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.mort td { color: var(--doux); }

/* Suivi de prix */
.produits { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px; }
.produit.touche { border: 2px solid var(--vert); }
.produit.pause { opacity: .6; }
.produit-haut { display: flex; justify-content: space-between; gap: 10px; }
.produit-nom { font-weight: 700; font-family: var(--titres); font-size: 1.05rem; text-decoration: none; word-break: break-word; }
.prix-ligne { display: flex; gap: 22px; flex-wrap: wrap; margin: 14px 0 6px; }
.prix-ligne > div { display: flex; flex-direction: column; }
.prix { font: 800 1.35rem var(--titres); } .prix.reel { color: var(--vert); } .prix.cible { color: var(--doux); }
.courbe { width: 100%; height: auto; display: block; margin: 8px 0; }
.courbe .trace { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.courbe .grille { stroke: var(--trait); stroke-width: 1; vector-effect: non-scaling-stroke; }
.courbe .cible { stroke: var(--vert); stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.courbe .axe { font: 11px var(--texte); fill: var(--doux); } .courbe .cible-txt { fill: var(--vert); font-weight: 600; }
.courbe .point { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }

/* Cartes cadeaux */
.offres { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.carte.offre { display: flex; align-items: center; gap: 16px; padding: 12px 16px; }
.carte.offre > div:nth-child(2) { flex: 1; }
.offre-remise { font: 800 1.5rem var(--titres); color: var(--accent); min-width: 86px; }
.total { font-size: .95rem; color: var(--vert); background: var(--vert-doux); padding: 2px 10px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
.carte.cadeau { margin-bottom: 12px; background: linear-gradient(135deg, var(--surface) 60%, var(--accent-doux)); }
.carte.cadeau.vide { opacity: .5; } .carte.cadeau.urgent { border-color: var(--ambre); }
.cadeau-haut { display: flex; justify-content: space-between; align-items: center; font-family: var(--titres); font-size: 1.1rem; }
.cadeau-solde { font: 800 1.6rem var(--titres); margin: 4px 0; }
.jauge { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 6px 0 8px; }
.jauge span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
#historique { margin-top: 10px; }

/* Réglages */
.sommaire { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.sommaire a { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); text-decoration: none; font-size: .88rem; }
.sommaire a:hover { background: var(--accent-doux); color: var(--accent); }
section.carte + section.carte { margin-top: 18px; }
section.carte { scroll-margin-top: 80px; }
.zone-depot { display: grid; place-items: center; text-align: center; border: 2px dashed var(--trait); border-radius: var(--r); padding: 30px 16px;
  cursor: pointer; color: var(--encre); font-size: 1rem; background: var(--surface-2); transition: border-color .15s, background .15s; margin-bottom: 12px; }
.zone-depot input { display: none; }
.zone-depot.survol, .zone-depot:hover { border-color: var(--accent); background: var(--accent-doux); }
.zone-depot.pret { border-style: solid; border-color: var(--vert); background: var(--vert-doux); }
.retour-arriere { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--trait); }
.retour-arriere input { width: 200px; }
.reglage-ligne { display: grid; grid-template-columns: 240px auto 1fr; align-items: center; gap: 14px; }
.tests { text-align: center; margin-top: 30px; }

/* Accès et redémarrage */
.page-acces { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.acces { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.redemarrage { max-width: 560px; margin: 40px auto; text-align: center; }
.sablier { width: 46px; height: 46px; margin: 0 auto 16px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--accent); animation: tourne 1s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.notes { text-align: left; background: var(--surface-2); padding: 12px; border-radius: 10px; white-space: pre-wrap; font-size: .85rem; }
.pied { text-align: center; color: var(--doux); font-size: .8rem; padding: 20px; }

@media (max-width: 1000px) {
  .colonnes, .deux-colonnes, .deux-colonnes.egal { grid-template-columns: 1fr; }
  .entete { flex-wrap: wrap; gap: 10px; } .recherche { flex: 1; } .recherche input { width: 100%; }
  .onglets { order: 3; flex-basis: 100%; }
  .reglage-ligne { grid-template-columns: 1fr; gap: 6px; }
  .produits { grid-template-columns: 1fr; }
}

/* Ajustements */
.ligne > input { flex: 1 1 160px; width: auto; }
.pile > h3:first-child, .carte > h3:first-child { margin-top: 0; }
.journal li > :first-child { flex: none; width: 120px; }
.journal li > :nth-child(2) { flex: 1; }
.cadeau-haut > strong { flex: 1; }
.cadeau-haut .tag { margin-right: 8px; }
#mail form + form { margin-top: 10px; }
.tag.hublot { background: var(--vert-doux); color: var(--vert); }
