/* =============================================================================
   Administration de Debustor (clair / sombre automatique). Couleurs de la présentation Debustor :
   encre verte, crème, terre cuite.
   ============================================================================= */

:root {
  --fond: #f7f2e8;
  --surface: #fffdf8;
  --surface-2: #efe8da;
  --texte: #1d3328;
  --doux: #5c6d63;
  --bord: #e4dccd;
  --accent: #b5532d;
  --accent-texte: #fffdf8;
  --accent-doux: #f3dfd3;
  --vert: #1f7a47;
  --vert-doux: #dcefe2;
  --orange: #a96200;
  --orange-doux: #fbecd2;
  --rouge: #b42318;
  --rouge-doux: #fbe2de;
  --ombre: 0 1px 2px rgba(29, 51, 40, .06), 0 4px 16px rgba(29, 51, 40, .05);
  --rayon: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121a16;
    --surface: #1a2520;
    --surface-2: #22302a;
    --texte: #ece6da;
    --doux: #a3b0a8;
    --bord: #2f3f37;
    --accent: #e58a63;
    --accent-texte: #121a16;
    --accent-doux: #3b261c;
    --vert: #5bcf8c;
    --vert-doux: #15301f;
    --orange: #f0b24a;
    --orange-doux: #33270f;
    --rouge: #ff8a7d;
    --rouge-doux: #3a1714;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
[hidden] { display: none !important; }
:is(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* En-tête */
.entete { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 10px clamp(16px, 3vw, 32px);
  background: var(--surface); border-bottom: 1px solid var(--bord); }
.marque { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; color: var(--texte); text-decoration: none; }
.marque span { color: var(--accent); }
.entete nav { display: flex; gap: 4px; flex-wrap: wrap; }
.entete nav a { padding: 6px 12px; border-radius: 999px; color: var(--doux); text-decoration: none; font-weight: 600; }
.entete nav a.actif { background: var(--accent-doux); color: var(--texte); }
.entete .qui { margin-left: auto; color: var(--doux); font-size: .9rem; display: flex; gap: 10px; align-items: center; }
main { padding: 24px clamp(16px, 3vw, 32px) 120px; max-width: 1400px; margin: 0 auto; display: grid; gap: 16px; }

/* Blocs, boutons, champs */
.bloc { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 20px; }
.aide { color: var(--doux); margin: 4px 0 0; }
.bouton { font: inherit; font-weight: 600; font-size: .92rem; border: 1px solid var(--bord); background: var(--surface); color: var(--texte); border-radius: 10px;
  padding: 0 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.bouton.petit { padding: 4px 10px; font-size: .85rem; }
.bouton:disabled { opacity: .55; cursor: not-allowed; }
.bouton.chargement { cursor: progress; opacity: .7; }
.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
/* Même hauteur pour tous les champs, listes et boutons (--hauteur), comme dans les formulaires de saisie */
:root { --hauteur: 40px; }
input, select, textarea { font: inherit; color: var(--texte); background-color: var(--surface); border: 1px solid var(--bord); border-radius: 8px; padding: 0 10px; }
input:not([type=checkbox]):not([type=radio]), select, .multi-bouton { height: var(--hauteur); }
textarea { padding: 8px 10px; }
select { -webkit-appearance: none; appearance: none; padding-right: 30px; background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235c6d63' stroke-width='1.6'/%3E%3C/svg%3E"); }
.bouton { height: var(--hauteur); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.bouton.petit { height: 32px; }
.champ { display: grid; gap: 4px; }
.champ > span { font-size: .85rem; font-weight: 600; color: var(--doux); }

/* Connexion */
.connexion { max-width: 380px; margin: 10vh auto 0; display: grid; gap: 14px; }
.connexion h1 span { color: var(--accent); }
.connexion form { display: grid; gap: 12px; }
.message { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--rouge-doux); color: var(--rouge); }
.message.ok { background: var(--vert-doux); color: var(--vert); }

/* Prospection */
.titre-page { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.titre-page .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.recherche { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr) auto; gap: 12px; align-items: start; margin-top: 14px; }
.recherche .champ-bouton { padding-top: 22px; }
@media (max-width: 760px) { .recherche { grid-template-columns: 1fr; } }
.champ-ville { position: relative; }
.code-postal { color: var(--accent); font-weight: 700; }
.suggestions-villes { position: absolute; z-index: 3; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--surface);
  border: 1px solid var(--bord); border-radius: 10px; box-shadow: var(--ombre); max-height: 320px; overflow: auto; }
.suggestions-villes li { display: flex; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 6px; cursor: pointer; flex-wrap: wrap; }
.suggestions-villes li.surligne, .suggestions-villes li:hover { background: var(--surface-2); }
.suggestions-villes li.complet .nom-ville { text-decoration: line-through; color: var(--doux); }
.suggestions-villes .cp, .suggestions-villes .dept { color: var(--doux); font-size: .85rem; }
.champ-bouton { display: grid; gap: 6px; justify-items: start; }
.quota { font-size: .85rem; color: var(--doux); }
.quota.bas { color: var(--rouge); font-weight: 600; }
.avertissement-recherche { grid-column: 1 / -1; margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--orange-doux); color: var(--orange); }
.resultat-recherche { margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); white-space: pre-line; }
.resultat-recherche.erreur { background: var(--rouge-doux); color: var(--rouge); }

.filtres { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.filtres .case { display: flex; gap: 6px; align-items: center; height: var(--hauteur); }
.barre-outils { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.resultat { margin: 0; color: var(--doux); }
.compteurs { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.pastille { display: inline-block; font: inherit; font-size: .8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--bord);
  background: var(--surface-2); color: var(--texte); }
button.pastille { cursor: pointer; }
.pastille.actif { border-color: var(--accent); background: var(--accent-doux); }
.pastille.ok { background: var(--vert-doux); color: var(--vert); border-color: transparent; }
.pastille.attention { background: var(--orange-doux); color: var(--orange); border-color: transparent; }
.pastille.accent { background: var(--accent-doux); color: var(--accent); border-color: transparent; text-decoration: none; }

.tableau-conteneur { overflow-x: auto; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; vertical-align: top; border-top: 1px solid var(--bord); }
thead th { border-top: 0; font-size: .8rem; color: var(--doux); font-weight: 700; white-space: nowrap; }
td.nom { min-width: 220px; max-width: 340px; }
td.nom .nom-commerce { display: flex; align-items: center; min-width: 0; }
td.nom .nom-commerce > :last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
td.nom .point-registre { flex: none; }
td.telephone { white-space: nowrap; width: 1%; }
td.nom .activite { display: block; color: var(--doux); font-size: .85rem; }
td.nom .pastille { margin-top: 4px; margin-right: 4px; }
td.adresse { min-width: 200px; color: var(--doux); }
td.adresse .ville { display: block; color: var(--texte); }
td.note { white-space: nowrap; }
.etoile { color: var(--orange); }
.avis { color: var(--doux); font-size: .85rem; }
td.vide { text-align: center; color: var(--doux); padding: 28px; }
.point-registre { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--bord); vertical-align: middle; }
.point-registre.vert { background: var(--vert); }
.point-registre.orange { background: var(--orange); }
.point-registre.rouge { background: var(--rouge); }

/* Pistes, commerciaux, secteurs */
td.actions { white-space: nowrap; }
td.actions > * + * { margin-left: 6px; }
td.nom .lien { font-weight: 600; text-align: left; }
.ligne-journal td { background: var(--surface-2); }
.journal { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.journal .quand { color: var(--doux); font-size: .85rem; margin-right: 8px; font-variant-numeric: tabular-nums; }
.journal .par { color: var(--doux); font-size: .85rem; }
.formulaire-ligne { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-top: 12px; }
.formulaire-ligne .champ { min-width: 200px; flex: 1; }
form.secteur { display: grid; gap: 12px; }
.puces { display: flex; gap: 6px; flex-wrap: wrap; }
.puce .lien { margin-left: 6px; text-decoration: none; }
fieldset.cases { border: 1px solid var(--bord); border-radius: 10px; padding: 8px 12px 12px; display: flex; gap: 8px 18px; flex-wrap: wrap; }
fieldset.cases legend { font-size: .85rem; font-weight: 600; color: var(--doux); padding: 0 4px; }
fieldset.cases label { display: flex; gap: 6px; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grille-reglages { display: grid; gap: 4px; margin: 12px 0; }
.ligne-reglage { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--bord); }
.ecran-reglages .bloc + .bloc { margin-top: 16px; }

/* Pistes : onglets par étape, alerte des prospects rendus, don en lot */
.onglets { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--bord); }
.onglet { font: inherit; font-weight: 600; color: var(--doux); background: none; border: 0; border-bottom: 3px solid transparent; padding: 0 14px; cursor: pointer;
  display: inline-flex; gap: 8px; align-items: center; height: var(--hauteur); }
.onglet.actif { color: var(--texte); border-bottom-color: var(--accent); }
.onglet .nombre { font-size: .8rem; background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.onglet.actif .nombre { background: var(--accent-doux); }
.alerte-rendus { font: inherit; font-weight: 600; width: 100%; text-align: left; padding: 10px 14px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  background: var(--orange-doux); color: var(--orange); }
.alerte-rendus.actif { border-color: var(--orange); }
.barre-lot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
tr.ligne-rendue td { background: var(--orange-doux); }
td.nombre-cellule { text-align: center; font-variant-numeric: tabular-nums; }
.multi-option.desactive { opacity: .55; cursor: not-allowed; }

/* Liste à choix multiple */
.multi { position: relative; }
.multi-bouton { width: 100%; display: flex; align-items: center; gap: 8px; font: inherit; color: var(--texte); background: var(--surface); border: 1px solid var(--bord);
  border-radius: 8px; padding: 0 10px; cursor: pointer; text-align: left; }
.multi-resume { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-vide { color: var(--doux); }
.multi-fleche { color: var(--doux); font-size: .8rem; }
.multi-panneau { position: absolute; z-index: 6; top: calc(100% + 4px); left: 0; right: 0; min-width: 260px; background: var(--surface); border: 1px solid var(--bord);
  border-radius: 10px; box-shadow: var(--ombre); padding: 8px; display: grid; gap: 6px; }
.multi-panneau input[type=search] { width: 100%; }
.multi-cases { max-height: 280px; overflow: auto; display: grid; }
.multi-option { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; cursor: pointer; }
.multi-option:hover { background: var(--surface-2); }
.multi-detail { margin-left: auto; color: var(--doux); font-size: .85rem; white-space: nowrap; }
.multi-groupe { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); padding: 8px 6px 2px; }
.multi-option.entete { font-weight: 600; }
.multi-pied { display: flex; justify-content: space-between; padding: 4px 6px 0; border-top: 1px solid var(--bord); }
.grille-secteur { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.grille-secteur .champ-ville { margin-top: 6px; }
.grille-secteur small.aide { font-size: .8rem; margin: 0; }
.grille-secteur .champ-ville input { width: 100%; }

/* Réglages */
.ecran-reglages { max-width: 760px; }
.tableau-google { width: 100%; border-collapse: collapse; margin: 12px 0; }
.tableau-google th, .tableau-google td { padding: 8px 6px; }
.tableau-google tbody th { font-weight: 600; font-size: .95rem; color: var(--texte); }
.limite-google { width: 6.5em; }
.liste-google { margin: 8px 0 0; padding-left: 18px; color: var(--doux); }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20; background: var(--texte); color: var(--fond); padding: 10px 16px;
  border-radius: 12px; font-weight: 600; max-width: calc(100% - 32px); }
#toast.erreur { background: var(--rouge); color: #fff; }
