:root {
  --bg: #05070d;
  --panel: rgba(12, 18, 32, .78);
  --line: rgba(0, 229, 255, .18);
  --cyan: #00e5ff;
  --green: #00ff9c;
  --red: #ff3d6e;
  --amber: #ffb020;
  --text: #d7e6f5;
  --muted: #6b7f99;
  --title: 'Orbitron', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(0, 229, 255, .12), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(0, 255, 156, .08), transparent 60%),
    linear-gradient(rgba(0, 229, 255, .05) 1px, transparent 1px) 0 0 / 100% 36px,
    linear-gradient(90deg, rgba(0, 229, 255, .05) 1px, transparent 1px) 0 0 / 36px 100%,
    var(--bg);
  background-attachment: fixed;
}

h1, h2 { font-family: var(--title); font-weight: 500; letter-spacing: .08em; margin: 0 0 .6rem; }
h1 { font-size: 1.4rem; }
h2 { font-size: .95rem; text-transform: uppercase; color: var(--cyan); }
a { color: var(--cyan); text-decoration: none; }
p { margin: .4rem 0; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.center { text-align: center; }
.right { text-align: right; }
.error { color: var(--red); }

/* Barre supérieure */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  padding: .8rem 1.2rem; position: sticky; top: 0; z-index: 5;
  background: rgba(5, 7, 13, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--title); font-weight: 700; letter-spacing: .15em; color: #fff;
}
.logo {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 12px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .35; } }
nav { display: flex; gap: .3rem; flex: 1; overflow-x: auto; }
nav a {
  color: var(--muted); padding: .4rem .8rem; border-radius: 8px;
  border: 1px solid transparent; white-space: nowrap;
}
nav a:hover, nav a.active { color: var(--cyan); border-color: var(--line); background: rgba(0, 229, 255, .06); }
.top-right { display: flex; align-items: center; gap: .6rem; }

[hidden] { display: none !important; }

main { max-width: 1200px; margin: 0 auto; padding: 1.2rem 16px 3rem; }

/* Panneaux, tuiles */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem; margin-bottom: 1rem; backdrop-filter: blur(8px);
  box-shadow: 0 0 24px rgba(0, 229, 255, .05), inset 0 1px 0 rgba(255, 255, 255, .03);
}
.head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .8rem; margin-bottom: .8rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile {
  position: relative; overflow: hidden; padding: .9rem 1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.tile::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--cyan); }
.tile.ok::before { background: var(--green); }
.tile.ko::before { background: var(--red); }
.tile.warn::before { background: var(--amber); }
.tile-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.tile-value { font-size: 1.4rem; margin-top: .3rem; color: #fff; }
.tile.ko .tile-value { color: var(--red); }

/* Badges & boutons */
.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px; border: 1px solid;
  font: 600 .68rem var(--mono); letter-spacing: .08em; white-space: nowrap;
}
.badge.ok { color: var(--green); border-color: rgba(0, 255, 156, .4); background: rgba(0, 255, 156, .08); }
.badge.ko { color: var(--red); border-color: rgba(255, 61, 110, .5); background: rgba(255, 61, 110, .1); }
.badge.off { color: var(--muted); border-color: var(--line); }

.btn {
  font: 600 .85rem var(--mono); cursor: pointer;
  color: var(--cyan); padding: .5rem .9rem; border-radius: 9px;
  border: 1px solid var(--cyan);
  background: linear-gradient(135deg, rgba(0, 229, 255, .2), rgba(0, 255, 156, .1));
  box-shadow: 0 0 14px rgba(0, 229, 255, .15);
}
.btn:hover { box-shadow: 0 0 22px rgba(0, 229, 255, .35); }
.btn.ghost { color: var(--text); border-color: var(--line); background: transparent; box-shadow: none; }
.btn.danger { color: var(--red); border-color: rgba(255, 61, 110, .5); background: transparent; box-shadow: none; }
.btn.small { padding: .3rem .6rem; font-size: .75rem; }
.btn.block { width: 100%; }
.actions-cell { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; align-items: center; }
.actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
.range { display: flex; gap: .3rem; }

/* Tableaux & listes */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .6rem .5rem; text-align: left; vertical-align: middle; border-bottom: 1px solid rgba(0, 229, 255, .08); }
th { color: var(--muted); font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .55rem .2rem; color: var(--text); border-bottom: 1px solid rgba(0, 229, 255, .08);
}
.srv {
  display: block; padding: .7rem; margin-bottom: .6rem; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
}
.srv:hover { border-color: var(--cyan); }
.srv-head { display: flex; justify-content: space-between; align-items: center; }

/* Jauges */
.meter { display: grid; grid-template-columns: 56px 1fr 52px; align-items: center; gap: .5rem; font-size: .8rem; margin-top: .35rem; }
.meter .mono { text-align: right; }
.bar { height: 8px; border-radius: 99px; overflow: hidden; background: rgba(0, 229, 255, .08); }
.bar span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  box-shadow: 0 0 10px var(--cyan);
}
.bar.warn span { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.bar.hot span { background: var(--red); box-shadow: 0 0 10px var(--red); }

.chart { position: relative; height: 280px; }

/* Fenêtres modales & formulaires */
.overlay {
  position: fixed; inset: 0; z-index: 20; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2, 4, 8, .7); backdrop-filter: blur(4px);
}
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; margin: 0; }
form label { display: block; margin-bottom: .7rem; font-size: .8rem; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem;
  font: 14px var(--mono); color: var(--text);
  background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, .15);
}
label.check { display: flex; align-items: center; gap: .5rem; color: var(--text); }
label.check input { width: auto; margin: 0; }
pre {
  max-height: 360px; overflow: auto; margin: 0; padding: .7rem;
  font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word;
  background: rgba(0, 0, 0, .45); border: 1px solid var(--line); border-radius: 8px;
}
.run { margin-bottom: 1rem; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: min(380px, 100%); }
.login-box .brand { margin-bottom: 1.2rem; font-size: 1.05rem; }

/* Notifications à l'écran */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  max-width: 340px; padding: .7rem 1rem; border-radius: 10px;
  font: .85rem var(--mono); background: rgba(12, 18, 32, .95);
  border: 1px solid var(--cyan); box-shadow: 0 0 20px rgba(0, 229, 255, .25);
}
.toast.ko { border-color: var(--red); box-shadow: 0 0 20px rgba(255, 61, 110, .3); }

@media (max-width: 640px) {
  h1 { font-size: 1.1rem; }
  .tile-value { font-size: 1.2rem; }
  .chart { height: 220px; }
  th, td { padding: .5rem .3rem; }
}
