/* App d'appels (T-642) — pensée pour l'ordinateur, lisible sur téléphone. */
:root {
  --fond: #f6f7fb;
  --carte: #ffffff;
  --texte: #1c2333;
  --discret: #626b80;
  --bord: #e2e5ee;
  --accent: #4338ca;
  --accent-fond: #eef0ff;
  --vert: #15803d;
  --vert-fond: #e8f6ee;
  --ambre: #a16207;
  --ambre-fond: #fdf5e1;
  --rouge: #b91c1c;
  --rouge-fond: #fdecec;
  --rayon: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--discret); margin: 0 0 .6rem; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
small { display: block; color: var(--discret); font-size: .8rem; }
.discret { color: var(--discret); }

/* En-tête */
.entete {
  display: flex; align-items: center; gap: 24px; padding: 10px 20px;
  background: var(--carte); border-bottom: 1px solid var(--bord); position: sticky; top: 0; z-index: 2;
}
.marque { font-weight: 700; color: var(--texte); text-decoration: none; font-size: 1.05rem; }
.marque span, .connexion h1 span { color: var(--accent); }
.entete nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.entete nav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--texte); font-weight: 500; }
.entete nav a:hover { background: var(--fond); }
.entete nav a[aria-current="page"] { background: var(--accent-fond); color: var(--accent); }
.qui { display: flex; align-items: center; gap: 12px; color: var(--discret); white-space: nowrap; }

