/* Vigie — charte sobre du cabinet : bordeaux en accent, pas de framework.
   Un écran de supervision doit être lisible d'un coup d'œil, de loin, et depuis
   un téléphone. */
:root {
  --bordeaux: #7b1b2b;
  --encre: #1d1f23;
  --gris: #6b7280;
  --trait: #e3e5e9;
  --fond: #f7f7f8;
  --vert: #17803d;
  --orange: #b45309;
  --rouge: #b91c1c;
  --rouge-sombre: #7f1d1d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
        Arial, sans-serif;
}

main { max-width: 1140px; margin: 0 auto; padding: 1rem 1rem 3rem; }

/* --- bandeau d'état global ------------------------------------------------ */
.bandeau {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  justify-content: space-between;
  background: #fff; border-left: 6px solid var(--vert);
  border-radius: 6px; padding: 1rem 1.25rem; margin: 1rem 0 1.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.bandeau.avertissement { border-left-color: var(--orange); }
.bandeau.alerte        { border-left-color: var(--rouge); }
.bandeau.critique      { border-left-color: var(--rouge-sombre); }
.bandeau h1 {
  margin: 0; font-size: 1.35rem; color: var(--bordeaux);
  letter-spacing: .02em;
}
.resume { margin: .25rem 0 0; color: var(--gris); }
.horloge { text-align: right; color: var(--gris); font-size: .85rem; }
.horloge span { display: block; }
.attente { color: var(--orange); }

/* --- sections ------------------------------------------------------------- */
section { margin-bottom: 2rem; }
h2 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--gris); margin: 0 0 .6rem; font-weight: 600;
}
h3 { font-size: .85rem; margin: 0 0 .4rem; color: var(--encre); }
.compte {
  background: var(--trait); color: var(--gris); border-radius: 10px;
  padding: 0 .45rem; font-size: .75rem; margin-left: .25rem;
}
.vide { color: var(--gris); font-style: italic; margin: .25rem 0; }
.discret { color: var(--gris); font-size: .85em; }

/* --- tuiles --------------------------------------------------------------- */
.tuiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tuile {
  background: #fff; border: 1px solid var(--trait); border-radius: 6px;
  padding: .7rem .85rem;
}
.tuile .etiquette { display: block; font-size: .75rem; color: var(--gris); }
.tuile strong { display: block; font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.tuile strong.petit { font-size: 1.1rem; }
.tuile small { font-size: .9rem; color: var(--gris); font-weight: 400; }
.tuile .detail { font-size: .75rem; color: var(--gris); }
.tuile.avertissement { border-color: var(--orange); }
.tuile.alerte   { border-color: var(--rouge); }
.tuile.critique { border-color: var(--rouge-sombre); background: #fef2f2; }

/* --- tableaux ------------------------------------------------------------- */
table {
  width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--trait); border-radius: 6px; overflow: hidden;
  font-size: .9rem;
}
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--trait); }
thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--gris); background: #fafafb; font-weight: 600;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr.alerte, tbody tr.critique { background: #fef4f4; }
tbody tr.avertissement { background: #fffaf1; }
td.message { color: var(--gris); }
td a { color: var(--bordeaux); }
a { color: var(--bordeaux); }

/* --- pastilles ------------------------------------------------------------ */
.pastille {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--gris); vertical-align: middle;
}
.pastille.ok { background: var(--vert); }
.pastille.avertissement, .pastille.info { background: var(--orange); }
.pastille.alerte { background: var(--rouge); }
.pastille.critique { background: var(--rouge-sombre); }
.pastille.inconnu { background: #c4c7cc; }

.puce {
  display: inline-block; font-size: .68rem; padding: 0 .35rem;
  border-radius: 8px; background: var(--trait); color: var(--gris);
  vertical-align: middle;
}
.puce.alerte { background: #fee2e2; color: var(--rouge); }

/* état textuel coloré (jours restants d'un certificat) */
.alerte { color: var(--rouge); }
.critique { color: var(--rouge-sombre); font-weight: 600; }
td .avertissement { color: var(--orange); }

/* --- divers --------------------------------------------------------------- */
.deux-colonnes { display: grid; gap: 1.25rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .deux-colonnes { grid-template-columns: 1fr; } }

details { background: #fff; border: 1px solid var(--trait); border-radius: 6px;
          padding: .4rem .6rem; margin-bottom: .4rem; }
summary { cursor: pointer; font-size: .9rem; }
pre {
  overflow-x: auto; font-size: .75rem; background: #fafafb; color: var(--encre);
  padding: .5rem; border-radius: 4px; margin: .5rem 0 0;
}
code { font-size: .85em; }

footer {
  max-width: 1140px; margin: 0 auto; padding: 0 1rem 2rem;
  color: var(--gris); font-size: .8rem;
}

/* --- connexion et enrôlement ---------------------------------------------- */
.carte-auth {
  max-width: 420px; margin: 4rem auto; background: #fff;
  border: 1px solid var(--trait); border-radius: 8px; padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06); text-align: center;
}
.carte-auth h1 {
  margin: 0; font-size: 1.6rem; color: var(--bordeaux); letter-spacing: .02em;
}
.sous-titre { margin: .2rem 0 1.5rem; color: var(--gris); font-size: .9rem; }
.bouton {
  width: 100%; padding: .75rem 1rem; font-size: .95rem; font-family: inherit;
  color: #fff; background: var(--bordeaux); border: 0; border-radius: 6px;
  cursor: pointer;
}
.bouton:hover { background: #661624; }
.bouton:disabled { background: var(--gris); cursor: progress; }
.message { min-height: 1.2rem; margin: .75rem 0 0; font-size: .85rem;
           color: var(--gris); }
.message.erreur { color: var(--rouge); }
.explication {
  margin: 1rem 0 0; font-size: .85rem; color: var(--gris); text-align: left;
  line-height: 1.5;
}
.explication.discret { font-size: .78rem; }
.carte-auth pre { text-align: left; }

/* --- navigation ----------------------------------------------------------- */
.nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  max-width: 1140px; margin: 0 auto; padding: .75rem 1rem;
  border-bottom: 1px solid var(--trait); font-size: .85rem;
}
.nav a { color: var(--gris); text-decoration: none; }
.nav a:hover { color: var(--encre); }
.nav a.actif { color: var(--bordeaux); font-weight: 600; }
.pousse { flex: 1; }
/* La déconnexion est un formulaire (POST), habillé comme les liens voisins. */
.nav-form { margin: 0; display: inline; }
.nav-form .lien {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--gris);
}
.nav-form .lien:hover { color: var(--encre); }

