/* =========================================================================
   Portail de réservation de matériel de test — feuille de styles unique
   ========================================================================= */

/* ---------- Jetons ------------------------------------------------------ */

:root {
  --texte: #1a1d21;
  --texte-secondaire: #4a5158;
  --fond: #ffffff;
  --fond-alt: #f3f6f9;
  --fond-alt-2: #e7edf3;
  --bordure: #c6cfd8;
  --bordure-forte: #8b97a3;

  --bleu: #0b4f8a;
  --bleu-fonce: #06304f;
  --bleu-clair: #e5eff8;

  --vert: #1c6b3f;
  --vert-clair: #e6f3ea;
  --rouge: #a3242a;
  --rouge-clair: #fbebec;
  --ambre: #7a5200;
  --ambre-clair: #fdf3e0;

  --rayon: 6px;
  --ombre: 0 1px 2px rgba(16, 24, 40, .08), 0 4px 12px rgba(16, 24, 40, .06);
  --focus: #b8410e;
}

/* ---------- Base -------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--texte);
  background: var(--fond-alt);
}

h1, h2, h3 { line-height: 1.25; color: var(--bleu-fonce); }
h1 { font-size: 1.75rem; margin: 0 0 .25rem; }
h2 { font-size: 1.3rem; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0 0 .5rem; }

p { margin: 0 0 .75rem; }

a { color: var(--bleu); }
a:hover { color: var(--bleu-fonce); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0; top: -60px;
  z-index: 100;
  padding: .75rem 1.25rem;
  background: var(--bleu-fonce);
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
  transition: top .15s ease-in-out;
}
.skip-link:focus { top: 0; color: #fff; }

/* ---------- En-tête et navigation --------------------------------------- */

.entete {
  background: var(--bleu-fonce);
  color: #fff;
  box-shadow: var(--ombre);
}

.entete__haut {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: .85rem 1.25rem;
}

