:root {
  --bg: #15110c;
  --bg-2: #1d1812;
  --card: #211b14;
  --card-hi: #2a2219;
  --line: #3a3024;
  --text: #efe4d0;
  --muted: #9c8c74;
  --amber: #f2a93b;
  --amber-soft: rgba(242, 169, 59, .14);
  --up: #8fce6b;
  --warn: #f07c2a;
  --down: #e5604a;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .8);
  --display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --letter-fg: 70% 74%;
  --letter-bg: 45% 45% / .2;
  color-scheme: dark;
}

/* Thème : suit le système, sauf choix explicite (data-theme posé par theme.js). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f4ecdd;
    --bg-2: #ebe1cd;
    --card: #fbf6ec;
    --card-hi: #fffaf1;
    --line: #dccfb6;
    --text: #2a2016;
    --muted: #85735a;
    --amber: #c9770e;
    --amber-soft: rgba(201, 119, 14, .12);
    --up: #4d9a2a;
    --warn: #d4621a;
    --down: #c8442f;
    --shadow: 0 18px 36px -24px rgba(90, 60, 20, .45);
    --letter-fg: 55% 36%;
    --letter-bg: 60% 55% / .16;
    color-scheme: light;
  }
}
:root[data-theme='light'] {
  --bg: #f4ecdd;
  --bg-2: #ebe1cd;
  --card: #fbf6ec;
  --card-hi: #fffaf1;
  --line: #dccfb6;
  --text: #2a2016;
  --muted: #85735a;
  --amber: #c9770e;
  --amber-soft: rgba(201, 119, 14, .12);
  --up: #4d9a2a;
  --warn: #d4621a;
  --down: #c8442f;
  --shadow: 0 18px 36px -24px rgba(90, 60, 20, .45);
  --letter-fg: 55% 36%;
  --letter-bg: 60% 55% / .16;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--amber-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--amber-soft), transparent 60%),
    linear-gradient(color-mix(in srgb, var(--line) 30%, transparent) 1px, transparent 1px) 0 0 / 100% 48px,
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--display);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- En-tête ---------- */
.top {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 32px 10px;
  display: grid;
  grid-template-columns: auto 1fr minmax(260px, 360px);
  gap: 32px;
  align-items: center;
}

.brand { display: flex; gap: 18px; align-items: center; }

.brand-mark {
  width: 54px; height: 54px;
  border-radius: 14px;
  background:
    linear-gradient(var(--amber), var(--amber)) 9px 9px / 16px 16px no-repeat,
    linear-gradient(var(--amber), var(--amber)) 29px 29px / 16px 16px no-repeat,
    linear-gradient(var(--line), var(--line)) 29px 9px / 16px 16px no-repeat,
    linear-gradient(var(--line), var(--line)) 9px 29px / 16px 16px no-repeat,
    var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: .9;
}
h1 span { color: var(--amber); }

.meta {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  text-transform: lowercase;
}
#clock { color: var(--text); }

.stats {
  display: flex;
  gap: 28px;
  justify-content: center;
  font-family: var(--mono);
}
.stats div { display: flex; flex-direction: column; }
.stats strong {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-alerts strong { color: var(--up); }
.stat-alerts[data-level='warn'] strong { color: var(--warn); }
.stat-alerts[data-level='crit'] strong { color: var(--down); }
.stat-online[data-level='warn'] strong { color: var(--warn); }
.stats span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-top: 6px; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}
.search input::-webkit-search-cancel-button { display: none; }
kbd {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
}

