/* MHD PROTECH OPS — interface claire, inspirée de Notion (calme, typographique)
   et d'Uptime Kuma (barres d'historique, pastilles d'état). */

@font-face { font-family: "Plex"; src: url("fonts/ibm-plex-sans-latin-400-normal.77bc02670657.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/ibm-plex-sans-latin-500-normal.f7016cd446d2.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/ibm-plex-sans-latin-600-normal.196e3cbc5fee.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --canvas: #ffffff;
  --side: #f7f7f5;
  --hover: #efefed;
  --ink: #2f2e2b;
  --muted: #7a7871;
  --faint: #a8a6a0;
  --line: #ecebe8;
  --accent: #2383e2;
  --accent-soft: #e7f1fc;
  --ok: #3bb273;   --ok-soft: #e8f6ee;
  --bad: #e5484d;  --bad-soft: #fdecec;
  --warn: #e3a008; --warn-soft: #fdf5e1;
  --idle: #d6d5d1;
  --r-sm: 4px; --r: 8px;
  font-family: "Plex", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.num, .temp { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt { margin-top: 28px; }
code { font-size: 12.5px; background: var(--side); padding: 1px 5px; border-radius: var(--r-sm); color: var(--muted); }

/* ---------- Structure : barre latérale + contenu ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0;
  height: 100vh; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; font-weight: 600; }
.brand .mark { width: 34px; height: 26px; border-radius: 6px; background: var(--ink); color: #fff; display: grid;
  place-items: center; font-size: 11px; letter-spacing: .02em; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.side-group { color: var(--faint); font-size: 12px; padding: 14px 8px 4px; }
.side a.item { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: var(--r-sm); color: var(--ink); }
.side a.item:hover { background: var(--hover); color: var(--ink); }
.side a.item.on { background: var(--hover); font-weight: 500; }
.side a.item svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.side a.item .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.side a.item .count.hot { color: #fff; background: var(--bad); border-radius: 10px; padding: 0 7px; }
.side .site-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); margin: 0 4px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 10px 8px 0; font-size: 13px; }
.side-foot .who { font-weight: 500; }
.side-foot .links { display: flex; gap: 12px; color: var(--muted); margin-top: 4px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.linkbtn:hover { color: var(--accent); }

main { padding: 36px 48px 64px; max-width: 1180px; width: 100%; }

/* ---------- Titres ---------- */
h1 { font-size: 28px; line-height: 1.2; font-weight: 600; margin: 0; letter-spacing: -.015em; }
h2 { font-size: 18px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 10px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Bandeau d'état (façon page de statut) ---------- */
.status-banner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r);
  background: var(--ok-soft); margin-bottom: 18px; }
.status-banner.bad { background: var(--bad-soft); }
.status-banner.warn { background: var(--warn-soft); }
.status-banner .big-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 5px rgba(59,178,115,.18); flex-shrink: 0; }
.status-banner.bad .big-dot { background: var(--bad); box-shadow: 0 0 0 5px rgba(229,72,77,.18); animation: pulse 2s infinite; }
.status-banner.warn .big-dot { background: var(--warn); box-shadow: 0 0 0 5px rgba(227,160,8,.18); }
.status-banner strong { font-size: 16px; font-weight: 600; }
.status-banner span { color: var(--muted); }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(229,72,77,0); } }
@media (prefers-reduced-motion: reduce) { .status-banner.bad .big-dot { animation: none; } }

/* ---------- Compteurs ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 32px; }
.stat { padding: 12px 16px; border-right: 1px solid var(--line); display: block; color: var(--ink); }
.stat:last-child { border-right: 0; }
.stat:hover { background: var(--side); color: var(--ink); }
.stat .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.stat .l { color: var(--muted); font-size: 12.5px; }
.stat .v .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.stat.bad .v .dot { background: var(--bad); }
.stat.warn .v .dot { background: var(--warn); }
.stat.ok .v .dot { background: var(--ok); }

/* ---------- Liste des équipements avec barre d'historique ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; }
.section-head .muted { font-size: 12.5px; }
.monitors { border-top: 1px solid var(--line); margin-bottom: 36px; }
.monitor { display: grid; grid-template-columns: 10px minmax(150px, 1.1fr) 90px minmax(220px, 2fr) 64px; gap: 14px;
  align-items: center; padding: 11px 6px; border-bottom: 1px solid var(--line); color: var(--ink); }
a.monitor:hover { background: var(--side); color: var(--ink); }
.monitor .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.monitor.alert .dot { background: var(--bad); }
.monitor.offline .dot, .monitor.nodata .dot { background: var(--idle); }
.monitor .name { font-weight: 500; }
.monitor .sub { color: var(--muted); font-size: 12.5px; }
.monitor .temp { font-size: 18px; font-weight: 600; text-align: right; }
.monitor.alert .temp { color: var(--bad); }
.monitor.offline .temp, .monitor.nodata .temp { color: var(--faint); }
.monitor .pct { text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.beats { display: flex; gap: 2px; height: 22px; align-items: stretch; }
.beats i { flex: 1; border-radius: 2px; background: var(--ok); min-width: 2px; }
.beats i.bad { background: var(--bad); }
.beats i.none { background: var(--idle); }
.beats-scale { display: flex; justify-content: space-between; color: var(--faint); font-size: 11.5px; margin-top: 4px; }

/* ---------- Colonnes de listes ---------- */
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li { padding: 10px 2px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between;
  gap: 12px; align-items: flex-start; }
