/* UHCore Network — panneau. Couleurs de marque injectées depuis le branding du lobby (--brand-*). */
:root {
  --brand-1: #ffaa00; --brand-2: #ff5555; --accent: #55ffff; --ok: #34c759; --bad: #ff453a; --warn: #ff9f0a;
  --brand-gradient: linear-gradient(120deg, var(--brand-1), var(--brand-2));
  --bg: #0a0a0d; --surface: rgba(28, 28, 34, .62); --surface-2: rgba(44, 44, 52, .6); --solid: #15151a;
  --line: rgba(255, 255, 255, .08); --line-strong: rgba(255, 255, 255, .14);
  --text: #f5f5f7; --muted: #98989f; --faint: #6e6e76;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 50px -20px rgba(0, 0, 0, .6);
  --radius: 22px; --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --sidebar: 248px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7; --surface: rgba(255, 255, 255, .72); --surface-2: rgba(255, 255, 255, .9); --solid: #ffffff;
    --line: rgba(0, 0, 0, .07); --line-strong: rgba(0, 0, 0, .12);
    --text: #1d1d1f; --muted: #6e6e73; --faint: #a1a1a6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 18px 40px -22px rgba(0, 0, 0, .25);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.47 var(--font); letter-spacing: -.01em; -webkit-font-smoothing: antialiased;
}
.mono, pre, code { font-family: var(--mono); letter-spacing: 0; }
.muted { color: var(--muted); }
::selection { background: color-mix(in srgb, var(--brand-1) 35%, transparent); }

/* Fond : deux halos aux couleurs du branding. */
.backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orb { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .22; }
.orb-a { background: var(--brand-1); top: -30vmax; right: -18vmax; }
.orb-b { background: var(--brand-2); bottom: -34vmax; left: -10vmax; opacity: .16; }
@media (prefers-color-scheme: light) { .orb { opacity: .16; } .orb-b { opacity: .1; } }

.glass {
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
}

/* ------------------------------------------------------------------ barre latérale */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 5; padding: 22px 14px 18px;
  display: flex; flex-direction: column; gap: 26px;
  background: color-mix(in srgb, var(--solid) 55%, transparent); border-right: 1px solid var(--line);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-gradient); position: relative; flex-shrink: 0;
  box-shadow: 0 8px 22px -8px var(--brand-1); }
.brand-mark::after { content: ""; position: absolute; inset: 9px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: rgba(255, 255, 255, .92); clip-path: polygon(50% 0, 100% 62%, 80% 100%, 20% 100%, 0 62%); }
.brand-text b { display: block; font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.brand-text span { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
nav { position: relative; display: flex; flex-direction: column; gap: 2px; flex: 1; }
nav a {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500; transition: color .2s;
}
nav a:hover { color: var(--text); }
nav a.active { color: var(--text); }
nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
nav a.active svg { stroke: var(--brand-1); }
.nav-pill { position: absolute; left: 0; right: 0; top: 0; height: 40px; border-radius: 10px; z-index: 0;
  background: color-mix(in srgb, var(--brand-1) 14%, transparent); border: 1px solid color-mix(in srgb, var(--brand-1) 22%, transparent); opacity: 0; }
.sidebar-foot { display: flex; flex-direction: column; gap: 12px; }
.phase { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 13px; padding: 0 10px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex-shrink: 0; position: relative; }
.dot.ok { background: var(--ok); }
.dot.ok::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); animation: pulse 2.4s ease-out infinite; }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
@keyframes pulse { from { transform: scale(.5); opacity: .8; } to { transform: scale(1.6); opacity: 0; } }

