/* Kyudai — feuille de style unique.
   Principe : la couleur sert d'abord à l'état des PC (vert, orange, rouge, gris).
   Tout le reste reste calme pour que ces couleurs ressortent. */

:root {
  --fond: #f4f5f2;
  --surface: #ffffff;
  --encre: #1c2330;
  --encre-douce: #5a6372;
  --trait: #dde0da;
  --action: #3346a8;
  --action-fonce: #263683;
  --vert: #2e7d4f;
  --vert-fond: #e6f2ea;
  --orange: #b85f0c;
  --orange-fond: #fbeedd;
  --rouge: #b3261e;
  --rouge-fond: #fbe4e2;
  --gris: #737a85;
  --gris-fond: #eceef0;
  --rayon: 6px;
  --police: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--action); text-underline-offset: 2px; }
a:hover { color: var(--action-fonce); }

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

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; font-weight: 650; margin-top: 2rem; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 1em; max-width: 72ch; }

.nombre { font-variant-numeric: tabular-nums; }
.discret { color: var(--encre-douce); font-size: .9rem; }

/* --- barre du haut --- */

.barre {
  background: var(--encre);
  color: #fff;
}
.barre-interieur {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 56px;
  flex-wrap: wrap;
}
.marque {
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: .02em;
}
.marque:hover { color: #fff; }
.menu { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.menu a {
  white-space: nowrap;
  color: #d5dae4;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--rayon);
}
.menu a:hover, .menu a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.1); }
.compteur {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 .4em;
  margin-left: .3em;
  border-radius: 1em;
  background: var(--rouge);
  color: #fff;
  font-size: .8rem;
  text-align: center;
}
.menu-compte { color: #d5dae4; text-decoration: none; }
.menu-compte:hover { color: #fff; }
.barre form button { background: none; border: 0; color: #d5dae4; cursor: pointer; font: inherit; padding: 8px 0; }
.barre form button:hover { color: #fff; }

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* --- messages --- */

.message { padding: 12px 16px; border-radius: var(--rayon); margin-bottom: 16px; background: var(--vert-fond); }
.message.error { background: var(--rouge-fond); }

/* --- blocs --- */

.bloc {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 20px;
  margin-bottom: 20px;
}
.bloc > h2:first-child, .bloc > h3:first-child { margin-top: 0; }

.entete {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.entete h1 { margin: 0; }

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

/* --- phrase d'accueil du tableau de bord --- */

.phrase {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.25;
  margin: 8px 0 20px;
  max-width: 30ch;
}

.repartition {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.repartition span {
  padding: 6px 12px;
  border-radius: var(--rayon);
  font-weight: 600;
}

/* --- états --- */

.etat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
}
.etat::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}
.etat-vert { color: var(--vert); }
.etat-orange { color: var(--orange); }
.etat-rouge { color: var(--rouge); }
.etat-gris, .etat-revoque { color: var(--gris); }

.fond-vert { background: var(--vert-fond); color: var(--vert); }
.fond-orange { background: var(--orange-fond); color: var(--orange); }
.fond-rouge { background: var(--rouge-fond); color: var(--rouge); }
.fond-gris { background: var(--gris-fond); color: var(--gris); }

/* --- liste de PC : la raison est toujours visible sous le nom --- */

.pc-liste { list-style: none; margin: 0; padding: 0; }
.pc-liste li {
  display: grid;
  grid-template-columns: 6px 1fr auto;
  gap: 0 14px;
  padding: 12px 0;
  border-top: 1px solid var(--trait);
}
.pc-liste li:first-child { border-top: 0; }
.pc-liste .barrette { border-radius: 3px; }
.barrette.etat-vert { background: var(--vert); }
.barrette.etat-orange { background: var(--orange); }
.barrette.etat-rouge { background: var(--rouge); }
.barrette.etat-gris, .barrette.etat-revoque { background: var(--gris); }
.pc-liste .nom { font-weight: 600; }
.pc-liste .raisons { margin: 2px 0 0; padding: 0; list-style: none; color: var(--encre-douce); font-size: .92rem; }
.pc-liste .raisons li { display: block; border: 0; padding: 0; }
.pc-liste .a-droite { text-align: right; font-size: .9rem; color: var(--encre-douce); }

/* --- tableaux --- */

.tableau-conteneur { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--trait); vertical-align: top; }
th { font-weight: 600; color: var(--encre-douce); font-size: .85rem; }
tr:last-child td { border-bottom: 0; }

.fiche { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
.fiche dt { color: var(--encre-douce); }
.fiche dd { margin: 0; }

/* --- jauge de disque --- */

.jauge { height: 8px; background: var(--gris-fond); border-radius: 4px; overflow: hidden; margin-top: 4px; max-width: 280px; }
.jauge span { display: block; height: 100%; background: var(--vert); }
.jauge.etat-orange span { background: var(--orange); }
.jauge.etat-rouge span { background: var(--rouge); }

/* --- formulaires et boutons --- */

label { display: block; font-weight: 600; margin-bottom: 4px; }
.champ { margin-bottom: 16px; }
.champ .aide { color: var(--encre-douce); font-size: .88rem; margin-top: 4px; }
.champ .erreur { color: var(--rouge); font-size: .9rem; margin-top: 4px; }
.champ-case { display: flex; gap: 8px; align-items: center; }
.champ-case label { margin: 0; font-weight: 400; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%;
  max-width: 520px;
  padding: 10px 12px;
  border: 1px solid #c4c9c1;
  border-radius: var(--rayon);
  font: inherit;
  background: #fff;
  color: var(--encre);
}
textarea { min-height: 90px; }

.bouton, button.bouton {
  display: inline-block;
  padding: 10px 16px;
  border-radius: var(--rayon);
  border: 1px solid var(--action);
  background: var(--action);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
}
.bouton:hover { background: var(--action-fonce); border-color: var(--action-fonce); color: #fff; }
.bouton.secondaire { background: #fff; color: var(--action); }
.bouton.secondaire:hover { background: #eef0fa; color: var(--action-fonce); }
.bouton.danger { background: #fff; color: var(--rouge); border-color: var(--rouge); }
.bouton.danger:hover { background: var(--rouge-fond); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.code-inscription {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  letter-spacing: .06em;
  padding: 16px;
  background: var(--fond);
  border-radius: var(--rayon);
  overflow-wrap: anywhere;
}

.etapes { padding-left: 1.3em; }
.etapes li { margin-bottom: 6px; }

.vide { color: var(--encre-douce); padding: 8px 0; }

.connexion { max-width: 380px; margin: 10vh auto 0; }

@media (max-width: 640px) {
  h1 { font-size: 1.45rem; }
  .barre-interieur { justify-content: space-between; gap: 0 16px; padding-top: 6px; }
  .menu { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
  .menu a { white-space: nowrap; padding: 8px 10px; }
  .pc-liste li { grid-template-columns: 6px 1fr; }
  .pc-liste .a-droite { grid-column: 2; text-align: left; }
  .fiche { grid-template-columns: 1fr; gap: 0; }
  .fiche dd { margin-bottom: 8px; }
  .masque-mobile { display: none; }
}

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