:root {
  --sable-clair: #F6F1E9; --sable: #E6D9C3; --texte: #2B2A28; --bleu: #2E6A78;
  --olivier: #5C6A48; --terre: #A9502F; --rose: #F2C9B5; --gris: #6f6a62; --blanc: #fff;
  --rayon: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--sable-clair); color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 17px; line-height: 1.45; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; color: var(--bleu); margin: 0 0 .5em; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.08rem; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

/* Accès */
.acces { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.carte-acces { background: var(--blanc); border-radius: var(--rayon); padding: 24px; width: 100%; max-width: 420px;
  box-shadow: 0 4px 20px rgba(0,0,0,.06); display: flex; flex-direction: column; gap: 12px; }
.logo-acces { width: 200px; align-self: center; }
.qr { width: 200px; align-self: center; background: #fff; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; }
input, select, textarea { border: 1px solid #cfc4b0; border-radius: 8px; padding: 10px 12px; background: #fff; color: var(--texte); font-weight: 400; }
textarea { min-height: 110px; resize: vertical; }
.msg { color: var(--terre); margin: 0; } .msg.ok { color: var(--olivier); }
.petit { font-size: .85rem; color: var(--gris); margin: 0; }

/* Boutons */
.btn { background: var(--terre); color: #fff; border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 600; cursor: pointer; }
.btn.bleu { background: var(--bleu); } .btn.olivier { background: var(--olivier); }
.btn.clair { background: var(--sable); color: var(--texte); }
.btn.petit-btn { padding: 6px 12px; font-size: .88rem; }
.btn:disabled { opacity: .5; }
.lien { background: none; border: 0; color: var(--bleu); text-decoration: underline; cursor: pointer; padding: 0; font-size: .9rem; }

/* En-tête et onglets */
.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--blanc); border-bottom: 3px solid var(--bleu); }
.logo { height: 44px; }
.qui { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; font-size: .9rem; }
.demo { background: var(--rose); color: var(--terre); border-radius: 999px; padding: 2px 10px; font-weight: 600; }
.onglets { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--blanc); border-bottom: 1px solid var(--sable); position: sticky; top: 0; z-index: 5; }
.onglets button { border: 0; background: none; padding: 8px 12px; border-radius: 999px; white-space: nowrap; cursor: pointer; color: var(--texte); }
.onglets button.actif { background: var(--bleu); color: #fff; }
.pastille { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--terre); color: #fff; font-size: .78rem; text-align: center; }
main { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* Cartes et listes */
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.carte { background: var(--blanc); border-radius: var(--rayon); padding: 14px 16px; box-shadow: 0 2px 10px rgba(0,0,0,.04); margin-bottom: 12px; }
.carte h3 { margin-bottom: .3em; }
.chiffre { font-family: Georgia, serif; font-size: 2rem; color: var(--bleu); line-height: 1; }
.ligne { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ligne.entre { justify-content: space-between; }
.barre-outils { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.etiquette { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 600; background: var(--sable); }
.e-a_valider, .e-ouverte, .e-a_contacter, .e-a_faire, .e-propose { background: var(--rose); color: var(--terre); }
.e-a_corriger, .e-a_ameliorer, .e-retard, .e-ecarte, .e-perdu, .e-pas_interesse, .e-refuse { background: var(--terre); color: #fff; }
.e-valide, .e-inscrit, .e-gagne, .e-fait, .e-repondue, .e-publie, .e-envoye { background: var(--olivier); color: #fff; }
.e-en_cours, .e-essai_prevu, .e-essai_fait, .e-contacte, .e-rdv, .e-devis { background: var(--bleu); color: #fff; }
.texte-post { white-space: pre-wrap; background: var(--sable-clair); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.visuel { max-width: 100%; max-height: 420px; border-radius: 8px; display: block; margin: 8px 0; }
.meta { color: var(--gris); font-size: .85rem; }
.vide { color: var(--gris); font-style: italic; }
.alerte { border-left: 5px solid var(--terre); }

/* Calendrier */
.cal-ligne { display: grid; grid-template-columns: 2.2em 1fr; gap: 8px; }
.cal-num { font-family: Georgia, serif; font-size: 1.2rem; color: var(--bleu); }
.frise { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; margin-top: 8px; }
.frise span { height: 10px; border-radius: 2px; background: var(--sable); }
.frise span.on { background: var(--bleu); } .frise span.fait { background: var(--olivier); }
.frise span.retard { background: var(--terre); } .frise span.cette-semaine { outline: 2px solid var(--rose); }
.reglages { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-top: 8px; }
.reglages label { font-size: .8rem; } .reglages input, .reglages select { padding: 6px 8px; }
.reglages input[type=number] { width: 80px; }

/* Fenêtre */
dialog { border: 0; border-radius: var(--rayon); padding: 0; width: min(560px, 94vw); }
dialog::backdrop { background: rgba(43,42,40,.45); }
#fenetre-form { padding: 18px; display: flex; flex-direction: column; gap: 10px; max-height: 88vh; overflow: auto; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .deux { grid-template-columns: 1fr; } html, body { font-size: 16px; } .logo { height: 36px; } }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--texte); color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 20; }

.envoi { margin: 6px 0; font-size: .9rem; }
.aide { background: var(--rose); padding: 8px 10px; border-radius: 8px; font-size: .9rem; }
/* Cadre « Conformité » (contrôle automatique + avis de l'agent de Claude) */
.controle { border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: .9rem; display: grid; gap: 4px; border: 1px solid var(--sable); }
.controle.c-ok { background: #eef1e8; border-color: var(--olivier); }
.controle.c-attention, .controle.c-attente { background: #fbf3e4; border-color: #c9a24a; }
.controle.c-bloquant { background: #f8e4dc; border-color: var(--terre); color: var(--terre); }
/* Accordéons et retour en haut */
.acc-aide { margin: 6px 0 10px; }
.acc-aide > summary { cursor: pointer; color: var(--bleu); font-weight: 600; font-size: .9rem; }
.acc-aide > summary:focus-visible, .tete-pliable:focus-visible { outline: 2px solid var(--bleu); outline-offset: 2px; }
.acc-aide[open] > summary { margin-bottom: 6px; }
.tete-pliable { cursor: pointer; }
.tete-pliable::after { content: "▾"; color: var(--gris); margin-left: 6px; transition: transform .15s; }
.carte.replie > .tete-pliable::after { transform: rotate(-90deg); }
.carte.replie > :not(.tete-pliable) { display: none; }
.carte.replie { padding-bottom: 10px; }
.tout-plier { justify-content: flex-end; margin: 0 0 6px; }
.haut { position: fixed; right: 16px; bottom: 16px; z-index: 20; background: var(--bleu); color: #fff; border: 0; border-radius: 999px;
  padding: 10px 16px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.2); cursor: pointer; }
.haut[hidden] { display: none; }
@media print { .haut { display: none; } }
