/* Application ATRIUM — version de test. Charte ATRIUM Insertion : encre, fond clair, rouge d'action, orange d'accent.
   Chaque service est reconnaissable au motif d'un quart du logo : rayures (Formation), arcs (AGIR),
   vagues (Hébergement relais), anneaux (Habitat Jeunes). */

@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 400; font-display: swap; src: url('polices/figtree-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 600; font-display: swap; src: url('polices/figtree-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 700; font-display: swap; src: url('polices/figtree-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 800; font-display: swap; src: url('polices/figtree-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 800; font-display: swap; src: url('polices/bricolage-grotesque-latin-800-normal.woff2') format('woff2'); }

:root {
  --encre: #1b2a4e;
  --fond: #faf8f3;
  --papier: #ffffff;
  --rouge: #d93a3a;
  --rouge-fonce: #b92f2f;
  --orange: #ed9b25;
  --vert-fond: #e6f2ea;
  --vert-texte: #1f5e33;
  --bord: #ece7db;
  --bord-fort: #d6cebd;
  --champ: #e6e0d3;
  --texte-2: #6b675c;
  --sable: #f3efe6;
  --titre: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --corps: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ------------------------------------------------------------ motifs des services */
.s-FORM  { --m-fond: #e4eef8; --m-image: repeating-linear-gradient(135deg, #3877bd 0 2px, transparent 2px 6px); --m-taille: auto; }
.s-AGIR  { --m-fond: #fdf2d6; --m-image: repeating-radial-gradient(circle at 0 100%, #e0a010 0 2px, transparent 2px 5px); --m-taille: auto; }
.s-HR    { --m-fond: #e6f2ea; --m-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M0 3.5 Q3 0.6 6 3.5 T12 3.5' fill='none' stroke='%233f9256' stroke-width='1.7'/%3E%3C/svg%3E"); --m-taille: 12px 7px; }
.s-HJ    { --m-fond: #f5e7ee; --m-image: radial-gradient(circle, transparent 2.1px, #8e3b63 2.3px 3.5px, transparent 3.7px); --m-taille: 9px 9px; }
.s-SIEGE { --m-fond: #e7e9ef; --m-image: linear-gradient(var(--encre), var(--encre)); --m-taille: 40% 40%; }

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 400 17px/1.55 var(--corps); -webkit-font-smoothing: antialiased; }
html[data-role="beneficiaire"] body { font-size: 18px; }
img, svg { display: block; }
a { color: var(--encre); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2 { font-family: var(--titre); font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: 32px; margin: 0 0 6px; }
h2 { font-size: 23px; margin: 34px 0 12px; }
h3 { font-size: 18px; font-weight: 700; line-height: 1.3; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icone { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.note { color: var(--texte-2); font-size: 15px; }
.intro { color: var(--texte-2); margin: 0 0 22px; max-width: 62ch; }

/* ------------------------------------------------------------ en-tête */
.entete { background: var(--papier); border-bottom: 1px solid var(--bord); }
.entete-ligne { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marque { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.marque img { width: 42px; height: 42px; }
.marque-nom { display: block; font-family: var(--titre); font-weight: 800; font-size: 21px; line-height: 1; }
.marque-sous { display: block; font-size: 13.5px; color: var(--texte-2); margin-top: 3px; }
.qui { display: flex; align-items: center; gap: 12px; min-width: 0; }
.qui-texte { text-align: right; min-width: 0; }
.qui-nom { display: block; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qui .service { margin-top: 2px; }
.bandeau-test { background: var(--orange); color: var(--encre); font-weight: 600; font-size: 14px; text-align: center; padding: 6px 16px; }

/* ------------------------------------------------------------ onglets */
.onglets { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--bord); }
.onglets-liste { max-width: 1080px; margin: 0 auto; padding: 0 2px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.onglet { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 14px 14px 15px; border: 0; background: none; cursor: pointer;
  color: var(--texte-2); font-weight: 600; font-size: 16px; white-space: nowrap; }
.onglet:hover { color: var(--encre); }
.onglet[aria-selected="true"] { color: var(--encre); font-weight: 700; }
.onglet[aria-selected="true"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 4px; border-radius: 4px 4px 0 0; background: var(--orange); }

/* ------------------------------------------------------------ contenu */
.panneau { margin: 0 auto; padding: 28px 16px 64px; }
.panneau.etroit { max-width: 720px; }
.panneau.large { max-width: 1080px; }
/* bénéficiaire : en-tête, onglets et contenu sur la même colonne */
html[data-role="beneficiaire"] .entete-ligne, html[data-role="beneficiaire"] .onglets-liste { max-width: 720px; }
.panneau:focus { outline: none; }
.chargement { color: var(--texte-2); padding: 24px 0; }

/* ------------------------------------------------------------ boutons et champs */
.bouton { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 11px;
  border: 2px solid transparent; font-weight: 700; font-size: 16px; line-height: 1.2; cursor: pointer; text-decoration: none; }
.bouton .icone { width: 20px; height: 20px; }
.bouton.principal { background: var(--rouge); color: #fff; }
.bouton.principal:hover { background: var(--rouge-fonce); }
.bouton.secondaire { background: var(--papier); color: var(--encre); border-color: var(--bord-fort); }
.bouton.secondaire:hover { border-color: var(--encre); }
.bouton.discret { background: transparent; color: var(--encre); text-decoration: underline; text-underline-offset: 3px; padding-left: 8px; padding-right: 8px; }
.bouton[disabled] { opacity: .55; cursor: default; }
.bouton[aria-busy="true"] { cursor: progress; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }

.formulaire { display: grid; gap: 0; }
.champ { display: grid; gap: 6px; margin: 0 0 16px; }
.champ > label, .groupe-titre { font-weight: 700; font-size: 15.5px; }
.champ input, .champ select, .champ textarea { width: 100%; padding: 12px 14px; border: 2px solid var(--champ); border-radius: 10px; background: var(--papier); font-size: 16px; }
.champ textarea { resize: vertical; min-height: 7em; line-height: 1.5; }
.champ input:focus, .champ select:focus, .champ textarea:focus { border-color: var(--encre); outline: none; box-shadow: 0 0 0 3px rgba(237, 155, 37, .45); }
.champ input[type="file"] { padding: 10px; background: var(--sable); }
.aide { font-size: 14px; color: var(--texte-2); }
.choix-liste { display: grid; gap: 8px; margin: 0 0 16px; border: 0; padding: 0; }
.choix-liste legend { font-weight: 700; font-size: 15.5px; margin-bottom: 6px; padding: 0; }
.choix-ligne { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 2px solid var(--champ); border-radius: 10px; background: var(--papier); cursor: pointer; }
.choix-ligne input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--rouge); flex: none; }
.choix-ligne:has(input:checked) { border-color: var(--encre); }
/* choix d'un fichier : un vrai bouton, en français, quel que soit le navigateur */
.fichier { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.fichier-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; }
.fichier-input:focus-visible + label { outline: 3px solid var(--orange); outline-offset: 2px; }
.fichier-nom { font-size: 15px; color: var(--texte-2); overflow-wrap: anywhere; }
.fichier-nom.choisi { color: var(--encre); font-weight: 600; }
.erreur { color: #8f1f1f; background: #fbe9e9; border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: 15px; margin: 0 0 12px; }
.erreur:empty { display: none; }
.mot-de-passe { display: flex; gap: 8px; }
.mot-de-passe input { flex: 1; min-width: 0; }

.segments { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--sable); border-radius: 12px; margin: 0 0 20px; }
.segment { border: 0; background: transparent; border-radius: 9px; padding: 10px 14px; font-weight: 700; font-size: 15px; color: var(--texte-2); cursor: pointer; }
.segment[aria-pressed="true"] { background: var(--papier); color: var(--encre); box-shadow: 0 1px 3px rgba(27, 42, 78, .16); }

/* ------------------------------------------------------------ puces de service, badges */
.service { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px 3px 4px; border-radius: 999px; background: var(--m-fond, var(--sable));
  color: var(--encre); font-weight: 600; font-size: 13.5px; line-height: 1.3; max-width: 100%; justify-self: start; }
.service .motif { width: 18px; height: 18px; border-radius: 50%; background-color: var(--papier); background-image: var(--m-image); background-size: var(--m-taille, auto);
  background-position: center; background-repeat: repeat; flex: none; }
.s-SIEGE .motif { background-repeat: no-repeat; }
.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 6px; font-weight: 700; font-size: 13px; background: var(--sable); color: var(--encre); }
.badge.mineur { background: #f5e7ee; color: #6e2a4b; }
.badge.activite { background: #e4eef8; color: #1d4a7c; }
.badge.information { background: #fdf2d6; color: #6b4a00; }
.badge.publie { background: var(--vert-fond); color: var(--vert-texte); }
.badge.brouillon { background: #fdf2d6; color: #6b4a00; }
.badge.archive { background: #ecebe8; color: #55524b; }
.badge.complet { background: #fbe9e9; color: #8f1f1f; }
.etat-fait { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 11px; background: var(--vert-fond); color: var(--vert-texte); font-weight: 700; font-size: 15.5px; }
.etat-fait .icone { width: 20px; height: 20px; }

/* ------------------------------------------------------------ listes */
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.liste.serree { gap: 8px; }
.ligne { position: relative; background: var(--papier); border: 1px solid var(--bord); border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; }
.ligne.avec-motif { padding-left: 26px; }
.ligne.avec-motif::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 10px; border-radius: 14px 0 0 14px;
  background-color: var(--m-fond); background-image: var(--m-image); background-size: var(--m-taille, auto); }
.ligne-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ligne .corps-texte { white-space: pre-line; }
.vide { border: 2px dashed var(--bord-fort); border-radius: 14px; padding: 18px; color: var(--texte-2); }
.carte { background: var(--papier); border: 1px solid var(--bord); border-radius: 18px; padding: 20px; }
.carte > * + * { margin-top: 10px; }
.encart { background: var(--sable); border-radius: 14px; padding: 16px; margin-top: 10px; }
.texte-page { white-space: pre-line; max-width: 66ch; }

/* tuiles d'activité */
.tuiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tuile { background: var(--papier); border: 1px solid var(--bord); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.tuile-bande { height: 16px; background-color: var(--m-fond); background-image: var(--m-image); background-size: var(--m-taille, auto); }
.tuile-corps { padding: 16px 18px 18px; display: grid; gap: 8px; flex: 1; align-content: start; }
.tuile-corps h3 { font-size: 20px; }
.echeance { font-weight: 600; font-size: 15.5px; }
.tuile.faite { background: #fbfdfb; }
.tuile.faite h3 { color: #3d4a66; }

/* agenda : feuille de calendrier */
.evenement { background: var(--papier); border: 1px solid var(--bord); border-radius: 16px; padding: 14px; display: grid; grid-template-columns: 66px 1fr; gap: 14px; align-items: start; }
.feuille { border: 2px solid var(--encre); border-radius: 12px; overflow: hidden; text-align: center; background: var(--papier); }
.feuille-jour { display: block; background: var(--encre); color: #fff; font-weight: 700; font-size: 12.5px; padding: 3px 0; text-transform: lowercase; }
.feuille-num { display: block; font-family: var(--titre); font-weight: 800; font-size: 27px; line-height: 1.1; padding-top: 4px; }
.feuille-mois { display: block; font-weight: 600; font-size: 13px; padding-bottom: 6px; }
.evenement-corps { display: grid; gap: 6px; min-width: 0; }
.inscrits { margin: 8px 0 0; padding-left: 20px; }

/* deux colonnes (accompagnateur) */
.deux-colonnes { display: grid; grid-template-columns: minmax(250px, 330px) 1fr; gap: 20px; align-items: start; }
.personne { width: 100%; text-align: left; background: var(--papier); border: 1px solid var(--bord); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; cursor: pointer; }
.personne:hover { border-color: var(--bord-fort); }
.personne[aria-current="true"] { border-color: var(--encre); box-shadow: inset 5px 0 0 var(--orange); }
.personne-nom { font-weight: 700; }
.panneau-detail { background: var(--papier); border: 1px solid var(--bord); border-radius: 18px; padding: 20px; }
.panneau-detail h2 { margin-top: 0; }
.panneau-detail > h3 { margin: 22px 0 10px; }
details.depliant { border-top: 1px solid var(--bord); padding: 12px 0 2px; margin-top: 14px; }
details.depliant summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
details.depliant[open] summary { margin-bottom: 10px; }

/* barre de recherche */
.barre-outils { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; align-items: end; margin-bottom: 6px; }

/* tableaux */
.tableau-conteneur { position: relative; overflow-x: auto; background: var(--papier); border: 1px solid var(--bord); border-radius: 14px; }
.tableau { width: 100%; border-collapse: collapse; font-size: 15px; }
.tableau th, .tableau td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bord); vertical-align: top; }
.tableau thead th { background: #f6f3ec; font-weight: 700; white-space: nowrap; }
.tableau tbody tr:last-child > * { border-bottom: 0; }
.tableau.suivi td { text-align: center; white-space: nowrap; }
.tableau.suivi td.fait { color: var(--vert-texte); font-weight: 700; }
.tableau.suivi td.fait .icone { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; }
.tableau.suivi td.pas-fait { color: var(--texte-2); }
.tableau.suivi tr.total > * { background: #f6f3ec; font-weight: 700; }
.th-date { display: block; font-weight: 400; font-size: 13px; color: var(--texte-2); }

/* connexion */
.connexion { max-width: 460px; margin: 0 auto; padding: 28px 16px 64px; }
.connexion-logo { width: 132px; margin: 0 auto 18px; padding: 14px; background: var(--papier); border: 1px solid var(--bord); border-radius: 22px; }
.connexion-logo img { width: 100%; height: auto; }
.connexion h1 { text-align: center; }
.connexion .intro { text-align: center; margin-left: auto; margin-right: auto; }
.connexion .segments { display: flex; margin-bottom: 18px; }
.connexion .segment { flex: 1; }
.connexion .bouton.principal { width: 100%; margin-top: 4px; }

/* annonces */
.annonces { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.annonce { background: var(--encre); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 15.5px; box-shadow: 0 12px 30px -12px rgba(27, 42, 78, .6); }
.annonce.erreur-annonce { background: #8f1f1f; }

@media (prefers-reduced-motion: no-preference) {
  .vient-de-finir .etat-fait { animation: valide .45s ease-out; }
  @keyframes valide { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
}

/* ------------------------------------------------------------ téléphone */
@media (max-width: 759px) {
  h1 { font-size: 27px; }
  h2 { font-size: 21px; }
  .onglets { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--papier); border-top: 1px solid var(--bord); border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -6px 20px -14px rgba(27, 42, 78, .5); }
  .onglets-liste { padding: 0; gap: 0; overflow: visible; }
  .onglet { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 9px 2px 8px; font-size: 12px; }
  .onglet .icone { width: 24px; height: 24px; }
  .onglet span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .onglet[aria-selected="true"]::after { top: 0; bottom: auto; border-radius: 0 0 4px 4px; left: 20%; right: 20%; }
  .panneau, .connexion { padding-bottom: 110px; }
  .annonces { bottom: 92px; }
  .qui-texte { display: none; }
  .libelle-large { display: none; }
  .bouton-sortie { padding: 10px 12px; }
  .deux-colonnes { grid-template-columns: 1fr; }
  .barre-outils { grid-template-columns: 1fr 1fr; }
  .barre-outils .champ:first-child { grid-column: 1 / -1; }
  .entete-ligne { padding: 8px 14px; }
  .marque img { width: 36px; height: 36px; }
}
