/* Agitys RMM — feuille de style de la console.
   Thème sombre par défaut ; thème clair avec <html data-theme="light"> (voir theme.js). */
:root {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #263449;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --nav-bg: #1e293b;
  --nav-text: #cbd5e1;
  --nav-hover: rgba(148, 163, 184, .12);
  --accent: #0891b2;
  --accent-mid: #06a5c9;
  --accent-ink: #ffffff;
  --accent-2: #06a5c9;
  --primary: #60a5fa;
  --primary-btn: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: rgba(59, 130, 246, .18);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fb923c;
  --warn-soft: rgba(251, 146, 60, .15);
  --crit: #f87171;
  --crit-soft: rgba(248, 113, 113, .15);
  --info: #60a5fa;
  --neutral-soft: #2b3950;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(2, 6, 23, .25);
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  /* Graphiques : couleurs de séries validées sur la surface sombre (ordre fixe). */
  --c1: #3b82f6;
  --c2: #d97706;
  --c3: #0d9488;
  --c4: #8b5cf6;
  --c5: #ea580c;
  --c-ok: #10b981;
  --c-neutral: #64748b;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #dbe2ea;
  --text: #0f172a;
  --muted: #5b6b80;
  --nav-bg: #ffffff;
  --nav-text: #334155;
  --nav-hover: rgba(15, 23, 42, .06);
  --primary: #2563eb;
  --primary-soft: #e0eaff;
  --ok: #047857;
  --ok-soft: #d9f5e8;
  --warn: #b4530a;
  --warn-soft: #fdecd6;
  --crit: #c81e1e;
  --crit-soft: #fde4e4;
  --info: #2563eb;
  --neutral-soft: #e8edf3;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 6px rgba(15, 23, 42, .04);
  --c-neutral: #94a3b8;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 650; }
p { margin: 0 0 10px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.icon { width: 18px; height: 18px; flex: none; }

/* --- Barre du haut --------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: var(--nav-bg); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); width: 214px; flex: none; }
.brand:hover { text-decoration: none; }
.brand svg { height: 25px; width: auto; }
.brand span { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--accent-2); margin-top: 4px; }
.brand small { font-size: 11px; color: var(--muted); margin-top: 4px; }
.topsearch { position: relative; flex: 0 1 420px; min-width: 0; }
.topsearch .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--accent-2); pointer-events: none; }
.topsearch input[type=search] { padding: 9px 12px 9px 38px; background: var(--bg); border-radius: 8px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-actions form { display: flex; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--bg); border: 1px solid var(--border); color: var(--nav-text); cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent-2); text-decoration: none; }
.icon-btn .count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.userchip { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; margin-left: 6px; }
.userchip:hover { text-decoration: none; color: var(--accent-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); font-size: 12.5px; font-weight: 700;
}
.menu-btn {
  display: none; width: 38px; height: 38px; border-radius: 8px; place-items: center; cursor: pointer; padding: 0;
  color: var(--text); background: var(--bg); border: 1px solid var(--border);
}

/* --- Structure ----------------------------------------------------------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100% - 60px); }
.sidebar {
  background: var(--nav-bg); color: var(--nav-text); border-right: 1px solid var(--border);
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
.nav { padding: 10px 0 16px; }
.nav-group { margin-top: 12px; }
.nav-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 2px 20px 5px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 7px 20px; color: var(--nav-text); font-size: 14px; }
.nav a .icon { color: var(--accent-2); }
.nav a:hover { background: var(--nav-hover); text-decoration: none; color: var(--text); }
.nav a.active { background: linear-gradient(90deg, var(--accent), var(--accent-mid)); color: var(--accent-ink); font-weight: 600; }
.nav a.active .icon { color: var(--accent-ink); }
.linklike { background: none; border: 0; padding: 0; color: var(--nav-text); cursor: pointer; font: inherit; }
.linklike:hover { color: var(--text); text-decoration: underline; }

.main { padding: 22px 28px 40px; min-width: 0; }
.main-inner { max-width: 1560px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head.ruled { padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.page-head .grow { flex: 1; min-width: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- Composants ---------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px;
}
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 12px 16px 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid { margin-bottom: 14px; }

/* Liste à gauche, formulaire d'ajout à droite : il reste visible quand la liste défile. */
.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.with-aside > .card { margin-bottom: 0; }
.with-aside > .aside { position: sticky; top: 74px; }
.with-aside > :only-child { grid-column: 1 / -1; }
.with-aside > .aside .row > * { min-width: 100%; }
.with-aside { margin-bottom: 14px; }
@media (max-width: 1100px) {
  .with-aside { grid-template-columns: minmax(0, 1fr); }
  .with-aside > .aside { position: static; order: -1; }
}

/* Tableau groupé : une ligne d'en-tête par entité (inventaire). */
table.grouped tr.group-row th {
  background: var(--neutral-soft); color: var(--text); text-transform: none; letter-spacing: 0; font-size: 13px; padding: 7px 14px;
}
table.grouped tr.group-row th a { color: var(--text); font-weight: 700; }
table.grouped tr.group-row:hover { background: none; }

/* Arborescence des sites : retrait par niveau, modification en panneau flottant. */
.site-name { display: inline-flex; align-items: baseline; gap: 6px; }
.site-branch { color: var(--muted); }
.site-actions { position: relative; }
.site-actions > * { vertical-align: middle; }
details.site-edit { display: inline-block; }
details.site-edit > summary { list-style: none; }
details.site-edit > summary::-webkit-details-marker { display: none; }
details.site-edit[open] > form {
  position: absolute; right: 0; top: calc(100% - 4px); z-index: 5; width: 340px; text-align: left; white-space: normal;
  box-shadow: 0 12px 32px rgba(2, 6, 23, .45);
}
.with-aside > div.aside > .card { margin-bottom: 14px; }
.with-aside > div.aside > .card:last-child { margin-bottom: 0; }

/* Carte de chiffre : grand nombre coloré, libellé en capitales. */
.stat { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 14px 12px 12px; }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--nav-text); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stat .meter { width: 100%; }
.stat.ok .value { color: var(--ok); }
.stat.warning .value { color: var(--warn); }
.stat.critical .value { color: var(--crit); }
a.card { color: inherit; display: block; }
a.card.stat { display: flex; }
a.card:hover { text-decoration: none; border-color: var(--accent-2); }

/* --- Tableau de bord ------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 14px 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit;
}
.stat-card:hover { text-decoration: none; border-color: var(--accent-2); }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 16px; font-weight: 600; color: var(--muted); }
.stat-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; line-height: 1.3; text-transform: uppercase; color: var(--nav-text); }
.stat-foot { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.stat-card.ok .stat-value { color: var(--ok); }
.stat-card.warning .stat-value { color: var(--warn); }
.stat-card.critical .stat-value { color: var(--crit); }
.stat-card.info .stat-value { color: var(--info); }

.charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.charts > .card { margin-bottom: 0; }
.chart-card h2 { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; font-size: 15px; }
.chart-card h2 .icon { color: var(--accent-2); }
.c1 { --c: var(--c1); } .c2 { --c: var(--c2); } .c3 { --c: var(--c3); } .c4 { --c: var(--c4); } .c5 { --c: var(--c5); }
.donut-slice.ok, .swatch.ok { --c: var(--c-ok); }
.donut-slice.neutral, .swatch.neutral { --c: var(--c-neutral); }
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 128px; height: 128px; flex: none; }
.donut circle { fill: none; stroke-width: 17; }
.donut-track { stroke: var(--neutral-soft); }
.donut-slice { stroke: var(--c); transform: rotate(-90deg); transform-origin: 60px 60px; transition: stroke-width .12s; }
.donut-slice:hover { stroke-width: 20; }
.donut-total { font-size: 22px; font-weight: 700; fill: var(--text); }
.donut-unit { font-size: 8px; fill: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; flex: 1; min-width: 140px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend strong { font-variant-numeric: tabular-nums; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); display: inline-block; flex: none; }
.row-legend { display: flex; gap: 18px; margin-bottom: 10px; min-width: 0; }
.row-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.bars { display: flex; gap: 10px; height: 118px; }
.bars-scale {
  display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 17px; margin-top: -7px;
  font-size: 11.5px; color: var(--muted); text-align: right; min-width: 18px; font-variant-numeric: tabular-nums;
}
.bars-plot {
  flex: 1; display: flex; gap: 4px; min-width: 0;
  background-image: linear-gradient(var(--border), var(--border)), linear-gradient(var(--border), var(--border)), linear-gradient(var(--border), var(--border));
  background-size: 100% 1px; background-repeat: no-repeat;
  background-position: 0 0, 0 calc((100% - 24px) / 2), 0 calc(100% - 24px);
}
.bar-group { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bar { width: min(16px, 38%); border-radius: 4px 4px 0 0; background: var(--c); }
.bar:hover { filter: brightness(1.2); }
.bar-x { height: 24px; line-height: 26px; text-align: center; font-size: 11.5px; color: var(--muted); }

.notice.banner { display: flex; align-items: center; gap: 10px; color: var(--crit); }
.notice.banner:hover { text-decoration: none; filter: brightness(.98); }
.notice.banner .icon { flex: none; }
.empty-state { text-align: center; padding: 36px 24px; }
.empty-state p { margin-bottom: 16px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0 8px; }
.section-head h2 { margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-auto-rows: min-content; column-gap: 12px; row-gap: 3px;
  align-items: center; align-content: start; padding: 12px 14px; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tile:hover { text-decoration: none; border-color: var(--accent-2); }
.tile-top { display: contents; }
.tile-icon {
  grid-column: 1; grid-row: 1 / span 2; align-self: start; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  background: var(--neutral-soft); color: var(--muted);
}
.tile.ok .tile-icon { background: var(--ok-soft); color: var(--ok); }
.tile.warning .tile-icon { background: var(--warn-soft); color: var(--warn); }
.tile.critical .tile-icon { background: var(--crit-soft); color: var(--crit); }
.tile-title { grid-column: 2; grid-row: 1; font-weight: 650; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-status {
  grid-column: 2; grid-row: 3; justify-self: start; margin-top: 4px;
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--muted);
}
.tile-status .dot { width: 6px; height: 6px; background: currentColor; }
.tile.ok .tile-status { background: var(--ok-soft); color: var(--ok); }
.tile.warning .tile-status { background: var(--warn-soft); color: var(--warn); }
.tile.critical .tile-status { background: var(--crit-soft); color: var(--crit); }
.tile-body { grid-column: 2; grid-row: 2; display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.tile-value { font-size: 20px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile.warning .tile-value { color: var(--warn); }
.tile.critical .tile-value { color: var(--crit); }
.tile-label { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.tile-detail { grid-column: 2; grid-row: 4; font-size: 12px; color: var(--muted); }

.list-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 8px; border-bottom: 1px solid var(--border); }
.list-head h2 { margin: 0; }
.list-head a { font-size: 13px; font-weight: 600; }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { display: flex; align-items: center; gap: 12px; padding: 7px 16px; border-bottom: 1px solid var(--border); }
ul.list li:last-child { border-bottom: 0; }
.list-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.list-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.list-title { color: var(--text); }
.list-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty .icon { color: var(--ok); vertical-align: -4px; margin-right: 6px; }

@media (max-width: 1320px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .charts { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: 1fr; }
  ul.list li { flex-wrap: wrap; }
}
.tile-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.wrap { word-break: break-word; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--neutral-soft); color: var(--muted); white-space: nowrap;
}
.badge.ok, .badge.done, .badge.online { background: var(--ok-soft); color: var(--ok); }
.badge.warning, .badge.running, .badge.sent, .badge.queued, .badge.acknowledged { background: var(--warn-soft); color: var(--warn); }
.badge.critical, .badge.failed, .badge.open { background: var(--crit-soft); color: var(--crit); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #a3adbd; display: inline-block; flex: none; }
.dot.on { background: var(--ok); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--neutral-soft); font-size: 12px; margin-right: 4px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary-btn); border-color: var(--primary-btn); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--crit); border-color: var(--crit); }
.btn.danger:hover { background: var(--crit-soft); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field .help { color: var(--muted); font-size: 12.5px; margin-top: 3px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
textarea { min-height: 90px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 280px; white-space: pre; tab-size: 2; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; }
.check input { width: auto; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 180px; }
.filters select { max-width: 320px; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-weight: 500; word-break: break-word; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--crit-soft); color: var(--crit); }
.notice { padding: 10px 14px; border-radius: 6px; background: var(--primary-soft); color: var(--text); margin-bottom: 14px; }
.notice.warning { background: var(--warn-soft); }
.notice.critical { background: var(--crit-soft); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 7px 11px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }

pre.output {
  background: #0b1220; color: #dbe3ef; border: 1px solid var(--border); padding: 12px 14px; border-radius: 6px; overflow: auto;
  max-height: 520px; margin: 0; white-space: pre-wrap; word-break: break-word;
}
.meter { height: 6px; border-radius: 3px; background: var(--neutral-soft); overflow: hidden; min-width: 60px; }
.meter > span { display: block; height: 100%; background: var(--primary); }
.meter.warn > span { background: var(--warn); }
.meter.crit > span { background: var(--crit); }
.chart { width: 100%; height: 60px; display: block; }
.chart polyline { fill: none; stroke: var(--primary); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart line { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
details > summary { cursor: pointer; font-weight: 600; }
.scroll { max-height: 440px; overflow: auto; }
.hidden { display: none !important; }

/* --- Connexion ----------------------------------------------------------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px 30px; }
.login-card .brand { width: auto; padding: 0 0 20px; justify-content: center; }
.login-card .btn { width: 100%; justify-content: center; padding: 10px; }

.login-card form + form, .login-card .login-methods form { margin-top: 12px; }
.login-lead { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.login-sep { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-methods { display: grid; gap: 10px; }
.login-methods details > summary { list-style: none; font-weight: 500; }
.login-methods details > summary::-webkit-details-marker { display: none; }
.login-alt { margin: 16px 0 0; text-align: center; font-size: 13px; }
.linklike { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; }
.linklike:hover { text-decoration: underline; }
dialog.pin-dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 22px 24px; width: min(360px, calc(100vw - 32px)); }
dialog.pin-dialog::backdrop { background: rgba(2, 6, 23, .6); }
dialog.pin-dialog h2 { margin: 0 0 6px; font-size: 16px; }
dialog.pin-dialog p { margin: 0 0 14px; color: var(--muted); }
dialog.pin-dialog .actions { margin-top: 14px; justify-content: flex-end; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: grid; }
  .brand { width: auto; }
  .brand small, .username { display: none; }
  .sidebar { position: fixed; left: 0; top: 60px; width: 260px; z-index: 15; transform: translateX(-100%); transition: transform .15s; }
  .sidebar.open { transform: none; box-shadow: 8px 0 24px rgba(2, 6, 23, .4); }
  .main { padding: 18px 16px 40px; }
}
@media (max-width: 640px) {
  .topsearch { display: none; }
  .topbar { gap: 10px; padding: 0 12px; }
}

/* --- Panneau de configuration --------------------------------------------- */
.settings-actions {
  position: sticky; bottom: 0; display: flex; gap: 8px; justify-content: flex-end; padding: 12px 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.feed { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.feed-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.feed-head input[type=text] { flex: 1; min-width: 180px; }
.feed .row > * { min-width: 140px; }
.feed-meta { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.key-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; }
.key-row input:first-child { max-width: 200px; }
.toggle-card { display: flex; gap: 12px; align-items: flex-start; }
.toggle-card input[type=checkbox] { margin-top: 4px; }

/* Badges des lignes de l'inventaire des logiciels */
.sw-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.sw-badges .badge .icon { width: 13px; height: 13px; }
.sw-badges form .btn.small { padding: 2px 8px; font-size: 12px; }

/* Services et observateur d'événements */
details.inline-details { display: inline-block; vertical-align: middle; }
details.inline-details > summary { list-style: none; }
details.inline-details > summary::-webkit-details-marker { display: none; }
table.events td details > summary { cursor: pointer; font-weight: 400; }
table.events pre.output { max-height: 320px; }

/* Ascenseurs discrets : fins, invisibles au repos dans le menu, visibles au survol. */
.sidebar { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sidebar:hover { scrollbar-color: var(--border) transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; }
.sidebar:hover::-webkit-scrollbar-thumb { background: var(--border); }
.sidebar::-webkit-scrollbar-button { display: none; height: 0; }

.scroll, pre.output, .main {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.scroll::-webkit-scrollbar, pre.output::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb, pre.output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.scroll::-webkit-scrollbar-track, pre.output::-webkit-scrollbar-track { background: transparent; }

/* --- Vue d'ensemble de la fiche appareil ---------------------------------- */
.ov-hero { display: flex; gap: 14px; align-items: center; padding: 12px 16px; }
.ov-hero-icon {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--neutral-soft); color: var(--muted);
}
.ov-hero-icon .icon { width: 28px; height: 28px; }
.ov-hero-icon.on { background: var(--primary-soft); color: var(--primary); }
.ov-hero-main { min-width: 0; flex: 1; }
.ov-hero-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ov-hero-title strong { font-size: 15px; }
.ov-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--text); font-size: 13px; }
.ov-facts > span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.ov-facts .icon { width: 16px; height: 16px; color: var(--muted); }

.ov-health { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.ov-health .card { margin-bottom: 0; }
.ov-metric { display: flex; flex-direction: column; gap: 4px; }
.ov-metric-head { display: flex; justify-content: space-between; font-weight: 600; color: var(--muted); font-size: 12.5px; }
.ov-metric-value { font-size: 26px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ov-metric-value small { font-size: 15px; color: var(--muted); font-weight: 500; }
.ov-metric-hint { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.ov-metric.warning .ov-metric-value { color: var(--warn); }
.ov-metric.critical .ov-metric-value { color: var(--crit); }
.ov-chart { width: 100%; height: 56px; display: block; margin-top: 2px; }
.ov-chart .grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 2 3; }
.ov-chart .threshold { stroke: var(--crit); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 5 4; opacity: .6; }
.ov-chart .line { fill: none; stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.ov-chart .area { fill: var(--primary); opacity: .12; stroke: none; }
.ov-metric.warning .ov-chart .line { stroke: var(--warn); }
.ov-metric.warning .ov-chart .area { fill: var(--warn); }
.ov-metric.critical .ov-chart .line { stroke: var(--crit); }
.ov-metric.critical .ov-chart .area { fill: var(--crit); }
.ov-metric-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.ov-metric-stats strong { color: var(--text); font-weight: 600; }
.ov-nodata { padding: 22px 0 6px; }

.ov-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ov-tiles .tile-value { word-break: break-all; }
@media (max-width: 1180px) { .ov-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .ov-tiles { grid-template-columns: 1fr; } }
.ov-kv { padding: 10px 16px; grid-template-columns: minmax(120px, max-content) 1fr; gap: 5px 18px; }
.ov-kv dd { font-size: 13.5px; }
.ov-foot { padding: 0 16px 10px; }

details.ov-manage > summary { list-style: none; display: flex; align-items: baseline; gap: 12px; cursor: pointer; }
details.ov-manage > summary::-webkit-details-marker { display: none; }
details.ov-manage > summary h2 { margin: 0; }
details.ov-manage > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.ov-manage[open] > summary::before { transform: rotate(90deg); }

@media (max-width: 1100px) { .ov-health { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) {
  .ov-health { grid-template-columns: 1fr; }
  .ov-hero { align-items: flex-start; }
}
