/* Tableau de bord du gérant : un logiciel de gestion classique, sobre et précis. */
:root {
  --fond: #f5f6f8;
  --surface: #fff;
  --survol: #f8f9fb;
  --filet: #e3e5ea;
  --filet-doux: #eef0f3;
  --encre: #15181d;
  --texte: #2f3540;
  --gris: #5b6270;
  --pale: #6b7280;
  --accent: #1f57c3;
  --accent-fonce: #18469f;
  --accent-doux: #ecf1fb;
  /* États : un point devant le texte, jamais un fond de couleur. */
  --e-envoye: #9aa0aa;
  --e-relance: #1f57c3;
  --e-appeler: #c3262f;
  --e-repondu: #b25f00;
  --e-signe: #1e7f45;
  --e-perdu: #5b6270;
  --e-ecarte: #c4c8cf;
  --r: 8px;
  --cote: 232px;
  --ombre: 0 1px 2px rgb(21 24 29 / .06);
  --sortie: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
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, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
/* Un logiciel, pas une page web : un double-clic ou un glissé ne surligne pas l'écran.
   Restent sélectionnables : les champs, et les textes qu'on peut vouloir copier (notes, textes des relances). */
body { -webkit-user-select: none; user-select: none; }
input, textarea, .notes li, .a-venir p, .msg-apercu { -webkit-user-select: text; user-select: text; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { list-style: none; padding: 0; }
h1, h2, h3, b, strong { color: var(--encre); }
h1 { font-size: 24px; line-height: 1.25; font-weight: 650; letter-spacing: -0.015em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--gris); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: var(--accent); text-underline-offset: 3px; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: #cddcf7; color: var(--encre); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
input { caret-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: #c9cdd4 transparent; }

/* --- Structure : barre latérale + zone principale --- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--cote); z-index: 20;
  background: var(--surface); border-right: 1px solid var(--filet);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.marque { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; min-width: 0; }
.marque span:last-child { min-width: 0; }
.marque b { display: block; font-size: 15px; line-height: 1.3; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marque small { display: block; font-size: 12.5px; color: var(--gris); }
.ini {
  width: 32px; height: 32px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 650; letter-spacing: .02em;
}
.nav { display: grid; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 6px;
  color: var(--gris); font-weight: 500;
}
.nav button:hover { background: var(--survol); color: var(--encre); }
.nav button[aria-current] { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
.par { margin-top: auto; padding: 8px; font-size: 12px; color: var(--pale); }
.par.bas { display: none; }
.haut { display: none; }

.main { margin-left: var(--cote); padding: 28px 36px 56px; max-width: calc(var(--cote) + 1240px); }
.tete { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.sous { color: var(--gris); font-size: 14px; }
.sous.alerte, .alerte { color: var(--e-appeler); }

/* Résumé : quatre chiffres dans une phrase, pas un bandeau de cartes. */
.resume { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; color: var(--gris); margin: 0 0 22px; }
.resume b { font-weight: 650; }
.resume button { color: var(--gris); text-decoration: underline; text-decoration-color: var(--filet); text-underline-offset: 4px; }
.resume button:hover { color: var(--accent); text-decoration-color: currentColor; }
.resume button:hover b { color: inherit; }

.cols { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.col { display: grid; gap: 20px; }

.panneau { background: var(--surface); border: 1px solid var(--filet); border-radius: var(--r); box-shadow: var(--ombre); overflow: hidden; }
.panneau > header { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 18px; border-bottom: 1px solid var(--filet-doux); }
.panneau > header .lien, .panneau > header .aide-h { margin-left: auto; }
.aide-h { font-size: 13px; color: var(--pale); }
.lien { color: var(--accent); font-size: 14px; font-weight: 500; }
.lien:hover { text-decoration: underline; text-underline-offset: 3px; }
.compte { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--e-appeler); color: #fff; font-size: 12.5px; font-weight: 650; display: inline-grid; place-items: center; }
.compte[data-vide="true"] { display: none; }
.vide { padding: 18px; color: var(--gris); font-size: 14px; }
.corps { padding: 18px; }

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 6px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap;
  text-decoration: none; box-shadow: 0 1px 2px rgb(21 24 29 / .12); transition: background .15s;
}
.btn:hover { background: var(--accent-fonce); }
.btn svg { width: 16px; height: 16px; stroke-width: 1.8; }
.btn.second { background: var(--surface); color: var(--encre); box-shadow: inset 0 0 0 1px var(--filet), 0 1px 2px rgb(21 24 29 / .05); }
.btn.second:hover { background: var(--survol); box-shadow: inset 0 0 0 1px #cfd3da, 0 1px 2px rgb(21 24 29 / .05); }
.btn.plein { width: 100%; height: 44px; margin-top: 18px; }

/* --- Statut : point de couleur + texte --- */
.statut { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--texte); white-space: nowrap; }
.statut::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--pale)); }
.statut[data-e="envoye"] { --c: var(--e-envoye); }
.statut[data-e="relance"] { --c: var(--e-relance); }
.statut[data-e="appeler"] { --c: var(--e-appeler); color: var(--e-appeler); font-weight: 600; }
.statut[data-e="repondu"] { --c: var(--e-repondu); }
.statut[data-e="signe"] { --c: var(--e-signe); }
.statut[data-e="perdu"] { --c: var(--e-perdu); color: var(--gris); }
.statut[data-e="ecarte"] { --c: var(--e-ecarte); color: var(--pale); }

