/* Interface de gestion Enseigne Web : sobre, lisible sur téléphone comme sur ordinateur, sans police ni ressource externe.
   Conçue d'abord pour l'écran étroit (375 px) ; les règles « min-width » ajoutent la mise en page large.
   Contrastes vérifiés par app/tests/test_interface.py : texte 4,5:1 au moins, 7:1 pour le texte courant. */
:root {
  --ardoise: #26323a;
  --ardoise-2: #3a4852;
  --signal: #f5b700;
  --fond: #f3f4f1;
  --carte: #ffffff;
  --texte: #1d2630;
  --doux: #55636d;
  --trait: #cfd5d9;
  --champ: #8a969e;
  --focus: #0b4fb3;
  --ok: #1a6b3b;
  --ok-fond: #e1f2e7;
  --alerte: #7a4f00;
  --alerte-fond: #fdf0cf;
  --danger: #9b1c1c;
  --danger-fond: #fbe3e3;
  --corps: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 400 1rem/1.5 var(--corps); }
a { color: var(--ardoise); }
a:hover { color: #000; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.evitement { position: absolute; left: .5rem; top: -4rem; z-index: 100; background: #fff; color: var(--ardoise); padding: .6rem 1rem; border-radius: 6px; border: 2px solid var(--ardoise); }
.evitement:focus { top: .5rem; }

/* En-tête et menu : sur téléphone, un bouton « Menu » (case à cocher, sans script) déplie les 12 pages */
.entete { background: var(--ardoise); color: #fff; border-bottom: 4px solid var(--signal); }
.entete :focus-visible { outline-color: var(--signal); }
.entete-interieur { width: min(100% - 1.5rem, 72rem); margin-inline: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0 .75rem; padding: .35rem 0; position: relative; }
.marque { font-weight: 700; letter-spacing: .01em; margin-right: auto; color: #fff; text-decoration: none; padding: .7rem 0; }
.menu-case { position: absolute; right: 0; top: .35rem; width: 1px; height: 1px; opacity: 0; margin: 0; }
.menu-bouton { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; padding: .5rem 1rem; border: 2px solid #fff; border-radius: 6px; font-weight: 600; cursor: pointer; margin: 0; color: #fff; }
.menu-bouton::after { content: "\25BE"; }
.menu-case:checked + .menu-bouton { background: #fff; color: var(--ardoise); }
.menu-case:checked + .menu-bouton::after { content: "\25B4"; }
.menu-case:focus-visible + .menu-bouton { outline: 3px solid var(--signal); outline-offset: 2px; }
.menu { display: none; flex-direction: column; width: 100%; padding: .5rem 0 .75rem; gap: .15rem; }
.menu-case:checked ~ .menu { display: flex; }
.menu a, .menu button { color: #fff; text-decoration: none; padding: .65rem .85rem; min-height: 2.75rem; display: flex; align-items: center; justify-content: space-between; border-radius: 6px; background: transparent; border: 0; font: inherit; cursor: pointer; width: 100%; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--ardoise-2); color: #fff; }
.menu a[aria-current="page"] { background: var(--ardoise-2); box-shadow: inset 4px 0 0 var(--signal); font-weight: 700; }
.menu form { margin: 0; border-top: 1px solid var(--ardoise-2); margin-top: .35rem; padding-top: .35rem; }
.pastille { background: var(--signal); color: var(--ardoise); border-radius: 999px; padding: 0 .55rem; margin-left: .5rem; font-size: .8rem; font-weight: 700; line-height: 1.5; min-width: 1.5rem; text-align: center; }
.menu-bouton .pastille { margin-left: 0; }

main { width: min(100% - 1.5rem, 72rem); margin-inline: auto; padding: 1rem 0 4rem; }
h1 { font-size: 1.5rem; line-height: 1.2; margin: .5rem 0 1rem; }
h2 { font-size: 1.2rem; line-height: 1.25; margin: 1.75rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .25rem; }
p { margin: .5rem 0; }
p, li, td { overflow-wrap: anywhere; }
.doux { color: var(--doux); }
.petit { font-size: .875rem; }
.danger { color: var(--danger); }

.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: 8px; padding: 1rem; margin: 0 0 1rem; }
.carte > :first-child { margin-top: 0; }
.carte > :last-child { margin-bottom: 0; }

.message { border-left: 5px solid var(--ok); background: var(--ok-fond); color: #11361f; padding: .75rem 1rem; margin: 0 0 1rem; border-radius: 4px; }
.message.alerte { border-color: var(--signal); background: var(--alerte-fond); color: var(--alerte); }
.message.erreur { border-color: var(--danger); background: var(--danger-fond); color: var(--danger); }
.message a { color: inherit; }

/* Boutons et champs : zones de toucher de 44 px au moins, police de 16 px (pas de zoom automatique sur iPhone) */
button, .bouton { font: inherit; font-weight: 600; min-height: 2.75rem; padding: .6rem 1rem; border-radius: 6px; border: 2px solid var(--ardoise); background: var(--ardoise); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
button:hover, .bouton:hover { background: var(--ardoise-2); border-color: var(--ardoise-2); color: #fff; }
button.secondaire, .bouton.secondaire { background: #fff; color: var(--ardoise); }
button.secondaire:hover, .bouton.secondaire:hover { background: var(--fond); color: var(--ardoise); }
button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--danger-fond); color: var(--danger); }
button.envoi { background: var(--ok); border-color: var(--ok); }
button.envoi:hover { background: #135430; border-color: #135430; }
button[disabled] { opacity: .55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.actions > button, .actions > .bouton { flex: 1 1 100%; }
form.en-ligne { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
form.en-ligne input { flex: 1 1 10rem; width: auto; }
label { display: block; font-weight: 600; margin: .75rem 0 .25rem; }
input, select, textarea { width: 100%; font: inherit; padding: .6rem .7rem; min-height: 2.75rem; border: 2px solid var(--champ); border-radius: 6px; background: #fff; color: var(--texte); }
input:focus, select:focus, textarea:focus { border-color: var(--ardoise); outline: 3px solid var(--focus); outline-offset: 0; }
label input:not([type="checkbox"]), label select, label textarea { font-weight: 400; }
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; min-height: 0; margin: 0 .5rem 0 0; vertical-align: -.2rem; accent-color: var(--ardoise); }
label:has(input[type="checkbox"]) { font-weight: 500; }
textarea { min-height: 14rem; line-height: 1.45; resize: vertical; }
textarea.court { min-height: 5rem; }
.ligne-champs { display: grid; gap: .5rem; grid-template-columns: 1fr; }

/* Blocs pliables : formulaires secondaires, repliés pour garder la page courte sur téléphone */
details.pliable { background: var(--carte); border: 1px solid var(--trait); border-radius: 8px; padding: 0 1rem; margin: 0 0 .75rem; }
details.pliable[open] { padding-bottom: 1rem; }
details.pliable > summary { cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; font-weight: 600; list-style-position: inside; }
details.pliable form > :first-child { margin-top: 0; }

/* Bloc de chiffres */
.chiffres { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.chiffres li { background: var(--carte); border: 1px solid var(--trait); border-radius: 8px; padding: .6rem .75rem; }
.chiffres .valeur { display: block; font-size: 1.5rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.chiffres .libelle { display: block; font-size: .8125rem; color: var(--doux); }
.chiffres-3 { grid-template-columns: repeat(3, 1fr); }
.chiffres-liens { grid-template-columns: repeat(3, 1fr); }
.chiffres-liens a { display: block; color: inherit; text-decoration: none; min-height: 2.75rem; }
.chiffres-liens li:hover { border-color: var(--ardoise); }
progress { width: 100%; height: 1rem; accent-color: var(--ardoise); }

/* Tableaux (défilement horizontal si trop larges) */
.defile { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1rem; }
table { border-collapse: collapse; width: 100%; background: var(--carte); font-size: .9375rem; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--trait); text-align: left; vertical-align: top; }
th { background: #e7eae5; font-size: .8125rem; text-transform: uppercase; letter-spacing: .03em; color: var(--doux); white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td:first-child { white-space: nowrap; }
.defile td:first-child { white-space: normal; min-width: 8rem; }

/* Listes de prospects, de tâches et d'événements */
.liste { list-style: none; margin: 0 0 1rem; padding: 0; }
.liste > li { background: var(--carte); border: 1px solid var(--trait); border-radius: 8px; padding: .75rem 1rem; margin: 0 0 .5rem; }
.liste .titre { font-weight: 700; }
.liste form { margin-top: .5rem; }
.a-faire > li { padding: 0; }
.a-faire .element { display: block; padding: .8rem 1rem; text-decoration: none; color: var(--texte); border-radius: 8px; min-height: 2.75rem; }
.a-faire .element:hover { background: var(--fond); }
.a-faire .element strong { display: inline; }
.a-faire .element .detail { display: block; margin-top: .2rem; }
.histo { list-style: none; margin: 0 0 1rem; padding: 0; }
.histo li { padding: .45rem 0; border-bottom: 1px solid var(--trait); }
.histo time { color: var(--doux); font-size: .875rem; margin-right: .5rem; white-space: nowrap; }

.etiquette { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: #e1e5e0; color: var(--ardoise); vertical-align: middle; }
.etiquette.ok { background: var(--ok-fond); color: var(--ok); }
.etiquette.alerte { background: var(--alerte-fond); color: var(--alerte); }
.etiquette.danger { background: var(--danger-fond); color: var(--danger); }
.compte { display: inline-block; font-size: .8125rem; font-weight: 700; padding: 0 .55rem; border-radius: 999px; background: var(--ardoise); color: #fff; vertical-align: middle; }

.texte-brut { white-space: pre-wrap; word-wrap: break-word; background: #fafaf8; border: 1px solid var(--trait); border-radius: 6px; padding: .75rem; font: inherit; margin: .5rem 0; max-height: 32rem; overflow: auto; }
details { margin: .5rem 0; }
summary { cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; font-weight: 600; }

.connexion { max-width: 24rem; margin: 2rem auto; }

/* Réglages et prospection */
code { font: .875rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #e9ece6; padding: .1rem .35rem; border-radius: 4px; overflow-wrap: anywhere; }
fieldset { border: 1px solid var(--trait); border-radius: 6px; margin: .75rem 0; padding: .25rem .75rem .5rem; }
legend { padding: 0 .35rem; }
ul.message { list-style: disc inside; }

/* Suivi commercial : une colonne par statut. Sur téléphone, les colonnes s'empilent (une rubrique par statut) ;
   sur grand écran, tableau à défilement horizontal. */
.suivi { display: grid; gap: .75rem; }
.colonne { background: #e9ece6; border-radius: 8px; padding: .5rem .75rem .25rem; }
.colonne h2 { margin: .35rem 0 .6rem; font-size: 1rem; }
.colonne .liste > li { padding: .6rem .75rem; }

@media (min-width: 40rem) {
  .chiffres { grid-template-columns: repeat(4, 1fr); }
  .chiffres-3 { grid-template-columns: repeat(3, 1fr); }
  .chiffres-liens { grid-template-columns: repeat(4, 1fr); }
  .ligne-champs { grid-template-columns: 1fr 1fr; }
  .actions > button, .actions > .bouton { flex: 0 1 auto; }
  h1 { font-size: 1.75rem; }
}
@media (min-width: 62rem) {
  .menu-bouton { display: none; }
  .menu { display: flex; flex-direction: row; flex-wrap: wrap; width: 100%; padding: 0 0 .5rem; gap: .15rem; }
  .menu a { width: auto; flex: 1 1 auto; justify-content: center; padding: .5rem .55rem; font-size: .9rem; }
  .chiffres-liens { grid-template-columns: repeat(6, 1fr); }
  .menu a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--signal); }
  /* La déconnexion rejoint la ligne de la marque (en haut à droite) : les douze pages se répartissent sur toute la largeur */
  .menu form { position: absolute; top: .35rem; right: 0; border-top: 0; margin: 0; padding: 0; width: auto; }
  .menu form button { width: auto; justify-content: center; padding: .5rem .8rem; font-size: .9rem; }
  .suivi { grid-auto-flow: column; grid-auto-columns: 17rem; overflow-x: auto; align-items: start; padding-bottom: 1rem; }
}

@media print {
  .entete, .evitement, .actions, form, details.pliable { display: none; }
  body { background: #fff; }
  main { width: 100%; }
}