/* --- filtres et logs ------------------------------------------------------ */
.filtres {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
  margin-bottom: .75rem;
}
.filtres label {
  display: flex; flex-direction: column; gap: .2rem;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--gris);
}
.filtres label.large { flex: 1; min-width: 180px; }
.filtres select, .filtres input {
  font: inherit; font-size: .9rem; padding: .35rem .5rem;
  border: 1px solid var(--trait); border-radius: 5px; background: #fff;
  color: var(--encre);
}
.bouton.petit { width: auto; padding: .4rem .9rem; font-size: .85rem; }

pre.logs {
  max-height: 65vh; overflow: auto; white-space: pre; margin: .5rem 0 0;
  background: #1d1f23; color: #e6e6e6; padding: .75rem; border-radius: 6px;
  font-size: .74rem; line-height: 1.45;
}

/* --- onglets de filtre ---------------------------------------------------- */
.onglets { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 .75rem; }
.onglets a {
  padding: .2rem .55rem; border: 1px solid var(--trait); border-radius: 12px;
  font-size: .78rem; color: var(--gris); text-decoration: none; background: #fff;
}
.onglets a:hover { border-color: var(--gris); }
.onglets a.actif {
  border-color: var(--bordeaux); color: var(--bordeaux); font-weight: 600;
}
.onglets .compte { margin-left: .2rem; }

tbody tr.info td { background: transparent; }
tbody tr.critique { background: #fdeeee; }

/* --- courbes -------------------------------------------------------------- */
.etincelle {
  width: 110px; height: 22px; vertical-align: middle;
  fill: none; stroke: var(--bordeaux); stroke-width: 1.5;
  stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
td.tendance { white-space: nowrap; }
td.tendance a { display: inline-block; line-height: 0; }
.graphique {
  background: #fff; border: 1px solid var(--trait); border-radius: 6px;
  padding: .75rem; margin: .5rem 0;
}
.graphique .etincelle { width: 100%; height: 200px; stroke-width: 2; }
.echeance { color: var(--orange); }

/* --- bouton de test et son verdict ---------------------------------------- */
.test-alerte { margin-top: .4rem; }
.bouton.fantome {
  background: transparent; color: var(--gris);
  border: 1px solid var(--trait); padding: .25rem .6rem; font-size: .78rem;
}
.bouton.fantome:hover { background: #fff; color: var(--bordeaux);
                        border-color: var(--bordeaux); }
.verdict {
  margin: 0 0 1.25rem; padding: .7rem .9rem; border-radius: 6px;
  font-size: .88rem; border: 1px solid var(--trait); background: #fff;
}
.verdict.ok { border-left: 4px solid var(--vert); }
.verdict.erreur { border-left: 4px solid var(--rouge); }
.verdict a { margin-left: .5rem; font-size: .8rem; }