/* ---------- Santé ---------- */
.health {
  max-width: 1320px;
  margin: 6px auto 0;
  padding: 0 32px;
}
.health-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* Tuile compacte : libellé, puis valeur et micro-barre sur une ligne ; le détail est dans l'infobulle. */
.metric {
  --c: var(--up);
  position: relative;
  padding: 9px 14px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: 'k k' 'v bar';
  align-items: center;
  column-gap: 10px;
  row-gap: 4px;
  min-width: 0;
  /* Séparateurs à droite et en bas ; ceux du bord sont masqués par l'overflow du conteneur. */
  box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line);
}
.metric[hidden] { display: none; }
.metric .k { grid-area: k; }
.metric strong { grid-area: v; }
.metric .bar { grid-area: bar; }
.metric small { display: none; }
.metric::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--c);
  opacity: 0;
  transition: opacity .3s;
}
.metric[data-level='warn'] { --c: var(--warn); }
.metric[data-level='crit'] { --c: var(--down); }
.metric[data-level='warn']::before, .metric[data-level='crit']::before { opacity: 1; }
.metric .k {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
}
.metric strong {
  white-space: nowrap;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.metric[data-level='warn'] strong, .metric[data-level='crit'] strong { color: var(--c); }
.metric small {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar {
  height: 4px;
  border-radius: 99px;
  background: var(--bg-2);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--c);
  transition: width .8s cubic-bezier(.2, .7, .2, 1);
}

.issues {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.issues li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--c) 8%, var(--card));
  font-size: .9rem;
}
.issues li[data-level='warn'] { --c: var(--warn); }
.issues li[data-level='crit'] { --c: var(--down); }
.issues li .dot { align-self: center; }
.issues li b { font-weight: 600; }
.issues li span { color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.issues li em { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: .68rem; color: var(--muted); white-space: nowrap; }

.health-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--muted);
}
.health-foot button, .foot button {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 11px;
  cursor: pointer;
}
.health-foot button:hover { border-color: var(--amber); color: var(--amber); }
.health-foot button[aria-busy='true'] { opacity: .5; pointer-events: none; }

/* ---------- HetrixTools ---------- */
.uptime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 6px;
}

.monitor {
  --c: var(--up);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color .25s;
}
.monitor::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--c);
}
.monitor.warn { --c: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.monitor.crit { --c: var(--down); border-color: color-mix(in srgb, var(--down) 55%, var(--line)); }
.monitor.paused { --c: var(--muted); opacity: .7; }
a.monitor:hover { border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); }

