/* mcadmin: same tokens and feel as the BlokkerCore panel. Dark, dense, calm; red only for danger. */

@font-face {
  font-family: "Silkscreen";
  src: url("/fonts/silkscreen-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("/fonts/silkscreen-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0f15;
  --bg-raised: #10151d;
  --card: #151b25;
  --control: #1b2230;
  --control-2: #222a3a;
  --control-3: #2a3345;
  --line: #1f2733;
  --line-strong: #2c3545;
  --line-hover: #3b465a;
  --text: #e9eef5;
  --text-2: #a4afc0;
  --text-3: #7a8699;
  --accent: #3ecf8e; --accent-hover: #5fdca3; --on-accent: #06140d;
  --danger: #f26b6b; --danger-solid: #c6373e;
  --warn: #f2b84b;
  --info: #62aef5;
  --gold: #f6c453;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --danger-soft: color-mix(in srgb, var(--danger) 14%, transparent);
  --warn-soft: color-mix(in srgb, var(--warn) 14%, transparent);
  --info-soft: color-mix(in srgb, var(--info) 14%, transparent);
  --neutral-soft: color-mix(in srgb, var(--text-2) 12%, transparent);
  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --fs-xs: 11px; --fs-sm: 12px; --fs: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --pixel: "Silkscreen", var(--font);
  --shadow-pop: 0 8px 24px rgb(0 0 0 / .45), 0 0 0 1px var(--line-strong);
  --shadow-modal: 0 24px 64px rgb(0 0 0 / .6);
  --ctl-h: 32px;
  --sidebar-w: 220px;
  --dur: 120ms; --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: var(--fs)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font: 700 var(--fs-xl)/1.2 var(--pixel); letter-spacing: .02em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
code, pre, .mono { font-family: var(--mono); font-size: var(--fs-sm); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-raised);
  border-right: 1px solid var(--line);
  border-top: 2px solid var(--text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: var(--s4) var(--s3);
}
.brand { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s2) var(--s4); font: 700 var(--fs-lg) var(--pixel); color: var(--text); }
.brand img { width: 24px; height: 24px; image-rendering: pixelated; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: var(--s2);
  padding: 6px var(--s2); border-radius: var(--r-sm);
  color: var(--text-2); font-size: var(--fs-md);
}
.nav a:hover { background: var(--control); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--control-2); color: var(--text); }
.nav .group { margin-top: var(--s4); padding: 0 var(--s2) var(--s1); font: 400 var(--fs-xs) var(--pixel); color: var(--text-3); text-transform: uppercase; }
.nav .sub { padding-left: var(--s5); font-size: var(--fs); }
.sidebar .me { margin-top: auto; display: flex; align-items: center; gap: var(--s2); padding: var(--s2); border-top: 1px solid var(--line); }
.me img { width: 28px; height: 28px; border-radius: 50%; }
.me .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; padding: var(--s5) var(--s6); max-width: 1280px; }
.page-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
.page-head .grow { flex: 1; }
.page-head .sub { color: var(--text-2); }

.topbar { display: none; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; inset: 0; z-index: 30; height: auto; width: 100%; }
  .shell.menu-open .sidebar { display: flex; }
  .topbar {
    display: flex; align-items: center; gap: var(--s2);
    position: sticky; top: 0; z-index: 20;
    background: var(--bg-raised); border-bottom: 1px solid var(--line);
    padding: var(--s2) var(--s4);
  }
  .main { padding: var(--s4); }
}

