/* Awa — PWA artisan. Refonte : nav par onglets, Fraunces + Hanken Grotesk. */
:root{
  --vert:#0E7C66; --vert-fonce:#0A4A3C; --ambre:#E29127; --rouge:#BE472E;
  --ok:#0E7C66;
  --fond:#F4F6F3; --carte:#FFFFFF; --carte2:#FAFBF9;
  --texte:#17231E; --muted:#5C6B63; --bord:#E4E9E3;
  --ombre:0 1px 2px rgba(10,74,60,.06), 0 6px 18px rgba(10,74,60,.06);
  --r:16px; --r-l:22px;
  --ui:'Hanken Grotesk',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --titre:'Fraunces',Georgia,serif;
}
@media (prefers-color-scheme:dark){
  :root{
    --fond:#0E1512; --carte:#16201C; --carte2:#111A16;
    --texte:#EAF1EC; --muted:#93A79C; --bord:#25322C;
    --vert:#2FA488; --ambre:#E9A63F; --rouge:#E06A50;
    --ombre:0 1px 2px rgba(0,0,0,.4), 0 8px 20px rgba(0,0,0,.35);
  }
}
*{box-sizing:border-box}
html,body{margin:0}
body{
  font-family:var(--ui); background:var(--fond); color:var(--texte);
  font-size:16px; line-height:1.45; -webkit-font-smoothing:antialiased;
  padding-bottom:env(safe-area-inset-bottom);
}
.hidden{display:none!important}
.muted{color:var(--muted)}
button{font-family:inherit; cursor:pointer}
.num{font-variant-numeric:tabular-nums; font-feature-settings:"tnum" 1}
h1,h2{font-family:var(--titre); font-weight:600; letter-spacing:-.01em; margin:0}
:focus-visible{outline:3px solid var(--vert); outline-offset:2px; border-radius:8px}
@media (prefers-reduced-motion:reduce){*{transition:none!important; animation:none!important}}

/* ---------- Connexion ---------- */
.login{min-height:100dvh; display:flex; flex-direction:column; justify-content:center;
  align-items:center; padding:24px; gap:8px}
.login-tete{text-align:center; margin-bottom:8px}
.login-tete .avatar{width:96px;height:96px;border-radius:50%;box-shadow:var(--ombre)}
.login-tete h1{font-size:44px; color:var(--vert-fonce); margin-top:14px}
@media (prefers-color-scheme:dark){.login-tete h1{color:var(--vert)}}
.login-tete p{color:var(--muted); font-size:18px; margin:6px 0 0}
.login-carte{background:var(--carte); border:1px solid var(--bord); border-radius:var(--r-l);
  box-shadow:var(--ombre); padding:22px; width:100%; max-width:420px}
.login-carte label{display:block; font-weight:600; margin:0 0 8px}
.tel{display:flex; gap:10px}
.drapeau{display:flex; align-items:center; gap:8px; padding:0 14px; border:1px solid var(--bord);
  border-radius:14px; background:var(--carte2); font-weight:700; white-space:nowrap}
input,textarea{font-family:inherit; font-size:16px; color:var(--texte); background:var(--carte2);
  border:1px solid var(--bord); border-radius:14px; padding:14px 16px; width:100%}
input:focus,textarea:focus{border-color:var(--vert); outline:none; box-shadow:0 0 0 3px rgba(14,124,102,.15)}
.login-carte button{margin-top:14px; width:100%; background:var(--vert); color:#fff; border:0;
  border-radius:14px; padding:15px; font-size:17px; font-weight:700; min-height:52px}
.login-carte .retour{background:none; color:var(--muted); width:auto; padding:6px 0; margin:0; font-weight:600}
.aide{color:var(--muted); font-size:14px; margin:12px 0 0}
.err{color:var(--rouge); font-weight:600; margin-top:12px; min-height:1.2em}

/* ---------- Cadre app ---------- */
#ecranApp{min-height:100dvh; display:flex; flex-direction:column;
  max-width:560px; margin:0 auto}
header{display:flex; align-items:center; gap:12px; padding:14px 16px calc(14px);
  position:sticky; top:0; background:color-mix(in srgb,var(--fond) 88%,transparent);
  backdrop-filter:blur(8px); z-index:5}
