:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #1d2330; --muted: #667085; --line: #e3e6eb;
  --ok: #1f9d55; --ok-bg: #e6f6ec; --warn: #c27c0e; --warn-bg: #fdf3e1;
  --crit: #d03b3b; --crit-bg: #fbe9e9; --none: #d5d9e0; --missing: #8a94a6;
  --accent: #2f5bd3; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --panel: #1b1f27; --text: #e6e8ec; --muted: #9aa3b2; --line: #2b313c;
    --ok: #3ccf7e; --ok-bg: #173325; --warn: #f0b04a; --warn-bg: #3a2c12;
    --crit: #ff6b6b; --crit-bg: #3d1a1c; --none: #353b47; --missing: #6b7385;
    --accent: #7c9dff; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); }

header { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 12px 20px; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
header h1 { font-size: 17px; margin: 0; font-weight: 650; }
.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { border-radius: 999px; padding: 3px 10px; font-weight: 600; font-size: 13px; border: 0; }
.pill.crit { background: var(--crit-bg); color: var(--crit); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.active { outline: 2px solid currentColor; }
.spacer { flex: 1; }
.meta { color: var(--muted); font-size: 13px; }
.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input[type=search] { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  color: var(--text); min-width: 220px; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 6px; padding: 5px 10px; }
.btn:hover { border-color: var(--accent); }
.btn.small { padding: 2px 8px; font-size: 12px; }

main { padding: 16px 20px 40px; max-width: 1400px; margin: 0 auto; }
.banner { background: var(--crit-bg); color: var(--crit); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.empty { color: var(--muted); padding: 40px; text-align: center; }

.nas { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--none);
  border-radius: 8px; margin-bottom: 8px; box-shadow: var(--shadow); }
.nas.crit { border-left-color: var(--crit); }
.nas.warn { border-left-color: var(--warn); }
.nas.ok { border-left-color: var(--ok); }
.nas-head { display: grid; grid-template-columns: 18px minmax(200px, 1.4fr) minmax(150px, .8fr) auto minmax(220px, 1.3fr);
  gap: 14px; align-items: center; padding: 10px 14px; cursor: pointer; }
.nas-head:hover { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.name { font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--none); display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.crit { background: var(--crit); }
.reasons { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.reasons li.crit { color: var(--crit); } .reasons li.warn { color: var(--warn); }
.ack { font-size: 12px; background: var(--bg); border: 1px dashed var(--line); border-radius: 6px; padding: 3px 8px;
  display: inline-flex; gap: 6px; align-items: center; margin-top: 4px; }

.history { display: flex; gap: 2px; align-items: center; }
.history span { width: 7px; height: 18px; border-radius: 2px; background: var(--none); }
.history span.ok { background: var(--ok); } .history span.warn { background: var(--warn); }
.history span.crit { background: var(--crit); }
.history span.missing { background: repeating-linear-gradient(45deg, var(--missing) 0 2px, transparent 2px 4px); }
.history.small span { width: 5px; height: 12px; }

.nas-body { border-top: 1px solid var(--line); padding: 10px 14px 14px; display: none; }
.nas.open .nas-body { display: block; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.tag.offsite { color: var(--accent); border-color: var(--accent); }
.note { margin-top: 10px; font-size: 13px; padding: 8px 10px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); }
.note.crit { background: var(--crit-bg); color: var(--crit); }
.footer-links { margin-top: 10px; display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin: 0 0 12px; flex-wrap: wrap; align-items: center; }
.legend .history span { width: 10px; height: 10px; }

@media (max-width: 900px) {
  .nas-head { grid-template-columns: 18px 1fr; }
  .nas-head > :nth-child(n+3) { grid-column: 2; }
  .tbl-wrap { overflow-x: auto; }
  input[type=search] { min-width: 0; width: 100%; }
  header, main { padding-left: 16px; padding-right: 16px; }
}

/* Page de connexion */
.login { max-width: 340px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 28px; box-shadow: var(--shadow); }
.login h1 { font-size: 18px; margin: 0 0 18px; }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.login input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit; }
.login button { width: 100%; margin-top: 18px; padding: 9px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 600; }
.login .error { color: var(--crit); font-size: 13px; margin-top: 12px; min-height: 1em; }
