:root {
  --accent: 255, 132, 33;
  --bg: 14, 14, 16;
  --panel: 24, 24, 28;
  --panel2: 32, 32, 37;
  --texte: #f2f2f2;
  --muted: rgba(255, 255, 255, 0.55);
  --faible: rgba(255, 255, 255, 0.35);
  --trait: rgba(255, 255, 255, 0.08);
  --ok: 74, 222, 128;
  --danger: 239, 68, 68;
  --alerte: 250, 204, 21;
  --rayon: 4px;
  --gouttiere: 16px;
  --police: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; background: rgb(var(--bg)); color: var(--texte); font: 500 13px/1.45 var(--police); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: 500 12px var(--police); color: var(--texte); }
a { color: rgb(var(--accent)); text-decoration: none; }
.cache { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

.marque { font-weight: 800; font-size: 18px; letter-spacing: 2px; white-space: nowrap; }
.marque span { color: rgb(var(--accent)); }

.champ { width: 100%; height: 36px; padding: 0 10px; border-radius: var(--rayon); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--trait); outline: none; }
.champ:focus { border-color: rgba(var(--accent), 0.7); }
select.champ option { background: rgb(var(--panel)); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--rayon); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; background: rgba(30, 30, 30, 0.85); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); transition: filter 0.12s, transform 0.08s; }
.btn:hover { filter: brightness(1.2); }
.btn:active { transform: scale(0.97); }
.btn.principal { background: rgba(var(--accent), 0.85); box-shadow: none; color: #fff; }
.btn.ghost { box-shadow: inset 0 0 0 1px rgba(var(--accent), 0.85); }
.btn.danger { color: rgb(var(--danger)); box-shadow: inset 0 0 0 1px rgba(var(--danger), 0.45); }
.btn.ok { color: rgb(var(--ok)); box-shadow: inset 0 0 0 1px rgba(var(--ok), 0.4); }
.btn.actif { background: rgba(var(--accent), 0.2); box-shadow: inset 0 0 0 1px rgb(var(--accent)); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; filter: none; }
.btn.petit { height: 28px; padding: 0 10px; font-size: 11px; }
.btn svg { width: 14px; height: 14px; }
.pleine { width: 100%; margin-top: 12px; height: 40px; }
.erreur { color: rgb(var(--danger)); font-size: 12px; margin-top: 10px; min-height: 18px; }

#connexion { min-height: 100vh; display: grid; place-items: center; padding: var(--gouttiere); }
.carte-login { width: 100%; max-width: 360px; background: rgba(var(--panel), 0.9); border-radius: var(--rayon); overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); }
.carte-login .tete { height: 56px; display: flex; align-items: center; padding: 0 20px; background: rgba(0, 0, 0, 0.45); border-bottom: 2px solid rgba(var(--accent), 0.8); }
.carte-login .corps { padding: 20px; }
.carte-login label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

.entete { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; height: 56px; padding: 0 20px; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); border-bottom: 2px solid rgba(var(--accent), 0.8); }
.entete nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.entete nav::-webkit-scrollbar { display: none; }
.entete nav button { padding: 8px 14px; border-radius: var(--rayon); font-weight: 600; font-size: 12px; text-transform: uppercase; opacity: 0.6; white-space: nowrap; }
.entete nav button:hover { opacity: 0.85; }
.entete nav button.actif { opacity: 1; background: rgba(var(--accent), 0.2); box-shadow: inset 0 -2px 0 rgb(var(--accent)); }
.entete nav .lien-site { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: var(--rayon); font-weight: 600; font-size: 12px; text-transform: uppercase; color: rgb(var(--accent)); white-space: nowrap; }
.entete nav .lien-site:hover { background: rgba(var(--accent), 0.12); }
body:not(.site-logs) #nav button[data-onglet="logs"] { display: none; }
.site-logs #nav button:not([data-onglet="logs"]), .site-logs #bloc-serveur { display: none !important; }
.entete .droite { display: flex; align-items: center; gap: 8px; }