.mon-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mon-top b { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mon-top strong {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mon-top small { font-size: .8em; color: var(--muted); }
.monitor.crit .mon-top strong { color: var(--down); }

.mon-sub { display: flex; gap: 8px; font-family: var(--mono); font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
.mon-sub em { font-style: normal; color: var(--down); overflow: hidden; text-overflow: ellipsis; }

/* ---------- Météo ---------- */
.wx { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.wx[hidden] { display: none; }
.wx-item { position: relative; }
.wx-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 6px;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
}
.wx-pill .wicon { width: 18px; height: 18px; }
.wx-pill b { color: var(--text); font-weight: 500; }
.wx-item:hover .wx-pill, .wx-pill:focus-visible { border-color: var(--amber); outline: none; }
.wx-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  width: max-content;
  max-width: calc(100vw - 32px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.wx-item:hover .wx-pop, .wx-item:focus-within .wx-pop { opacity: 1; visibility: visible; transform: none; }
.wx-pop .place { box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .75); background: var(--card); }

.place {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(260px 140px at 0% 0%, var(--amber-soft), transparent 70%),
    var(--card);
  box-shadow: var(--shadow);
}
.now { min-width: 0; }
.now header { display: flex; align-items: baseline; gap: 8px; }
.now h3 { margin: 0; font-size: .95rem; font-weight: 600; letter-spacing: -.01em; }
.now header span { font-family: var(--mono); font-size: .68rem; color: var(--muted); }

.temp { display: flex; align-items: center; gap: 8px; margin: 2px 0 0; }
.temp strong {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}
.temp sup { font-size: .5em; font-weight: 600; color: var(--amber); vertical-align: top; position: relative; top: .15em; }

.cond { margin: 0; font-size: .8rem; }
.wind {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arrow { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--amber); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.wicon { width: 20px; height: 20px; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wicon.big { width: 34px; height: 34px; stroke-width: 1.5; }
.w-sun { stroke: var(--amber); }
.w-moon { stroke: var(--muted); }
.w-cloud { stroke: var(--text); fill: var(--card); }
.w-rain { stroke: #5aa5e6; }
.w-snow { stroke: var(--text); stroke-width: 3; }
.w-bolt { stroke: var(--amber); }

.days {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 4px;
}
.days li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 44px;
  padding: 5px 3px;
  border-radius: 8px;
  background: var(--bg-2);
}
.days li:first-child { outline: 1px solid var(--line); }
.days .d { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.days .mm { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.days .mm b { color: var(--text); font-weight: 600; }
.days .rain { font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.days .rain.wet { color: #5aa5e6; }

/* ---------- Puces de catégories ---------- */
.chips {
  position: sticky;
  top: 0;
  z-index: 10;
  max-width: 1320px;
  margin: 0 auto;
  padding: 10px 32px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex: none;
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  transition: color .2s, border-color .2s;
}
.chips a:hover { color: var(--amber); border-color: var(--amber); }
.chips a b { color: var(--text); font-weight: 500; margin-left: 6px; }

/* ---------- Tableau ---------- */
.board {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 32px 40px;
}

.loading, .empty, .error {
  font-family: var(--mono);
  color: var(--muted);
  padding: 60px 0;
  text-align: center;
}
.error { color: var(--down); }

.category { margin-top: 22px; scroll-margin-top: 60px; }
.category:first-child { margin-top: 6px; }
.category[hidden] { display: none; }

.cat-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}
.cat-head .num { font-family: var(--mono); font-size: .8rem; color: var(--amber); }
.cat-head h2 { margin: 0; font-size: 1.2rem; font-weight: 600; letter-spacing: -.02em; }
.cat-head .count { margin-left: auto; font-family: var(--mono); font-size: .75rem; color: var(--muted); }

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

.card {
  --i: 0;
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .25s cubic-bezier(.2, .7, .2, 1), border-color .25s, background .25s;
}
.card::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
.card:hover, .card:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--amber) 55%, var(--line));
  background: var(--card-hi);
  outline: none;
}
.card:hover::after, .card:focus-visible::after { transform: scaleX(1); }
.card[hidden] { display: none; }

/* Apparition en cascade au premier affichage seulement (pas à chaque filtre ou épingle). */
.board.intro .card {
  opacity: 0;
  animation: rise .5s cubic-bezier(.2, .7, .2, 1) forwards;
  animation-delay: calc(min(var(--i), 20) * 25ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.icon {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.icon img { width: 22px; height: 22px; object-fit: contain; }
/* Lettre de secours : teinte discrète pour ne pas éclipser les vrais logos. */
.icon.letter {
  font-size: 1rem;
  font-weight: 800;
  color: hsl(var(--h) var(--letter-fg));
  background: hsl(var(--h) var(--letter-bg));
  border-color: hsl(var(--h) var(--letter-bg) / .9);
}

.body { min-width: 0; }
.name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: .92rem;
  letter-spacing: -.01em;
}
.name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lock { width: 13px; height: 13px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; }

.desc {
  margin: 0 0 2px;
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.desc:empty { display: none; }
.desc.reason { color: var(--c); }

.host {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
}
.dot.ok { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 22%, transparent); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); }
.dot.crit { background: var(--down); box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 28%, transparent); animation: blink 1.2s infinite; }
.card.crit { --c: var(--down); border-color: color-mix(in srgb, var(--down) 55%, var(--line)); }
.card.warn { --c: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.card.warn::before, .card.crit::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c); }
@keyframes blink { 50% { opacity: .3; } }

/* Épingle : visible au survol de la carte, toujours visible si active. */
.cell { position: relative; min-width: 0; }
.cell > .card { height: 100%; }
.pin {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.pin svg { width: 13px; height: 13px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linejoin: round; }
.cell:hover .pin, .pin:focus-visible, .pin.on { opacity: 1; }
.pin.on { border-color: transparent; background: none; }
.pin.on svg { fill: var(--amber); stroke: var(--amber); }
.pin:hover svg { stroke: var(--amber); }
@media (hover: none) { .pin { opacity: .55; } }

/* Catégories repliables */
.cat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.cat-toggle::after {
  content: '';
  width: 7px;
  height: 7px;
  border: solid var(--muted);
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .2s;
}
.collapsed .cat-toggle::after { transform: translateX(-2px) rotate(-45deg); }
.cat-toggle:hover, .cat-toggle:focus-visible { color: var(--amber); outline: none; }
.category.collapsed .grid { display: none; }
.category.collapsed .cat-head { margin-bottom: 0; }

/* Squelette pendant le premier chargement */
.skeleton { margin-top: 6px; }
.skeleton .card-sk {
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(90deg, var(--card) 30%, var(--card-hi) 50%, var(--card) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }

mark { background: var(--amber-soft); color: var(--amber); border-radius: 3px; }

/* ---------- Pied ---------- */
.foot {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
}
.foot button {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
.foot button:hover { border-color: var(--amber); color: var(--amber); }
.foot button[aria-busy='true'] { opacity: .5; pointer-events: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .top { grid-template-columns: 1fr auto; padding-top: 32px; }
  .health-grid { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .search { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .top { grid-template-columns: 1fr; gap: 20px; padding: 24px 16px 12px; }
  .stats { justify-content: flex-start; }
  .chips, .board, .health { padding-left: 16px; padding-right: 16px; }
  .health-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Popover pleine largeur, ancré sur la rangée de pastilles plutôt que sur la pastille. */
  .wx { position: relative; }
  .wx-item { position: static; }
  .wx-pop { right: 0; width: auto; }
  .place { grid-template-columns: 1fr; gap: 8px; }
  .days li { flex: 1; min-width: 0; }
  .metric { padding: 8px 10px; }
  .metric strong { font-size: 1.05rem; }
  .issues li { flex-wrap: wrap; }
  .issues li em { margin-left: 0; width: 100%; }
  .foot { padding: 20px 16px 32px; }
  .grid { grid-template-columns: 1fr; gap: 6px; }
  kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .board.intro .card { animation: none; opacity: 1; }
  .skeleton .card-sk { animation: none; }
  .card, .card::after { transition: none; }
}

/* ---------- Compte ---------- */
.account {
  font: inherit;
  color: var(--amber);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.account:hover { color: var(--text); }

.account-dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
}
.account-dialog::backdrop { background: rgba(10, 8, 5, .6); backdrop-filter: blur(3px); }
.account-dialog > header, .account-dialog > section, .account-dialog > footer { padding: 18px 22px; }
.account-dialog > header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px dashed var(--line); }
.account-dialog > section + section, .account-dialog > footer { border-top: 1px dashed var(--line); }
.account-dialog h2 { margin: 0; font-size: 1.25rem; }
.account-dialog h2 span { color: var(--muted); font-weight: 400; }
.account-dialog h3 { margin: 0 0 12px; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.account-dialog .close { font-size: 1.4rem; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; }
.account-dialog .close:hover { color: var(--text); }
.theme-switch { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.theme-switch button {
  flex: 1;
  padding: 7px 0;
  font: inherit;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}
.theme-switch button[aria-pressed='true'] { color: var(--text); background: var(--card); box-shadow: 0 1px 0 var(--line); }
.theme-switch button:hover { color: var(--amber); }
.badge { font-family: var(--mono); font-size: .68rem; font-weight: 400; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.badge.on { color: var(--up); border-color: color-mix(in srgb, var(--up) 50%, var(--line)); }
.qr { width: 180px; padding: 8px; margin: 4px 0 10px; background: #fff; border-radius: 10px; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { font-size: .78rem; color: var(--muted); margin: 0 0 12px; }
.secret code { font-family: var(--mono); color: var(--text); word-break: break-all; }
.msg { margin: 0 0 10px; font-size: .82rem; color: var(--down); }
.msg.ok { color: var(--up); }

/* ---------- Formulaires (connexion + compte) ---------- */
.login-card label, .account-dialog label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.login-card label > span, .account-dialog label > span {
  font-family: var(--mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
}
.login-card input:not([type='checkbox']), .account-dialog input {
  height: 44px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.login-card input:focus, .account-dialog input:focus { border-color: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
input.otp { font-family: var(--mono); font-size: 1.3rem; letter-spacing: .5em; text-align: center; }
.login-card button[type='submit'], .account-dialog button[type='submit'], .account-dialog #totp-start, .account-dialog .danger {
  height: 44px;
  padding: 0 18px;
  font: inherit;
  font-weight: 600;
  color: #1b150e;
  background: var(--amber);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: filter .2s, transform .1s;
}
.login-card button[type='submit']:hover, .account-dialog button:hover { filter: brightness(1.08); }
.login-card button:active { transform: translateY(1px); }
.login-card button:disabled { opacity: .6; cursor: wait; }
.account-dialog .danger { background: transparent; color: var(--down); border: 1px solid color-mix(in srgb, var(--down) 50%, var(--line)); }
.hint { margin: 0 0 14px; font-size: .85rem; color: var(--muted); line-height: 1.45; }

/* ---------- Page de connexion ---------- */
.login-page { display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(400px, 100%); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-brand h1 { font-size: 2.4rem; }
.login-card {
  padding: 26px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  animation: rise .5s cubic-bezier(.2, .7, .2, 1);
}
.login-card[hidden] { display: none; }
.login-card h2 { margin: 0 0 20px; font-size: 1.35rem; letter-spacing: -.02em; }
.login-card button[type='submit'] { width: 100%; margin-top: 4px; }
.login-card .check { flex-direction: row; align-items: center; gap: 10px; }
.login-card .check input { width: 16px; height: 16px; accent-color: var(--amber); }
.login-card .check span { text-transform: none; letter-spacing: 0; font-size: .82rem; }
.login-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: .85rem;
  color: var(--down);
  background: color-mix(in srgb, var(--down) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--down) 40%, var(--line));
  border-radius: 10px;
}
.login-card .link {
  display: block;
  margin: 12px auto 0;
  font: inherit;
  font-size: .82rem;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.login-card .link:hover { color: var(--amber); }
.login-card .link[hidden] { display: none; }
.sso-button {
  display: grid;
  place-items: center;
  height: 44px;
  font-weight: 600;
  color: #1b150e;
  background: var(--amber);
  border-radius: 10px;
  text-decoration: none;
  transition: filter .2s;
}
.sso-button:hover { filter: brightness(1.08); }
.sso-button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--amber-soft); }
.sso-note { margin: 0; }
.account-dialog > section[hidden] { display: none; }

/* ---------- Page des vérifications ---------- */
.health-foot a { color: var(--amber); text-decoration: none; }
.health-foot a:hover { text-decoration: underline; }
.back { color: var(--amber); text-decoration: none; }
.back:hover { text-decoration: underline; }
.stat-warn strong { color: var(--up); }
.stat-warn[data-level='warn'] strong { color: var(--warn); }
.checks { max-width: 1320px; margin: 0 auto; padding: 8px 32px 56px; }
.checks-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 22px;
}
.checks-intro p { margin: 0; max-width: 820px; color: var(--muted); line-height: 1.55; font-size: .92rem; }
.checks-intro strong, .checks-intro #remind { color: var(--text); font-weight: 600; }
.only-issues { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .75rem; color: var(--muted); cursor: pointer; }
.only-issues input { width: 16px; height: 16px; accent-color: var(--amber); }
.lvl {
  display: inline-block;
  font-family: var(--mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 55%, var(--line));
  color: var(--c, var(--muted));
  white-space: nowrap;
}
.lvl.ok { --c: var(--up); }
.lvl.warn { --c: var(--warn); }
.lvl.crit { --c: var(--down); }
.family {
  margin-bottom: 18px;
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.family > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.family h2 { margin: 0; font-size: 1.3rem; letter-spacing: -.02em; }
.family .count { font-family: var(--mono); font-size: .8rem; font-weight: 400; color: var(--muted); margin-left: 6px; }
.family-state { font-family: var(--mono); font-size: .72rem; color: var(--up); }
.family-state.warn { color: var(--warn); }
.family-state.crit { color: var(--down); }
.family-what { margin: 10px 0 12px; color: var(--muted); font-size: .9rem; line-height: 1.5; max-width: 900px; }
.rules { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
.rules li { display: flex; gap: 10px; align-items: baseline; font-size: .85rem; }
.rules .lvl { min-width: 104px; text-align: center; }
.check-list {
  list-style: none;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px dashed var(--line);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 6px 18px;
}
.check-list li { display: flex; align-items: baseline; gap: 10px; min-width: 0; padding: 5px 0; font-size: .86rem; }
.check-list li .dot { align-self: center; }
.check-list b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.check-list .detail { color: var(--muted); font-family: var(--mono); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.check-list li[data-level='warn'] .detail { color: var(--warn); }
.check-list li[data-level='crit'] .detail { color: var(--down); }
.check-list em { font-style: normal; font-family: var(--mono); font-size: .68rem; color: var(--warn); white-space: nowrap; }
.empty { color: var(--muted); font-family: var(--mono); font-size: .85rem; }
@media (max-width: 600px) {
  .checks { padding: 4px 16px 40px; }
  .family { padding: 18px 16px 14px; }
  .rules li { flex-direction: column; gap: 4px; }
  .check-list { grid-template-columns: 1fr; }
}
.metric[hidden] { display: none; }

/* ---------- Détail des bans CrowdSec ---------- */
.metric-more {
  position: absolute;
  inset: 0;
  padding: 0;
  font-size: 0; /* libellé pour les lecteurs d'écran ; la tuile entière est la cible */
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
.metric-more:hover, .metric-more:focus-visible { background: var(--amber-soft); outline: none; }
.metric-more[hidden] { display: none; }
.metric:has(.metric-more:not([hidden])) .k::after { content: ' →'; color: var(--amber); }
.uptime-dialog { width: min(980px, calc(100vw - 32px)); }
.bans-dialog { width: min(760px, calc(100vw - 32px)); }
.bans-dialog[open] { display: flex; flex-direction: column; }
.upd-reboot {
  margin: 14px 22px 0;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--down) 50%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--down) 10%, var(--card));
  color: var(--down);
  font-family: var(--mono);
  font-size: .78rem;
}
.upd-reboot[hidden] { display: none; }
.ban-origin b { color: var(--text); font-weight: 500; }
.upd-foot { margin: 0; padding: 12px 22px 16px; border-top: 1px dashed var(--line); font-family: var(--mono); font-size: .72rem; }
.bans-tools { padding-bottom: 6px !important; }
.bans-tools input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.bans-tools input:focus { border-color: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.bans-tools .hint { margin: 10px 0 0; font-size: .75rem; }
.bans { list-style: none; margin: 0; padding: 4px 22px 18px; overflow-y: auto; min-height: 0; }
.bans li { padding: 12px 0; border-top: 1px dashed var(--line); display: grid; gap: 7px; }
.bans li:first-child { border-top: 0; }
.bans li.empty { color: var(--muted); font-family: var(--mono); font-size: .8rem; }
.ban-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ban-ip { font-family: var(--mono); font-size: .92rem; font-weight: 500; color: var(--text); }
.ban-origin { font-size: .82rem; color: var(--muted); }
.ban-time { margin-left: auto; font-family: var(--mono); font-size: .68rem; color: var(--muted); white-space: nowrap; }
.ban-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ban-target { font-family: var(--mono); font-size: .7rem; color: var(--amber); }
.ban-events { font-family: var(--mono); font-size: .68rem; color: var(--muted); }
.ban-paths { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.ban-paths code {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .bans { padding: 4px 16px 16px; }
  .ban-time { margin-left: 0; width: 100%; }
}