/* Trois cases J+3 / J+7 / J+14 : pleine = partie, creuse = à venir, barrée = sautée. */
.cases { display: inline-flex; gap: 4px; vertical-align: middle; }
.cases i { width: 14px; height: 14px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px #c4c8cf; }
.cases i.partie { background: var(--accent); box-shadow: none; }
.cases i.sautee { background: linear-gradient(to top right, transparent 44%, var(--e-appeler) 44% 56%, transparent 56%); box-shadow: inset 0 0 0 1.5px #e5a3a7; }

/* --- À rappeler --- */
.appels li { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--filet-doux); }
.appels li:first-child { border-top: 0; }
.appels .qui { flex: 1; min-width: 0; }
.appels .qui b { display: block; font-weight: 600; }
.appels .qui:hover b { color: var(--accent); }
.appels .qui small { display: block; color: var(--gris); font-size: 13.5px; }
.appels .btn { color: var(--e-appeler); }
.appels .btn svg { stroke: var(--e-appeler); }
.manque { font-size: 13px; color: var(--pale); }

/* --- Liste des devis (tableau) --- */
.ligne {
  display: grid; grid-template-columns: minmax(170px, 1.4fr) minmax(140px, 1.3fr) 76px 66px 124px 96px;
  gap: 16px; align-items: center; width: 100%; padding: 11px 18px; border-top: 1px solid var(--filet-doux);
  font-size: 14px; transition: background .12s;
}
button.ligne:hover { background: var(--survol); }
button.ligne:hover .nom b { color: var(--accent); }
.ligne.tete-l { border-top: 0; padding-block: 9px; font-size: 12px; font-weight: 600; color: var(--gris); text-transform: uppercase; letter-spacing: .05em; background: var(--survol); border-bottom: 1px solid var(--filet-doux); }
.ligne.tete-l + .ligne { border-top: 0; }
.ligne .nom { min-width: 0; }
.ligne .nom b, .ligne .nom small, .ligne .proj { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne .nom b { font-weight: 600; }
.ligne .nom small { color: var(--gris); font-size: 13px; }
.ligne .proj { color: var(--texte); }
.ligne .proj i { color: var(--pale); font-style: normal; }
.ligne .date { color: var(--gris); }
.ligne .mt { text-align: right; font-weight: 600; color: var(--encre); }
.ligne.tete-l .mt { color: var(--gris); }
.panneau .ligne:not(.tete-l) { min-height: 56px; }
/* Sur l'accueil, la colonne est plus étroite : on retire projet et date. */
#recents .ligne { grid-template-columns: minmax(150px, 1.4fr) 66px 124px 96px; }
#recents .proj, #recents .date { display: none; }
.ligne.court { grid-template-columns: minmax(0, 1fr) auto 96px; }

/* --- Outils de la liste --- */
.outils { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0 14px; flex-wrap: wrap; }
.onglets { display: flex; gap: 4px; flex-wrap: wrap; }
.onglets button {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 6px;
  color: var(--gris); font-size: 14px; font-weight: 500;
}
.onglets button span { font-size: 12.5px; color: var(--pale); }
.onglets button:hover { background: #eceef2; color: var(--encre); }
.onglets button[aria-pressed="true"] { background: var(--surface); color: var(--encre); font-weight: 600; box-shadow: inset 0 0 0 1px var(--filet), var(--ombre); }
.onglets button[aria-pressed="true"] span { color: var(--gris); }
.cherche { display: flex; align-items: center; gap: 8px; height: 36px; width: min(300px, 100%); padding: 0 10px; border-radius: 6px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--filet); color: var(--pale); }
.cherche:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px #d6e2f8; }
.cherche svg { width: 16px; height: 16px; }
.cherche input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 14px; color: var(--encre); }
.cherche input::placeholder { color: var(--gris); }

/* --- Relances prévues --- */
.prevues { padding: 6px 0 10px; }
.prevues dt { padding: 12px 18px 4px; font-size: 12.5px; font-weight: 600; color: var(--gris); }
.prevues dd button { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 6px 18px; font-size: 14px; }
.prevues dd button:hover { background: var(--survol); }
.prevues dd button:hover span { color: var(--accent); }
.prevues dd span { color: var(--encre); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prevues dd small { font-size: 13px; color: var(--gris); white-space: nowrap; }
.prevues dd small.alerte { color: var(--e-appeler); }

/* --- Bilan --- */
.cols.bilan { grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); margin-top: 20px; }
.gros { font-size: 40px; line-height: 1.1; font-weight: 650; letter-spacing: -0.02em; color: var(--e-signe); margin-bottom: 8px; }
.chiffres { display: grid; grid-template-columns: 1fr auto; }
.chiffres dt, .chiffres dd { padding: 12px 18px; border-top: 1px solid var(--filet-doux); font-size: 14px; }
.chiffres dt:first-of-type, .chiffres dd:first-of-type { border-top: 0; }
.chiffres dd { text-align: right; font-weight: 650; color: var(--encre); }

/* --- Messages : chaque relance telle que le client la reçoit, et son texte modifiable --- */
.exemple { font-size: 13.5px; color: var(--pale); margin: 2px 0 18px; }
.messages { display: grid; gap: 20px; }
.msg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
.msg-infos { display: grid; align-content: start; justify-items: start; gap: 14px; padding: 18px; font-size: 14px; border-right: 1px solid var(--filet-doux); }
.msg-apercu { display: grid; place-items: start center; padding: 22px 18px; background: var(--survol); }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-doux); color: var(--accent); font-size: 13px; font-weight: 650; }
/* Email : une fenêtre de messagerie, en réponse au mail du devis. */
.mail { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--filet); border-radius: var(--r); box-shadow: var(--ombre); }
.mail-objet { padding: 14px 16px 10px; font-size: 15px; font-weight: 600; color: var(--encre); }
.mail-de { display: flex; align-items: center; gap: 10px; padding: 0 16px 12px; border-bottom: 1px solid var(--filet-doux); font-size: 13.5px; min-width: 0; }
.mail-de div { min-width: 0; }
.mail-de b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-de small { display: block; color: var(--gris); font-size: 13px; }
.mail-de time { margin-left: auto; color: var(--pale); font-size: 12.5px; }
.mail-texte { padding: 16px; font-size: 14.5px; line-height: 1.55; color: var(--encre); white-space: pre-wrap; overflow-wrap: anywhere; }
.mail-cite { margin: 0 16px 16px; padding-left: 10px; border-left: 2px solid var(--filet); font-size: 13px; color: var(--pale); }
/* SMS : un écran de téléphone, bulle reçue. */
.tel { width: 300px; max-width: 100%; background: var(--surface); border: 1px solid var(--filet); border-radius: 28px; box-shadow: var(--ombre); overflow: hidden; }
.tel-tete { display: grid; justify-items: center; gap: 4px; padding: 18px 16px 12px; background: var(--survol); border-bottom: 1px solid var(--filet-doux); }
.tel-tete .avatar { width: 40px; height: 40px; font-size: 15px; }
.tel-tete b { font-size: 13.5px; font-weight: 600; }
.tel-fil { display: grid; align-content: start; gap: 8px; min-height: 200px; padding: 14px 14px 24px; }
.tel-fil time { justify-self: center; font-size: 11.5px; color: var(--pale); }
.bulle { justify-self: start; max-width: 88%; padding: 9px 13px; border-radius: 18px 18px 18px 6px; background: #e9ebef; color: var(--encre); font-size: 14.5px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.bulle .stop { color: var(--gris); }
/* Modification du texte */
.editeur { display: grid; gap: 10px; width: 100%; }
.editeur .champ { margin-top: 0; }
.editeur textarea {
  width: 100%; padding: 10px 11px; border: 0; border-radius: 6px; background: var(--surface); color: var(--encre);
  box-shadow: inset 0 0 0 1px #d5d9e0; font-size: 15px; font-weight: 400; line-height: 1.5; resize: vertical;
}
.editeur textarea:focus { outline: 0; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px #d6e2f8; }
.inserer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--gris); }
.inserer button { height: 28px; padding: 0 9px; border-radius: 6px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--filet); font-size: 13px; color: var(--encre); }
.inserer button:hover { background: var(--survol); box-shadow: inset 0 0 0 1px #cfd3da; }
.editeur .aide { margin-top: 0; }
.compteur { font-size: 13px; color: var(--gris); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.actions .lien { margin-left: auto; font-size: 13.5px; }

/* --- Fiche client : carte au centre, page floutée derrière. L'animation (la ligne cliquée se déplie en carte) est dans index.html. --- */
html { scrollbar-gutter: stable; }
body.fige { overflow: hidden; }
.voile {
  position: fixed; inset: 0; z-index: 40; background: rgb(21 24 29 / .22); backdrop-filter: blur(7px) saturate(1.15);
  -webkit-backdrop-filter: blur(7px) saturate(1.15); opacity: 0; pointer-events: none; transition: opacity .32s;
}
.voile.on { opacity: 1; pointer-events: auto; }
.fiche {
  position: fixed; left: 50%; top: 50%; translate: -50% -50%; z-index: 50; width: min(720px, calc(100% - 48px));
  max-height: min(880px, calc(100dvh - 64px)); background: var(--surface); border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; visibility: hidden;
  box-shadow: 0 0 0 1px rgb(21 24 29 / .06), 0 28px 70px -18px rgb(21 24 29 / .42);
}
.fiche.on { visibility: visible; }
/* Fiche d'un client sur écran large : ce qu'on fait à gauche, ce qu'on consulte à droite, pour tout voir sans faire défiler. */
@media (min-width: 1000px) {
  .fiche.large { width: min(1040px, calc(100% - 48px)); }
  .fiche.large .defile { display: grid; grid-template-columns: 1fr 1fr; align-items: start; padding-bottom: 26px; }
  .fiche.large .col-a { padding-right: 26px; }
  .fiche.large .col-b { padding-left: 26px; border-left: 1px solid var(--filet-doux); margin-top: 18px; }
  .fiche.large .col-b > .bloc:first-child { padding-top: 0; }
}
.fiche > header { display: flex; align-items: flex-start; gap: 16px; padding: 20px 22px 16px; border-bottom: 1px solid var(--filet-doux); }
.fiche > header div { flex: 1; min-width: 0; }
.fiche h2 { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.fiche > header small { display: block; margin-top: 2px; font-size: 13.5px; color: var(--gris); }
.fermer { width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; color: var(--gris); flex: none; }
.fermer:hover { background: var(--survol); color: var(--encre); }
.defile { min-height: 0; overflow-y: auto; padding: 0 22px 32px; overscroll-behavior: contain; }
.contact { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 18px; }
.bloc { padding-top: 26px; }
.bloc h3 { margin-bottom: 10px; }
.bloc > .sous { margin-bottom: 4px; }
.etat { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.choix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.choix .btn { width: 100%; height: auto; min-height: 42px; padding: 8px 10px; white-space: normal; line-height: 1.25; }
.choix .signe { color: var(--e-signe); }
.choix .large { grid-column: 1 / -1; }
.aide { margin-top: 10px; font-size: 13.5px; color: var(--gris); }
.champ { display: grid; gap: 5px; margin-top: 12px; font-size: 13.5px; font-weight: 500; color: var(--texte); }
.champ input, .ajout-note input {
  height: 40px; padding: 0 11px; border: 0; border-radius: 6px; background: var(--surface); color: var(--encre);
  box-shadow: inset 0 0 0 1px #d5d9e0; font-size: 15px; font-weight: 400; width: 100%; min-width: 0;
}
.champ input:focus, .ajout-note input:focus { outline: 0; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px #d6e2f8; }
.champ input::placeholder, .ajout-note input::placeholder { color: var(--pale); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.notes { display: grid; gap: 6px; margin-bottom: 10px; }
.notes li { display: flex; align-items: flex-start; gap: 8px; padding: 9px 8px 9px 12px; border-radius: 6px; background: var(--survol); font-size: 14px; box-shadow: inset 0 0 0 1px var(--filet-doux); }
.note-txt { flex: 1; min-width: 0; overflow-wrap: anywhere; align-self: center; }
/* Crayon et corbeille : discrets, ils n'apparaissent qu'au survol de la note (toujours visibles sur écran tactile). */
.note-outils { display: flex; align-items: center; gap: 0; flex: none; margin: -5px 0; opacity: 0; transition: opacity .12s; }
.notes li:hover .note-outils, .notes li:focus-within .note-outils, .note-outils.visible { opacity: 1; }
@media (hover: none) { .note-outils { opacity: 1; } }
.icone-btn { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--pale); flex: none; }
.icone-btn:hover { color: var(--encre); background: rgb(21 24 29 / .05); }
.icone-btn[data-note="supprimer"]:hover { color: var(--e-appeler); }
.icone-btn.ok { color: var(--accent); }
.icone-btn svg { width: 15px; height: 15px; }
.supprimer-ok { height: 28px; padding: 0 6px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--e-appeler); }
.supprimer-ok:hover { background: rgb(195 38 47 / .08); }
.notes li:has(.note-edit) { padding: 5px 8px 5px 6px; }
.note-edit { flex: 1; display: flex; align-items: center; gap: 2px; min-width: 0; }
.note-edit input {
  flex: 1; min-width: 0; height: 30px; padding: 0 6px; border: 0; border-radius: 4px; background: var(--surface); color: var(--encre);
  font: inherit; font-size: 14px; box-shadow: inset 0 0 0 1px var(--accent);
}
.note-edit input:focus { outline: 0; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px #d6e2f8; }
.ajout-note { display: flex; gap: 8px; }
.ajout-note .btn { height: 40px; }
.histo li { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 6px 0 6px 20px; font-size: 14px; }
.histo li::before { content: ""; position: absolute; left: 3px; top: 13px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.histo li:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 22px; bottom: -8px; width: 1px; background: var(--filet); }
.histo li[data-c="gerant"]::before { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--gris); }
.histo li[data-c="alerte"]::before { background: var(--e-appeler); }
.histo li[data-c="sautee"]::before { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--pale); }
.histo time { color: var(--pale); font-size: 13px; white-space: nowrap; }
.a-venir { display: grid; gap: 8px; margin: 10px 0 12px; }
.a-venir li { padding: 10px 12px; border-radius: 6px; background: var(--survol); box-shadow: inset 0 0 0 1px var(--filet-doux); }
.av-tete { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; font-size: 13px; color: var(--gris); }
.av-tete b { font-weight: 600; }
.a-venir p { font-size: 14px; color: var(--encre); white-space: pre-wrap; overflow-wrap: anywhere; }
.a-venir p.alerte { color: var(--e-appeler); }

/* --- Écran de chargement / d'erreur --- */
.ecran { max-width: 460px; margin: 20vh auto 0; padding: 0 20px; text-align: center; }
.ecran h1 { font-size: 22px; }
.ecran p { color: var(--gris); margin-top: 10px; }
.ecran .par { margin-top: 32px; }

/* --- Alertes --- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; width: min(360px, calc(100% - 32px)); }
.toast { background: var(--encre); color: #d9dce2; border-radius: var(--r); padding: 12px 14px; font-size: 14px; box-shadow: 0 10px 28px -8px rgb(21 24 29 / .4); animation: entree .35s var(--sortie); }
.toast b { color: #fff; font-weight: 600; }
.toast:has(button) { display: flex; align-items: center; gap: 12px; }
.toast > div { flex: 1; min-width: 0; }
.toast > button { flex: none; height: 32px; padding: 0 10px; border-radius: 6px; color: #fff; font-size: 14px; font-weight: 600; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .28); }
.toast > button:hover { background: rgb(255 255 255 / .1); }
.toast p { margin-top: 2px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes entree { from { opacity: 0; transform: translateY(10px); } }

/* Pendant un enregistrement (3 à 4 s avec n8n + Google Sheets) : on le dit, et on évite le double clic. */
body.occupe { cursor: progress; }
body.occupe .choix, body.occupe .toast > button, body.occupe #nouveauDevis button, body.occupe .ajout-note button, body.occupe .notes button, body.occupe .editeur .actions { opacity: .5; pointer-events: none; }
body.occupe::after {
  content: "Enregistrement…"; position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); translate: -50% 0; z-index: 70;
  background: var(--encre); color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 28px -8px rgb(21 24 29 / .4);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
}

/* --- Écrans moyens --- */
@media (max-width: 1180px) {
  .ligne { grid-template-columns: minmax(160px, 1.4fr) minmax(120px, 1.2fr) 66px 116px 92px; }
  .ligne .date { display: none; }
  .cols { grid-template-columns: 1fr; }
  .msg { grid-template-columns: 1fr; }
  .msg-infos { border-right: 0; border-bottom: 1px solid var(--filet-doux); }
  #recents .ligne { grid-template-columns: minmax(150px, 1.4fr) minmax(120px, 1.2fr) 66px 116px 92px; }
  #recents .proj { display: block; }
}

/* --- Téléphone : barre du haut, onglets en bas, liste empilée --- */
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .haut {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; height: 56px; padding: 0 16px;
    background: rgb(245 246 248 / .94); border-bottom: 1px solid var(--filet); backdrop-filter: saturate(1.4) blur(8px);
  }
  .haut .ini { width: 28px; height: 28px; font-size: 12px; }
  .haut b { font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side {
    inset: auto 0 0 0; width: auto; height: auto; flex-direction: row; padding: 0 0 env(safe-area-inset-bottom);
    border-right: 0; border-top: 1px solid var(--filet);
  }
  .side .marque, .side .par { display: none; }
  .nav { grid-template-columns: repeat(4, 1fr); width: 100%; }
  .nav button { flex-direction: column; justify-content: center; gap: 3px; height: 58px; border-radius: 0; font-size: 12px; }
  .nav button svg { width: 22px; height: 22px; }
  .nav button[aria-current] { background: none; }
  .main { margin-left: 0; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .par.bas { display: block; text-align: center; margin-top: 28px; }
  h1 { font-size: 22px; }
  .tete { align-items: center; }
  .tete .btn { height: 40px; padding: 0 12px; }
  .resume { gap: 4px 16px; font-size: 13.5px; }
  .cols, .col { gap: 16px; }
  .panneau > header { padding: 12px 16px; }
  .appels li { flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
  .appels .qui { flex-basis: 100%; }
  .appels .btn { height: 44px; flex: 1; }
  .ligne, #recents .ligne {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nom mt" "st rel";
    gap: 6px 12px; padding: 12px 16px;
  }
  .ligne.tete-l { display: none; }
  .ligne .nom { grid-area: nom; }
  .ligne .mt { grid-area: mt; align-self: start; }
  .ligne .st { grid-area: st; }
  .ligne .rel { grid-area: rel; justify-self: end; }
  .ligne .proj, .ligne .date, #recents .proj { display: none; }
  .ligne.court { grid-template-areas: none; grid-template-columns: minmax(0, 1fr) auto; }
  .ligne.court .date { display: none; }
  .outils { margin: 12px 0; }
  .onglets { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; width: calc(100% + 32px); scrollbar-width: none; }
  .onglets button { flex: none; }
  .cherche { width: 100%; height: 42px; }
  .cherche input { font-size: 16px; }
  .prevues dd button { padding-inline: 16px; }
  .prevues dt { padding-inline: 16px; }
  .gros { font-size: 34px; }
  .fiche { width: calc(100% - 20px); max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 12px; }
  .fiche > header { padding: 16px 16px 12px; }
  .defile { padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
  .contact .btn { flex: 1; height: 44px; }
  .choix .btn { min-height: 48px; }
  .champ input, .ajout-note input { height: 44px; font-size: 16px; }
  .icone-btn, .supprimer-ok { height: 36px; }
  .icone-btn { width: 36px; }
  .note-edit input { height: 36px; font-size: 16px; }
  .editeur textarea { font-size: 16px; }
  .msg-infos { padding: 16px; }
  .msg-apercu { padding: 18px 16px; }
  .inserer button { height: 36px; }
  .actions .btn { flex: 1; height: 44px; }
  .actions .lien { margin: 4px 0 0; flex-basis: 100%; text-align: center; }
  .deux { grid-template-columns: 1fr; }
  .toasts { left: 16px; right: 16px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.occupe::after { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* Crédits SMS : bandeau en haut de chaque vue quand il faut recharger (orange : bientôt, rouge : maintenant). */
.credits { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin: 0 0 22px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--filet); border-left: 3px solid var(--pale); border-radius: var(--r); box-shadow: var(--ombre); }
.credits[hidden] { display: none; }
.credits div { flex: 1 1 260px; }
.credits b { color: var(--encre); font-weight: 650; }
.credits p { margin: 3px 0 0; font-size: 13.5px; color: var(--gris); }
.credits[data-n="alerte"] { border-left-color: var(--e-repondu); }
.credits[data-n="alerte"] b { color: var(--e-repondu); }
.credits[data-n="critique"] { border-left-color: var(--e-appeler); }
.credits[data-n="critique"] b { color: var(--e-appeler); }
@media (max-width: 760px) { .credits .btn { width: 100%; justify-content: center; height: 44px; } }
