/* Administration de La Boucherie Martigues. Couleurs = variables seulement (mode clair et sombre). */
:root {
  color-scheme: light dark;
  --fond: #f2ede2;
  --carte: #fbf8f2;
  --appuye: #e7e0d0;
  --texte: #1d140b;
  --doux: #5d5346;
  --pale: #8a7f70;
  --cadre: #d6cdb8;
  --grille: #e6dfcf;
  --accent: #a24628;
  --accent-texte: #fff;
  --serie: #b2532f; /* une seule série par graphique, validée (dataviz) contre --carte */
  --bon: #2f6b3a;
  --alerte: #8a5a00;
  --mauvais: #9b2c2c;
  --rayon: 6px;
  --ombre: 0 1px 2px rgb(29 20 11 / 6%), 0 6px 18px rgb(29 20 11 / 7%);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --fond: #14100a;
    --carte: #1e1810;
    --appuye: #2a2217;
    --texte: #f2ecdf;
    --doux: #b8ac97;
    --pale: #8d826f;
    --cadre: #3a3124;
    --grille: #2c2419;
    --accent: #e0805c;
    --accent-texte: #14100a;
    --serie: #d4704c;
    --bon: #7fbf8a;
    --alerte: #e3b45a;
    --mauvais: #e58a8a;
  }
}
:root[data-theme="sombre"] {
    --fond: #14100a;
    --carte: #1e1810;
    --appuye: #2a2217;
    --texte: #f2ecdf;
    --doux: #b8ac97;
    --pale: #8d826f;
    --cadre: #3a3124;
    --grille: #2c2419;
    --accent: #e0805c;
    --accent-texte: #14100a;
    --serie: #d4704c;
    --bon: #7fbf8a;
    --alerte: #e3b45a;
    --mauvais: #e58a8a;
  }
:root[data-theme="clair"] { color-scheme: light; }
:root[data-theme="sombre"] { color-scheme: dark; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--fond); color: var(--texte); }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.evite { position: absolute; left: -999px; }
.evite:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--carte); padding: .5rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#vue:focus { outline: none; }

.haut { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1.25rem; background: var(--carte); border-bottom: 1px solid var(--cadre); position: sticky; top: 0; z-index: 6; }
.marque { font-weight: 700; color: var(--texte); text-decoration: none; }
.marque span { font-weight: 400; color: var(--doux); }
.compte { position: relative; }
.avatar { width: 2.25rem; height: 2.25rem; padding: 0; border-radius: 50%; background: var(--appuye); border: 1px solid var(--cadre); color: var(--texte); font-weight: 700; }
@media (hover: hover) { .avatar:hover { border-color: var(--accent); } }
.menu-compte { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 15rem; background: var(--carte); border: 1px solid var(--cadre); border-radius: var(--rayon); box-shadow: var(--ombre); padding: .4rem; z-index: 30; }
.menu-compte .tete { padding: .5rem .7rem; border-bottom: 1px solid var(--cadre); margin-bottom: .3rem; }
.menu-compte .tete small { display: block; color: var(--pale); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-compte a, .menu-compte button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--texte); padding: .5rem .7rem; border-radius: var(--rayon); text-decoration: none; }
@media (hover: hover) { .menu-compte a:hover, .menu-compte button:hover { background: var(--appuye); } }
.menu-compte .sortie { color: var(--mauvais); }
.menu-compte hr { border: 0; border-top: 1px solid var(--cadre); margin: .3rem .2rem; }

.mise-en-page { display: flex; align-items: flex-start; min-height: calc(100vh - 3.5rem); }
.cote { position: sticky; top: 3.5rem; flex: 0 0 13.5rem; max-height: calc(100vh - 3.5rem); overflow-y: auto; padding: 1rem .6rem; border-right: 1px solid var(--cadre); align-self: stretch; }
.cote a { display: block; padding: .45rem .7rem; border-radius: var(--rayon); color: var(--doux); text-decoration: none; }
@media (hover: hover) { .cote a:hover { background: var(--appuye); color: var(--texte); } }
.cote a[aria-current="page"] { background: var(--appuye); color: var(--texte); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.cote .groupe { margin: .9rem .7rem .3rem; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--pale); }
.mbarre { display: none; }