/* ---------------------------------------------------------------- components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4); }
.card + .card { margin-top: var(--s4); }
.card-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); flex-wrap: wrap; }
.card-head .grow { flex: 1; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: var(--s3); }
.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctl-h); padding: 0 var(--s3);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--control); color: var(--text);
  font: 500 var(--fs) var(--font); cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--control-2); border-color: var(--line-hover); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--control); color: var(--text); }
.btn.sm { height: 26px; padding: 0 var(--s2); font-size: var(--fs-sm); }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; height: 40px; padding: 0 var(--s5); font-size: var(--fs-md); }

input, select, textarea {
  height: var(--ctl-h); padding: 0 var(--s2);
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font: var(--fs) var(--font); min-width: 0;
}
textarea { height: auto; padding: var(--s2); }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--info); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field label { color: var(--text-2); font-size: var(--fs-sm); }
.field .hint { color: var(--text-3); font-size: var(--fs-xs); }
.form { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.form .wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.check input { height: auto; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px;
  background: var(--neutral-soft); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; display: inline-block; }
.dot.active { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.activating, .dot.deactivating, .dot.reloading { background: var(--warn); }
.dot.failed { background: var(--danger); }
.dot.offline { background: var(--danger); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px var(--s2); border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--text-3); font-weight: 500; font-size: var(--fs-sm); }
tbody tr:hover { background: var(--bg-raised); }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-2); padding: var(--s2) var(--s3); cursor: pointer; font: 500 var(--fs-md) var(--font); white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); }
.stat { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2) var(--s3); }
.stat .k { color: var(--text-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.meter { height: 4px; background: var(--control-2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.meter > div { height: 100%; background: var(--accent); }
.meter > div.warn { background: var(--warn); }
.meter > div.bad { background: var(--danger); }

/* node + instance cards on the dashboard */
.node { margin-bottom: var(--s5); }
.node-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.node-head h2 { font: 700 var(--fs-lg) var(--pixel); }
.node-meters { display: flex; gap: var(--s4); flex-wrap: wrap; color: var(--text-2); font-size: var(--fs-sm); }
.node-meters > div { min-width: 120px; }
.inst {
  cursor: pointer;
  display: block; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4);
  transition: border-color var(--dur) var(--ease);
}
.inst:hover { border-color: var(--line-hover); text-decoration: none; }
.inst .title { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.inst .title strong { font-size: var(--fs-md); }
.inst dl { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s3); margin: 0; font-size: var(--fs-sm); }
.inst dt { color: var(--text-3); }
.inst dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inst.new { display: flex; align-items: center; justify-content: center; border-style: dashed; color: var(--text-2); min-height: 120px; }

/* console */
.console {
  background: #06090d; border: 1px solid var(--line); border-radius: var(--r);
  height: 52vh; min-height: 260px; overflow-y: auto; padding: var(--s2) var(--s3);
  font: var(--fs-sm)/1.45 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.console .warn { color: var(--warn); }
.console .error { color: var(--danger); }
.console .cmd { color: var(--info); }
.console-input { display: flex; gap: var(--s2); margin-top: var(--s2); }
.console-input input { flex: 1; font-family: var(--mono); }

.players { display: flex; flex-wrap: wrap; gap: var(--s2); }
.player { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px var(--s2) 2px 2px; }
.player img { width: 20px; height: 20px; image-rendering: pixelated; border-radius: 3px; }

/* drawer for job output */
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 40;
  width: min(640px, 100%);
  background: var(--bg-raised); border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column;
}
.drawer header { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.drawer header h3 { flex: 1; }
.drawer pre { flex: 1; margin: 0; padding: var(--s3) var(--s4); overflow: auto; white-space: pre-wrap; word-break: break-word; background: #06090d; }

/* modal */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .55); display: flex; align-items: center; justify-content: center; padding: var(--s4); }
.modal { background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-modal); width: min(480px, 100%); padding: var(--s5); }
.modal h3 { margin-bottom: var(--s3); font-size: var(--fs-lg); }
.modal .actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }
.modal p { color: var(--text-2); margin: 0 0 var(--s3); }

.copy { display: flex; gap: var(--s2); }
.copy code { flex: 1; background: #06090d; border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s2); overflow-x: auto; white-space: nowrap; }

.toasts { position: fixed; bottom: var(--s4); right: var(--s4); z-index: 60; display: flex; flex-direction: column; gap: var(--s2); max-width: calc(100% - 32px); }
.toast { background: var(--control-2); border: 1px solid var(--line-strong); border-left: 3px solid var(--accent); border-radius: var(--r); padding: var(--s2) var(--s3); box-shadow: var(--shadow-pop); max-width: 420px; }
.toast.error { border-left-color: var(--danger); }

.empty { text-align: center; color: var(--text-2); padding: var(--s6) var(--s4); }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: var(--r); padding: var(--s2) var(--s3); }
.notice.bad { background: var(--danger-soft); color: var(--danger); }
.notice.info { background: var(--info-soft); color: var(--info); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--s4); }
.login .card { width: min(380px, 100%); text-align: center; padding: var(--s6) var(--s5); }
.login h1 { font-size: 28px; margin-bottom: var(--s2); }
.login img { width: 48px; height: 48px; image-rendering: pixelated; margin-bottom: var(--s3); }
.login .notice { margin-bottom: var(--s4); text-align: left; }
