/* ============================================================
   CRM BY OPTIMIZERLABS — Charte graphique
   ------------------------------------------------------------
   Architecture reprise de Notes (variables en français, polices
   locales Ubuntu/Inter), couleur propre : bleu pétrole. Notes est
   bleu encre, Atelyo vert — trois applications ouvertes côte à
   côte doivent se distinguer.

   Usage : sur le trottoir (téléphone, une main, plein soleil) et
   sur la tablette Crosscall 8" (écrire). D'où : thème clair
   uniquement, contrastes forts, cibles tactiles ≥ 44 px, champs
   en 16 px minimum (en dessous, iOS et certains Android zooment
   à la saisie).
   ============================================================ */

@font-face { font-family: 'Ubuntu'; src: url("../fonts/ubuntu/ubuntu-500.0e7e5f9d3a8e.woff2") format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Ubuntu'; src: url("../fonts/ubuntu/ubuntu-700.ab1fc8621287.woff2") format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url("../fonts/inter/inter-400.73aaa95eab31.woff2") format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url("../fonts/inter/inter-600.0bf7eadca131.woff2") format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --marque:         #0f4c5c;   /* 9,6:1 sur blanc */
  --marque-sombre:  #0a3742;
  --marque-pale:    #e6f0f2;

  /* Signature de l'éditeur : réservée au nom OptimizerLabs. */
  --editeur-optimizer: #458651;
  --editeur-labs:      #97b879;

  --fond:      #f6f7f9;
  --surface:   #ffffff;
  --bordure:   #cfd6de;
  --texte:     #14181f;
  --texte-2:   #4a5361;   /* 7,9:1 : lisible au soleil, pas un gris décoratif */

  /* Étapes — la couleur des points sur la carte. Choisies pour se
     distinguer entre elles même pour un daltonien rouge-vert :
     le gris, le bleu et l'ambre portent l'essentiel ; vert et
     bordeaux se séparent aussi par la luminosité. */
  --et-jamais:      #8a93a3;
  --et-visite:      #2563eb;
  --et-discussion:  #d97706;
  --et-actif:       #15803d;
  --et-perdu:       #7f1d1d;

  --retard:   #dc2626;
  --semaine:  #f59e0b;
  --bio:      #4d7c0f;

  --police-titre: 'Ubuntu', system-ui, sans-serif;
  --police-corps: 'Inter', system-ui, sans-serif;
  --rayon: 10px;
  --barre: 56px;
  --cible: 44px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.45 var(--police-corps);
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { font-family: var(--police-titre); font-weight: 700; margin: 0; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin: 1.1rem 0 .4rem; color: var(--marque); }

.sig-optimizer { color: var(--editeur-optimizer); }
.sig-labs { color: var(--editeur-labs); }

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
  min-height: var(--cible);
  padding: 0 14px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--texte);
  font: 600 1rem var(--police-corps);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none;
  cursor: pointer;
}
.btn-plein { background: var(--marque); border-color: var(--marque); color: #fff; width: 100%; }
.btn-plein:active { background: var(--marque-sombre); }
.btn[disabled] { opacity: .6; }
.lien { background: none; border: 0; color: var(--marque); font: inherit; text-decoration: underline; padding: 4px; cursor: pointer; }

/* ── Formulaires ─────────────────────────────────────────── */
.pile { display: flex; flex-direction: column; gap: 12px; }
.pile label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.pile label.case { flex-direction: row; align-items: center; }
input[type=text], input[type=password], input[type=date], input[type=tel], input[type=email], select, textarea {
  font: 16px var(--police-corps);
  min-height: var(--cible);
  padding: 8px 10px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--texte);
  width: 100%;
}
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.errorlist, .erreur { color: var(--retard); margin: 0; padding: 0; list-style: none; font-weight: 600; }

/* Puces : un bouton radio ou une case dans une étiquette cliquable
   entière. La puce cochée se remplit — l'état se lit d'un coup d'œil. */
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puces > div { display: contents; } /* conteneur ajouté par RadioSelect */
.puce {
  min-height: var(--cible);
  padding: 0 12px;
  border: 1px solid var(--bordure);
  border-radius: 999px;
  background: var(--surface);
  display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 6px;
  font-weight: 500 !important;
  cursor: pointer;
  user-select: none;
}
.puce input { position: absolute; opacity: 0; pointer-events: none; }
.puce:has(input:checked) { background: var(--marque-pale); border-color: var(--marque); font-weight: 600 !important; }
.puce:has(input:focus-visible) { outline: 3px solid var(--marque); outline-offset: 2px; }

.pastille { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; }
.et-jamais_visite { --c: var(--et-jamais); }
.et-visite { --c: var(--et-visite); }
.et-en_discussion { --c: var(--et-discussion); }
.et-client_actif { --c: var(--et-actif); }
.et-perdu { --c: var(--et-perdu); }
.pastille { background: var(--c); }

/* Date précise : n'apparaît que si le bouton correspondant est coché. */
.choix-revoir .si-date { display: none; margin-top: 8px; }
.choix-revoir:has(input[value=date]:checked) .si-date { display: flex; }

