:root {
  --fond: #0e0b16; --fond2: #14101f; --carte: #1b1529; --carte2: #231b36; --bord: #33284a;
  --texte: #ece4f7; --doux: #a597bd; --or: #f2c14e; --or2: #c9a24a; --violet: #8b5cf6; --violet2: #5b3a8e;
  --vert: #4ade80; --rouge: #f87171; --bleu: #60a5fa; --orange: #fb923c;
  --rayon: 12px; --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #2a1a45 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #3a1d2a 0%, transparent 55%), var(--fond);
  color: var(--texte); font: 14px/1.5 Inter, system-ui, sans-serif; background-attachment: fixed;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: Cinzel, Georgia, serif; letter-spacing: .02em; margin: 0 0 .6em; }
h2 { font-size: 22px; } h3 { font-size: 15px; color: var(--or); }
a { color: var(--or); }
input, select, textarea {
  background: var(--fond2); color: var(--texte); border: 1px solid var(--bord); border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--violet); outline-offset: 0; border-color: transparent; }
label { display: block; color: var(--doux); font-size: 12px; margin: 0 0 10px; }
label input, label select { margin-top: 4px; }

.btn { border: 1px solid var(--bord); background: var(--carte2); color: var(--texte); border-radius: 8px; padding: 8px 14px; font: 500 13px Inter, sans-serif; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--violet); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.or { background: linear-gradient(180deg, var(--or), var(--or2)); color: #241634; border: 0; font-weight: 600; }
.btn.vert { background: #1d3a2a; border-color: #2d5a40; color: var(--vert); }
.btn.rouge { background: #3a1d24; border-color: #5a2d36; color: var(--rouge); }
.btn.orange { background: #3a2a1d; border-color: #5a402d; color: var(--orange); }
.btn.lien { background: none; border: 0; color: var(--doux); padding: 4px 0; text-align: left; }
.btn.lien:hover { color: var(--texte); }
.btn.petit { padding: 4px 9px; font-size: 12px; }

/* connexion */
#ecran-login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login { width: min(380px, 100%); text-align: center; padding: 34px 28px; }
.login label { text-align: left; }
.login .btn { width: 100%; margin-top: 8px; padding: 11px; }
.sous { color: var(--doux); margin: -6px 0 22px; }
.erreur { color: var(--rouge); min-height: 1.4em; margin: 10px 0 0; }
.lune { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: var(--or); box-shadow: 0 0 40px #f2c14e55; position: relative; overflow: hidden; }
.lune::after { content: ''; position: absolute; width: 100%; height: 100%; border-radius: 50%; background: var(--carte); left: 30%; top: -18%; }
.lune.petite { width: 22px; height: 22px; margin: 0; box-shadow: 0 0 14px #f2c14e55; }
.lune.petite::after { background: var(--fond2); }

/* structure */
#ecran-app { display: grid; grid-template-columns: 230px 1fr; min-height: 100%; }
#nav { background: #120e1ccc; border-right: 1px solid var(--bord); padding: 18px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; backdrop-filter: blur(6px); }
.marque { display: flex; align-items: center; gap: 10px; font: 700 18px Cinzel, serif; color: var(--or); margin: 0 6px 22px; }
#menu { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
#menu a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--doux); text-decoration: none; }
#menu a:hover { background: var(--carte); color: var(--texte); }
#menu a.actif { background: linear-gradient(90deg, #3b2a5a, #2a1f40); color: var(--texte); box-shadow: inset 3px 0 0 var(--or); }
#menu .ico { width: 20px; text-align: center; }
.pied-nav { border-top: 1px solid var(--bord); padding-top: 12px; }
#qui { font-weight: 600; margin-bottom: 4px; }
#qui small { display: block; color: var(--doux); font-weight: 400; }
#barre-mobile { display: none; }
main { padding: 26px clamp(16px, 3vw, 36px) 60px; min-width: 0; }

.carte { background: linear-gradient(180deg, var(--carte), #17122299); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 18px; }
.grille { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 14px; }
.ligne { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.entete h2 { margin: 0; }
.doux { color: var(--doux); }
.mono { font-family: var(--mono); }
.pastille { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--fond2); border: 1px solid var(--bord); }
.pastille::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--doux); }
.pastille.on::before { background: var(--vert); box-shadow: 0 0 8px var(--vert); }
.pastille.off::before { background: var(--rouge); }
.stat { font: 600 26px Inter, sans-serif; margin: 4px 0 2px; }
.jauge { height: 6px; background: var(--fond2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.jauge > i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--or)); border-radius: 99px; transition: width .5s; }
canvas.graphe { width: 100%; height: 140px; display: block; }

/* console */
.console { background: #08060d; border: 1px solid var(--bord); border-radius: var(--rayon); font: 12.5px/1.45 var(--mono); padding: 12px; height: min(62vh, 640px); overflow: auto; white-space: pre-wrap; word-break: break-word; color: #d8cfe8; }
.console .warn { color: var(--orange); } .console .err { color: var(--rouge); } .console .moi { color: var(--or); } .console .rep { color: var(--bleu); }
.saisie { display: flex; gap: 8px; margin-top: 10px; }
.saisie input { font-family: var(--mono); }

/* tableaux */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--doux); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--bord); }
.table td { padding: 8px 10px; border-bottom: 1px solid #261e38; vertical-align: middle; }
.table tr:hover td { background: #ffffff05; }
.table .act { text-align: right; white-space: nowrap; }
.defile { overflow-x: auto; }
.nom-fichier { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.nom-fichier:hover { color: var(--or); }
.off-txt { color: var(--doux); text-decoration: line-through; }
.chemin { font-family: var(--mono); font-size: 12px; color: var(--doux); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chemin a { cursor: pointer; text-decoration: none; }
.tete { width: 28px; height: 28px; border-radius: 6px; image-rendering: pixelated; vertical-align: middle; margin-right: 8px; }

.depot { border: 2px dashed var(--bord); border-radius: var(--rayon); padding: 22px; text-align: center; color: var(--doux); transition: .15s; }
.depot.survol { border-color: var(--or); color: var(--texte); background: #f2c14e0d; }

.onglets { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.onglets button { background: var(--carte); border: 1px solid var(--bord); color: var(--doux); padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.onglets button.actif { color: #241634; background: var(--or); border-color: var(--or); }

textarea.editeur { font: 12.5px/1.5 var(--mono); height: 62vh; resize: vertical; tab-size: 2; white-space: pre; }
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.cases label { display: flex; gap: 8px; align-items: center; color: var(--texte); font-size: 13px; margin: 0; background: var(--fond2); border: 1px solid var(--bord); padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.cases input { width: auto; margin: 0; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: var(--carte2); border: 1px solid var(--bord); border-left: 3px solid var(--or); padding: 10px 14px; border-radius: 8px; max-width: 360px; box-shadow: 0 8px 30px #0008; animation: entre .2s; }
.toast.ko { border-left-color: var(--rouge); }
@keyframes entre { from { transform: translateY(8px); opacity: 0; } }

dialog { background: var(--carte); color: var(--texte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 22px; width: min(520px, calc(100% - 32px)); }
dialog::backdrop { background: #000a; backdrop-filter: blur(2px); }
dialog.large { width: min(1000px, calc(100% - 32px)); }
.pied { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

@media (max-width: 860px) {
  #ecran-app { grid-template-columns: 1fr; }
  #nav { position: fixed; z-index: 50; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  #nav.ouvert { transform: none; box-shadow: 20px 0 60px #000a; }
  #barre-mobile { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--bord); font: 700 16px Cinzel, serif; color: var(--or); position: sticky; top: 0; background: #120e1cee; z-index: 40; }
  #barre-mobile button { background: none; border: 0; color: var(--texte); font-size: 22px; cursor: pointer; }
  main { padding-top: 16px; }
  .table .cache-mobile { display: none; }
}