.pastille { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 20px; background: rgba(255, 255, 255, 0.06); font-size: 11px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.pastille i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pastille.on i { background: rgb(var(--ok)); box-shadow: 0 0 8px rgba(var(--ok), 0.8); }
.pastille.off i { background: rgb(var(--danger)); }
.pastille.attente i { background: rgb(var(--accent)); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

main { max-width: 1100px; margin: 0 auto; padding: 16px 20px 80px; }

.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: rgba(var(--panel), 0.9); border-radius: var(--rayon); padding: 12px 14px; min-width: 0; }
.stat .lib { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.stat .val { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .sous { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.panneau { background: rgba(var(--panel), 0.9); border-radius: var(--rayon); overflow: hidden; }
.panneau + .panneau { margin-top: 12px; }
.barre { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: rgba(0, 0, 0, 0.35); flex-wrap: wrap; min-height: 48px; }
.barre h2 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; flex: 1; display: flex; align-items: center; gap: 8px; }
.barre .champ { height: 30px; max-width: 240px; }
.badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: rgba(255, 255, 255, 0.08); color: var(--muted); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.badge.accent { background: rgba(var(--accent), 0.18); color: rgb(var(--accent)); }

#log { height: min(60vh, 560px); overflow-y: auto; padding: 10px 12px; font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: rgba(0, 0, 0, 0.45); }
#log .l { color: #d4d4d8; }
#log .l.err { color: #fca5a5; }
#log .l.warn { color: #fde68a; }
#log .l.cmd { color: rgb(var(--accent)); }
#log .l.sys { color: #86efac; }
#log .l .src { color: #71717a; }
.saisie { display: flex; gap: 8px; padding: 10px 12px; background: rgba(0, 0, 0, 0.35); }
.saisie .champ { flex: 1; font-family: var(--mono); font-size: 12px; height: 36px; }
.raccourcis { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; }
.puce { height: 26px; padding: 0 10px; border-radius: 20px; background: rgba(255, 255, 255, 0.06); font-size: 11px; font-weight: 600; font-family: var(--mono); white-space: nowrap; color: var(--muted); }
.puce:hover { color: var(--texte); background: rgba(var(--accent), 0.2); }
.suivre { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; font-weight: 600; text-transform: uppercase; }
input[type=checkbox] { accent-color: rgb(var(--accent)); }

.liste { max-height: min(62vh, 600px); overflow-y: auto; }
.ligne { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--trait); }
.ligne:first-child { border-top: 0; }
.ligne .nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.ligne .etat { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.ligne .etat.on { background: rgb(var(--ok)); }
.ligne .etat.off { background: rgb(var(--danger)); }
.ligne .meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.ligne.dossier .nom { color: var(--muted); }
.vide { color: var(--muted); text-align: center; padding: 32px 12px; font-size: 12px; }
.ligne.vide { justify-content: center; border: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; background: rgba(255, 255, 255, 0.06); white-space: nowrap; }
.chips button:hover { background: rgba(255, 255, 255, 0.1); }
.chips button.actif { background: rgba(var(--accent), 0.85); color: #fff; }
.chips button svg { width: 13px; height: 13px; }
.chips .cat.actif { background: rgba(var(--c), 0.22); box-shadow: inset 0 0 0 1px rgba(var(--c), 0.9); color: var(--texte); }
.chips .cat svg { color: rgb(var(--c)); }
.sousnav { margin-bottom: 12px; }

.filtres { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.filtres .rang { display: grid; grid-template-columns: 1.1fr 1.1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.filtres label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.filtres .actions-f { display: flex; gap: 6px; }
.etat-flux { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.etat-flux i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.etat-flux.direct i { background: rgb(var(--ok)); box-shadow: 0 0 8px rgba(var(--ok), 0.8); animation: pulse 1.6s infinite; }
.etat-flux.pause i { background: rgb(var(--accent)); }

.cat-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; background: rgba(var(--c), 0.16); color: rgb(var(--c)); white-space: nowrap; }
.cat-badge svg { width: 12px; height: 12px; flex-shrink: 0; }

.journal { max-height: none; }
.log { display: grid; grid-template-columns: 70px 128px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--trait); cursor: pointer; }
.log:first-child { border-top: 0; }
.log:hover { background: rgba(255, 255, 255, 0.03); }
.log.nouveau { animation: arrivee 1.8s ease-out; }
@keyframes arrivee { from { background: rgba(var(--accent), 0.18); } to { background: transparent; } }
.log .h { font-family: var(--mono); font-size: 11px; color: var(--muted); line-height: 1.25; }
.log .h small { display: block; font-size: 10px; color: var(--faible); }
.log .contenu { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.log .qui { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; font-weight: 600; min-width: 0; }
.log .qui .act { color: var(--muted); font-weight: 600; font-size: 11px; }
.log .msg { font-size: 12px; color: #d4d4d8; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log.ouvert .msg { white-space: pre-wrap; word-break: break-word; }
.log .droite { display: flex; align-items: center; gap: 8px; }
.log .item { width: 34px; height: 34px; border-radius: var(--rayon); background: rgba(255, 255, 255, 0.05); object-fit: contain; }
.montant { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
.montant.plus { color: rgb(var(--ok)); }
.montant.moins { color: rgb(var(--danger)); }
.lien-j { color: var(--texte); border-bottom: 1px dotted rgba(255, 255, 255, 0.3); cursor: pointer; }
.lien-j:hover { color: rgb(var(--accent)); border-color: rgb(var(--accent)); }
.uidb { font-family: var(--mono); font-size: 10px; font-weight: 600; color: rgb(var(--accent)); background: rgba(var(--accent), 0.14); padding: 1px 5px; border-radius: 3px; }
.fleche { color: var(--faible); }
.detail { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px; padding: 8px 0 2px; font-size: 11px; cursor: auto; }
.detail div { min-width: 0; overflow-wrap: anywhere; }
.detail b { display: block; font-size: 9px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; }
.detail pre { grid-column: 1 / -1; font-family: var(--mono); font-size: 11px; background: rgba(0, 0, 0, 0.4); padding: 8px 10px; border-radius: var(--rayon); white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; color: #d4d4d8; }
.sentinelle { padding: 14px; text-align: center; color: var(--muted); font-size: 11px; }
.bandeau-nouveaux { display: block; width: 100%; padding: 8px; background: rgba(var(--accent), 0.2); color: rgb(var(--accent)); font-weight: 700; font-size: 11px; text-transform: uppercase; }

.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.tuile { background: rgba(var(--panel), 0.9); border-radius: var(--rayon); padding: 10px 12px; text-align: left; box-shadow: inset 3px 0 0 rgb(var(--c)); transition: transform 0.1s; }
.tuile:hover { transform: translateY(-2px); }
.tuile .t { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.tuile .t svg { width: 13px; height: 13px; color: rgb(var(--c)); }
.tuile .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tuile .s { font-size: 11px; color: var(--muted); }
.deux { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.deux .panneau + .panneau { margin-top: 0; }
.trois { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }

.histo { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 120px; padding: 12px 12px 0; }
.histo .b { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; position: relative; }
.histo .b i { display: block; width: 100%; background: rgba(var(--accent), 0.85); border-radius: 4px 4px 0 0; min-height: 1px; }
.histo .b:hover i { background: rgb(var(--accent)); }
.histo .b::after { content: attr(data-t); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.9); padding: 4px 8px; border-radius: var(--rayon); font-size: 11px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.1s; z-index: 2; }
.histo .b:hover::after { opacity: 1; }
.histo-axe { display: flex; justify-content: space-between; padding: 6px 12px 10px; font-size: 10px; color: var(--muted); font-family: var(--mono); border-top: 1px solid var(--trait); margin: 0 12px; padding-left: 0; padding-right: 0; }

.critique { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 8px 12px; border-top: 1px solid var(--trait); align-items: start; }
.critique:first-child { border-top: 0; }
.critique .titre { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; font-weight: 600; }
.critique .msg { font-size: 12px; color: #d4d4d8; overflow-wrap: anywhere; }

.fiche-tete { display: flex; gap: 16px; align-items: center; padding: 16px; flex-wrap: wrap; }
.avatar { width: 52px; height: 52px; border-radius: var(--rayon); background: rgba(var(--accent), 0.2); color: rgb(var(--accent)); display: grid; place-items: center; font-weight: 800; font-size: 20px; flex-shrink: 0; }
.fiche-tete h2 { font-size: 18px; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fiche-tete .ids { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.fiche-tete .ids span { overflow-wrap: anywhere; }
.status { padding: 4px 10px; border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.status.on { background: rgba(var(--ok), 0.18); color: rgb(var(--ok)); }
.status.danger { background: rgba(var(--danger), 0.18); color: rgb(var(--danger)); }
.status.accent { background: rgba(var(--accent), 0.18); color: rgb(var(--accent)); }
table.tab { width: 100%; border-collapse: collapse; font-size: 12px; }
table.tab th { text-align: left; font-size: 10px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 12px; }
table.tab td { padding: 8px 12px; border-top: 1px solid var(--trait); vertical-align: top; }
table.tab td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.defile-x { overflow-x: auto; }
.recherche-fiche { display: flex; gap: 8px; margin-bottom: 12px; }
.recherche-fiche .champ { max-width: 360px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: 0.2s; background: rgba(var(--panel), 0.98); border-radius: var(--rayon); box-shadow: inset 3px 0 0 rgb(var(--accent)), 0 10px 30px rgba(0, 0, 0, 0.5); padding: 11px 16px; font-size: 13px; max-width: calc(100vw - 32px); z-index: 50; pointer-events: none; }
#toast.visible { opacity: 1; transform: translate(-50%, 0); }
#toast.erreur { box-shadow: inset 3px 0 0 rgb(var(--danger)), 0 10px 30px rgba(0, 0, 0, 0.5); }
#voile { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; padding: var(--gouttiere); z-index: 40; }
.dialogue { width: 100%; max-width: 400px; background: rgba(var(--bg), 0.98); border-radius: var(--rayon); overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); }
.dialogue h2 { height: 48px; display: flex; align-items: center; padding: 0 16px; font-size: 13px; font-weight: 700; text-transform: uppercase; background: rgba(0, 0, 0, 0.45); border-bottom: 2px solid rgba(var(--accent), 0.8); }
.dialogue .corps { padding: 16px; }
.dialogue p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.dialogue .boutons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

@media (max-width: 900px) {
  .filtres .rang { grid-template-columns: 1fr 1fr; }
  .filtres .rang .actions-f { grid-column: 1 / -1; }
  .trois, .deux { grid-template-columns: minmax(0, 1fr); }
  .deux .panneau + .panneau, .trois .panneau + .panneau { margin-top: 0; }
}
@media (max-width: 640px) {
  .entete { height: auto; flex-wrap: wrap; gap: 6px 12px; padding: 10px var(--gouttiere) 0; }
  .entete nav .lien-site { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: var(--rayon); font-weight: 600; font-size: 12px; text-transform: uppercase; color: rgb(var(--accent)); white-space: nowrap; }
.entete nav .lien-site:hover { background: rgba(var(--accent), 0.12); }
body:not(.site-logs) #nav button[data-onglet="logs"] { display: none; }
.site-logs #nav button:not([data-onglet="logs"]), .site-logs #bloc-serveur { display: none !important; }
.entete .droite { margin-left: auto; }
  .entete nav { order: 3; flex-basis: 100%; }
  .entete .pastille span.long { display: none; }
  main { padding: 12px var(--gouttiere) 60px; }
  .stat .val { font-size: 18px; }
  #log { height: 48vh; font-size: 11px; }
  .log { grid-template-columns: 56px minmax(0, 1fr); gap: 4px 10px; }
  .log .cat-badge { grid-column: 2; justify-self: start; }
  .log .h { grid-row: 1 / span 2; }
  .log .contenu { grid-column: 2; }
  .log .droite { grid-column: 2; }
  .filtres .rang { grid-template-columns: 1fr; }
  .critique { grid-template-columns: 1fr; gap: 4px; }
}
