/* Panel Lanelle : sombre, dans le bleu nuit et les bleus du logo, avec des touches dorées. */
:root {
  --bg: #0a1120;
  --bg-2: #0e1729;
  --panel: #121d33;
  --panel-2: #172540;
  --line: #233456;
  --line-2: #2c4170;
  --text: #e7eef9;
  --muted: #8fa3c4;
  --faint: #5f7397;
  --blue: #3b82f6;
  --blue-2: #60a5fa;
  --cyan: #38bdf8;
  --sky: #7dd3fc;
  --gold: #e8c77a;
  --green: #34d399;
  --red: #f87171;
  --orange: #fbbf24;
  --violet: #a78bfa;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(59, 130, 246, .12), transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}
a { color: var(--blue-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.loading { padding: 40px; color: var(--muted); }
[hidden] { display: none !important; }

/* --- Connexion ----------------------------------------------------------------------------- */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}
.login-card {
  width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 36px 28px; text-align: center; box-shadow: var(--shadow);
}
.login-card img { width: 88px; height: 88px; border-radius: 20px; }
.login-card h1 { margin: 14px 0 6px; font-size: 24px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }
.discord {
  display: inline-flex; align-items: center; gap: 10px; background: #5865f2; color: #fff;
  border-radius: 10px; padding: 12px 22px; font-weight: 600;
}
.discord:hover { background: #4752c4; text-decoration: none; }
.login .alert { margin-top: 18px; text-align: left; }

/* --- Structure ----------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
/* Sans ça, un large tableau élargirait la page au lieu de défiler dans son cadre. */
.shell > div { min-width: 0; }
.side {
  background: var(--bg-2); border-right: 1px solid var(--line); padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.brand b { font-size: 17px; letter-spacing: .02em; }
.brand small { display: block; color: var(--gold); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(59, 130, 246, .22), rgba(59, 130, 246, .05)); color: var(--text); }
.nav a.active svg { color: var(--blue-2); }
.nav svg { width: 18px; height: 18px; flex: none; }
.who { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.who img, .who .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); flex: none; }
.who div { min-width: 0; flex: 1; }
.who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.who small { color: var(--faint); font-size: 12px; }
.main { padding: 26px 30px 60px; min-width: 0; }
.top { display: none; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { margin: 0; font-size: 24px; }
.head p { margin: 4px 0 0; color: var(--muted); }

/* --- Blocs --------------------------------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.stat .value small { font-size: 15px; color: var(--muted); font-weight: 500; }
.stat .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.bar { height: 6px; border-radius: 6px; background: var(--panel-2); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--blue)); border-radius: 6px; }
.bar.warn i { background: linear-gradient(90deg, var(--orange), #f97316); }
.bar.bad i { background: linear-gradient(90deg, #fb7185, var(--red)); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { color: var(--green); background: rgba(52, 211, 153, .12); }
.badge.bad { color: var(--red); background: rgba(248, 113, 113, .12); }
.badge.warn { color: var(--orange); background: rgba(251, 191, 36, .12); }
.badge.info { color: var(--blue-2); background: rgba(96, 165, 250, .12); }
.badge.gold { color: var(--gold); background: rgba(232, 199, 122, .12); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid rgba(35, 52, 86, .6); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(23, 37, 64, .5); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.nowrap td, table.nowrap th { white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text); padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn:hover { border-color: var(--blue); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #4f8ff7, var(--blue)); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .4); color: #fecaca; }
.btn.danger:hover { border-color: var(--red); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn svg { width: 17px; height: 17px; flex: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

input[type=text], input[type=search], select, textarea {
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 11px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, .2); }
label.check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); cursor: pointer; }
label.check input { margin-top: 4px; accent-color: var(--blue); }

.alert { border-radius: 10px; padding: 10px 14px; background: rgba(251, 191, 36, .1); border: 1px solid rgba(251, 191, 36, .35); color: #fde68a; font-size: 14px; }
.alert.error { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .4); color: #fecaca; }
.alert.info { background: rgba(96, 165, 250, .1); border-color: rgba(96, 165, 250, .35); color: #bfdbfe; }
.alert + .alert { margin-top: 8px; }

/* --- Serveurs ------------------------------------------------------------------------------ */
.server { display: flex; flex-direction: column; gap: 6px; }
.server .name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.server .meta { color: var(--muted); font-size: 13px; }
.server a.cover { color: inherit; }
.server a.cover:hover { text-decoration: none; }
.card.link:hover { border-color: var(--line-2); background: var(--panel-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 2px 9px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); }

/* --- Journaux et console ------------------------------------------------------------------- */
.terminal {
  background: #060b16; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; height: 52vh; min-height: 300px;
  overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.terminal .line.hidden { display: none; }
.terminal mark { background: rgba(232, 199, 122, .35); color: inherit; border-radius: 3px; }
.console { display: flex; gap: 8px; margin-top: 10px; }
.console input { flex: 1; font-family: var(--mono); }
.a30 { color: #6b7280; } .a31 { color: #f87171; } .a32 { color: #34d399; } .a33 { color: #fbbf24; }
.a34 { color: #60a5fa; } .a35 { color: #c084fc; } .a36 { color: #22d3ee; } .a37 { color: #e5e7eb; }
.a90 { color: #9ca3af; } .a91 { color: #fca5a5; } .a92 { color: #6ee7b7; } .a93 { color: #fde68a; }
.a94 { color: #93c5fd; } .a95 { color: #e9d5ff; } .a96 { color: #67e8f9; } .a97 { color: #fff; }
.ab { font-weight: 700; }

/* --- Graphiques ---------------------------------------------------------------------------- */
.chart { display: block; }
.chart text { fill: var(--faint); font-size: 11px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .area { opacity: .16; }
.chart .line { fill: none; stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; font-size: 13px; box-shadow: var(--shadow); z-index: 50; }
.ranges { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.ranges button { border: 0; background: transparent; color: var(--muted); padding: 5px 11px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 13px; }
.ranges button.active { background: var(--panel-2); color: var(--text); }

/* --- Fichiers ------------------------------------------------------------------------------ */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-family: var(--mono); font-size: 14px; }
.crumbs a { padding: 2px 6px; border-radius: 6px; }
.crumbs span { color: var(--faint); }
.file-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file-name svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.file-name .dir { color: var(--sky); }
.file-name a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.drop { border: 2px dashed var(--line-2); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--blue); background: rgba(59, 130, 246, .08); color: var(--text); }
.editor { width: 100%; min-height: 60vh; font-family: var(--mono); font-size: 13px; line-height: 1.5; tab-size: 2; white-space: pre; resize: vertical; }
.progress { height: 4px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--blue); width: 0; transition: width .2s; }

/* --- Fenêtres et messages ------------------------------------------------------------------ */
.modal-back { position: fixed; inset: 0; background: rgba(3, 7, 15, .72); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal.wide { max-width: 1100px; }
.modal h3 { margin: 0 0 10px; font-size: 19px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--blue); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); max-width: 420px; }
.toast.error { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
.empty { color: var(--faint); padding: 14px 0; text-align: center; }

/* --- Téléphone ----------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.open .side { transform: none; }
  .top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-2); position: sticky; top: 0; z-index: 20; }
  .top img { width: 28px; height: 28px; border-radius: 7px; }
  .top button { background: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; cursor: pointer; }
  .top button svg { width: 20px; height: 20px; display: block; }
  .main { padding: 18px 16px 50px; }
  .grid.k4, .grid.k3, .grid.k2 { grid-template-columns: 1fr; }
  .terminal { height: 46vh; }
}
