/* Sentinelle — design system « Business Clear » (tokens Plane) */
:root {
  --bg-page: #f4f6f8; --surface: #fff; --surface-tint: #f5f8fd; --bg-secondary: #f9fafb; --bg-hover: #f3f4f6;
  --text: #111827; --text-secondary: #6b7280; --text-muted: #9ca3af; --border: #e5e7eb;
  --accent: #2563eb; --accent-hover: #1d4ed8; --accent-bg: #eff6ff;
  --success: #047857; --success-bg: #ecfdf5; --warning: #b45309; --warning-bg: #fffbeb;
  --danger: #b91c1c; --danger-bg: #fef2f2; --neutral: #6b7280; --neutral-bg: #f3f4f6;
  --radius: 8px; --radius-sm: 6px; --shadow: 0 1px 2px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg-page); color: var(--text); font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 18px; font-weight: 600; margin: 0; } h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0; color: var(--text-secondary); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: var(--text-secondary); } .small { font-size: 12px; }

/* Topbar */
.topbar { height: 52px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 10; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.topbar .brand svg { width: 20px; height: 20px; color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .meta { color: var(--text-secondary); font-size: 12px; display: flex; gap: 16px; align-items: center; }
.topbar nav a { color: var(--text-secondary); padding: 6px 10px; border-radius: var(--radius-sm); }
.topbar nav a:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }
.topbar nav a.active { background: var(--accent-bg); color: var(--accent); }

main { max-width: 1400px; margin: 0 auto; padding: 24px; }
.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-hosts { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
section { margin-bottom: 32px; }
section > header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
section > header h2 { margin: 0; } section > header .count { color: var(--text-muted); font-size: 12px; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card.tint { background: var(--surface-tint); }
.kpi { display: flex; flex-direction: column; gap: 4px; min-height: 84px; }
.kpi .label { font-size: 12px; color: var(--text-secondary); }
.kpi .value { font-size: 26px; font-weight: 600; line-height: 1.1; }
.kpi .value.crit { color: var(--danger); } .kpi .value.warn { color: var(--warning); } .kpi .value.ok { color: var(--success); }
.kpi .sub { font-size: 12px; color: var(--text-muted); }

/* Badges & points */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge.crit { background: var(--danger-bg); color: var(--danger); } .badge.warn { background: var(--warning-bg); color: var(--warning); }
.badge.ok { background: var(--success-bg); color: var(--success); } .badge.neutral { background: var(--neutral-bg); color: var(--neutral); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.crit { background: var(--danger); } .dot.warn { background: #d97706; } .dot.ok { background: #059669; } .dot.neutral { background: var(--text-muted); }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-secondary); background: var(--bg-secondary); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; } tbody tr:hover td { background: var(--bg-secondary); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.clickable { cursor: pointer; }

/* Barres */
.bar { height: 6px; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar > i.warn { background: #d97706; } .bar > i.crit { background: var(--danger); }

/* Filtres */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); padding: 4px 10px; border-radius: 999px; font-size: 12px; cursor: pointer; user-select: none; }
.chip:hover { background: var(--bg-hover); } .chip.on { background: var(--accent-bg); border-color: #bfdbfe; color: var(--accent); }
.chip .n { color: var(--text-muted); margin-left: 4px; }
.active-filters { display: none; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--surface-tint); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; font-size: 12px; }
.active-filters.show { display: flex; }
.active-filters .chip { background: var(--surface); }
.active-filters .chip b { margin-right: 4px; font-weight: 500; color: var(--text); }
.active-filters .clear { margin-left: auto; color: var(--accent); cursor: pointer; }
input[type=search] { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 10px; font: inherit; font-size: 13px; background: var(--surface); min-width: 220px; }
input[type=search]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.counter { font-size: 12px; color: var(--text-muted); margin-left: auto; }

/* Boutons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 6px 12px; border-radius: var(--radius-sm); font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { background: var(--bg-hover); } .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: var(--accent-hover); }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .6; cursor: default; }

/* Bandeaux */
.banner { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; background: var(--surface); }
.banner.warn { background: var(--warning-bg); } .banner.crit { background: var(--danger-bg); }
.banner svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--text-secondary); }

/* Panneau de détail */
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: 0 0 0 100vw rgba(17,24,39,.25); transform: translateX(100%); transition: transform .15s ease; z-index: 20; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.drawer header h2 { margin: 0; flex: 1; }
.drawer .body { padding: 16px 20px; overflow: auto; flex: 1; }
.drawer pre { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-size: 12px; overflow: auto; }
.iconbtn { border: none; background: transparent; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); color: var(--text-secondary); display: inline-flex; }
.iconbtn:hover { background: var(--bg-hover); color: var(--text); } .iconbtn svg { width: 18px; height: 18px; }

/* Sparkline */
.spark { width: 120px; height: 28px; display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; } .spark .area { fill: var(--accent-bg); stroke: none; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; }
.login .card { width: 360px; }
.login label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.login input[type=password] { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; margin-bottom: 12px; }
.login input[type=password]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

/* Aide */
.help h2 { margin-top: 28px; } .help p, .help li { color: var(--text); } .help code { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.help table td:first-child { white-space: nowrap; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.empty { color: var(--text-muted); padding: 24px; text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.dl dt { font-size: 12px; color: var(--text-secondary); margin-top: 8px; } .dl dd { margin: 0; }
.host-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline; margin-top: 10px; }
.host-row:first-of-type { margin-top: 0; }
.host-row .v { font-variant-numeric: tabular-nums; font-weight: 500; }
@media (max-width: 720px) { main { padding: 12px; } .topbar { padding: 0 12px; } .topbar .meta { display: none; } }
