/* Portail intranet Groupe Carré. Couleurs : arborescence-intranet.md §6.
   Les variables --fort, --brand, --texte-accent, --doux, --ico changent selon la société
   de la personne connectée (app.js, appliquerTheme). */

/* Polices auto-hébergées (pas d'appel à Google : RGPD). Fichiers téléchargés par
   scripts/telecharger-dependances.ps1 ; sans eux, la police système prend le relais. */
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/montserrat-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-display: swap; src: url("../vendor/fonts/montserrat-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/work-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/work-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  --fort: #1F7A35; --brand: #32AA48; --texte-accent: #fff; --doux: #E3F3E6; --ico: #1F7A35;
  --bg: #F4F5F2; --surface: #fff; --texte: #1B1D1A; --gris: #5D635B; --bordure: #E2E5DF; --erreur: #A4161A;
  --ombre: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.06);
  --titres: "Montserrat", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--texte); font: 15px/1.5 "Work Sans", "Segoe UI", system-ui, sans-serif; }
h1, h2, h3 { font-family: var(--titres); margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid #014288; outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Bandeau démo */
.demo { background: #111; color: #fff; font-size: 13px; }
.demo .wrap { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding-block: 10px; }
.demo-titre { font-family: var(--titres); letter-spacing: .06em; }
.demo-texte { color: #C9CDC6; }
.profils { display: contents; }
.chip { min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 1px solid #4A4F48; background: transparent; color: #fff; font-weight: 600; font-size: 13px; cursor: pointer; }

/* En-tête */
header { background: var(--surface); border-bottom: 1px solid var(--bordure); }
.entete { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding-top: 12px; }
.logo-lien img { height: 48px; display: block; }
.marque { font-family: var(--titres); font-weight: 800; font-size: 18px; line-height: 1.1; }
.marque small { display: block; font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gris); }
.recherche { flex: 1 1 260px; max-width: 460px; margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 44px; border-radius: 999px; border: 1px solid var(--bordure); background: var(--bg); color: var(--gris); }
.recherche input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--texte); }
.recherche.grande { max-width: 520px; height: 48px; margin: 16px 0 20px; background: #fff; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; background: var(--fort); color: var(--texte-accent); }
nav.onglets { display: flex; gap: 4px; overflow-x: auto; padding-block: 8px; }
nav.onglets a { padding: 8px 14px; border-radius: 999px; white-space: nowrap; color: var(--gris); font-weight: 500; text-decoration: none; }
nav.onglets a:hover { background: var(--bg); }
nav.onglets a.actif { background: var(--fort); color: var(--texte-accent); font-weight: 600; }

/* Mise en page */
main.wrap { padding-block: 24px 40px; min-height: 60vh; }
.titre-page { font-size: 28px; margin-bottom: 4px; }
.titre-ligne { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.chapo { margin: 0 0 20px; color: var(--gris); }
.note { margin: 20px 0 0; font-size: 14px; color: var(--gris); }
.carte { background: var(--surface); border-radius: 18px; padding: 20px; box-shadow: var(--ombre); }
.carte h2 { font-size: 17px; margin-bottom: 10px; }
.deux-col { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 24px; align-items: flex-start; }
.deux-col.sans-marge { margin-top: 0; }
.col-principale { flex: 999 1 560px; min-width: 0; }
.col-cote { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-cote.bloc { display: block; }
.moitie { flex: 1 1 360px; }
.entete-section { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 12px; }
.entete-section h2 { font-size: 20px; }
.espace { margin-top: 32px; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pile { display: flex; flex-direction: column; gap: 10px; }

/* Accueil */
.hero { border-radius: 24px; padding: 28px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -50px; bottom: -70px; width: 240px; height: 240px; border-radius: 28px; transform: rotate(45deg); opacity: .18; background: var(--brand); }
.hero-contenu { position: relative; z-index: 1; }
.hero h1 { margin: 12px 0 4px; font-size: clamp(26px, 4vw, 34px); font-weight: 800; }
.hero p { margin: 0; color: var(--gris); }
.badge { display: inline-block; align-self: flex-start; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--fort); color: var(--texte-accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.noire { background: #111; color: #fff; }
.noire p { color: #C9CDC6; margin: 0 0 14px; font-size: 14px; }
.logos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.logos a { aspect-ratio: 1; border-radius: 12px; background: #fff; border: 1px solid var(--bordure); display: grid; place-items: center; padding: 8px; outline: 3px solid transparent; outline-offset: 2px; }
.logos a.moi { outline-style: solid; }
.logos img { max-width: 100%; max-height: 64px; object-fit: contain; }

/* Boutons et liens */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--bordure); background: var(--bg); color: var(--texte); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.plein { background: var(--fort); color: var(--texte-accent); border-color: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.discret { min-height: 36px; padding: 0 12px; font-size: 13px; }
.lien { border: 0; background: transparent; padding: 0; cursor: pointer; font-size: 13px; color: var(--gris); text-decoration: underline; }

/* Tuiles */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tuiles.grandes { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tuile { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 140px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid transparent; text-decoration: none; box-shadow: var(--ombre); transition: transform .15s, border-color .15s; }
a.tuile:hover { transform: translateY(-2px); border-color: var(--texte); }
.tuile.inactive { opacity: .6; }
.tuile .ico, .ligne-plus .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--doux); color: var(--ico); flex: none; }
.desc { font-size: 13px; color: var(--gris); line-height: 1.35; display: block; }
.etat { position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; }
.etat.test { background: #FFF4C2; color: #5A4800; }
.etat.bientot { border: 1px dashed #A3AA9F; color: var(--gris); }
.carte-rh { min-height: 0; gap: 6px; padding: 20px; }
.carte-rh strong { font-family: var(--titres); font-size: 17px; }
.carte-rh .cta { margin-top: 8px; font-weight: 600; color: var(--ico); }

/* Actualités */
.actus { display: flex; flex-direction: column; gap: 12px; }
.actu { display: flex; gap: 14px; }
.actu .barre { flex: none; width: 6px; border-radius: 6px; }
.actu h3 { margin: 6px 0 2px; font-size: 16px; }
.actu h3.grand { font-size: 18px; }
.actu p { margin: 0; color: var(--gris); font-size: 14px; white-space: pre-line; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.date { font-size: 12px; color: var(--gris); margin-left: 8px; }
.filtres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip-f { min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; border: 1px solid var(--bordure); background: #fff; color: var(--texte); }
.chip-f.carre { border-radius: 12px; min-height: 44px; font-weight: 500; }
.chip-f.on { background: var(--fort); border-color: var(--fort); color: var(--texte-accent); }

/* Listes */
.liste a, .ligne-liste { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; text-decoration: none; border-top: 1px solid var(--bordure); color: var(--texte); font-weight: 500; }
.liste h2 + a, .liste h2 + .ligne-liste { border-top: 0; }
.liste a span, .ligne-liste span { color: var(--gris); font-weight: 400; font-size: 13px; text-align: right; }
.ligne-liste.inactive { color: var(--gris); }
.vide-petit { color: var(--gris); font-size: 14px; margin: 0; }
.etapes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.ligne-plus { display: flex; align-items: center; gap: 14px; text-decoration: none; padding: 14px 16px; }
.ligne-plus > span:nth-child(2) { flex: 1; }

/* Sociétés */
.fiche { position: relative; overflow: hidden; padding-top: 26px; display: flex; flex-direction: column; gap: 8px; }
.fiche .bandeau { position: absolute; left: 0; right: 0; top: 0; height: 8px; }
.fiche .logo { height: 96px; display: grid; place-items: center; }
.fiche .logo img { max-height: 90px; max-width: 70%; object-fit: contain; }
.fiche strong { font-family: var(--titres); font-size: 18px; }
.fiche .desc { font-size: 14px; }

/* Annuaire */
.personne { display: flex; gap: 14px; align-items: center; }
.pastille { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.personne-infos { min-width: 0; }
.personne-infos strong, .personne-infos .poste { display: block; }
.personne-infos .poste { font-size: 14px; color: var(--gris); }
.personne-infos .tag { margin-top: 4px; }
.contacts { display: flex; gap: 14px; margin-top: 8px; font-size: 14px; font-weight: 600; }
.contacts a { display: inline-flex; align-items: center; gap: 4px; color: var(--ico); text-decoration: none; min-height: 32px; }

/* Formulaires */
.formulaire { display: flex; flex-direction: column; gap: 18px; }
.formulaire fieldset { border: 0; padding: 0; margin: 0; }
.formulaire .q { font-weight: 600; display: block; margin-bottom: 8px; padding: 0; }
.formulaire input, .formulaire select, .formulaire textarea { width: 100%; border-radius: 12px; border: 1px solid var(--bordure); padding: 12px; background: #fff; }
.formulaire input, .formulaire select { height: 44px; padding: 0 12px; }
.formulaire select { max-width: 320px; }
.choix { display: flex; flex-wrap: wrap; gap: 8px; }
.actions-form { display: flex; gap: 10px; flex-wrap: wrap; }
.erreur { color: var(--erreur); font-weight: 600; margin: 0; }
.carte.formulaire { margin-bottom: 20px; }
.ok { text-align: center; padding: 24px 0; }
.ok .rond { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--doux); color: var(--ico); }
.ok h2 { margin: 16px 0 4px; font-size: 22px; }
.ok p { margin: 0 0 20px; color: var(--gris); }
.vide { padding: 24px; text-align: center; color: var(--gris); }
.vide.erreur { color: var(--erreur); }

/* Pied de page */
footer { border-top: 1px solid var(--bordure); padding: 20px 0 32px; color: var(--gris); font-size: 13px; }

/* Barre du bas : mobile uniquement */
.barre-mobile { display: none; }
@media (max-width: 760px) {
  .recherche:not(.grande), nav.onglets, .marque small { display: none; }
  .entete { padding-bottom: 12px; }
  .avatar { margin-left: auto; }
  .logo-lien img { height: 40px; }
  .titre-page { font-size: 24px; }
  .hero { padding: 22px; }
  .actions .btn { flex: 1 1 100%; }
  main.wrap { padding-bottom: 96px; }
  footer { padding-bottom: 96px; }
  .barre-mobile { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: #fff; border-top: 1px solid var(--bordure); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .barre-mobile a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; justify-content: center; text-decoration: none; font-size: 11px; font-weight: 600; color: var(--gris); border-radius: 12px; }
  .barre-mobile a.actif { color: var(--ico); background: var(--doux); }
}

@media (prefers-reduced-motion: reduce) { .tuile { transition: none; } }