/* ------------------------------------------------------------------ contenu */
main { position: relative; z-index: 1; margin-left: var(--sidebar); padding: 46px clamp(20px, 4vw, 56px) 80px; max-width: calc(1240px + var(--sidebar)); }
.page { display: none; }
.page.active { display: block; }
.hero { margin-bottom: 30px; }
.hero.compact { margin-bottom: 24px; }
.eyebrow { margin: 0 0 4px; color: var(--brand-1); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.hero h1 { margin: 0; font-size: clamp(32px, 4.6vw, 52px); line-height: 1.05; font-weight: 700; letter-spacing: -.035em; }
.hero.compact h1 { font-size: clamp(28px, 3.4vw, 40px); }
.hero p.muted { margin: 10px 0 0; font-size: 16px; max-width: 640px; }
.gradient-text { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { display: flex; align-items: center; justify-content: space-between; margin: 40px 0 14px; font-size: 21px; font-weight: 650; letter-spacing: -.02em; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat b { font-size: 38px; font-weight: 650; letter-spacing: -.04em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat b.small, .stat b.mono { font-size: 19px; letter-spacing: -.01em; padding: 9px 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat small { color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy { cursor: pointer; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; will-change: transform; }
.card .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card .title { font-weight: 650; font-size: 17px; letter-spacing: -.02em; }
.card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.card dt { color: var(--muted); }
.card dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.card .actions button { flex: 1; }
.empty { grid-column: 1 / -1; color: var(--muted); padding: 34px; text-align: center; border-radius: var(--radius); border: 1px dashed var(--line-strong); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.badge.info { color: var(--brand-1); background: color-mix(in srgb, var(--brand-1) 14%, transparent); }

/* ------------------------------------------------------------------ contrôles */
button {
  font: inherit; font-weight: 550; font-size: 14px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; transition: transform .18s cubic-bezier(.3, .7, .4, 1.5), background .2s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
button:hover { background: color-mix(in srgb, var(--surface-2) 70%, var(--text) 8%); }
button:active { transform: scale(.96); }
button:disabled { opacity: .45; pointer-events: none; }
button.primary { background: var(--brand-gradient); border-color: transparent; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
  box-shadow: 0 8px 22px -10px var(--brand-1); }
button.primary:hover { filter: brightness(1.06); }
button.danger { color: var(--bad); }
button.ghost { background: transparent; }
button.block { width: 100%; }
button.small { padding: 6px 14px; font-size: 13px; }
button.link { background: none; border: 0; padding: 0; color: var(--brand-1); font-size: 15px; font-weight: 500; }
input {
  font: inherit; color: var(--text); background: color-mix(in srgb, var(--solid) 70%, transparent); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 10px 13px; width: 100%; transition: border-color .2s, box-shadow .2s; outline: none;
}
input:focus { border-color: var(--brand-1); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-1) 22%, transparent); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.field.grow { flex: 1; min-width: 200px; }
.hint { color: var(--faint); font-size: 12px; margin-top: 4px; }

/* Interrupteur façon iOS. */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: relative; width: 46px; height: 28px; border-radius: 99px; background: var(--line-strong); transition: background .25s; flex-shrink: 0; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .25); transition: transform .3s cubic-bezier(.3, .7, .4, 1.3); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-1) 25%, transparent); }

.panel { border-radius: var(--radius); padding: 18px 20px; }
.create { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 22px; }

/* Contrôle segmenté. */
.segmented { position: relative; display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  margin-bottom: 14px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button { position: relative; z-index: 1; background: none; border: 0; border-radius: 9px; padding: 6px 16px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.segmented button.active { color: var(--text); }
.segmented .thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; border-radius: 9px; background: var(--solid); box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }

.terminal { border-radius: var(--radius); overflow: hidden; }
.console { margin: 0; padding: 16px 18px; height: calc(100vh - 330px); min-height: 320px; overflow: auto; font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; background: color-mix(in srgb, #000 55%, transparent); color: #e6e6ea; }
@media (prefers-color-scheme: light) { .console { background: #1c1c1e; } }
.console .warn { color: #ffd60a; }
.console .err { color: #ff6961; }
.console .cmd { color: var(--brand-1); }
.console-input { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); }
.console-input input { border: 0; background: transparent; box-shadow: none; padding: 6px 2px; }
.prompt { color: var(--brand-1); font-family: var(--mono); font-size: 18px; }

.settings { display: flex; flex-direction: column; gap: 18px; }
.group { border-radius: var(--radius); padding: 20px; }
.group h3 { margin: 0 0 14px; font-size: 15px; font-weight: 650; }
.group .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 18px; }
.save-bar { position: sticky; bottom: 18px; display: flex; justify-content: flex-end; }
.save-bar button { padding: 12px 26px; }

.plugin-list { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.plugin-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.plugin-list li:last-child { border: 0; }

#toast { position: fixed; z-index: 20; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { pointer-events: auto; padding: 11px 18px; border-radius: 16px; font-size: 14px; font-weight: 500; max-width: min(92vw, 420px);
  background: color-mix(in srgb, var(--solid) 82%, transparent); border: 1px solid var(--line); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); }
#toast div.bad { color: var(--bad); }

/* ------------------------------------------------------------------ connexion, comptes, grades */
[hidden] { display: none !important; }
select, textarea {
  font: inherit; color: var(--text); background: color-mix(in srgb, var(--solid) 70%, transparent); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 10px 13px; width: 100%; outline: none; transition: border-color .2s, box-shadow .2s;
}
select:focus, textarea:focus { border-color: var(--brand-1); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-1) 22%, transparent); }
textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; resize: vertical; min-height: 200px; letter-spacing: 0; }
.save-row { display: flex; justify-content: flex-end; margin-top: 12px; }
.small-text { font-size: 13px; font-weight: 400; }
.user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 0 10px; }
.user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: var(--bg); overflow: auto; }
.auth::before { content: ""; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(60vmax 60vmax at 90% -10%, color-mix(in srgb, var(--brand-1) 22%, transparent), transparent 60%),
              radial-gradient(60vmax 60vmax at -10% 110%, color-mix(in srgb, var(--brand-2) 16%, transparent), transparent 60%); }
.auth-card { position: relative; width: min(420px, 100%); border-radius: 28px; padding: 32px 28px 26px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .brand-mark { align-self: flex-start; }
.auth-card h1 { margin: 6px 0 0; font-size: 28px; letter-spacing: -.03em; }
.auth-card p { margin: 0; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.auth-msg { padding: 10px 14px; border-radius: 12px; font-size: 14px; color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.discord-btn { display: block; text-align: center; text-decoration: none; padding: 11px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  color: #fff; background: #5865f2; box-shadow: 0 8px 22px -10px #5865f2; transition: filter .2s, transform .18s; }
.discord-btn:hover { filter: brightness(1.08); }
.discord-btn:active { transform: scale(.97); }
.account-edit { display: flex; gap: 8px; align-items: center; }
.account-edit input { padding: 7px 11px; font-size: 13px; }
.account-edit button { flex-shrink: 0; }
.card .field-row { display: flex; flex-direction: column; gap: 8px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  :root { --radius: 18px; }
  main { margin-left: 0; padding: 26px 16px calc(96px + env(safe-area-inset-bottom)); }
  .sidebar {
    inset: auto 10px calc(10px + env(safe-area-inset-bottom)) 10px; width: auto; height: 66px; padding: 6px; border-radius: 22px;
    flex-direction: row; gap: 0; border: 1px solid var(--line); box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .5);
  }
  .brand, .sidebar-foot { display: none; }
  nav { flex-direction: row; gap: 0; justify-content: space-around; }
  nav a { flex: 1; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 10.5px; justify-content: center; border-radius: 16px; }
  nav svg { width: 22px; height: 22px; }
  .nav-pill { height: auto; bottom: 0; border-radius: 16px; }
  .stats { gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 30px; }
  .cards { grid-template-columns: 1fr; }
  .create { flex-direction: column; align-items: stretch; }
  .console { height: calc(100vh - 360px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
