/* UHQ Host — socle commun. Thème sombre par défaut, thème clair via [data-theme="light"].
   Typographie : Archivo (largeur variable) — titres élargis et très gras = signature UHQ. */
:root, [data-theme="dark"] {
  --bg: #080c17;
  --bg-2: #0b1020;
  --surface: #0f1526;
  --surface-2: #141c31;
  --line: #1e2840;
  --line-strong: #2b3756;
  --text: #edf1fa;
  --text-2: #a6b1c8;
  --text-3: #6f7b96;
  --brand: #5470ff;          /* bleu UHQ */
  --brand-hover: #6d86ff;
  --brand-ink: #ffffff;      /* texte posé sur le bleu */
  --brand-soft: rgba(84, 112, 255, .14);
  --brand-line: rgba(84, 112, 255, .42);
  --brand-text: #8fa2ff;
  --ok: #22c57a;
  --ok-soft: rgba(34, 197, 122, .13);
  --ok-line: rgba(34, 197, 122, .38);
  --ok-text: #55e3a0;
  --warn: #f2a93b;
  --warn-soft: rgba(242, 169, 59, .12);
  --warn-line: rgba(242, 169, 59, .38);
  --warn-text: #f7c470;
  --danger: #f0525e;
  --danger-soft: rgba(240, 82, 94, .12);
  --danger-line: rgba(240, 82, 94, .4);
  --danger-text: #ff8f98;
  --term: #05080f;
  --term-2: #0a1020;
  --term-line: #182138;
  --term-text: #d5e0f5;
  --term-dim: #5d6a86;
  --grid: rgba(255, 255, 255, .045);
  --strip: #04060c;          /* barre utilitaire */
  --strip-text: #a6b1c8;
  --toast-bg: #edf1fa;
  --toast-text: #0b1020;
  --input-bg: #0b1122;
  --featured-bg: rgba(84, 112, 255, .07);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 48px -16px rgba(0, 0, 0, .7);
  --chart-grid: #1b2439;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f2f4f8;
  --bg-2: #eaedf3;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #dde2ea;
  --line-strong: #c6cdd8;
  --text: #0b1222;
  --text-2: #435069;
  --text-3: #76829a;
  --brand: #2b4bf2;
  --brand-hover: #1e3bd4;
  --brand-ink: #ffffff;
  --brand-soft: #e9edff;
  --brand-line: #c4cffd;
  --brand-text: #2b4bf2;
  --ok: #12a865;
  --ok-soft: #e2f7ec;
  --ok-line: #a9e7c9;
  --ok-text: #0b7a47;
  --warn: #c97a05;
  --warn-soft: #fff4dc;
  --warn-line: #f3d79e;
  --warn-text: #8a5300;
  --danger: #d92d3a;
  --danger-soft: #fdeaec;
  --danger-line: #f0b4bb;
  --danger-text: #9b1c27;
  --term: #0b1426;
  --term-2: #111d35;
  --term-line: #1e2c49;
  --term-text: #d5e0f5;
  --term-dim: #61708c;
  --grid: #e7ebf1;
  --strip: #0b1222;
  --strip-text: #c3cbdb;
  --toast-bg: #0b1222;
  --toast-text: #ffffff;
  --input-bg: #ffffff;
  --featured-bg: #f5f7ff;
  --shadow: 0 1px 2px rgba(11, 18, 34, .06), 0 1px 1px rgba(11, 18, 34, .04);
  --shadow-lg: 0 14px 34px -14px rgba(11, 18, 34, .28);
  --chart-grid: #e6eaf0;
  color-scheme: light;
}

