/* Module « projets » — charte graphique officielle du CHU Besançon
   Franche-Comté (couleurs reprises du logo vectoriel, police Sora),
   commune au formulaire public, à l'espace directions, à la consultation
   finale et au back-office. */

@font-face { font-family: "Sora"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/Sora-Regular.otf") format("opentype"); }
@font-face { font-family: "Sora"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/Sora-Medium.otf") format("opentype"); }
@font-face { font-family: "Sora"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/Sora-SemiBold.otf") format("opentype"); }
@font-face { font-family: "Sora"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/Sora-Bold.otf") format("opentype"); }

:root {
  --marine: #2C3494;
  --marine-fonce: #1F2470;
  --bleu: #2C3494;
  --cyan: #30C4EC;
  --orange: #F39200;
  --vert: #00AC58;
  --ciel: #EEF0FB;
  --ligne: #D9DCF2;
  --encre: #121140;
  --teal: #006B77;
  --rouge: #D33457;
  --gris: #5B6670;
  --fond: #F6F7FC;
  --rayon: 6px;
  --largeur: 1180px;
  --hauteur-entete: 84px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: #fff; color: var(--encre);
  font: 400 15px/1.6 "Sora", "Segoe UI", Arial, sans-serif;
}
body.fond-teinte { background: var(--fond); }
a { color: var(--marine); }
a:hover { color: var(--marine-fonce); }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { color: var(--marine); line-height: 1.25; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- bandeau ---------- */
.bandeau, header.entete {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  max-width: var(--largeur); margin: 0 auto; padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--ligne);
  position: sticky; top: 0; z-index: 20; background: #fff;
  box-shadow: 0 1px 3px rgba(18, 17, 64, .05);
}
header.entete { color: inherit; }
header.entete .conteneur, .conteneur { max-width: var(--largeur); margin: 0 auto; padding: 0 1.25rem; width: 100%; }
header.entete { padding: 1rem 0; }
header.entete h1 { font-size: 1.2rem; }
header.entete a { color: inherit; text-decoration: none; }
.logo-entete { height: 46px; width: auto; display: block; flex-shrink: 0; }
.bandeau-marque { display: flex; align-items: center; gap: .9rem; text-decoration: none; color: var(--marine); }
.bandeau-marque strong { display: block; font-size: 1.05rem; }
.bandeau-marque span span { font-size: .82rem; color: var(--gris); }
.bandeau-moi { display: flex; align-items: center; gap: 1.1rem; font-size: .85rem; flex-wrap: wrap; }
.bandeau-moi .identite { color: var(--gris); }
.bandeau-moi .identite b { color: var(--marine); font-weight: 700; }

main, main.conteneur { max-width: var(--largeur); margin: 0 auto; padding: 2rem 1.25rem 4rem; }
main:focus { outline: none; }
.chargement { color: var(--gris); padding: 3rem 0; }

/* ---------- cartes / formulaire public / admin ---------- */
.carte {
  background: #fff; border: 1px solid var(--ligne); border-radius: var(--rayon);
  box-shadow: 0 1px 3px rgba(12, 66, 112, .08); padding: 1.4rem 1.5rem; margin-bottom: 1.3rem;
}
.carte-intro { border-top: 4px solid var(--marine); padding-top: 1.3rem; }
.carte-intro h2 { font-size: 1.35rem; }
.bouton, button.bouton {
  display: inline-block; border: 0; cursor: pointer; background: var(--marine); color: #fff; font-weight: 500;
  padding: .7rem 1.2rem; border-radius: var(--rayon); text-decoration: none; font-size: 1rem;
}
.bouton:hover { background: var(--marine-fonce); color: #fff; }
.bouton[disabled], .bouton:disabled { opacity: .6; cursor: wait; }
.bouton-secondaire {
  display: inline-block; background: #fff; color: var(--marine); border: 1px solid var(--marine);
  border-radius: var(--rayon); padding: .55rem 1.1rem; font-weight: 500; text-decoration: none; cursor: pointer;
}
.bouton-secondaire:hover { background: var(--ciel); }
.lien-supprimer { background: none; border: none; color: var(--rouge); cursor: pointer; text-decoration: underline; padding: 0; font-size: .9rem; }

.champ { margin-bottom: 1.1rem; }
.champ label, .champ-legende { display: block; font-weight: 500; color: var(--marine); margin-bottom: .35rem; }
.champ input[type=text], .champ input[type=email], .champ input[type=tel], .champ input[type=date],
.champ input[type=password], .champ textarea, .champ select {
  width: 100%; padding: .55rem .7rem; border: 1px solid #B9CDE0; border-radius: var(--rayon);
  font-size: 1rem; font-family: inherit; background: #fff; color: inherit;
}
.champ textarea { resize: vertical; }
.options { display: flex; flex-direction: column; gap: .4rem; }
.options .option { font-weight: 400; display: flex; align-items: center; gap: .5rem; }
.champ-case .option { font-weight: 500; }
.obligatoire { color: var(--rouge); }
.aide { font-size: .8rem; color: var(--gris); margin: .3rem 0 0; }
.erreur-champ { color: var(--rouge); font-size: .85rem; margin: .4rem 0 0; font-weight: 600; }
.section-titre { border-top: 2px solid var(--ciel); padding-top: 1.4rem; margin-top: 2rem; }
.section-bloc { scroll-margin-top: 1rem; }
.section-nom {
  margin: 0 0 1.3rem; padding-bottom: .6rem; border-bottom: 2px solid var(--cyan);
  font-size: 1.15rem; display: flex; align-items: center; gap: .55rem;
}
.section-nom::before {
  content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--cyan); flex-shrink: 0;
}
.paragraphe { color: #444; }
.non-renseigne { color: var(--gris); font-style: italic; }

.alerte-globale { background: #FDF0EF; border-left: 4px solid var(--rouge); color: var(--rouge); border-radius: 4px; padding: .7rem 1rem; margin-bottom: 1.2rem; font-weight: 600; }
.info-globale { background: var(--ciel); border-left: 4px solid var(--marine); color: var(--marine); border-radius: 4px; padding: .7rem 1rem; margin-bottom: 1.2rem; }
.vide { padding: 2.5rem 0; color: var(--gris); text-align: center; }

table.tableau-saisie, table.tableau-lecture { width: 100%; border-collapse: collapse; margin-bottom: .6rem; }
table.tableau-saisie th, table.tableau-saisie td, table.tableau-lecture th, table.tableau-lecture td {
  border: 1px solid var(--ligne); padding: .4rem .5rem; text-align: left; font-size: .9rem;
}
table.tableau-saisie input { width: 100%; border: 1px solid #B9CDE0; border-radius: 4px; padding: .4rem; font: inherit; }
table.tableau-lecture th { background: var(--fond); }
.fichiers-liste { list-style: none; padding: 0; margin: 0; }
.fichiers-liste li { padding: .3rem 0; border-bottom: 1px dashed var(--ligne); }

footer.pied { text-align: center; color: var(--gris); font-size: .82rem; padding: 2rem 0; }

/* ---------- accueil (SPA avis/consultation) ---------- */
.accueil-tete { padding: 2.5rem 0 1.75rem; max-width: 760px; }
.accueil-tete h1 { font-size: clamp(1.7rem, 3.4vw, 2.45rem); font-weight: 700; letter-spacing: -.01em; }
.accueil-tete p { margin: .6rem 0 0; color: var(--gris); max-width: 62ch; }
.progression { margin-top: 1.4rem; display: flex; align-items: center; gap: .9rem; font-size: .85rem; color: var(--gris); }
.progression-barre { flex: 0 1 320px; height: 8px; background: var(--ciel); border-radius: 4px; overflow: hidden; display: flex; }
.progression-barre i { display: block; height: 100%; }
.progression-barre .v { background: var(--vert); }
.progression-barre .r { background: var(--orange); }
.progression-barre .x { background: var(--rouge); }

.outils {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .75rem 0; border-top: 2px solid var(--marine); border-bottom: 1px solid var(--ligne);
}
.onglets, .filtres { display: flex; gap: .35rem; flex-wrap: wrap; }
.onglets a, .filtres button {
  border: 1px solid transparent; background: none; cursor: pointer; text-decoration: none;
  padding: .35rem .8rem; border-radius: 999px; font-size: .85rem; color: var(--marine);
}
.onglets a[aria-current="page"] { background: var(--marine); color: #fff; }
.filtres button[aria-pressed="true"] { border-color: var(--marine); font-weight: 500; }
.filtres select { border: 1px solid var(--ligne); border-radius: 999px; padding: .3rem .8rem; font-size: .85rem; color: var(--marine); background: #fff; }

.projets { list-style: none; margin: 0; padding: 0; }
.projet { border-bottom: 1px solid var(--ligne); }
.projet > a { display: grid; grid-template-columns: 3.4rem 1fr auto; gap: .2rem 1.1rem; align-items: start; padding: 1.15rem .5rem 1.15rem 0; text-decoration: none; color: inherit; }
.projet > a:hover { background: linear-gradient(90deg, var(--fond), #fff); }
.projet-num { font-size: 2.1rem; font-weight: 700; color: var(--orange); line-height: 1; text-align: right; padding-top: .1rem; }
.projet-titre { font-weight: 700; color: var(--marine); font-size: 1.04rem; line-height: 1.35; }
.projet-porteur { color: var(--gris); font-size: .84rem; margin-top: .15rem; }
.projet-montant { font-weight: 700; color: var(--marine); font-size: 1.04rem; white-space: nowrap; text-align: right; }
.projet .circuit { grid-column: 2 / 4; margin-top: .55rem; }

.axe { display: inline-block; font-size: .74rem; font-weight: 500; padding: .05rem .55rem; border-radius: 999px; margin-top: .35rem; background: var(--ciel); color: var(--marine); }

.circuit { display: flex; flex-wrap: wrap; gap: .3rem; }
.tampon {
  display: inline-flex; align-items: center; gap: .25rem; min-width: 2.6rem; justify-content: center;
  font-size: .7rem; font-weight: 500; line-height: 1; padding: .32rem .45rem; border-radius: 3px;
  border: 1.5px dashed #AFC3D4; color: var(--gris); background: #fff;
}
.tampon.visa { border: 1.5px solid var(--vert); background: var(--vert); color: #fff; }
.tampon.reserve { border: 1.5px solid var(--orange); background: var(--orange); color: var(--encre); }
.tampon.visa::before { content: "✓"; font-weight: 700; }
.tampon.reserve::before { content: "!"; font-weight: 700; }
.tampon.refus { border: 1.5px solid var(--rouge); background: var(--rouge); color: #fff; }
.tampon.refus::before { content: "✕"; font-weight: 700; }
.tampon.moi { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--marine); }

.suivi-intro { color: var(--gris); font-size: .88rem; margin: 1.2rem 0; }
.suivi-cadre { overflow-x: auto; border: 1px solid var(--ligne); border-radius: var(--rayon); }
.suivi { border-collapse: collapse; width: 100%; font-size: .82rem; min-width: 900px; }
.suivi th, .suivi td { border-bottom: 1px solid var(--ligne); padding: .5rem .45rem; text-align: center; vertical-align: middle; }
.suivi thead th { background: var(--marine); color: #fff; font-weight: 500; font-size: .74rem; position: sticky; top: var(--hauteur-entete); }
.suivi th[scope="row"] { text-align: left; font-weight: 500; background: #fff; position: sticky; left: 0; min-width: 260px; }
.suivi th[scope="row"] a { color: var(--marine); text-decoration: none; }
.suivi th[scope="row"] b { color: var(--orange); margin-right: .4rem; }
.suivi td.visa { color: var(--vert); font-weight: 700; }
.suivi td.reserve { background: #FFF1DC; color: #8A4F00; font-weight: 700; }
.suivi td.refus { background: #FBE4E2; color: var(--rouge); font-weight: 700; }
.suivi td.na { background: repeating-linear-gradient(135deg, #fff 0 5px, var(--fond) 5px 10px); color: #A9B4BE; }
.suivi td.attente { color: #A9B4BE; }
.suivi td.total { font-weight: 500; color: var(--marine); white-space: nowrap; }
.legende { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .8rem; color: var(--gris); margin-top: .8rem; }

.fil { display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; font-size: .86rem; flex-wrap: wrap; }
.fil a { text-decoration: none; }
.fil nav { display: flex; gap: 1.2rem; }
.fiche-tete { display: grid; grid-template-columns: 1fr auto; gap: .5rem 2rem; align-items: end; padding-bottom: 1.4rem; border-bottom: 2px solid var(--marine); }
.fiche-num { color: var(--orange); font-weight: 700; font-size: 1rem; }
.fiche-tete h1 { font-size: clamp(1.45rem, 2.8vw, 2.05rem); font-weight: 700; margin-top: .2rem; max-width: 30ch; }
.fiche-montant { text-align: right; }
.fiche-montant strong { display: block; font-size: clamp(1.5rem, 3vw, 2.1rem); color: var(--marine); line-height: 1.1; }
.fiche-montant span { font-size: .78rem; color: var(--gris); }

.porteur { display: flex; flex-wrap: wrap; gap: .3rem 2rem; padding: 1rem 0; border-bottom: 1px solid var(--ligne); font-size: .86rem; }
.porteur div { min-width: 0; }
.porteur dt { color: var(--gris); font-size: .74rem; }
.porteur dd { margin: 0; font-weight: 500; color: var(--marine); overflow-wrap: anywhere; }
.porteur dl { margin: 0; display: contents; }

.fiche-corps { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 3rem; margin-top: 1.8rem; align-items: start; }
.contenu { max-width: 74ch; }
.contenu section + section { margin-top: 1.9rem; }
.contenu h2 { font-size: 1.05rem; font-weight: 700; padding-bottom: .35rem; border-bottom: 1px solid var(--ligne); margin-bottom: .7rem; }
.contenu p { margin: 0 0 .15rem; }
.contenu ul { margin: .1rem 0 .3rem; padding-left: 1.2rem; }
.contenu li::marker { color: var(--orange); }

.panneau { position: sticky; top: calc(var(--hauteur-entete) + .75rem); display: grid; gap: 1.2rem; }
.avis-form { background: var(--ciel); border-radius: var(--rayon); padding: 1.2rem 1.2rem 1.3rem; border-top: 4px solid var(--marine); }
.avis-form h2 { font-size: 1.05rem; }
.avis-form .qui { font-size: .8rem; color: var(--gris); margin: .15rem 0 .9rem; }
.choix { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; border: 0; padding: 0; margin: 0 0 .9rem; }
.choix.trois { grid-template-columns: repeat(3, 1fr); }
.choix legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.choix label { display: block; cursor: pointer; background: #fff; border: 2px solid var(--ligne); border-radius: var(--rayon); padding: .65rem .35rem; font-weight: 700; color: var(--marine); text-align: center; }
.choix label span { display: block; font-weight: 400; font-size: .74rem; color: var(--gris); }
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix input:focus-visible + label { outline: 3px solid var(--orange); outline-offset: 2px; }
.choix input[value="Visa"]:checked + label { border-color: var(--vert); background: var(--vert); color: #fff; }
.choix input[value="Réserve"]:checked + label { border-color: var(--orange); background: var(--orange); color: var(--encre); }
.choix input[value="Refus"]:checked + label { border-color: var(--rouge); background: var(--rouge); color: #fff; }
.choix input:checked + label span { color: inherit; }
.avis-form label.champ { display: block; font-size: .85rem; font-weight: 500; color: var(--marine); }
.avis-form textarea { width: 100%; min-height: 7.5rem; margin-top: .3rem; border: 1px solid #B9CDE0; border-radius: var(--rayon); padding: .6rem .7rem; background: #fff; resize: vertical; font-size: .9rem; }
.avis-form .bouton { width: 100%; margin-top: .9rem; }
.actuel { font-size: .82rem; margin: 0 0 .8rem; padding: .5rem .7rem; background: #fff; border-radius: 4px; }
.info-dsn, .info-non-concerne { background: var(--fond); border-radius: var(--rayon); padding: 1rem 1.2rem; color: var(--gris); font-size: .86rem; }

.visas h2 { font-size: .95rem; margin-bottom: .4rem; }
.visas ol { list-style: none; padding: 0; margin: 0; }
.visas li { display: grid; grid-template-columns: 4.6rem 1fr; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--ligne); font-size: .82rem; }
.visas .tampon { width: 100%; }
.visas .etat { color: var(--gris); }
.visas .etat b { color: var(--encre); font-weight: 500; }
.visas blockquote { margin: .3rem 0 0; padding: .35rem .6rem; border-left: 3px solid var(--orange); background: #FFF8EE; color: var(--encre); white-space: pre-line; }
.visas li.reserve blockquote { border-color: var(--orange); }
.visas li.refus blockquote { border-color: var(--rouge); background: #FDF0EF; }
.visas li.visa blockquote { border-color: var(--vert); background: #F0F8F3; }
.visas details { margin-top: .3rem; font-size: .76rem; color: var(--gris); }
.visas details summary { cursor: pointer; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--marine); color: #fff; padding: .7rem 1.2rem; border-radius: var(--rayon); font-size: .9rem;
  transition: opacity .2s, transform .2s; box-shadow: 0 6px 24px rgba(12, 66, 112, .25); z-index: 50;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .fiche-corps { grid-template-columns: 1fr; gap: 2rem; }
  .panneau { position: static; }
}
@media (max-width: 620px) {
  body { font-size: 14.5px; }
  .projet > a { grid-template-columns: 2.4rem 1fr; }
  .projet-num { font-size: 1.6rem; }
  .projet-montant { grid-column: 2; text-align: left; }
  .projet .circuit { grid-column: 1 / 3; }
  .fiche-tete { grid-template-columns: 1fr; }
  .fiche-montant { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media print {
  .bandeau-moi, .fil nav, .avis-form, .outils, .toast { display: none !important; }
  .fiche-corps { grid-template-columns: 1fr; }
}
