/* CAAF · plateforme. Couleurs de la marque CAAF, structure de plateforme (barre latérale) alignée sur TOS. */
:root {
  --vert: #007A6C; --vert-fonce: #005A50; --vert-nuit: #0F3F39; --vert-rail: #0B302B; --vert-actif: #1C574F; --vert-pale: #D9EEEA;
  --rouge: #B81C17; --rouge-vif: #D9211B; --rouge-pale: #F8DEDB;
  --ambre: #7A4E00; --ambre-pale: #FBEBC8; --ambre-trait: #E9C779;
  --encre: #1F2020; --gris: #55605A; --trait: #E2D8C5; --trait-fort: #CFC4B0;
  --creme: #F9F5EE; --sable: #EFE7D8; --blanc: #FFFFFF;
  --rail-texte: #F3EEE4; --rail-doux: #A9C9C2;
  --titre: 'Bricolage Grotesque', system-ui, sans-serif;
  --texte: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --ombre: 0 1px 2px rgba(15, 63, 57, .06), 0 4px 14px rgba(15, 63, 57, .06);
  --rail: 288px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--creme); color: var(--encre); font-family: var(--texte); font-size: 15px; line-height: 1.45; }
::selection { background: var(--vert-pale); color: var(--vert-nuit); }
a { color: var(--vert); text-underline-offset: 3px; } a:hover { color: var(--vert-fonce); }
:focus-visible { outline: 3px solid var(--vert); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--titre); margin: 0; line-height: 1.15; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
.nombre, td.d, .chiffre { font-variant-numeric: tabular-nums; }
.nombre { white-space: nowrap; }
.discret { color: var(--gris); font-size: 13px; }
[hidden] { display: none !important; }
.icone { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Coquille : barre latérale + zone de travail ---------- */
.coquille { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--vert-rail) var(--rail), transparent var(--rail)); }
.rail { background: var(--vert-rail); color: var(--rail-texte); display: flex; flex-direction: column; padding: 18px 12px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.rail-logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; text-decoration: none; color: var(--rail-texte); }
.rail-logo .rond { width: 40px; height: 40px; border-radius: 50%; background: var(--vert); display: grid; place-items: center; }
.rail-logo strong { font-family: var(--titre); font-size: 26px; letter-spacing: -.02em; line-height: 1; }
.rail-logo small { display: block; font-size: 12px; color: var(--rail-doux); margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 12px; align-items: start; padding: 11px 12px; border-radius: 12px; color: var(--rail-texte); text-decoration: none; }
.nav a .icone { margin-top: 1px; color: var(--rail-doux); }
.nav a span { font-family: var(--titre); font-weight: 700; font-size: 16px; }
.nav a small { grid-column: 2; color: var(--rail-doux); font-size: 13px; line-height: 1.3; }
.nav a:hover { background: rgba(255, 255, 255, .06); }
.nav a[aria-current="page"] { background: var(--vert-actif); }
.nav a[aria-current="page"] .icone { color: #F2C94C; }
.nav .badge { grid-row: 1; grid-column: 3; min-width: 26px; padding: 1px 8px; border-radius: 999px; background: var(--creme); color: var(--vert-nuit); font-weight: 700; font-size: 13px; text-align: center; }
.nav .badge.alerte { background: var(--rouge-vif); color: #fff; }
.rail-bas { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.rail-bouton { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(169, 201, 194, .35); color: var(--rail-texte); background: none; text-decoration: none; font-family: var(--titre); font-weight: 700; font-size: 15px; cursor: pointer; width: 100%; text-align: left; min-height: 44px; }
.rail-bouton:hover { background: rgba(255, 255, 255, .06); color: var(--rail-texte); }
.rail-bouton[aria-current="page"] { background: var(--vert-actif); border-color: transparent; }
.rail-qui { padding: 8px 4px 0; font-size: 12px; color: var(--rail-doux); line-height: 1.4; }
.rail-qui strong { color: var(--rail-texte); font-weight: 700; display: block; font-size: 13px; }

.travail { min-width: 0; display: flex; flex-direction: column; }
.barre-haut { display: flex; align-items: center; gap: 12px; padding: 22px 40px 6px; flex-wrap: wrap; }
.barre-haut h1 { font-size: 30px; letter-spacing: -.02em; flex: 1; min-width: 200px; }
.barre-haut .sous-titre { display: block; font-family: var(--texte); font-size: 14px; font-weight: 400; color: var(--gris); letter-spacing: 0; margin-top: 4px; }
.choix-entreprise { display: flex; align-items: center; gap: 8px; }
.choix-entreprise label { font-size: 13px; color: var(--gris); }
.choix-entreprise select { padding: 10px 36px 10px 12px; border: 1px solid var(--trait-fort); border-radius: 10px; background: var(--blanc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2355605A' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 12px center; appearance: none; max-width: 280px; min-height: 44px; font-weight: 700; }
.bouton-menu, .voile { display: none; }
main { padding: 18px 40px 56px; max-width: 1280px; width: 100%; }

/* ---------- Blocs ---------- */
.grille { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c5 { grid-column: span 5; } .c4 { grid-column: span 4; }
.bloc { background: var(--blanc); border: 1px solid var(--trait); border-radius: 16px; padding: 18px 20px; min-width: 0; box-shadow: var(--ombre); }
.bloc-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.bloc h2 { font-size: 18px; }
.bloc .sous { color: var(--gris); font-size: 13px; margin: 2px 0 14px; max-width: 70ch; }
.bloc-pied { margin-top: 12px; font-size: 14px; }

/* Bandeau des chiffres du mois */
.bandeau { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--blanc); border: 1px solid var(--trait); border-radius: 16px; box-shadow: var(--ombre); margin-bottom: 16px; }
.bandeau > div { padding: 16px 20px; border-left: 1px solid var(--sable); min-width: 0; }
.bandeau > div:first-child { border-left: 0; }
.bandeau .etiquette { font-size: 13px; color: var(--gris); }
.bandeau .valeur { font-family: var(--titre); font-weight: 700; font-size: 26px; letter-spacing: -.01em; margin-top: 2px; overflow-wrap: anywhere; }
.bandeau .note { font-size: 12px; color: var(--gris); margin-top: 2px; }
.bandeau .fort { background: var(--vert-pale); border-radius: 0 16px 16px 0; }
.bandeau .fort .etiquette { color: var(--vert-nuit); font-weight: 700; }
.entree { color: var(--vert); } .sortie { color: var(--rouge); }

/* Liste « à traiter » */
.a-traiter { list-style: none; margin: 0; padding: 0; }
.a-traiter li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--sable); }
.a-traiter li:last-child { border-bottom: 0; }
.a-traiter .pastille-n { min-width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-family: var(--titre); font-weight: 700; background: var(--ambre-pale); color: var(--ambre); flex-shrink: 0; padding: 0 6px; }
.a-traiter .pastille-n.alerte { background: var(--rouge-pale); color: var(--rouge); }
.a-traiter .quoi { flex: 1; min-width: 0; }
.a-traiter .quoi strong { display: block; }
.a-traiter .quoi span { color: var(--gris); font-size: 13px; }
.a-traiter a.aller { font-weight: 700; font-size: 14px; white-space: nowrap; }

/* Tableaux */
.defile { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 700; font-size: 12px; color: var(--gris); padding: 8px; border-bottom: 2px solid var(--trait); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--sable); vertical-align: top; }
tbody tr:hover td { background: #FCFAF6; }
tr:last-child td { border-bottom: 0; }
td.d, th.d { text-align: right; }
td .ligne2 { display: block; color: var(--gris); font-size: 12px; margin-top: 2px; }
tr.total td { font-weight: 700; border-top: 2px solid var(--trait); background: var(--creme); }
tr.groupe td { font-family: var(--titre); font-weight: 700; color: var(--vert-nuit); background: var(--creme); }

/* Pastilles, barres */
.pastille { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--sable); color: var(--gris); }
.pastille.ok { background: var(--vert-pale); color: var(--vert-nuit); }
.pastille.attention { background: var(--ambre-pale); color: var(--ambre); }
.pastille.alerte { background: var(--rouge-pale); color: var(--rouge); }
.barre { height: 8px; background: var(--sable); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.barre > i { display: block; height: 100%; background: var(--vert); border-radius: 999px; }
.barre.attention > i { background: #C98A00; } .barre.alerte > i { background: var(--rouge-vif); }
.poste { padding: 12px 0; border-bottom: 1px solid var(--sable); }
.poste:last-child { border-bottom: 0; }
.poste-ligne { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.poste-ligne.petit { font-size: 13px; color: var(--gris); margin-top: 6px; }

.cat { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px; align-items: center; padding: 7px 0; }
.cat-nom { font-size: 14px; overflow-wrap: anywhere; }
.cat-barres { display: flex; flex-direction: column; gap: 4px; }
.cat-b { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.cat-b i { display: block; height: 10px; border-radius: 3px; min-width: 3px; }
.cat-b.e i { background: var(--vert); } .cat-b.s i { background: var(--rouge-vif); }

/* Projection : colonnes en HTML pour que les chiffres gardent leur taille sur tous les écrans */
.colonnes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; height: 240px; align-items: end; border-bottom: 1px solid var(--trait-fort); padding-bottom: 0; }
.colonne { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; position: relative; }
.colonne-barre { display: block; width: min(100%, 120px); background: var(--vert); border-radius: 8px 8px 0 0; }
.colonne.aujourdhui .colonne-barre { background: var(--vert-nuit); }
.colonne.negatif .colonne-barre { background: var(--rouge-vif); }
.colonne-valeur { font-family: var(--titre); font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.colonne-nom { position: absolute; bottom: -26px; font-size: 13px; color: var(--gris); white-space: nowrap; }
.projection { padding-bottom: 30px; }
.legende { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--gris); margin-top: 8px; }
.legende i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
.hypothese { background: var(--creme); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--gris); margin-top: 14px; max-width: 80ch; }

/* Accueil */
.accueil { max-width: 980px; margin: 0 auto; }
.accueil-tete { text-align: center; padding: 34px 0 22px; }
.accueil-tete .mot { font-family: var(--titre); font-weight: 700; font-size: clamp(64px, 9vw, 104px); letter-spacing: -.04em; line-height: .9; color: var(--vert-nuit); }
.accueil-tete .mot span { color: var(--rouge-vif); }
.accueil-tete h2 { font-size: clamp(24px, 3.2vw, 34px); margin-top: 18px; letter-spacing: -.01em; }
.demande { background: var(--blanc); border: 1px solid var(--trait); border-radius: 18px; box-shadow: var(--ombre); padding: 16px 18px 14px; }
.demande:focus-within { border-color: var(--vert); }
.demande textarea { width: 100%; border: 0; resize: none; min-height: 64px; font-size: 17px; outline: none; background: none; }
.demande textarea::placeholder { color: #6B746F; }
.demande-pied { display: flex; align-items: center; gap: 10px; }
.demande-pied p { flex: 1; margin: 0; font-size: 14px; color: var(--gris); }
.demande-pied p strong { color: var(--encre); }
.envoyer { width: 52px; height: 48px; border-radius: 12px; border: 0; background: var(--vert); color: #fff; display: grid; place-items: center; cursor: pointer; }
.envoyer:hover { background: var(--vert-fonce); }
.section-titre { font-size: 15px; color: var(--gris); margin: 30px 0 12px; font-family: var(--texte); font-weight: 400; }
.actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.action { display: flex; flex-direction: column; justify-content: space-between; gap: 22px; min-height: 140px; padding: 16px; background: var(--blanc); border: 1px solid var(--trait); border-radius: 16px; text-decoration: none; color: var(--encre); font-size: 16px; line-height: 1.35; box-shadow: var(--ombre); }
.action .icone { width: 24px; height: 24px; color: var(--vert); }
.action:hover { border-color: var(--vert); color: var(--encre); }
.resume-mois { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; color: var(--gris); }
.resume-mois strong { display: block; font-family: var(--titre); font-size: 20px; color: var(--encre); }

/* Guide */
.guide { max-width: 860px; }
.guide section { background: var(--blanc); border: 1px solid var(--trait); border-radius: 16px; padding: 20px 24px; margin-bottom: 14px; box-shadow: var(--ombre); }
.guide h2 { font-size: 20px; margin-bottom: 8px; }
.guide p, .guide li { max-width: 72ch; }
.guide ul { padding-left: 20px; margin: 8px 0 0; }
.guide li { margin: 6px 0; }
.guide dl { margin: 6px 0 0; display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 10px 18px; }
.guide dt { font-weight: 700; }
.guide dd { margin: 0; color: var(--gris); }
.exemple { display: inline-block; background: var(--vert-pale); color: var(--vert-nuit); border-radius: 8px; padding: 1px 8px; font-size: 14px; }

.vide { color: var(--gris); font-size: 14px; padding: 16px; background: var(--creme); border-radius: 12px; }
.vide strong { color: var(--encre); display: block; margin-bottom: 2px; }
.mention { font-size: 13px; color: var(--gris); margin-top: 20px; max-width: 80ch; }
.chargement { padding: 60px 0; text-align: center; color: var(--gris); }
.squelette { height: 16px; border-radius: 6px; background: linear-gradient(90deg, var(--sable), #F6F1E8, var(--sable)); background-size: 200% 100%; animation: luire 1.4s ease-in-out infinite; margin: 10px 0; }
@keyframes luire { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .squelette { animation: none; } }
.erreur-page { max-width: 520px; margin: 60px auto; text-align: center; }

/* ---------- Connexion ---------- */
.connexion { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.connexion-marque { background: var(--vert-rail); color: var(--rail-texte); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.connexion-marque .mot { font-family: var(--titre); font-weight: 700; font-size: clamp(64px, 8vw, 112px); letter-spacing: -.04em; line-height: .9; }
.connexion-marque .mot span { color: var(--rouge-vif); }
.connexion-marque p { color: var(--rail-doux); font-size: 17px; max-width: 34ch; }
.connexion-form { display: grid; place-items: center; padding: 32px 20px; }
.boite { width: 100%; max-width: 400px; }
.boite h1 { font-size: 28px; margin: 0 0 6px; }
.boite p { color: var(--gris); margin: 0 0 20px; }
.champ { display: block; margin-bottom: 14px; }
.champ span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.champ input { width: 100%; padding: 12px 14px; border: 1px solid var(--trait-fort); border-radius: 12px; font-size: 17px; background: var(--blanc); min-height: 48px; }
.champ input:focus { outline: 3px solid var(--vert-pale); border-color: var(--vert); }
.code-input { letter-spacing: .4em; font-size: 24px !important; text-align: center; font-family: var(--titre); }
.bouton { display: block; width: 100%; padding: 13px 16px; border-radius: 12px; border: 0; background: var(--vert); color: var(--blanc); font-weight: 700; font-size: 16px; cursor: pointer; min-height: 48px; text-align: center; text-decoration: none; }
.bouton:hover { background: var(--vert-fonce); color: #fff; }
.bouton:disabled { opacity: .6; cursor: wait; }
.bouton.secondaire { background: var(--blanc); color: var(--vert); border: 1px solid var(--vert); margin-top: 10px; }
.message { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.message.erreur { background: var(--rouge-pale); color: var(--rouge); }
.pied { font-size: 13px; color: var(--gris); margin-top: 22px; }

/* ---------- Écrans moyens et téléphones ---------- */
@media (max-width: 1100px) {
  .c8, .c7, .c6, .c5, .c4 { grid-column: span 12; }
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .coquille { grid-template-columns: minmax(0, 1fr); background: none; }
  .colonnes { height: 200px; gap: 8px; }
  .colonne-valeur { font-size: 12px; white-space: normal; text-align: center; line-height: 1.15; }
  .colonne-nom { font-size: 12px; }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); z-index: 30; transform: translateX(-102%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
  .coquille.menu-ouvert .rail { transform: none; }
  .coquille.menu-ouvert .voile { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(11, 48, 43, .45); }
  .bouton-menu { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--trait-fort); background: var(--blanc); cursor: pointer; }
  .barre-haut { padding: 14px 16px 4px; }
  .barre-haut h1 { font-size: 24px; min-width: 0; }
  .choix-entreprise { width: 100%; }
  .choix-entreprise label { display: none; }
  .choix-entreprise select { max-width: none; width: 100%; }
  main { padding: 12px 16px 48px; }
  .bandeau { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bandeau > div:nth-child(3) { border-left: 0; }
  .bandeau > div:nth-child(n+3) { border-top: 1px solid var(--sable); }
  .bandeau .fort { border-radius: 0; }
  .bandeau .valeur { font-size: 21px; }
  .bloc { padding: 16px; }
  .connexion { grid-template-columns: minmax(0, 1fr); }
  .connexion-marque { padding: 28px 20px; }
  .connexion-marque p { margin-bottom: 0; }
  .guide dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .guide dd { margin-bottom: 10px; }
  /* Les tableaux deviennent des fiches empilées */
  table.empile thead { display: none; }
  table.empile, table.empile tbody, table.empile tr, table.empile td { display: block; width: 100%; }
  table.empile tr { padding: 10px 0; border-bottom: 1px solid var(--sable); }
  table.empile tr:last-child { border-bottom: 0; }
  table.empile td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.empile td::before { content: attr(data-t); color: var(--gris); font-size: 13px; text-align: left; flex-shrink: 0; }
  table.empile td.premier { display: block; text-align: left; font-weight: 700; padding-bottom: 4px; }
  table.empile td.premier::before { content: none; }
  table.empile td.premier .ligne2 { font-weight: 400; }
  table.empile td:empty { display: none; }
  table.empile tr.total td.premier:empty { display: none; }
  tbody tr:hover td { background: none; }
}
@media (max-width: 520px) {
  .actions { grid-template-columns: minmax(0, 1fr); }
  .action { min-height: 0; flex-direction: row; align-items: center; gap: 14px; }
  .accueil-tete { padding: 18px 0 16px; }
}