:root {
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--sans);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }
h1, h2, h3 { font-family: var(--sans); font-weight: 800; font-stretch: 112%; line-height: 1.05; letter-spacing: -0.015em; margin: 0; }
p { margin: 0; }
code, kbd, pre, .mono { font-family: var(--mono); }
code { font-size: .86em; background: var(--surface-2); border: 1px solid var(--line); padding: .05em .35em; border-radius: var(--r-sm); color: var(--text); }
::selection { background: var(--brand); color: var(--brand-ink); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap-row { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Marque UHQ ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.wordmark { font: 900 21px/1 var(--sans); font-stretch: 125%; letter-spacing: -0.02em; }
.wordmark-sub { font: 500 11px/1 var(--mono); color: var(--text-3); padding: 3px 5px; border: 1px solid var(--line); border-radius: var(--r-sm); text-transform: lowercase; }

/* ---------- Boutons ---------- */
.btn {
  --bg: var(--surface); --fg: var(--text); --bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--bd); border-radius: var(--r);
  background: var(--bg); color: var(--fg);
  font: 600 14px/1 var(--sans); text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none; box-shadow: var(--shadow);
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover:not(:disabled) { --bg: var(--surface-2); --bd: var(--text-3); color: var(--fg); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 0 20px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn-primary { --bg: var(--brand); --fg: var(--brand-ink); --bd: var(--brand); }
.btn-primary:hover:not(:disabled) { --bg: var(--brand-hover); --bd: var(--brand-hover); --fg: var(--brand-ink); }
.btn-dark { --bg: var(--text); --fg: var(--bg); --bd: var(--text); }
.btn-dark:hover:not(:disabled) { --bg: var(--text-2); --bd: var(--text-2); --fg: var(--bg); }
.btn-discord { --bg: #5865f2; --fg: #fff; --bd: #5865f2; }
.btn-discord:hover:not(:disabled) { --bg: #4752e0; --bd: #4752e0; --fg: #fff; }
.btn-ghost { --bg: transparent; --bd: transparent; box-shadow: none; }
.btn-ghost:hover:not(:disabled) { --bg: var(--surface-2); --bd: var(--line); }
.btn-ok { --bg: var(--ok); --fg: #fff; --bd: var(--ok); }
.btn-ok:hover:not(:disabled) { filter: brightness(1.08); }
.btn-danger { --bg: var(--danger); --fg: #fff; --bd: var(--danger); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-danger-ghost { --fg: var(--danger-text); }
.btn-danger-ghost:hover:not(:disabled) { --bg: var(--danger-soft); --bd: var(--danger-line); --fg: var(--danger-text); }
.icon { width: 17px; height: 17px; flex-shrink: 0; }

/* Préférences : langue + thème */
.prefs { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.prefs button { display: inline-grid; place-items: center; min-width: 30px; height: 28px; padding: 0 7px; border: none; border-radius: var(--r-sm); background: none; color: var(--text-2); font: 700 12px/1 var(--sans); font-stretch: 112%; cursor: pointer; }
.prefs button:hover { background: var(--surface-2); color: var(--text); }
.prefs button .icon { width: 16px; height: 16px; }

/* ---------- Champs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field > small { color: var(--text-3); font-size: 12.5px; }
input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: 0 11px; min-height: 38px; outline: none; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
textarea { padding: 9px 11px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand); padding: 0; }
input[type="range"] { padding: 0; min-height: 0; accent-color: var(--brand); border: none; background: none; box-shadow: none; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-2); font-size: 14px; user-select: none; }
.input-copy { display: flex; gap: 6px; }
.input-copy input { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); }

/* ---------- Statuts ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--text-3); }
.s-running { --c: var(--ok); --ct: var(--ok-text); --cs: var(--ok-soft); --cl: var(--ok-line); }
.s-installing, .s-restarting { --c: var(--warn); --ct: var(--warn-text); --cs: var(--warn-soft); --cl: var(--warn-line); }
.s-crashed, .s-error { --c: var(--danger); --ct: var(--danger-text); --cs: var(--danger-soft); --cl: var(--danger-line); }
.s-stopped { --c: var(--text-3); --ct: var(--text-2); --cs: var(--surface-2); --cl: var(--line); }
.dot[class*="s-"] { background: var(--c); }
.dot.s-running { box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.s-installing, .dot.s-restarting { animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--ct, var(--text-2));
  background: var(--cs, var(--surface-2)); border: 1px solid var(--cl, var(--line));
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c, currentColor); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 7px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.tag-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.tag-ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-text); }
.tag-brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-text); }

/* ---------- Barres d'uptime (30 jours) ---------- */
.ubars { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; height: 28px; }
.ubars i { border-radius: 1px; background: var(--ok); }
.ubars i.mid { background: var(--warn); }
.ubars i.low { background: var(--danger); }
.ubars i.none { background: var(--line); }
.ubars-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ---------- Terminal ---------- */
.term {
  margin: 0; overflow: auto; padding: 14px 16px; border-radius: var(--r-lg);
  background: var(--term); color: var(--term-text); border: 1px solid var(--term-line);
  font: 12.6px/1.65 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.term .ts { color: var(--term-dim); user-select: none; }
.term .l-err { color: #ff9ca5; }
.term .l-sys { color: #8fa6ff; }
.term .l-inst { color: #7b89a6; }
.term .l-ok { color: #5fe0a2; }
.term .mask { color: #ffd27a; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100% - 32px); }
.toast {
  max-width: 420px; padding: 11px 14px; border-radius: var(--r);
  background: var(--toast-bg); color: var(--toast-text); border-left: 3px solid var(--ok);
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
  animation: toast-in .2s ease-out;
}
.toast.err { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Finitions (v5) ---------- */
:root, [data-theme="dark"] {
  --card-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 1px 2px rgba(0, 0, 0, .4);
  --glow: 0 10px 28px -12px rgba(84, 112, 255, .75);
  --scroll: #222c45;
}
[data-theme="light"] {
  --card-shadow: 0 1px 2px rgba(11, 18, 34, .06), 0 1px 1px rgba(11, 18, 34, .04);
  --glow: 0 8px 20px -10px rgba(43, 75, 242, .55);
  --scroll: #c6cdd8;
}
.btn { border-radius: 8px; letter-spacing: .005em; }
.btn-lg { border-radius: 10px; }
.btn-primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--glow); }
.btn-primary:hover:not(:disabled) { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 12px 30px -12px rgba(84, 112, 255, .9); }
.btn-discord { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 10px 26px -12px rgba(88, 101, 242, .8); }
input, select, textarea { border-radius: 8px; min-height: 40px; }
.tag, .pill { letter-spacing: .005em; }
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