.list li .t { font-weight: 500; }
.list li .s { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); padding: 12px 2px; }
.list li.empty { display: block; }
.box { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }

/* ---------- Pastilles ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 1px 8px;
  border-radius: 10px; background: var(--side); color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok, .pill.closed, .pill.resolved { background: var(--ok-soft); color: #23824f; }
.pill.bad, .pill.active, .pill.p-urgent { background: var(--bad-soft); color: #c4343a; }
.pill.warn, .pill.to_document, .pill.p-high, .pill.waiting { background: var(--warn-soft); color: #9a6b00; }
.pill.open, .pill.in_progress { background: var(--accent-soft); color: #1a6dc2; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }
tbody tr:hover, tr:hover td { background: #fbfbfa; }
td a { font-weight: 500; }

/* ---------- Filtres (onglets) ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.tabs a { padding: 4px 10px; border-radius: var(--r-sm); color: var(--muted); }
.tabs a:hover { background: var(--side); color: var(--ink); }
.tabs a.on { background: var(--hover); color: var(--ink); font-weight: 500; }
.tabs select, .tabs input[type=text] { width: auto; min-width: 180px; padding: 5px 8px; }

/* ---------- Boutons et formulaires ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: 1px solid var(--accent);
  padding: 6px 12px; border-radius: 6px; font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { background: #1b72c9; color: #fff; }
.btn.secondary { background: var(--canvas); color: var(--ink); border-color: var(--line); box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.btn.secondary:hover { background: var(--side); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.form-narrow { max-width: 620px; }
form .field { margin-bottom: 14px; }
form label { display: block; font-weight: 500; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=password], input[type=email], input[type=datetime-local],
input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; color: var(--ink);
  background: var(--canvas); box-shadow: inset 0 1px 1px rgba(0,0,0,.02); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=file] { font: inherit; color: var(--muted); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.field.check label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.field .help { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.errorlist { color: var(--bad); margin: 4px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- Messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 20px; }
.messages li { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; background: var(--ok-soft); color: #23824f; }
.messages li.error { background: var(--bad-soft); color: #c4343a; }
.messages li.warning { background: var(--warn-soft); color: #9a6b00; }

/* ---------- Graphique ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .band { fill: var(--ok-soft); }
.chart .grid line { stroke: var(--line); }
.chart .axis text { fill: var(--faint); font-size: 11px; font-family: inherit; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.chart .out { fill: var(--bad); }
.chart-note { color: var(--faint); font-size: 12px; margin: 6px 0 0; }
.figures { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 14px; }
.figures div { font-size: 12.5px; color: var(--muted); }
.figures strong { display: block; font-size: 18px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Propriétés (façon Notion) et historique ---------- */
.props { display: grid; grid-template-columns: 160px 1fr; gap: 0; margin: 0 0 8px; }
.props dt, .props dd { padding: 6px 0; margin: 0; }
.props dt { color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 18px 22px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .meta { color: var(--muted); font-size: 12.5px; }

/* ---------- Connexion ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--side); }
.login { width: 360px; background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 28px; }
.login .brand { padding: 0 0 18px; }

/* ---------- Mobile : la barre latérale devient une barre du haut ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px; gap: 2px; }
  .side-group, .side .sites { display: none; }
  .brand { padding: 4px 8px; width: 100%; }
  .side-foot { margin: 0; border: 0; width: 100%; display: flex; justify-content: space-between; }
  main { padding: 20px 16px 48px; }
  .cols, .cols-2 { grid-template-columns: 1fr; }
  .monitor { grid-template-columns: 10px 1fr 70px; }
  .monitor > :nth-child(4) { grid-column: 2 / 3; }
  .monitor > :nth-child(5) { grid-column: 3; }
  .props { grid-template-columns: 120px 1fr; }
}
/* fond de la barre latérale sur toute la hauteur de page */
.app { background: linear-gradient(to right, var(--side) 240px, var(--line) 240px, var(--line) 241px, var(--canvas) 241px); }
.side { border-right: 0; }
.side a.item.on .site-dot { background: var(--accent); }
@media (max-width: 860px) { .app { background: var(--canvas); } .side { border-bottom: 1px solid var(--line); } }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 8px; }
.side-foot .links { flex-wrap: wrap; gap: 4px 12px; }
