/* =========================================================================
   monitoring.swolf.ovh — feuille de style unique
   Thème sombre, sans dépendance externe, lisible sur écran de bureau comme
   sur la TV de supervision.
   ========================================================================= */

:root {
  --bg: #0d1117;
  --bg-alt: #131a24;
  --bg-card: #161d28;
  --bg-hover: #1c2532;
  --border: #243040;
  --border-soft: #1b2534;
  --text: #dfe6ef;
  --text-dim: #8b98a9;
  --text-faint: #616e7f;
  --accent: #4c9be8;
  --accent-dim: #2a5f96;
  --ok: #3fb950;
  --warn: #d29922;
  --crit: #f85149;
  --info: #58a6ff;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, .mono { font-family: var(--mono); font-size: 0.88em; }

/* --------------------------------------------------------------- structure */

.wrap { max-width: 1400px; margin: 0 auto; padding: 0 20px 60px; }

header.top {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #111823, #0d1117);
  padding: 22px 0 16px;
  margin-bottom: 26px;
}

header.top .wrap { padding-bottom: 0; }

.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand h1 { font-size: 21px; margin: 0; letter-spacing: -0.2px; }
.brand .sub { color: var(--text-faint); font-size: 13px; }

nav.main { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
nav.main a {
  padding: 7px 13px; border-radius: 7px; color: var(--text-dim);
  font-size: 14px; font-weight: 500;
}
nav.main a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
nav.main a.active { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }

.toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-left: auto; font-size: 13px; color: var(--text-dim);
}

button, .btn {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 12px; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--bg-hover); border-color: var(--accent-dim); }

/* ------------------------------------------------------------- barre d'état */

.statusbar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 22px;
}

.stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat .k { font-size: 12px; color: var(--text-dim); text-transform: uppercase;
           letter-spacing: 0.5px; }
.stat .v { font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: -0.5px; }
.stat .v.ok { color: var(--ok); } .stat .v.warn { color: var(--warn); }
.stat .v.crit { color: var(--crit); } .stat .v.info { color: var(--info); }

/* ----------------------------------------------------------------- alertes */

.alerts { margin-bottom: 26px; }
.alerts h2, section h2 {
  font-size: 15px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-dim); margin: 0 0 12px; font-weight: 600;
}

.alert-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-left-width: 3px; border-radius: 8px; padding: 10px 14px; margin-bottom: 7px;
  font-size: 14px;
}
.alert-row.crit { border-left-color: var(--crit); }
.alert-row.warn { border-left-color: var(--warn); }
.alert-row.info { border-left-color: var(--info); }
.alert-row .who { font-weight: 600; min-width: 92px; }
.alert-row .msg { color: var(--text-dim); }
.alert-row code { color: var(--text-faint); }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
}
.badge.ok { background: rgba(63,185,80,.15); color: var(--ok); }
.badge.warn { background: rgba(210,153,34,.15); color: var(--warn); }
.badge.crit { background: rgba(248,81,73,.15); color: var(--crit); }
.badge.info { background: rgba(88,166,255,.15); color: var(--info); }
.badge.off { background: rgba(139,152,169,.15); color: var(--text-dim); }

/* ---------------------------------------------------------------- machines */

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.card:hover { border-color: var(--accent-dim); }

.card .head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--border-soft);
  background: var(--bg-alt);
}
.card .head .name { font-weight: 600; font-size: 15px; }
.card .head .role { color: var(--text-faint); font-size: 12.5px; }
.card .head .right { margin-left: auto; text-align: right; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.dot.ok { background: var(--ok); box-shadow: 0 0 7px rgba(63,185,80,.55); }
.dot.warn { background: var(--warn); box-shadow: 0 0 7px rgba(210,153,34,.5); }
.dot.crit { background: var(--crit); box-shadow: 0 0 7px rgba(248,81,73,.5); }
.dot.off { background: var(--text-faint); }

.card .body { padding: 14px 16px; flex: 1; }

.gauge { margin-bottom: 11px; }
.gauge .line {
  display: flex; justify-content: space-between; font-size: 13px;
  margin-bottom: 5px; color: var(--text-dim);
}
.gauge .line b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.gauge .track { height: 6px; background: #0b1017; border-radius: 4px; overflow: hidden; }
.gauge .fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s; }
.gauge .fill.ok { background: var(--ok); }
.gauge .fill.warn { background: var(--warn); }
.gauge .fill.crit { background: var(--crit); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 12.5px; }

.card .foot {
  padding: 10px 16px; border-top: 1px solid var(--border-soft);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.port {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-dim);
  background: #0b1017; border: 1px solid var(--border-soft);
  border-radius: 5px; padding: 1px 6px;
}

/* ------------------------------------------------------------------ détail */

.machine-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px;
}
.machine-head h2 { margin: 0; font-size: 22px; text-transform: none;
                   letter-spacing: -0.3px; color: var(--text); }