main { flex: 1; min-width: 0; padding: 1.25rem; max-width: 84rem; margin: 0 auto; }
.attente { color: var(--doux); }
.carte { background: var(--carte); border: 1px solid var(--cadre); border-radius: var(--rayon); padding: 1rem 1.25rem; box-shadow: var(--ombre); margin-bottom: 1rem; min-width: 0; }
.grille { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.tuiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin-bottom: 1rem; }
.tuile { background: var(--carte); border: 1px solid var(--cadre); border-radius: var(--rayon); padding: .8rem 1rem; }
.tuile b { display: block; font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tuile span { color: var(--doux); font-size: .85rem; }
.tuile small { display: block; color: var(--pale); font-size: .8rem; }

.ligne { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ligne > * { min-width: 0; }
.entre { justify-content: space-between; }
.pile > * + * { margin-top: .75rem; }
.doux { color: var(--doux); }
.pale { color: var(--pale); font-size: .85rem; }
.bon { color: var(--bon); }
.alerte { color: var(--alerte); }
.mauvais { color: var(--mauvais); }

button, .bouton { font: inherit; padding: .45rem .9rem; border-radius: var(--rayon); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-texte); cursor: pointer; text-decoration: none; display: inline-block; }
button.creux, .bouton.creux { background: transparent; color: var(--accent); }
button.discret { background: transparent; border-color: var(--cadre); color: var(--texte); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; padding: .4rem .55rem; border-radius: var(--rayon); border: 1px solid var(--cadre); background: var(--fond); color: var(--texte); max-width: 100%; }
textarea { width: 100%; min-height: 8rem; }
label { display: grid; gap: .2rem; font-size: .9rem; color: var(--doux); }
label.coche { display: flex; align-items: center; gap: .4rem; color: var(--texte); }
fieldset { border: 1px solid var(--cadre); border-radius: var(--rayon); padding: .75rem 1rem; }
legend { color: var(--doux); padding: 0 .3rem; }
.formulaire { display: grid; gap: .75rem; align-content: start; }
.deux { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }

.defile { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--grille); vertical-align: top; }
th { color: var(--doux); font-weight: 600; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.clic { cursor: pointer; }
@media (hover: hover) { tr.clic:hover { background: var(--appuye); } }

.pastille { display: inline-block; padding: .05rem .45rem; border-radius: 999px; font-size: .8rem; background: var(--appuye); color: var(--texte); white-space: nowrap; }
.pastille.bon { color: var(--bon); }
.pastille.mauvais { color: var(--mauvais); }
.pastille.alerte { color: var(--alerte); }
.coche-liste { list-style: none; padding: 0; margin: 0; }
.coche-liste li { padding: .2rem 0; }
.coche-liste li::before { content: "✔ "; color: var(--bon); }
.coche-liste li.non::before { content: "✖ "; color: var(--mauvais); }

/* Graphiques : une série, barres fines arrondies côté valeur, grille discrète, bulle au survol, table lisible. */
.graphe svg { display: block; width: 100%; height: auto; overflow: visible; }
.graphe .barre-donnee { fill: var(--serie); }
.graphe .cible { fill: transparent; }
.graphe .grille-ligne { stroke: var(--grille); stroke-width: 1; }
.graphe text { fill: var(--pale); font-size: 11px; }
.graphe details { margin-top: .4rem; font-size: .85rem; }
.horiz { display: grid; gap: .45rem; }
.horiz .rang { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr 4rem; gap: .6rem; align-items: center; }
.horiz .piste { height: 12px; }
.horiz .plein { height: 12px; background: var(--serie); border-radius: 0 4px 4px 0; min-width: 2px; }
.horiz .val { text-align: right; font-variant-numeric: tabular-nums; }
.bulle { position: fixed; pointer-events: none; background: var(--texte); color: var(--fond); padding: .3rem .55rem; border-radius: var(--rayon); font-size: .8rem; z-index: 20; }
.message { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--texte); color: var(--fond); padding: .6rem 1rem; border-radius: var(--rayon); z-index: 30; max-width: calc(100% - 2rem); }
.message.erreur { background: var(--mauvais); color: #fff; }

.panneau { position: fixed; inset: 0 0 0 auto; width: min(44rem, 100%); background: var(--carte); border-left: 1px solid var(--cadre); box-shadow: var(--ombre); overflow-y: auto; padding: 1.25rem; z-index: 15; }
.voile { position: fixed; inset: 0; background: rgb(0 0 0 / 30%); z-index: 14; }
.chrono { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.chrono li { padding: .3rem 0; border-bottom: 1px solid var(--grille); }

.appel { display: grid; gap: .5rem; }
.appel .tel { font-size: 1.35rem; font-weight: 700; text-decoration: none; }
.issues { display: flex; flex-wrap: wrap; gap: .4rem; }

.editeur-barre { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .4rem; }
.editeur-barre button { padding: .25rem .55rem; }
.editeur { min-height: 22rem; padding: .75rem 1rem; border: 1px solid var(--cadre); border-radius: var(--rayon); background: var(--fond); line-height: 1.65; overflow-wrap: anywhere; }
.editeur img { max-width: 100%; height: auto; }
.score { font-size: 2rem; font-weight: 700; }
.apercu-couverture { max-width: 100%; max-height: 12rem; border-radius: var(--rayon); display: block; margin-top: .4rem; }
details.message-recu > summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
details.message-recu[open] > summary { margin-bottom: .4rem; }
pre.apercu { white-space: pre-wrap; background: var(--fond); border: 1px solid var(--cadre); border-radius: var(--rayon); padding: .75rem; font: inherit; font-size: .9rem; }
.etape { display: grid; grid-template-columns: 5rem 8rem 1fr auto; gap: .5rem; align-items: end; }
@media (max-width: 40rem) {
  .etape { grid-template-columns: 1fr 1fr; }
  .horiz .rang { grid-template-columns: 1fr 3rem; }
  .horiz .piste { grid-column: 1 / -1; order: 3; }
}
@media print { .haut, .cote, .mbarre, button { display: none !important; } }
@media (max-width: 48rem) {
  .haut { padding: .5rem 1rem; }
  .mbarre:not([hidden]) { display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem; border-bottom: 1px solid var(--cadre); background: var(--carte); }
  .mbarre span { color: var(--doux); }
  .mise-en-page { display: block; }
  .cote { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--cadre); display: none; }
  .cote.ouvert { display: block; }
  main { padding: 1rem; }
}

/* Écrans de connexion */
.seul { max-width: 24rem; margin: 3rem auto; }
.seul h1 { margin-bottom: .25rem; }
.seul .formulaire input { width: 100%; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; letter-spacing: .08em; word-break: break-all; background: var(--fond); border: 1px solid var(--cadre); border-radius: var(--rayon); padding: .5rem .7rem; }
.verrou { border-style: dashed; }

/* Mot de passe : bouton œil dans le champ */
.mdp { position: relative; display: block; }
.mdp input { width: 100%; padding-right: 2.6rem; }
.oeil { position: absolute; right: .2rem; top: 50%; transform: translateY(-50%); background: transparent; border: 0; padding: .35rem; color: var(--doux); line-height: 0; }
.oeil:hover, .oeil:focus-visible { color: var(--texte); }
.envoye { margin: 0; padding: .6rem .75rem; border-radius: var(--rayon); background: var(--appuye); color: var(--bon); }

/* Suivi : filtres dans les en-têtes, menu déroulant, ajout */
#vue { position: relative; }
.barre-suivi { margin-bottom: .5rem; }
.barre-suivi h1 { margin: 0; }
button.icone { display: inline-flex; align-items: center; gap: .35rem; line-height: 1; }
button.icone:not(.discret) { padding: .45rem; }
button.icone.actif, .entete.actif { color: var(--accent); border-color: var(--accent); }
.entete { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.entete svg { opacity: .45; }
.entete.actif svg, .entete:hover svg, .entete:focus-visible svg { opacity: 1; }
.puces { margin-bottom: .75rem; }
.puce { background: var(--appuye); border: 1px solid var(--cadre); color: var(--texte); border-radius: 999px; padding: .15rem .65rem; font-size: .85rem; }
button.petit { padding: .15rem .65rem; font-size: .85rem; }
.deroulant { position: absolute; z-index: 25; width: max-content; max-width: 40rem; max-height: 70vh; overflow-y: auto; display: grid; gap: .75rem; margin: 0; }
.deroulant.plein { width: auto; max-width: none; max-height: none; overflow: visible; }
.deroulant[hidden] { display: none; }
.deroulant label { display: grid; gap: .2rem; }
.deroulant label.coche { display: flex; }
.deroulant fieldset { margin: 0; }
.grille-filtres { display: grid; gap: .75rem; align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
dialog { border: 1px solid var(--cadre); border-radius: var(--rayon); background: var(--carte); color: var(--texte); padding: 1.25rem; width: min(36rem, calc(100% - 2rem)); box-shadow: var(--ombre); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog h2 { margin-top: 0; }
@media print { .barre-suivi button, .puces, .deroulant { display: none !important; } }
details.carte > summary { cursor: pointer; font-weight: 600; }
details.carte[open] > summary { margin-bottom: .75rem; }
