:root {
  --fond: #f6f6f3;
  --encre: #1c2024;
  --discret: #646b73;
  --filet: #dcdcd6;
  --grille: #e6e6e1;
  --accent: #1b6b8f;
  --accent-clair: #a9cbdb;
  --zone: #e4ebee;
  --ok: #17703f;
  --attention: #9a5700;
  --alerte: #b0261e;
  --champ: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #15181b;
    --encre: #e6e8ea;
    --discret: #98a0a8;
    --filet: #30363c;
    --grille: #262b30;
    --accent: #5fb0d6;
    --accent-clair: #2d5568;
    --zone: #20292f;
    --ok: #5cc98b;
    --attention: #e0a04a;
    --alerte: #f0877f;
    --champ: #1d2126;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1.02rem; padding-bottom: 6px; border-bottom: 1px solid var(--filet); margin-bottom: 12px; }
a { color: var(--accent); }
.discret { color: var(--discret); }
.petit { font-size: 0.85rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85rem; }

.haut {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  max-width: 1100px; margin: 0 auto; padding: 14px 16px 10px;
}
.haut-outils { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 0.9rem; }
main, .pied { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
section { padding: 18px 0 8px; }
.pied { padding-top: 20px; padding-bottom: 40px; border-top: 1px solid var(--filet); margin-top: 20px; }
.bandeau { max-width: 1100px; margin: 0 auto 8px; padding: 8px 16px; color: var(--alerte); border-left: 3px solid var(--alerte); }

button, select, input, textarea {
  font: inherit; color: inherit; background: var(--champ);
  border: 1px solid var(--filet); border-radius: 4px; padding: 5px 10px;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { button.principal { color: #0c1114; } }
button.lien { border: none; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
textarea { width: 100%; min-height: 170px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85rem; }
input[type="text"] { width: 100%; }

.etat-badge { display: inline-block; font-weight: 600; padding: 0 8px; border: 1px solid currentColor; border-radius: 3px; font-size: 0.85rem; }
.etat-ok { color: var(--ok); }
.etat-attention { color: var(--attention); }
.etat-alerte { color: var(--alerte); }
.contact { font-size: 1.05rem; margin: 0 0 12px; }

dl.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0 28px; margin: 0; }
dl.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--grille); }
dl.kv dt { color: var(--discret); }
dl.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 5px 10px 5px 0; border-bottom: 1px solid var(--grille); vertical-align: top; }
th { font-weight: 600; color: var(--discret); white-space: nowrap; }
td.num, th.num { text-align: right; }
.defile { overflow-x: auto; }
.defile-haut { max-height: 340px; overflow-y: auto; }

.graphe { position: relative; margin: 6px 0 10px; }
.graphe svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.graphe .axe { font-size: 11px; fill: var(--discret); }
.graphe .grille { stroke: var(--grille); stroke-width: 1; }
.graphe .repere { stroke: var(--discret); stroke-width: 1; stroke-dasharray: 4 3; }
.graphe .courbe { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphe .barre { fill: var(--accent); }
.graphe .barre-claire { fill: var(--accent-clair); }
.graphe .bande { fill: var(--zone); }
.graphe .bande-texte { font-size: 10px; fill: var(--discret); }
.graphe .curseur { stroke: var(--discret); stroke-width: 1; }
.graphe .point { fill: var(--accent); stroke: var(--fond); stroke-width: 2; }
.infobulle {
  position: absolute; pointer-events: none; background: var(--encre); color: var(--fond);
  padding: 3px 8px; border-radius: 3px; font-size: 0.8rem; white-space: nowrap; transform: translate(-50%, -120%);
}
.legende { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.82rem; color: var(--discret); margin: 0 0 8px; }
.legende i { display: inline-block; width: 12px; height: 10px; margin-right: 5px; vertical-align: -1px; }
.legende .l-courbe { background: var(--accent); height: 2px; vertical-align: 3px; }
.legende .l-claire { background: var(--accent-clair); }
.legende .l-bande { background: var(--zone); border: 1px solid var(--filet); }
.legende .l-pointille { height: 0; border-top: 1px dashed var(--discret); vertical-align: 3px; }
.lecture { margin: 8px 0 12px; font-weight: 600; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 36px; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.filtre { margin-bottom: 8px; }
.retour { min-height: 1.4em; margin: 6px 0; }
.retour.erreur { color: var(--alerte); }
.retour.ok { color: var(--ok); }
pre { margin: 0; padding: 8px 10px; background: var(--champ); border: 1px solid var(--grille); border-radius: 4px; overflow-x: auto; }
.supprime { text-decoration: line-through; color: var(--discret); }

.page-login { display: grid; place-items: center; min-height: 100vh; }
.login { width: min(320px, 90vw); }
.login h1 { margin-bottom: 18px; }
.login form { display: grid; gap: 10px; }
.msg-erreur { margin: 0; color: var(--alerte); }