.marque { margin: 0; display: flex; flex-direction: column; }
.marque__nom {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.marque__appli { font-size: .9rem; color: #d7e3ee; }

.session { display: flex; align-items: center; gap: .9rem; }
.session__identite { display: flex; flex-direction: column; margin: 0; }
.session__nom { font-weight: 600; }
.session__role { font-size: .85rem; color: #d7e3ee; }
.entete .bouton--secondaire { background: transparent; color: #fff; border-color: #9fb8cd; }
.entete .bouton--secondaire:hover { background: #fff; color: var(--bleu-fonce); }

.nav { background: var(--bleu); }
.nav__liste {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  list-style: none;
}
.nav__liste a {
  display: block;
  padding: .7rem 1rem;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 4px solid transparent;
}
.nav__liste a:hover { background: var(--bleu-fonce); color: #fff; text-decoration: underline; }
.nav__liste a[aria-current="page"] {
  background: var(--fond-alt);
  color: var(--bleu-fonce);
  border-bottom-color: var(--ambre);
}

/* ---------- Mise en page ------------------------------------------------ */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.page--etroite { max-width: 62rem; }

.page__intro {
  max-width: 70ch;
  margin-bottom: 1.5rem;
  color: var(--texte-secondaire);
}

.carte {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}

.carte > :last-child { margin-bottom: 0; }

.grille-2 {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.barre-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

/* ---------- Formulaires ------------------------------------------------- */

.champ { margin-bottom: 1rem; }
.champ > label,
.legende {
  display: block;
  margin-bottom: .3rem;
  font-weight: 600;
}
.champ__aide {
  display: block;
  margin-bottom: .3rem;
  font-size: .875rem;
  font-weight: 400;
  color: var(--texte-secondaire);
}

input[type="text"],
input[type="date"],
input[type="search"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  max-width: 26rem;
  padding: .5rem .6rem;
  font: inherit;
  color: var(--texte);
  background: #fff;
  border: 1px solid var(--bordure-forte);
  border-radius: var(--rayon);
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border: 2px solid var(--rouge);
  background: var(--rouge-clair);
}

.erreur-champ {
  display: block;
  margin-top: .3rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--rouge);
}
.erreur-champ:empty { display: none; }

fieldset {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}
legend { padding: 0 .4rem; font-weight: 600; }

.liste-cases {
  display: grid;
  gap: .35rem;
  grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr));
  max-height: 22rem;
  overflow-y: auto;
  padding: .25rem;
  list-style: none;
  margin: 0;
}

.case-device {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .5rem .6rem;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  background: var(--fond);
}
.case-device:hover { background: var(--bleu-clair); }
.case-device input { margin-top: .25rem; flex: none; width: 1.15rem; height: 1.15rem; }
.case-device--hs { background: var(--fond-alt); color: var(--texte-secondaire); }
.case-device__texte { display: flex; flex-direction: column; }
.case-device__mention { font-size: .85rem; color: var(--ambre); font-weight: 600; }

/* ---------- Boutons ----------------------------------------------------- */

.bouton {
  display: inline-block;
  padding: .55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--bleu);
  border: 2px solid var(--bleu);
  border-radius: var(--rayon);
  cursor: pointer;
  text-decoration: none;
}
.bouton:hover { background: var(--bleu-fonce); border-color: var(--bleu-fonce); color: #fff; }

.bouton--secondaire { color: var(--bleu-fonce); background: #fff; border-color: var(--bleu-fonce); }
.bouton--secondaire:hover { background: var(--bleu-clair); color: var(--bleu-fonce); }

.bouton--danger { color: #fff; background: var(--rouge); border-color: var(--rouge); }
.bouton--danger:hover { background: #7d1b20; border-color: #7d1b20; }

.bouton--petit { padding: .3rem .65rem; font-size: .875rem; }

.bouton[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Messages ---------------------------------------------------- */

.message {
  margin-bottom: 1.25rem;
  padding: .9rem 1rem;
  border-left: 6px solid;
  border-radius: var(--rayon);
}
.message__titre { margin: 0; font-weight: 700; }
.message__detail { margin-top: .5rem; }
.message__detail ul { margin: .25rem 0 0; padding-left: 1.25rem; }
.message--succes { background: var(--vert-clair); border-color: var(--vert); color: #123f26; }
.message--erreur { background: var(--rouge-clair); border-color: var(--rouge); color: #6d1418; }
.message--info { background: var(--bleu-clair); border-color: var(--bleu); color: var(--bleu-fonce); }

/* ---------- Badges ------------------------------------------------------ */

.badge {
  display: inline-block;
  padding: .12rem .55rem;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid;
  border-radius: 999px;
}
.badge__icone { margin-right: .3rem; }
.badge--disponible { color: #123f26; background: var(--vert-clair); border-color: var(--vert); }
.badge--indisponible { color: #6d1418; background: var(--rouge-clair); border-color: var(--rouge); }
.badge--statut-a-venir { color: var(--bleu-fonce); background: var(--bleu-clair); border-color: var(--bleu); }
.badge--statut-en-cours { color: #123f26; background: var(--vert-clair); border-color: var(--vert); }
.badge--statut-passee { color: var(--texte-secondaire); background: var(--fond-alt-2); border-color: var(--bordure-forte); }
.badge--statut-annulee { color: #6d1418; background: var(--rouge-clair); border-color: var(--rouge); }

/* ---------- Tableaux ---------------------------------------------------- */

.tableau-defilant { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
caption {
  padding-bottom: .5rem;
  font-weight: 600;
  text-align: left;
  color: var(--texte-secondaire);
}
th, td {
  padding: .6rem .7rem;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--bordure);
}
thead th { background: var(--fond-alt-2); color: var(--bleu-fonce); }
tbody tr:nth-child(even) td { background: #fafcfd; }

.liste-devices { margin: 0; padding-left: 1.1rem; }
.cellule-actions { white-space: nowrap; }

/* Édition du catalogue : laisser respirer le nom du device. */
#corps-devices input[type="text"] { min-width: 20rem; }

/* Mot de passe temporaire : affiché une seule fois, il doit être lisible. */
.mot-de-passe-temporaire code {
  display: inline-block;
  padding: .4rem .7rem;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: .04em;
  background: #fff;
  border: 2px solid var(--vert);
  border-radius: var(--rayon);
  user-select: all;
}

/* Listes de définitions (page Mon compte). */
.definitions { display: grid; gap: .6rem; margin: 0; }
.definitions > div { display: flex; flex-wrap: wrap; gap: .5rem; }
.definitions dt { min-width: 12rem; font-weight: 600; }
.definitions dd { margin: 0; }

.tableau-vide {
  padding: 1rem;
  background: var(--fond-alt);
  border: 1px dashed var(--bordure-forte);
  border-radius: var(--rayon);
  color: var(--texte-secondaire);
}

/* ---------- Planning de disponibilité ----------------------------------- */

.planning { border-collapse: collapse; font-size: .875rem; }
.planning th, .planning td { border: 1px solid var(--bordure); }
.planning thead th { padding: .35rem .25rem; text-align: center; font-size: .8rem; }
.planning thead th.est-week-end { background: var(--fond-alt); }
.planning thead th.est-aujourdhui { background: var(--ambre-clair); border-bottom: 3px solid var(--ambre); }
.planning th[scope="row"] {
  position: sticky;
  left: 0;
  min-width: 16rem;
  background: #fff;
  font-weight: 600;
  text-align: left;
}
.planning td {
  width: 2.4rem;
  padding: .3rem 0;
  text-align: center;
  font-weight: 700;
}
.cellule--libre { background: #f0f6f2; color: var(--vert); }
.cellule--reserve { background: var(--bleu); color: #fff; }
.cellule--hs {
  color: var(--texte-secondaire);
  background: repeating-linear-gradient(
    45deg, #e3e8ed, #e3e8ed 4px, #cfd6dd 4px, #cfd6dd 8px
  );
}

.legende-planning {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: .75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: .9rem;
}
.legende-planning li { display: flex; gap: .45rem; align-items: center; }
.legende-planning .puce {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  font-weight: 700;
  border: 1px solid var(--bordure);
}

/* ---------- Boîte de dialogue ------------------------------------------- */

dialog {
  width: min(32rem, 92vw);
  padding: 1.5rem;
  color: var(--texte);
  background: #fff;
  border: 2px solid var(--bleu-fonce);
  border-radius: var(--rayon);
  box-shadow: 0 12px 32px rgba(6, 48, 79, .35);
}
dialog::backdrop { background: rgba(6, 48, 79, .55); }
.dialogue__actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ---------- Journal des e-mails ----------------------------------------- */

.courriel {
  margin-bottom: .75rem;
  padding: .85rem 1rem;
  background: var(--fond-alt);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}
.courriel__entete { margin: 0 0 .4rem; font-size: .875rem; color: var(--texte-secondaire); }
.courriel__objet { margin: 0 0 .4rem; font-weight: 700; color: var(--bleu-fonce); }
.courriel__corps {
  margin: 0;
  font-family: inherit;
  font-size: .9rem;
  white-space: pre-wrap;
}

/* ---------- Pied de page ------------------------------------------------ */

.pied {
  padding: 1.5rem 1.25rem 2.5rem;
  background: var(--bleu-fonce);
  color: #d7e3ee;
}
.pied__inner { max-width: 1200px; margin: 0 auto; font-size: .9rem; }
.pied a { color: #fff; }

/* ---------- Préférences utilisateur ------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
  .badge, .bouton, .planning td { forced-color-adjust: none; }
  .cellule--reserve { background: Highlight; color: HighlightText; }
  .cellule--libre { background: Canvas; color: CanvasText; }
}

@media (max-width: 640px) {
  .entete__haut { flex-direction: column; align-items: flex-start; }
  .session__select { min-width: 0; width: 100%; }
  h1 { font-size: 1.45rem; }
}

/* Mention de la version de démonstration (publication sans serveur). */
.pied__mode {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid #35597b;
  font-size: .85rem;
}
