/* Console HoldingAI. Une seule famille (Archivo) : large pour les titres, étroite pour les données.
   Le tampon d'approbation est le seul élément décoratif. */
:root {
  --papier: #EDF0F4; --feuille: #FFFFFF; --encre: #18212E; --gris: #5A6675; --ligne: #D5DBE3;
  --tampon: #2447C8; --tampon-pale: #E4EAFB; --refus: #B5332A; --refus-pale: #F8E5E3; --attente: #8A6200; --attente-pale: #FBF0D2;
  --commis: #1F5B3A; --fanion: #C98A00; --plumeau: #5B2A86; --tiroir: #B4532A; --gousset: #B23A6E; --seuil: #2F5D7C; --voute: #7A6431; --echange: #3F6FA8; --pourquoi: #6A4FA0; --vestibule: #1E7F7A; --donne: #8C1D40; --nostalgie: #9A6B4F; --escale: #0D8AA8; --debours: #4A6B2F;
  --f: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --papier: #10161F; --feuille: #18212E; --encre: #E8EDF4; --gris: #9AA7B8; --ligne: #2B3747;
    --tampon: #8FADFF; --tampon-pale: #1D2B52; --refus: #FF8E84; --refus-pale: #3E1E1B; --attente: #F0C155; --attente-pale: #3A2E10;
    --commis: #6CC495; --fanion: #F0BB2A; --plumeau: #C9A6EC; --tiroir: #E89A75; --gousset: #EE8FB8; --seuil: #8DBBDB; --voute: #D9C08A; --echange: #8FB4E6; --pourquoi: #B9A4E8; --vestibule: #7FD0C9; --donne: #E68AA6; --nostalgie: #D8AE92; --escale: #7FD3E6; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--papier); color: var(--encre); font: 400 16px/1.5 var(--f); font-stretch: 96%; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--tampon); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.marque { display: flex; align-items: center; gap: 9px; white-space: nowrap; font-size: 17px; }
.marque svg { width: 28px; height: 28px; flex: none; color: var(--encre); }
.marque b { font-family: Fraunces, Georgia, "Times New Roman", serif; font-weight: 600; font-size: 21px; letter-spacing: -.01em; }
.marque span { font-weight: 500; color: var(--gris); padding-left: 10px; border-left: 1px solid var(--ligne); }

/* Boutons */
.btn { appearance: none; border: 1.5px solid var(--encre); background: var(--encre); color: var(--feuille); border-radius: 8px; padding: 9px 14px; font-weight: 650; font-size: 15px; cursor: pointer; min-height: 42px; }
.btn:hover { filter: brightness(1.15); }
.btn.pale { background: transparent; color: var(--encre); border-color: var(--ligne); }
.btn.pale:hover { border-color: var(--encre); filter: none; }
.btn.plein { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.lien { appearance: none; border: 0; background: none; padding: 6px 2px; color: var(--gris); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lien:hover { color: var(--encre); }

/* Connexion */
.porte { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.porte-carte { width: min(430px, 100%); background: var(--feuille); border: 1px solid var(--ligne); border-radius: 14px; padding: 30px 28px 26px; }
.porte h1 { font-size: 27px; line-height: 1.12; font-weight: 750; font-stretch: 112%; letter-spacing: -.02em; margin: 26px 0 26px; text-wrap: balance; }
.porte form { display: grid; gap: 10px; }
.porte label { font-weight: 600; font-size: 14px; }
.porte input { border: 1.5px solid var(--ligne); background: var(--papier); border-radius: 8px; padding: 12px; font-size: 17px; width: 100%; }
#in-code { font-size: 26px; letter-spacing: .3em; font-variant-numeric: tabular-nums; text-align: center; }
.msg { min-height: 1.5em; margin-top: 14px; font-size: 14.5px; color: var(--gris); }
.msg.err { color: var(--refus); }

/* Barre et onglets */
.barre { background: var(--feuille); border-bottom: 1px solid var(--ligne); position: sticky; top: 0; z-index: 5; padding-top: env(safe-area-inset-top, 0px); }
.barre-in, .onglets, .page, .pied { max-width: 980px; margin: 0 auto; padding-inline: max(18px, env(safe-area-inset-left, 0px)); }
.barre-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 14px; padding-block: 12px 4px; }
.barre-actions { display: flex; gap: 14px; white-space: nowrap; }
.onglets { display: block; }
.rangee { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.rangee::-webkit-scrollbar { display: none; }
/* Deuxième rangée : une puce par app, sur une bande à part */
.rangee.apps { gap: 8px; padding-block: 9px 10px; border-top: 1px solid var(--ligne); flex-wrap: wrap; }
@media (max-width: 700px) { .rangee.apps { flex-wrap: nowrap; } }
.app-entete .sous a { color: inherit; }
.app-entete .chiffres { margin-top: 16px; }
/* Étiquette d'app (pastille + nom) dans les fiches et les tableaux */
.app { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rangee.apps .app { appearance: none; border: 1.5px solid var(--ligne); background: transparent; border-radius: 99px; padding: 5px 13px 5px 11px; font-weight: 600; font-size: 14.5px; color: var(--gris); cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.rangee.apps .app:hover { color: var(--encre); border-color: var(--gris); }
.rangee.apps .app[aria-current="page"] { color: var(--feuille); background: var(--encre); border-color: var(--encre); }
.onglet { appearance: none; border: 0; background: none; padding: 11px 12px 12px; font-weight: 650; font-size: 15.5px; color: var(--gris); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.onglet[aria-current="page"] { color: var(--encre); border-bottom-color: var(--encre); }
.pastille { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pastille.commis { background: var(--commis); }
.pastille.fanion { background: var(--fanion); }
.pastille.plumeau { background: var(--plumeau); }
.pastille.tiroir { background: var(--tiroir); }
.pastille.gousset { background: var(--gousset); }
.pastille.seuil { background: var(--seuil); }
.pastille.voute { background: var(--voute); }
.pastille.pourquoi { background: var(--pourquoi); }
.pastille.nostalgie { background: var(--nostalgie); }
.pastille.echange { background: var(--echange); }
.pastille.vestibule { background: var(--vestibule); }
.pastille.donne { background: var(--donne); }
.pastille.escale { background: var(--escale); }
.pastille.debours { background: var(--debours); }
.puces { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.puce-app { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pastille.holdingai { background: var(--tampon); }
.compte { background: var(--tampon); color: var(--feuille); border-radius: 99px; font-size: 12.5px; font-weight: 750; padding: 1px 8px; font-variant-numeric: tabular-nums; }

.page { padding-block: 26px 40px; display: grid; gap: 34px; }
.pied { color: var(--gris); font-size: 13.5px; padding-bottom: 40px; }

/* Sections */
.section > h2 { font-size: 21px; font-weight: 750; font-stretch: 112%; letter-spacing: -.015em; }
.section > .sous { color: var(--gris); font-size: 14.5px; margin-top: 2px; max-width: 70ch; }
.section > .liste, .section > .table-boite, .section > .vide { margin-top: 14px; }
.vide { border: 1.5px dashed var(--ligne); border-radius: 12px; padding: 18px; color: var(--gris); font-size: 15px; }
.bandeau { background: var(--attente-pale); border-radius: 12px; padding: 16px 18px; font-size: 15px; }
.bandeau b { font-weight: 700; }
.bandeau ol { margin: 8px 0 0; padding-left: 20px; }

.chiffres { display: flex; flex-wrap: wrap; gap: 10px 34px; }
.chiffre b { display: block; font-size: 34px; line-height: 1; font-weight: 750; font-stretch: 112%; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.chiffre span { color: var(--gris); font-size: 14px; }

/* Fiches (avis, demandes, questions) */
.liste { display: grid; gap: 10px; }
.fiche { background: var(--feuille); border: 1px solid var(--ligne); border-radius: 12px; padding: 16px 18px; display: grid; gap: 10px; position: relative; }
.fiche .tete { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; color: var(--gris); padding-right: 96px; }
.fiche .tete b { color: var(--encre); font-weight: 650; }
.fiche .app { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--encre); }
.fiche blockquote { margin: 0; font-size: 17.5px; line-height: 1.45; max-width: 68ch; overflow-wrap: anywhere; }
.fiche .etoiles { color: var(--fanion); letter-spacing: 1px; }
.fiche .note { font-size: 14px; color: var(--gris); }
.fiche .note.alerte { color: var(--attente); font-weight: 600; }
.fiche .gestes { display: flex; flex-wrap: wrap; gap: 8px; }
.fiche .reponse { font-size: 15px; color: var(--gris); border-left: 3px solid var(--ligne); padding-left: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
.fiche a { color: var(--tampon); overflow-wrap: anywhere; }
details > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--gris); }

/* Le tampon : l'état d'un avis ou d'un forfait */
.tampon { display: inline-block; border: 2px solid currentColor; border-radius: 5px; padding: 1px 8px 2px; font-weight: 800; font-stretch: 84%; font-size: 13.5px; letter-spacing: .03em; transform: rotate(-3deg); color: var(--tampon); background: var(--tampon-pale); white-space: nowrap; }
.tampon.refus { color: var(--refus); background: var(--refus-pale); }
.tampon.attente { color: var(--attente); background: var(--attente-pale); border-style: dashed; }
.tampon.neutre { color: var(--gris); background: transparent; }
.fiche > .tampon { position: absolute; top: 14px; right: 16px; }

/* Tableaux (foyers, groupes, paiements, journal) */
.table-boite { background: var(--feuille); border: 1px solid var(--ligne); border-radius: 12px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-stretch: 90%; font-size: 15px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--ligne); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-weight: 650; font-size: 13.5px; color: var(--gris); white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .nom { font-weight: 700; font-stretch: 100%; }
td small { display: block; color: var(--gris); font-size: 13.5px; overflow-wrap: anywhere; }
td .gestes { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
td .gestes .lien { padding: 2px 0; text-align: left; white-space: nowrap; }
@media (max-width: 720px) {
  .table-boite { border: 0; background: none; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { background: var(--feuille); border: 1px solid var(--ligne); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; }
  td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 16px; text-align: right; }
  td::before { content: attr(data-t); color: var(--gris); font-size: 13.5px; text-align: left; flex: none; }
  td.principal { display: block; text-align: left; padding-bottom: 8px; }
  td.principal::before { content: none; }
  td.n { text-align: right; }
  td .gestes { align-items: flex-end; }
  .fiche .tete { padding-right: 0; }
  .fiche > .tampon { position: static; justify-self: start; }
}

/* Confirmation */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--feuille); color: var(--encre); }
dialog::backdrop { background: rgb(10 15 25 / .55); }
#dlg-form { padding: 24px; display: grid; gap: 12px; }
#dlg-titre { font-size: 20px; font-weight: 750; font-stretch: 110%; letter-spacing: -.01em; }
#dlg-texte { color: var(--gris); font-size: 15.5px; }
#dlg-raison-l { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
#dlg-raison { border: 1.5px solid var(--ligne); background: var(--papier); border-radius: 8px; padding: 10px; font-weight: 400; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--encre); color: var(--feuille); padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 15px; max-width: calc(100vw - 32px); z-index: 20; }
.toast.err { background: var(--refus); color: #fff; }
.charge { color: var(--gris); padding: 30px 0; }
@media (prefers-reduced-motion: no-preference) {
  .tampon.frais { animation: tamponner .28s cubic-bezier(.2, 1.4, .4, 1); }
  @keyframes tamponner { from { transform: rotate(-3deg) scale(1.7); opacity: 0; } to { transform: rotate(-3deg) scale(1); opacity: 1; } }
}

/* Courriels */
.filtres { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.filtre { appearance: none; border: 1.5px solid var(--ligne); background: var(--feuille); color: var(--gris); border-radius: 99px; padding: 6px 14px; font-weight: 650; font-size: 14.5px; cursor: pointer; min-height: 38px; }
.filtre[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: var(--feuille); }
.fiche .objet { margin: 0; font-size: 18.5px; line-height: 1.3; font-weight: 700; overflow-wrap: anywhere; max-width: 68ch; }
.fiche .lettre { margin: 0; font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
.fiche details .lettre { margin-top: 8px; }
.fiche .message { display: grid; gap: 8px; }
.fiche .message .note b { color: var(--encre); font-weight: 650; }
.fiche .message.envoye { border-left: 3px solid var(--tampon); padding-left: 12px; }
.fiche .echange { display: grid; gap: 14px; margin-top: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--ligne); }
#dlg-rep { width: min(620px, calc(100vw - 32px)); }
#rep-form { padding: 24px; display: grid; gap: 10px; }
#rep-titre { font-size: 20px; font-weight: 750; font-stretch: 110%; letter-spacing: -.01em; overflow-wrap: anywhere; }
#rep-info { color: var(--gris); font-size: 14.5px; overflow-wrap: anywhere; }
#rep-form label { font-size: 14px; font-weight: 600; }
#rep-texte { font: inherit; color: inherit; border: 1.5px solid var(--ligne); background: var(--papier); border-radius: 8px; padding: 12px; width: 100%; min-height: 180px; resize: vertical; font-size: 16px; line-height: 1.45; }
#rep-msg { margin-top: 0; }

/* Accès */
.invite { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 12px; align-items: end; background: var(--feuille); border: 1px solid var(--ligne); border-radius: 12px; padding: 16px 18px; margin-top: 14px; }
.invite label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; min-width: 0; }
.invite input, .invite select { border: 1.5px solid var(--ligne); background: var(--papier); border-radius: 8px; padding: 10px; font-weight: 400; font-size: 16px; min-height: 42px; width: 100%; min-width: 0; }
@media (max-width: 720px) { .invite { grid-template-columns: 1fr; } }

/* Idées : fenêtre de saisie */
#dlg-saisie { width: min(620px, calc(100vw - 32px)); }
#sa-form { padding: 24px; display: grid; gap: 10px; }
#sa-titre { font-size: 20px; font-weight: 750; font-stretch: 110%; letter-spacing: -.01em; }
#sa-info { color: var(--gris); font-size: 14.5px; overflow-wrap: anywhere; margin: 0; }
#sa-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
#sa-form input, #sa-form select, #sa-texte { font: inherit; color: inherit; border: 1.5px solid var(--ligne); background: var(--papier); border-radius: 8px; padding: 10px 12px; width: 100%; font-size: 16px; }
#sa-texte { min-height: 140px; resize: vertical; line-height: 1.45; }
#sa-form [hidden] { display: none; }

.gris { color: var(--gris); }
.section .sous .lien { padding: 0 2px; font-size: inherit; }

/* CRM */
.crm-barre { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.crm-barre input[type=search] { flex: 1 1 280px; border: 1.5px solid var(--ligne); background: var(--feuille); border-radius: 8px; padding: 10px 12px; font-size: 16px; min-height: 42px; }
.crm-boutons { display: flex; gap: 8px; flex-wrap: wrap; }
.crm-filtres, .crm-etapes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 2px; }
.crm-filtres select { border: 1.5px solid var(--ligne); background: var(--feuille); border-radius: 99px; padding: 6px 10px; font-size: 14px; }
.filtre { appearance: none; border: 1.5px solid var(--ligne); background: transparent; border-radius: 99px; padding: 5px 12px; font-weight: 600; font-size: 14px; color: var(--gris); cursor: pointer; }
.filtre:hover { color: var(--encre); border-color: var(--gris); }
.filtre[aria-pressed="true"] { background: var(--encre); color: var(--feuille); border-color: var(--encre); }
.nom-fiche { appearance: none; border: 0; background: none; padding: 0; font-weight: 700; font-stretch: 100%; font-size: inherit; color: var(--encre); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--ligne); text-underline-offset: 3px; }
.nom-fiche:hover { text-decoration-color: var(--encre); }
small.retard, .retard { color: var(--refus); font-weight: 600; }
.crm-entete { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; align-items: flex-start; }
.crm-entete h2 { font-size: 28px; }
.crm-statut { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.etiquette { border: 1px solid var(--ligne); border-radius: 6px; padding: 1px 8px; font-size: 13.5px; color: var(--gris); background: var(--feuille); }
.crm-colonnes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.crm-colonnes > div { display: grid; gap: 34px; }
@media (max-width: 860px) { .crm-colonnes { grid-template-columns: 1fr; } }
.crm-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; background: var(--feuille); border: 1px solid var(--ligne); border-radius: 12px; padding: 18px; margin-top: 14px; }
.crm-form .crm-apps, .crm-form .dlg-actions { grid-column: 1 / -1; }
@media (max-width: 620px) { .crm-form { grid-template-columns: 1fr; } }
.crm-form label, .crm-col label, .crm-ligne label { display: grid; gap: 5px; font-size: 14px; font-weight: 600; }
.crm-form input, .crm-form select, .crm-col input, .crm-col select, .crm-col textarea, .crm-ligne input, .crm-ligne select {
  border: 1.5px solid var(--ligne); background: var(--papier); border-radius: 8px; padding: 9px 10px; font-weight: 400; font-size: 16px; width: 100%; min-width: 0; }
.crm-col textarea { resize: vertical; }
.crm-apps { border: 1px solid var(--ligne); border-radius: 8px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.crm-apps legend { font-size: 14px; font-weight: 600; padding: 0 4px; }
label.case { display: inline-flex !important; align-items: center; gap: 8px; font-weight: 500 !important; cursor: pointer; }
label.case input { width: 18px; height: 18px; accent-color: var(--tampon); }
.crm-col { display: grid; gap: 10px; margin-top: 12px; }
.crm-col .btn { justify-self: start; }
.crm-ligne { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 12px; }
.crm-ligne > input[name=titre] { flex: 1 1 200px; }
.crm-ligne > label { flex: 1 1 200px; }
.fiche.tache { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; align-items: center; padding: 12px 16px; }
.crm-fichier input { font-size: 14px; }
.crm-bas { display: flex; gap: 18px; }
.crm-apps-ligne { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; }
.crm-apps-ligne > span:first-child { color: var(--gris); font-size: 14px; min-width: 92px; }
.section > p.note, .crm-colonnes p.note { font-size: 14px; color: var(--gris); margin-top: 4px; }
/* Viralité */
.note-liste { margin: 6px 0 0; padding-left: 20px; color: var(--gris); line-height: 1.55; }
.note-liste li + li { margin-top: 6px; }
.filtres + .chiffres, .filtres + .charge, .filtres + .bandeau { margin-top: 18px; }
/* CRM : chaînes d'invitation */
.arbre { display: grid; gap: 14px; }
.arbre-racine > .nom-fiche { font-weight: 700; }
.arbre ul { list-style: none; margin: 6px 0 0 6px; padding-left: 16px; border-left: 2px solid var(--ligne, #e4dccb); }
.arbre li { margin: 8px 0; }
.arbre li small { display: block; color: var(--gris); font-size: 13px; }
.chaine { color: var(--gris); }
.app-entete [data-statut-app-ligne] { margin-top: 16px; }

/* L'avis de Claude sur une idée */
.avis-claude { margin: 4px 0 10px; padding: 12px 14px; border-radius: 8px; background: var(--papier); border-left: 3px solid var(--pourquoi); }
.avis-claude .tete { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 6px; }
.avis-claude .tete > span:not(.tampon) { color: var(--gris); font-size: 14px; }
.avis-claude p { margin: 4px 0; }
.avis-claude .resume { font-weight: 600; }
.avis-claude.attend { border-left-style: dashed; animation: respirer 1.4s ease-in-out infinite alternate; }
.avis-apps { margin: 2px 0 6px; padding-left: 0; list-style: none; display: grid; gap: 4px; }
.avis-apps .app { margin-right: 6px; }
.btn.claude { border-color: var(--pourquoi); color: var(--pourquoi); }
@keyframes respirer { from { opacity: .65; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .avis-claude.attend { animation: none; } }

/* Ouvrir le site ou l'app depuis la page d'une app */
.ouvrir-app { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.ouvrir-app a.btn { text-decoration: none; display: inline-flex; align-items: center; }
