/* Identité reprise de la page Arketype « indisponible » :
   gris charbon neutres, argent, pilules à bordure translucide. */
:root {
  --bg: #1f1f1f;
  --panel: #262626;
  --panel-2: #303030;
  --line: rgb(200 200 200 / .14);
  --line-strong: rgb(200 200 200 / .3);
  --text: #ffffff;
  --muted: #a0a0a0;
  --ok: #3dbb8c;
  --warn: #e3a63b;
  --bad: #e35d5d;
  --off: #6a6a6a;
  --focus: #d8d8d8;
  --console: #161616;
  --ui: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1f1f1f 100%) fixed; color: var(--text); font: 15px/1.45 var(--ui); }
a { color: #e0e0e0; text-decoration-color: rgb(200 200 200 / .4); text-underline-offset: 3px; }
a:hover { color: #fff; text-decoration-color: #fff; }

/* Logo et titre argenté, comme sur la page Arketype */
.logo { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.silver {
  background: linear-gradient(135deg, #ffffff 0%, #cccccc 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Boutons ---------- */
.btn {
  border: 1px solid var(--line-strong); background: rgb(150 150 150 / .15); border-radius: 999px;
  padding: 7px 16px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn:hover:not(:disabled) { border-color: rgb(255 255 255 / .5); background: rgb(150 150 150 / .25); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #333333 0%, #555555 100%); border: 2px solid var(--line-strong); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #3d3d3d 0%, #626262 100%); border-color: rgb(255 255 255 / .5); }
.btn.danger { color: #ffb4b4; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }

/* ---------- Voyants ---------- */
.led { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--off); }
.led.ok { background: var(--ok); box-shadow: 0 0 0 3px rgb(61 187 140 / .18), 0 0 10px rgb(61 187 140 / .55); }
.led.warn { background: var(--warn); box-shadow: 0 0 0 3px rgb(227 166 59 / .18), 0 0 10px rgb(227 166 59 / .5); }
.led.bad { background: var(--bad); box-shadow: 0 0 0 3px rgb(227 93 93 / .2), 0 0 10px rgb(227 93 93 / .6); animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .led.bad { animation: none; } }

/* ---------- Connexion ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login {
  width: 100%; max-width: 360px; background: rgb(38 38 38 / .85); border: 1px solid var(--line);
  border-radius: 14px; padding: 32px 28px 26px;
}
.login .logo { width: 64px; height: 64px; border-radius: 13px; display: block; margin: 0 auto 16px; }
.login h1 { margin: 0 0 4px; font-size: 26px; text-align: center; }
.login p { margin: 0 0 24px; color: var(--muted); text-align: center; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.field input {
  background: var(--console); border: 1px solid var(--line); border-radius: 6px; color: var(--text);
  padding: 10px 12px; font: inherit;
}
.field input:focus { border-color: var(--focus); outline: none; }
.login .btn { width: 100%; padding: 10px; margin-top: 6px; }
.error { color: #ffb4b4; min-height: 20px; font-size: 14px; margin-top: 10px; }

/* ---------- Structure ---------- */
.app { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 10px 20px;
  border-bottom: 1px solid var(--line); background: rgb(26 26 26 / .7);
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand .host { font-weight: 400; color: var(--muted); font-size: 14px; }
.meters { display: flex; gap: 22px; margin-left: auto; }
.meter { display: grid; gap: 4px; min-width: 110px; font-size: 13px; }
.meter .row { display: flex; justify-content: space-between; color: var(--muted); }
.meter .row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--focus); width: 0; transition: width .6s; }
.bar i.hot { background: var(--warn); }

.layout { display: grid; grid-template-columns: minmax(330px, 420px) 1fr; min-height: 0; }

/* ---------- Liste des services (la « baie ») ---------- */
.rack { border-right: 1px solid var(--line); overflow-y: auto; padding: 8px 0 24px; }
.summary { padding: 10px 20px 4px; color: var(--muted); font-size: 13px; }
.summary b { color: var(--text); }
.group h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 20px 6px; }
.unit {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  width: 100%; text-align: left; background: none; border: 0; border-left: 3px solid transparent;
  padding: 9px 20px 9px 17px; cursor: pointer;
}
.unit + .unit { border-top: 1px solid rgb(200 200 200 / .07); }
.unit:hover { background: var(--panel); }
.unit[aria-current="true"] { background: var(--panel-2); border-left-color: var(--focus); }
.unit .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit .stat { text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.unit .stat .warn { color: var(--warn); }
.unit .stat .bad { color: var(--bad); }

/* ---------- Détail ---------- */
.detail { display: grid; grid-template-rows: auto 1fr; min-height: 0; min-width: 0; }
.head { padding: 18px 24px 16px; border-bottom: 1px solid var(--line); }
.head-top { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.head .state { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); }
.head .state strong { color: var(--text); font-weight: 600; }
.actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 14px 0 0; padding: 0; font-size: 14px; }
.facts div { display: flex; gap: 8px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.links { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.note { margin-top: 8px; color: var(--muted); font-size: 14px; }
.path { color: var(--muted); font-size: 13px; margin-top: 8px; word-break: break-all; }

/* ---------- Console ---------- */
.console { display: grid; grid-template-rows: auto 1fr; min-height: 0; background: var(--console); }
.console-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--muted); flex-wrap: wrap;
}
.console-bar .live { display: flex; align-items: center; gap: 7px; }
.console-bar input[type="search"] {
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px; color: var(--text);
  padding: 5px 9px; font: inherit; width: 200px;
}
.console-bar label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.console-bar .spacer { flex: 1; }
.log {
  overflow: auto; padding: 10px 0 16px; font: 13px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.log .l { padding: 0 16px; display: grid; grid-template-columns: 76px 1fr; gap: 12px; }
.log .l:hover { background: rgb(255 255 255 / .03); }
.log .t { color: #6a6a6a; user-select: none; }
.log .err { color: #ff9d9d; }
.log .sys { color: var(--focus); }
.log .empty { padding: 24px 16px; color: var(--muted); font-family: var(--ui); }
.placeholder { display: grid; place-items: center; color: var(--muted); padding: 40px; text-align: center; }

/* ---------- Dialogue ---------- */
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px; max-width: 420px; width: calc(100% - 32px);
}
dialog::backdrop { background: rgb(8 12 18 / .6); }
dialog h2 { margin: 0 0 8px; font-size: 18px; }
dialog p { margin: 0 0 18px; color: var(--muted); }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--ok); padding: 10px 16px; border-radius: 6px; max-width: 360px;
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.bad { border-left-color: var(--bad); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .app { height: auto; min-height: 100%; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .meters { margin-left: 0; width: 100%; gap: 14px; flex-wrap: wrap; }
  .meter { min-width: 0; flex: 1 1 40%; }
  .layout { grid-template-columns: 1fr; }
  .rack { border-right: 0; border-bottom: 1px solid var(--line); max-height: 45vh; }
  .console { min-height: 60vh; }
  .actions { margin-left: 0; width: 100%; }
}