header .avatar{width:40px;height:40px;border-radius:50%}
.bonjour{flex:1; line-height:1.15}
.bonjour .salut{color:var(--muted); font-size:14px}
.bonjour .nom{font-family:var(--titre); font-weight:600; font-size:20px}
header #btnReglages{background:var(--carte); border:1px solid var(--bord); color:var(--texte);
  width:42px;height:42px; border-radius:12px; display:grid; place-items:center}
/* Assez de dégagement en bas pour que le dernier message de la conversation
   passe au-dessus du champ de saisie ET de la barre d'onglets (56px barre +
   ~68px saisie + marge système). */
.zone{flex:1; padding:6px 16px calc(132px + env(safe-area-inset-bottom))}
.vue{animation:fade .18s ease}
@keyframes fade{from{opacity:0; transform:translateY(4px)}to{opacity:1;transform:none}}

/* ---------- Micro (Atelier) ---------- */
.micro-bloc{text-align:center; padding:14px 0 6px}
.micro{width:210px;height:210px;border-radius:50%; border:0; background:radial-gradient(120% 120% at 50% 20%,var(--ambre),#cf7f1e);
  color:#20140A; box-shadow:0 10px 30px rgba(226,145,39,.35); display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:8px; font-weight:800; font-size:19px}
.micro svg{width:44px;height:44px}
.micro.enregistre{background:radial-gradient(120% 120% at 50% 20%,var(--rouge),#a03a25); color:#fff;
  animation:pulse 1.4s ease-in-out infinite}
@keyframes pulse{0%,100%{box-shadow:0 10px 30px rgba(190,71,46,.35)}50%{box-shadow:0 10px 44px rgba(190,71,46,.6)}}
/* En communication : halo vert pulsant (le même bouton sert à raccrocher). */
.micro.en-appel{background:radial-gradient(120% 120% at 50% 20%,var(--vert),#0a4a3c); color:#fff;
  animation:pulse-appel 1.6s ease-in-out infinite}
@keyframes pulse-appel{0%,100%{box-shadow:0 10px 30px rgba(14,124,102,.35)}
  50%{box-shadow:0 12px 52px rgba(14,124,102,.65)}}
.exemple{color:var(--muted); margin:14px 6px 0; font-size:15px}
.exemple em{color:var(--texte); font-style:normal; font-weight:600}

/* ---------- Tuiles résumé ---------- */
.tuiles{display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:18px 0}
.tuile{border:1px solid var(--bord); border-radius:var(--r); background:var(--carte);
  box-shadow:var(--ombre); padding:16px; text-align:left; display:flex; flex-direction:column; gap:2px}
.tuile-n{font-family:var(--titre); font-weight:700; font-size:30px; font-variant-numeric:tabular-nums}
.tuile-l{color:var(--muted); font-weight:600}
.tuile.amber .tuile-n{color:var(--ambre)}
.tuile.rouge .tuile-n{color:var(--rouge)}

/* ---------- Aperçu / sections ---------- */
.apercu-tete,.resume-mois{display:flex; align-items:center; justify-content:space-between; margin:6px 2px 10px}
.apercu-tete h2{font-size:19px}
.lien{background:none;border:0;color:var(--vert);font-weight:700}
h2.sec{font-size:20px; margin:18px 2px 10px}

/* ---------- Lignes de document (cartes) ---------- */
.ligne{display:flex; align-items:center; gap:12px; background:var(--carte); border:1px solid var(--bord);
  border-radius:var(--r); box-shadow:var(--ombre); padding:14px 16px; margin-bottom:10px; width:100%;
  text-align:left; color:inherit; min-height:60px}
.ligne .corps{flex:1; min-width:0}
.ligne .client{font-weight:700}
.ligne .presta{color:var(--muted); font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.ligne .montant{font-family:var(--titre); font-weight:600; font-size:19px; font-variant-numeric:tabular-nums; margin-top:2px}
.ligne .droite{display:flex; align-items:center; gap:8px; flex:0 0 auto}
.ligne .chev{color:var(--muted); width:20px;height:20px}

/* ---------- Pastilles (couleur + forme) ---------- */
.pastille{display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:700;
  padding:5px 11px; border-radius:999px; white-space:nowrap}
.pastille::before{content:""; width:8px;height:8px; border-radius:2px; display:inline-block}
.pastille.attente{background:rgba(226,145,39,.15); color:#a86a10}
.pastille.attente::before{background:var(--ambre); border-radius:2px}          /* carré = à faire */
.pastille.ok{background:rgba(14,124,102,.15); color:var(--vert)}
.pastille.ok::before{background:var(--ok); border-radius:50%}                    /* rond = accepté */
.pastille.refus{background:rgba(190,71,46,.15); color:var(--rouge)}
.pastille.refus::before{background:var(--rouge); transform:rotate(45deg)}        /* losange = refus */
.pastille.neutre{background:var(--carte2); color:var(--muted); border:1px solid var(--bord)}
.pastille.neutre::before{background:var(--muted); clip-path:polygon(50% 0,100% 100%,0 100%)} /* triangle = expiré */
@media (prefers-color-scheme:dark){.pastille.attente{color:var(--ambre)}}

/* ---------- Boutons ---------- */
.btn{border:0; border-radius:12px; padding:12px 16px; font-weight:700; font-size:15px; min-height:48px;
  display:inline-flex; align-items:center; justify-content:center; gap:8px}
.btn.primaire{background:var(--vert); color:#fff}
.btn.ligne-b{background:var(--carte); border:1px solid var(--bord); color:var(--texte)}
.btn svg{width:19px;height:19px}
.mini{min-height:40px; padding:8px 14px; font-size:14px; border-radius:11px}
.retour{background:none; border:0; color:var(--muted); font-weight:700; display:inline-flex; align-items:center;
  gap:4px; padding:8px 0; margin-bottom:4px}

/* ---------- Détail devis ---------- */
.detail-tete{background:var(--carte); border:1px solid var(--bord); border-radius:var(--r-l);
  box-shadow:var(--ombre); padding:18px; margin-bottom:14px}
.detail-tete .client{font-family:var(--titre); font-weight:600; font-size:24px}
.detail-tete .meta{color:var(--muted); font-size:14px; margin-top:6px; display:flex; gap:8px; flex-wrap:wrap; align-items:center}
.lignes-t{width:100%; border-collapse:collapse; margin:6px 0 4px}
.lignes-t td{padding:10px 0; border-bottom:1px solid var(--bord); vertical-align:top}
.lignes-t .d{font-weight:600}
.lignes-t .q{color:var(--muted); font-size:14px}
.lignes-t .m{text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; font-family:var(--titre)}
.totaux{margin-top:10px}
.totaux .ligne-t{display:flex; justify-content:space-between; padding:5px 0}
.totaux .ttc{display:flex; justify-content:space-between; align-items:baseline; gap:12px;
  font-family:var(--titre); font-weight:700; font-size:22px; border-top:2px solid var(--bord); padding-top:10px; margin-top:4px}
.totaux .ttc .v{font-variant-numeric:tabular-nums}
.mention{color:var(--muted); font-size:13px; margin-top:8px}
.actions{display:flex; gap:10px; margin-top:16px; flex-wrap:wrap}
.actions .btn{flex:1; min-width:120px}

/* ---------- Suivi : commandes (barre acompte/reste) ---------- */
.cmd .barre-paye{height:8px; border-radius:999px; background:var(--bord); overflow:hidden; margin-top:8px}
.cmd .barre-paye > i{display:block; height:100%; background:var(--vert); border-radius:999px}
.cmd .paye-txt{display:flex; justify-content:space-between; color:var(--muted); font-size:13px; margin-top:6px}
.cmd .paye-txt .reste{color:var(--rouge); font-weight:700}
.cmd .paye-txt .solde{color:var(--vert); font-weight:700}
.total-du{display:flex; justify-content:space-between; align-items:center; background:rgba(190,71,46,.1);
  border:1px solid rgba(190,71,46,.25); border-radius:var(--r); padding:14px 16px; margin-bottom:12px}
.total-du .v{font-family:var(--titre); font-weight:700; font-size:22px; color:var(--rouge); font-variant-numeric:tabular-nums}

/* ---------- Vide / chargement ---------- */
.vide{color:var(--muted); text-align:center; padding:34px 16px; font-size:15px}
.skeleton{height:60px; border-radius:var(--r); background:linear-gradient(90deg,var(--carte),var(--carte2),var(--carte));
  background-size:200% 100%; animation:sk 1.2s infinite; margin-bottom:10px}
@keyframes sk{to{background-position:-200% 0}}

/* ---------- Conversation (Awa) ---------- */
.fil{display:flex; flex-direction:column; gap:10px; padding:10px 0 6px}
.bulle{max-width:82%; padding:11px 14px; border-radius:16px; line-height:1.4; white-space:pre-wrap; word-wrap:break-word}
.bulle.moi{align-self:flex-end; background:var(--vert); color:#fff; border-bottom-right-radius:5px}
.bulle.awa{align-self:flex-start; background:var(--carte); border:1px solid var(--bord); border-bottom-left-radius:5px}
.bulle.attente{color:var(--muted); font-style:italic}
.carte-devis{align-self:flex-start; max-width:88%; background:var(--carte); border:1px solid var(--bord);
  border-radius:var(--r); box-shadow:var(--ombre); padding:14px; margin-top:2px}
.carte-devis .coiffe{color:var(--vert); font-weight:800; font-size:13px; text-transform:uppercase; letter-spacing:.04em}
.carte-devis .client{font-family:var(--titre); font-weight:600; font-size:19px; margin-top:4px}
.carte-devis .total{font-family:var(--titre); font-weight:700; font-size:22px; font-variant-numeric:tabular-nums; margin:4px 0 8px}
.carte-devis .actions{margin-top:6px}

/* ---------- Barre de saisie ---------- */
/* Le champ de saisie est calé JUSTE au-dessus de la barre d'onglets, quelle que
   soit sa hauteur : la barre mesure 56px + la marge système du bas. Ainsi il
   reste visible et cliquable, jamais recouvert par le menu. */
.barre{position:fixed; left:0; right:0; bottom:calc(56px + env(safe-area-inset-bottom));
  max-width:560px; margin:0 auto; z-index:7;
  display:flex; gap:8px; padding:10px 12px; background:color-mix(in srgb,var(--fond) 92%,transparent);
  backdrop-filter:blur(8px); border-top:1px solid var(--bord)}
.barre textarea{resize:none; max-height:132px}
.rond{flex:0 0 auto; width:48px;height:48px; border-radius:50%; border:0; background:var(--vert); color:#fff;
  display:grid; place-items:center}
.rond svg{width:22px;height:22px}
.rond.micro-petit{background:var(--carte); border:1px solid var(--bord); color:var(--vert)}
.rond.micro-petit.enregistre{background:var(--rouge); color:#fff; border-color:var(--rouge)}

/* ---------- Barre d'onglets ---------- */
.tabbar{position:fixed; left:0; right:0; bottom:0; max-width:560px; margin:0 auto; z-index:6;
  display:grid; grid-template-columns:repeat(4,1fr); background:var(--carte);
  border-top:1px solid var(--bord); padding-bottom:env(safe-area-inset-bottom)}
.tab{background:none; border:0; color:var(--muted); padding:9px 0 8px; display:flex; flex-direction:column;
  align-items:center; gap:3px; font-size:11px; font-weight:700; min-height:56px; min-width:0}
.tab svg{width:24px;height:24px}
.tab span{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%}
.tab.actif{color:var(--vert)}

/* Accès discret au carnet Clients, depuis Suivi (plus d'onglet du bas). */
.lien-clients{display:flex; align-items:center; gap:10px; width:100%; text-align:left;
  background:var(--carte); border:1px solid var(--bord); border-radius:var(--r);
  padding:12px 14px; margin-bottom:14px; font-weight:700; font-size:15px; color:var(--texte)}
.lien-clients .chev{margin-left:auto; color:var(--muted)}
.lien-clients svg{color:var(--vert)}

/* ---------- Feuille réglages ---------- */
.feuille{position:fixed; inset:0; background:rgba(10,20,16,.5); display:flex; align-items:flex-end; z-index:20}
.feuille .contenu{background:var(--carte); width:100%; max-width:560px; margin:0 auto; border-radius:22px 22px 0 0;
  padding:22px 20px calc(24px + env(safe-area-inset-bottom)); max-height:92vh; overflow-y:auto}
.feuille .sep{border:0; border-top:1px solid var(--bord); margin:18px 0}

/* ---------- Alerte de complétude (accueil) ---------- */
.alerte-identite{display:flex; flex-direction:column; gap:2px; text-align:left; width:100%;
  background:color-mix(in srgb,var(--ambre) 14%,var(--carte)); border:1px solid color-mix(in srgb,var(--ambre) 40%,var(--bord));
  color:var(--texte); border-radius:14px; padding:12px 14px; margin-bottom:14px; font-size:15px}
.alerte-identite strong{font-weight:700}
.alerte-identite span{color:var(--muted); font-size:13px}

/* ---------- Formulaire identité (réglages) ---------- */
#formIdentite{display:flex; flex-direction:column; gap:12px}
.champ-id{display:flex; flex-direction:column; gap:5px; font-size:13px; color:var(--muted); font-weight:600}
.champ-id input{font-size:16px; color:var(--texte); font-weight:400}
.champ-check{display:flex; align-items:center; gap:10px; font-weight:600; font-size:15px}
.champ-check input{width:auto}
.mentions-titre{font-weight:700; font-size:14px; margin-top:6px; color:var(--vert-fonce)}
@media (prefers-color-scheme:dark){.mentions-titre{color:var(--vert)}}
#btnSauverIdentite{background:var(--vert); color:#fff; border:0; border-radius:14px; padding:14px; font-weight:700; font-size:16px}
.logo-ligne{display:flex; align-items:center; gap:14px}
.mono-apercu{width:52px; height:52px; border-radius:50%; background:var(--vert-fonce); color:#fff;
  display:flex; align-items:center; justify-content:center; font-family:var(--titre); font-weight:600; font-size:20px; flex:0 0 auto}
.logo-actions{display:flex; flex-direction:column; gap:4px}
.logo-titre{font-weight:700; font-size:14px}
.fantome.mini{background:var(--carte2); border:1px solid var(--bord); color:var(--vert); border-radius:12px;
  padding:8px 12px; font-weight:700; font-size:13px; cursor:pointer; display:inline-block; width:auto}
.feuille h2{font-size:22px}
.feuille .muted{margin:6px 0 18px}
.feuille button.discret{background:var(--carte2); border:1px solid var(--bord); color:var(--rouge); border-radius:14px; padding:14px; font-weight:700}
.feuille button.fantome{background:none; border:0; color:var(--muted); font-weight:700}

@media (min-width:600px){ .barre,.tabbar{border-left:1px solid var(--bord); border-right:1px solid var(--bord)} }

/* Toast (envoi de devis, etc.) */
.toast{position:fixed; left:50%; bottom:78px; transform:translate(-50%,20px); z-index:30;
  background:var(--vert-fonce); color:#fff; padding:12px 18px; border-radius:14px; box-shadow:var(--ombre);
  font-weight:600; max-width:90%; text-align:center; opacity:0; pointer-events:none; transition:opacity .2s, transform .2s}
.toast.montre{opacity:1; transform:translate(-50%,0)}
.toast.erreur{background:var(--rouge)}
@media (prefers-color-scheme:dark){.toast{background:#0f2b23}}

/* ---------- Clients (carnet) ---------- */
.pastille-nb{background:var(--carte2); border:1px solid var(--bord); color:var(--muted);
  border-radius:999px; padding:3px 9px; font-size:12px; font-weight:700; white-space:nowrap}
.fiche-bloc{background:var(--carte); border:1px solid var(--bord); border-radius:var(--r); padding:4px 14px}
.fiche-ligne{display:flex; justify-content:space-between; gap:12px; padding:10px 0;
  border-bottom:1px solid var(--bord)}
.fiche-ligne:last-child{border-bottom:0}
.fiche-k{color:var(--muted); font-size:14px; font-weight:600}
.fiche-v{font-size:15px; text-align:right; word-break:break-word}