/* Boutons et champs */
button, .bouton {
  font: inherit; font-weight: 600; border: 1px solid var(--bord); background: var(--carte); color: var(--texte);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-block; min-height: 40px;
}
button:hover, .bouton:hover { border-color: #c5cad8; }
button.principal, .bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
button.lien { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; }
input, select, textarea {
  font: inherit; color: inherit; border: 1px solid var(--bord); border-radius: 8px; padding: 8px 10px;
  background: #fff; width: 100%; min-height: 40px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label { display: block; font-weight: 500; margin-bottom: 12px; }
label input, label select, label textarea { margin-top: 4px; }

/* Cartes */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 18px 20px; margin-bottom: 16px; }
.info, .note, .erreur { border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; }
.info, .note { background: var(--accent-fond); }
.erreur { background: var(--rouge-fond); color: var(--rouge); }
.note { margin: 12px 0 0; }

/* Connexion */
.connexion { max-width: 380px; margin: 10vh auto 0; padding: 28px; }
.connexion h1 { margin-bottom: 18px; }
.connexion button { width: 100%; margin-top: 6px; }

/* Liste */
.barre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.recherche { display: flex; gap: 8px; flex: 0 1 420px; }
table.liste { width: 100%; border-collapse: collapse; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); overflow: hidden; }
.liste th, .liste td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--bord); vertical-align: top; }
.liste th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--discret); background: #fafbfd; }
.liste tr:last-child td { border-bottom: 0; }
.liste td a { font-weight: 600; text-decoration: none; }
.liste td a:hover { text-decoration: underline; }
.nombre { text-align: right !important; white-space: nowrap; }
.tel { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Pastilles */
.pastille { display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.p1 { background: var(--vert-fond); color: var(--vert); }
.p2 { background: var(--ambre-fond); color: var(--ambre); }

/* Fiche */
.fiche-titre { margin-bottom: 14px; }
.fiche-titre p { margin: 0; color: var(--discret); }
.appeler {
  display: inline-block; font-size: 1.7rem; font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums;
  padding: 6px 16px; border-radius: 10px; background: var(--accent-fond); margin-bottom: 8px;
}
.fiche dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.fiche dt { color: var(--discret); }
.fiche dd { margin: 0; overflow-wrap: anywhere; }
.carte p { margin: 4px 0; }

.entete .suivant { min-height: 36px; padding: 6px 16px; }
.fiche-grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.fiche-grille > div:last-child { position: sticky; top: 64px; }
.fiche-titre h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* États d'une fiche */
.etat { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.e-a_appeler { background: #eef1f6; color: var(--discret); }
.e-sans_reponse { background: var(--ambre-fond); color: var(--ambre); }
.e-a_rappeler { background: var(--accent-fond); color: var(--accent); }
.e-rdv { background: var(--vert-fond); color: var(--vert); }
.e-termine, .e-injoignable { background: #f1f2f5; color: #7a8193; }

/* Ce qui vient d'être noté */
.note-appel { background: var(--vert-fond); color: #14532d; border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }

/* Historique */
.historique { list-style: none; margin: 0; padding: 0; }
.historique li { padding: 8px 0; border-bottom: 1px solid var(--bord); }
.historique li:last-child { border-bottom: 0; }
.historique small { display: block; }
.remarque { white-space: pre-wrap; margin: 4px 0 0 !important; }

/* Résultat de l'appel */
.boutons-resultat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.boutons-resultat button { width: 100%; }
button.danger { color: var(--rouge); border-color: #f2c4c4; }
button.danger:hover { background: var(--rouge-fond); }
fieldset.rappel { border: 1px solid var(--bord); border-radius: 8px; padding: 10px 12px 12px; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
fieldset.rappel legend { font-weight: 600; padding: 0 4px; }
fieldset.rappel input { width: auto; flex: 1 1 140px; }
textarea { resize: vertical; }

/* Le texte à dire */
.script .etapes { margin: 0; padding-left: 1.3rem; }
.script .etapes li { margin-bottom: 10px; }
.script .etapes li::marker { color: var(--accent); font-weight: 700; }
.dire { margin: 2px 0 0 !important; font-size: 1.02rem; line-height: 1.55; }
.conseil { margin: 4px 0 0 !important; color: var(--discret); font-size: .88rem; }
.conseil::before { content: "→ "; }
.script details { border-top: 1px solid var(--bord); padding-top: 10px; margin-top: 10px; }
.script summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.objections { margin: 10px 0 0; }
.objections dt { font-weight: 600; margin-top: 10px; }
.objections dd { margin: 2px 0 0; }

/* Rendez-vous */
details.rdv > summary { cursor: pointer; font-weight: 700; color: var(--accent); font-size: 1rem; }
details.rdv[open] > summary { margin-bottom: 12px; }
details.rdv fieldset { border: 0; padding: 0; margin: 0 0 12px; }
details.rdv legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.creneaux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
label.choix {
  display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-weight: 500;
  border: 1px solid var(--bord); border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
label.choix:has(input:checked) { border-color: var(--accent); background: var(--accent-fond); }
label.choix input { width: auto; min-height: 0; margin: 0; }
.rdv-actif { border-color: #b7e2c6; background: var(--vert-fond); }
.note-appel.alerte { background: var(--ambre-fond); color: #713f12; }
form.en-ligne { display: inline-flex; gap: 6px; align-items: center; margin: 0 0 4px; }
form.en-ligne select { width: auto; }
td.actions { white-space: nowrap; }
.titre-section { margin: 28px 0 10px; }
.ajout-creneau { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.ajout-creneau label { margin: 0; }
.ajout-creneau input, .ajout-creneau select { width: auto; }

/* Numéro trouvé */
.ajout-numero { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ajout-numero input { flex: 1 1 180px; width: auto; }
.ajout-numero .erreur { flex-basis: 100%; margin: 0; }
details.autre-numero { margin-top: 8px; }
details.autre-numero summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: .9rem; }

/* Suivi */
.exports { display: flex; gap: 8px; margin: 0; }
.grille-suivi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
dl.chiffres { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin: 0; }
dl.chiffres dt { color: var(--discret); }
dl.chiffres dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
dl.chiffres dt:first-child, dl.chiffres dt:first-child + dd { color: var(--texte); font-size: 1.1rem; }

@media (max-width: 900px) {
  .grille-suivi { grid-template-columns: minmax(0, 1fr); }
  .fiche-grille { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .boutons-resultat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entete { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .liste th:nth-child(4), .liste td:nth-child(4) { display: none; }
  .fiche dl { grid-template-columns: minmax(0, 1fr); }
}
