:root {
  color-scheme: dark;
  --ArrierePlan: #050505;
  --Panneau: rgba(8, 8, 8, .88);
  --Ligne: rgba(255, 255, 255, .20);
  --Texte: #f3f3f3;
  --Attenue: #a4a4a4;
  --Vert: #38e88a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: #000;
  position: relative;
  overflow-x: hidden;
  color: var(--Texte);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.ArrierePlanGrille {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
              linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px),
              radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .065), transparent 34rem),
              var(--ArrierePlan);
  background-size: 32px 32px, 32px 32px, auto, auto;
}

.ArrierePlanGrille::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, .025) 50%, transparent 100%);
  animation: BalayageGrille 7s linear infinite;
}

@keyframes BalayageGrille {
  from { transform: translateY(-100%); }
  to { transform: translateY(100%); }
}

.LignesBalayage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .018) 0, rgba(255, 255, 255, .018) 1px, transparent 2px, transparent 4px);
  opacity: .28;
}

.Clignotement { animation: Clignotement 1s steps(1) infinite; }

@keyframes Clignotement { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ArrierePlanGrille::after, .Clignotement { animation: none; }
}

.Coquille {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.Panneau {
  border: 1px solid var(--Ligne);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .008)), var(--Panneau);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .018), 0 20px 60px rgba(0, 0, 0, .35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.BarreSuperieure, .EnteteMonitor, .PiedPage, .NoteMonitor, .BarreGraphiques {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.BarreSuperieure { padding: 22px 26px; }
.BlocMarque { display: flex; align-items: center; gap: 18px; min-width: 0; }
.Logo { width: 64px; height: 64px; object-fit: contain; flex: none; }
.SurTitre, .SousTitre, .Description, .Detail, .Libelle { color: var(--Attenue); }
.SurTitre { margin: 0 0 8px; font-size: .75rem; }
.SousTitre { margin: 8px 0 0; font-size: .84rem; }
h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.8rem); letter-spacing: -.05em; }
h1 span { color: var(--Attenue); font-weight: 400; }
h2 { margin: 0; font-size: clamp(1.25rem, 3vw, 1.8rem); letter-spacing: -.04em; }
h3 { margin: 0 0 16px; font-size: .95rem; }
.Description { font-size: .82rem; line-height: 1.6; margin: 8px 0 0; }

button, input { font: inherit; }
button {
  cursor: pointer;
  border: 1px solid var(--Ligne);
  border-radius: 5px;
  background: #121212;
  color: var(--Texte);
  padding: 10px 12px;
  font-size: .78rem;
}
button:hover { border-color: #858585; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 2px solid white; outline-offset: 3px; }
.BadgeSysteme { display: flex; gap: 9px; align-items: center; }
.PointSysteme { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.BoutonConnexion[data-admin="true"] { color: var(--Vert); }
.BoutonConnexion[data-admin="false"] { color: #ff8585; }

.Tableau { margin-top: 14px; padding: 26px; }
.EnteteMonitor { margin-bottom: 24px; align-items: flex-start; }
.AccesMonitor { border: 1px dashed var(--Ligne); padding: 22px; border-radius: 7px; color: var(--Attenue); font-size: .85rem; line-height: 1.6; }
.AccesMonitor p { margin: 0; }
.GrilleMetriques { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.CarteMetrique, .CarteGraphique { min-width: 0; background: #0c0c0c; border: 1px solid var(--Ligne); border-radius: 7px; padding: 18px; }
.CarteMetrique strong, .Debits strong { display: block; font-size: clamp(1.15rem, 3vw, 1.75rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.Libelle { font-size: .73rem; margin: 0 0 12px; }
.Detail { font-size: .72rem; line-height: 1.5; margin: 10px 0 0; overflow-wrap: anywhere; }
.Jauge { height: 4px; background: #282828; border-radius: 5px; margin-top: 14px; overflow: hidden; }
.Jauge span { display: block; width: 0; height: 100%; background: #fff; border-radius: 5px; }
.BarreGraphiques { margin: 22px 0 12px; }
.BarreGraphiques .Libelle { margin: 0; }
.Periodes { display: flex; gap: 5px; flex-wrap: wrap; }
.Periodes button[aria-pressed="true"] { border-color: #fff; background: #fff; color: #080808; }
.Debits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.Debits .Libelle { display: block; margin-bottom: 6px; }
.Reception { color: #fff; }
.Emission { color: #bdbdbd; }

.TraitReception, .TraitEmission { display: inline-block; width: 23px; vertical-align: middle; border-top: 2px solid #fff; }
.TraitEmission { border-top: 2px dashed #bdbdbd; }
.ZoneGraphique { position: relative; min-width: 0; }
.ZoneGraphique canvas { cursor: crosshair; touch-action: pan-y; }
.ZoneGraphique canvas:focus-visible { outline: 1px solid #999; outline-offset: 3px; }
.InfoGraphique { position: absolute; z-index: 2; pointer-events: none; max-width: 100%; padding: 9px 11px; border: 1px solid #666; border-radius: 5px; background: #101010; color: #eee; box-shadow: 0 4px 16px #0008; font-size: .73rem; line-height: 1.6; white-space: pre-line; font-variant-numeric: tabular-nums; }
canvas { display: block; width: 100%; height: 210px; }
.GrilleGraphiques { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.GrilleGraphiques canvas { height: 170px; }
.Informations { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.Informations div { padding: 12px 0; border-top: 1px solid #252525; min-width: 0; }
.Informations dt { font-size: .73rem; color: var(--Attenue); line-height: 1.5; }
.Informations dd { margin: 6px 0 0; font-size: .85rem; overflow-wrap: anywhere; }
.NoteMonitor, .PiedPage { font-size: .73rem; color: var(--Attenue); line-height: 1.5; }
.NoteMonitor { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--Ligne); }
#EtatMonitor { margin-left: auto; text-align: right; }
.PiedPage { margin-top: 14px; padding: 13px 16px; }
.Fenetre { width: min(460px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 26px; color: var(--Texte); }
.Fenetre::backdrop { background: #000c; }
.Fenetre h2 { padding-right: 30px; }
.Fenetre .Description { margin-bottom: 20px; }
.Fermer { position: absolute; right: 12px; top: 12px; font-size: 1.1rem; }
.Principal { background: #eee; color: #111; font-weight: 700; }
.Actions, .Formulaire { display: grid; gap: 12px; }
.Formulaire { margin-top: 16px; }
.Formulaire label { font-size: .77rem; color: var(--Attenue); }
.Formulaire input { width: 100%; min-width: 0; background: #080808; border: 1px solid var(--Ligne); color: var(--Texte); border-radius: 5px; padding: 12px; font-size: 1rem; }
.Erreur { font-size: .8rem; color: #ddd; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .GrilleMetriques { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .GrilleGraphiques { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .Coquille { width: calc(100% - 16px); margin-top: 8px; }
  .BarreSuperieure, .Tableau { padding: 14px; }
  .BlocMarque { gap: 10px; }
  .Logo { width: 42px; height: 42px; }
  h1 { font-size: 1.35rem; }
  h1 span { display: block; }
  .BoutonConnexion { width: 100%; }
  .CarteMetrique, .CarteGraphique { padding: 12px; }
  .GrilleMetriques { gap: 8px; }
  .Informations { grid-template-columns: 1fr; }
  .Periodes { width: 100%; }
  .Periodes button { flex: 1 1 28%; min-height: 44px; padding: 8px 4px; }
  canvas { height: 190px; }
  .PiedPage { gap: 6px; }
}