/* ── Barre haute ─────────────────────────────────────────── */
.barre {
  height: var(--barre);
  padding: 6px 8px;
  padding-top: max(6px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
  position: relative; z-index: 1000;
}
.compteur { margin-left: auto; color: var(--texte-2); font-weight: 600; white-space: nowrap; }
.bascule { display: inline-flex; align-items: center; gap: 6px; min-height: var(--cible); font-weight: 600; padding: 0 4px; }
.bascule input { width: 22px; height: 22px; accent-color: var(--marque); }

#carte { height: calc(100dvh - var(--barre)); width: 100%; }

/* ── Points sur la carte ─────────────────────────────────── */
.pt {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff;
  border: 4px solid var(--c);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
  position: relative;
}
.loin .pt { transform: scale(.6); }
.pt.urg-semaine { box-shadow: 0 0 0 4px var(--semaine), 0 1px 3px rgba(0,0,0,.35); }
.pt.urg-retard { box-shadow: 0 0 0 4px var(--retard), 0 1px 3px rgba(0,0,0,.35); animation: pouls 1.6s ease-out infinite; }
@keyframes pouls { 50% { box-shadow: 0 0 0 9px rgba(220,38,38,.25), 0 1px 3px rgba(0,0,0,.35); } }
@media (prefers-reduced-motion: reduce) { .pt.urg-retard { animation: none; } }
.pt .bio { position: absolute; right: -4px; bottom: -4px; width: 13px; height: 13px; border-radius: 50%; background: var(--bio); border: 2px solid #fff; }
.moi { width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(26,115,232,.4); }

/* ── Feuilles : panneau bas sur téléphone, colonne droite sur tablette ── */
.feuille {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-height: 85dvh;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,.2);
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform .2s ease-out;
  z-index: 1100;
}
.feuille.ouverte { transform: none; }
.feuille-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: -12px; background: var(--surface); padding: 6px 0; z-index: 1; }

@media (min-width: 760px) {
  .feuille {
    left: auto; top: var(--barre); width: 420px; max-height: none;
    border-radius: 0; transform: translateX(105%);
  }
  .feuille.ouverte { transform: none; }
}

/* ── Fiche ───────────────────────────────────────────────── */
.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.badge { padding: 3px 10px; border-radius: 999px; background: var(--fond); border: 1px solid var(--bordure); font-size: .9rem; font-weight: 600; }
.badge[class*="et-"] { background: var(--c); border-color: var(--c); color: #fff; }
.badge-bio { color: var(--bio); border-color: var(--bio); }
.revoir { padding: 10px 12px; border-radius: var(--rayon); background: var(--fond); border-left: 5px solid var(--texte-2); }
.revoir.urg-semaine { border-left-color: var(--semaine); }
.revoir.urg-retard { border-left-color: var(--retard); background: #fef2f2; }
.adresse { color: var(--texte-2); }
.actions { display: flex; gap: 8px; margin-bottom: 8px; }
.actions .btn { flex: 1; }
.historique { padding-left: 18px; }
.historique li { margin-bottom: 8px; }
details { margin-top: 16px; }
summary { min-height: var(--cible); display: flex; align-items: center; font-weight: 600; color: var(--marque); cursor: pointer; }
.discret { color: var(--texte-2); font-size: .85rem; }

.vitrine { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--rayon); margin: 6px 0; background: var(--fond); }
.btn-photo { width: 100%; margin: 6px 0; }
.avis { padding: 10px 12px; border-radius: var(--rayon); background: #fffbeb; border-left: 5px solid var(--semaine); margin: 8px 0; }
.voisins { margin: 6px 0 0; padding-left: 18px; }
.voisins .lien { min-height: var(--cible); text-align: left; }
.ligne { display: grid; grid-template-columns: 7rem 1fr; gap: 8px; }

/* ── Connexion ───────────────────────────────────────────── */
.connexion { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.connexion h1 { margin-bottom: 24px; }
.btn-photo.envoi { opacity: .6; pointer-events: none; }

/* Barre haute sur un téléphone de 360–412 px : cinq éléments sur une ligne.
   Rien ne doit passer à la ligne — une barre qui double de hauteur décale
   la carte, et le bouton visé n'est plus sous le pouce. */
.barre { gap: 6px; }
.barre .btn { padding: 0 10px; white-space: nowrap; flex: none; }
.barre .bascule { white-space: nowrap; flex: none; }
.barre .compteur { font-size: .9rem; }
@media (max-width: 380px) { .barre .compteur { display: none; } }

/* ── Personnes ───────────────────────────────────────────────
   Le repère est le bloc le plus visible de la carte de visite :
   fond coloré, gros corps, en tête. Pour un prosopagnosique,
   c'est lui — pas le nom — qui permet de dire bonjour à la bonne
   personne. */
.personne { border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 10px 12px; margin-bottom: 10px; }
.personne-nom { margin: 0 0 6px; font-size: 1.05rem; }
.reperes { margin: 0 0 8px; padding: 10px 12px; border-radius: var(--rayon); background: var(--marque-pale); border-left: 5px solid var(--marque); font-size: 1.05rem; }
.reperes-titre { display: block; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--marque); margin-bottom: 2px; }
.reperes-vide { background: var(--fond); border-left-color: var(--bordure); color: var(--texte-2); font-size: .95rem; }
.champ-reperes textarea { border-color: var(--marque); border-width: 2px; }
.personne details { margin-top: 4px; }
.personne .actions .btn { font-size: .95rem; }
.notes-compte { padding: 8px 12px; border-radius: var(--rayon); background: var(--fond); margin: 6px 0; }