.machine-head .role { color: var(--text-dim); font-size: 14px; }

.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
}
.panel h3 {
  margin: 0 0 12px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--text-dim); font-weight: 600;
}

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text-faint); font-weight: 500; font-size: 12px;
     text-transform: uppercase; letter-spacing: 0.4px; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

.spark { display: block; width: 100%; height: 60px; }

/* -------------------------------------------------------------------- wiki */

.wiki-layout { display: grid; grid-template-columns: 250px 1fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .wiki-layout { grid-template-columns: 1fr; } }

.wiki-nav {
  position: sticky; top: 16px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; max-height: calc(100vh - 32px); overflow-y: auto;
}
.wiki-nav .group {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-faint); margin: 14px 0 6px; font-weight: 600;
}
.wiki-nav .group:first-child { margin-top: 0; }
.wiki-nav a {
  display: block; padding: 5px 9px; border-radius: 6px; font-size: 13.5px;
  color: var(--text-dim);
}
.wiki-nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.wiki-nav a.active { background: var(--accent-dim); color: #fff; }

.md { max-width: 900px; }
.md h1 { font-size: 27px; margin: 0 0 18px; letter-spacing: -0.4px; }
.md h2 {
  font-size: 20px; margin: 32px 0 12px; padding-bottom: 7px;
  border-bottom: 1px solid var(--border); color: var(--text);
  text-transform: none; letter-spacing: -0.2px;
}
.md h3 { font-size: 16px; margin: 22px 0 9px; color: var(--text); }
.md h4 { font-size: 14px; margin: 18px 0 7px; color: var(--text-dim); }
.md p { margin: 0 0 13px; }
.md ul, .md ol { margin: 0 0 13px; padding-left: 22px; }
.md li { margin-bottom: 5px; }
.md li > input[type=checkbox] { margin-right: 7px; }
.md blockquote {
  margin: 0 0 14px; padding: 10px 16px; border-left: 3px solid var(--accent-dim);
  background: var(--bg-card); border-radius: 0 8px 8px 0; color: var(--text-dim);
}
.md pre {
  background: #0b1017; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; margin: 0 0 14px;
}
.md code { background: #0b1017; border: 1px solid var(--border-soft);
           border-radius: 4px; padding: 1px 5px; color: #9ecbff; }
.md pre code { background: none; border: none; padding: 0; color: var(--text); }
.md table { margin: 0 0 16px; }
.md th { background: var(--bg-alt); }
.md hr { border: none; border-top: 1px solid var(--border); margin: 26px 0; }
.md strong { color: #fff; }

/* ------------------------------------------------------------------ divers */

footer.bottom {
  border-top: 1px solid var(--border); margin-top: 40px; padding-top: 18px;
  color: var(--text-faint); font-size: 13px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

.loading, .empty {
  color: var(--text-faint); text-align: center; padding: 40px 20px; font-size: 14px;
}

.err {
  background: rgba(248,81,73,.08); border: 1px solid rgba(248,81,73,.35);
  color: #ffb4ae; border-radius: 8px; padding: 13px 16px; margin-bottom: 18px;
  font-size: 14px;
}

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px;
           color: var(--text-faint); margin-top: 8px; }
.legend span { display: flex; align-items: center; gap: 5px; }

/* ------------------------------------------------- page hébergements */

.host-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.host-head h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.3px; }
.host-head .role { color: var(--text-dim); font-size: 14px; max-width: 70em; margin: 0; }
.host-head .updated { color: var(--text-faint); font-size: 12.5px; white-space: nowrap; }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 18px; min-width: 110px;
  display: flex; flex-direction: column; align-items: flex-start;
}
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--text-faint); font-size: 12px; }

.section-title { margin: 24px 0 12px; font-size: 16px; color: var(--text); }
.hint, .note { color: var(--text-dim); font-size: 13px; }
.card .foot a { font-size: 12.5px; }
.tag {
  font-size: 11px; font-weight: 600; color: var(--info);
  background: rgba(88,166,255,.12); border: 1px solid rgba(88,166,255,.3);
  border-radius: 5px; padding: 1px 7px; white-space: nowrap;
}
.panel pre { margin: 12px 0 0; }

/* Lien sortant : petit repère pour signaler l'ouverture d'un nouvel onglet */
a.ext::after { content: " \2197"; font-size: .85em; opacity: .65; }
.animal-emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  margin-right: .35em; font-size: 1.15em; line-height: 1;
}
#main table a { text-decoration: none; }
#main table a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .toolbar { width: 100%; }
}
