/* mcadmin
   Light but pretty: one strong element per view (the player figure with its block strip on
   every server tile), hairlines instead of chrome, colour only where it means something.
   Lapis = pressable, grass = running, redstone = failed, gold = waiting, stone = stopped. */

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

:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --inset: #eeeeeb;
  --line: #e5e6e2;
  --line-strong: #d2d4cf;
  --text: #1a1c1e;
  --text-2: #5b6168;
  --text-3: #868c93;

  --lapis: #2e52d4; --lapis-hover: #2443b3; --on-lapis: #ffffff;
  --grass: #2e8b4e;
  --redstone: #c9372c;
  --gold: #a9730a;
  --stone: #9aa0a6;

  --lapis-soft: #e8edfb;
  --grass-soft: #e2f3e7;
  --redstone-soft: #fbe5e3;
  --gold-soft: #faefd6;
  --stone-soft: #ececea;

  --console-bg: #15181b;
  --console-text: #d9dde2;

  --shadow-card: 0 1px 2px rgb(26 28 30 / .04), 0 1px 1px rgb(26 28 30 / .02);
  --shadow-float: 0 12px 32px rgb(26 28 30 / .12), 0 0 0 1px rgb(26 28 30 / .04);
  --shadow-deep: 0 32px 72px rgb(26 28 30 / .24);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --pixel: "Silkscreen", var(--font);

  --fs-xs: 0.75rem; --fs-sm: 0.8125rem; --fs: 0.875rem; --fs-md: 0.9375rem; --fs-lg: 1.0625rem;
  --fs-xl: 1.25rem; --fs-2xl: 1.75rem; --fs-hero: 2.125rem;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --ctl: 36px;
  --sidebar: 236px;
  --dur: 140ms; --ease: cubic-bezier(.2, .8, .2, 1);
  --focus: 0 0 0 3px color-mix(in srgb, var(--lapis) 30%, transparent);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416;
    --surface: #1a1d20;
    --surface-2: #212529;
    --inset: #0e1012;
    --line: #272b2f;
    --line-strong: #353a40;
    --text: #e9ebee;
    --text-2: #a7adb5;
    --text-3: #7b828a;

    --lapis: #93a8ff; --lapis-hover: #aabbff; --on-lapis: #0b1330;
    --grass: #62cf84;
    --redstone: #f27a70;
    --gold: #e8b64a;
    --stone: #7f868e;

    --lapis-soft: #1f2a4d;
    --grass-soft: #173826;
    --redstone-soft: #442220;
    --gold-soft: #3e3116;
    --stone-soft: #262a2f;

    --console-bg: #0c0e10;
    --console-text: #d4d9de;

    --shadow-card: none;
    --shadow-float: 0 12px 32px rgb(0 0 0 / .5), 0 0 0 1px var(--line-strong);
    --shadow-deep: 0 32px 72px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121416;
  --surface: #1a1d20;
  --surface-2: #212529;
  --inset: #0e1012;
  --line: #272b2f;
  --line-strong: #353a40;
  --text: #e9ebee;
  --text-2: #a7adb5;
  --text-3: #7b828a;

  --lapis: #93a8ff; --lapis-hover: #aabbff; --on-lapis: #0b1330;
  --grass: #62cf84;
  --redstone: #f27a70;
  --gold: #e8b64a;
  --stone: #7f868e;

  --lapis-soft: #1f2a4d;
  --grass-soft: #173826;
  --redstone-soft: #442220;
  --gold-soft: #3e3116;
  --stone-soft: #262a2f;

  --console-bg: #0c0e10;
  --console-text: #d4d9de;

  --shadow-card: none;
  --shadow-float: 0 12px 32px rgb(0 0 0 / .5), 0 0 0 1px var(--line-strong);
  --shadow-deep: 0 32px 72px rgb(0 0 0 / .7);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font: var(--fs)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--lapis); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.012em; line-height: 1.2; }
h1 { font-size: var(--fs-2xl); letter-spacing: -0.022em; font-weight: 650; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p { margin: 0; }
code, pre, .mono { font-family: var(--mono); font-size: 0.8125em; }
code { background: var(--inset); padding: 1px 5px; border-radius: 4px; }
pre code { background: none; padding: 0; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: var(--s5); }
.card.stack > * + * { padding-top: var(--s5); border-top: 1px solid var(--line); }
.break { word-break: break-word; }
:focus-visible { outline: none; box-shadow: var(--focus); }
::selection { background: color-mix(in srgb, var(--lapis) 22%, transparent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: var(--s4) var(--s3);
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: var(--s1) var(--s2) var(--s5);
  color: var(--text); font: 700 .95rem/1 var(--pixel); letter-spacing: .03em;
}
.brand:hover { text-decoration: none; }
.brand img { width: 20px; height: 20px; image-rendering: pixelated; border-radius: 3px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  min-height: 34px; padding: 0 10px; border-radius: var(--r);
  color: var(--text-2); font-size: var(--fs-md); font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav a:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--lapis-soft); color: var(--lapis); }
.nav .ico { width: 18px; height: 18px; flex: none; display: inline-flex; opacity: .85; }
.nav .ico svg { width: 100%; height: 100%; display: block; }
.nav .section { margin: var(--s5) 10px var(--s1); font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }
.nav a.sub { font-weight: 450; font-size: var(--fs); min-height: 32px; }
.nav a.sub .mark { margin: 0 4px; }
.nav .sub-empty { padding: 4px 10px; font-size: var(--fs-sm); color: var(--text-3); }

.sidebar .foot { margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line); display: flex; align-items: center; gap: var(--s1); }
.sidebar .foot .me { display: flex; align-items: center; gap: var(--s2); flex: 1; min-width: 0; padding: 4px 6px; border-radius: var(--r); color: var(--text); }
.sidebar .foot .me:hover { background: color-mix(in srgb, var(--text) 5%, transparent); text-decoration: none; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--inset); flex: none; object-fit: cover; }
.me .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s3);
  min-height: 52px; padding: 0 var(--s6);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.topbar .crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-2); font-size: var(--fs); }
.topbar .crumbs a { color: var(--text-2); }
.topbar .crumbs .sep { color: var(--text-3); }
.topbar .crumbs .here { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .menu-btn { display: none; }
.content { padding: var(--s3) var(--s6) var(--s7); max-width: 1140px; width: 100%; }

.page-head { display: flex; align-items: flex-end; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s6); }
.page-head .lead { color: var(--text-2); margin-top: 6px; max-width: 58ch; }
.page-head .actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-left: auto; }

.bottom-nav { display: none; }
.scrim { display: none; }

@media (min-width: 901px) {
  /* The top bar only earns its place when there is a path to show */
  .topbar .crumbs:not(:has(.sep)) { visibility: hidden; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    display: none; position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(300px, 86vw);
    background: var(--surface); box-shadow: var(--shadow-deep);
  }
  .shell.menu-open .sidebar { display: flex; }
  .shell.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgb(0 0 0 / .35); }
  .topbar { padding: 0 var(--s3); border-bottom: 1px solid var(--line); }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: var(--s4) var(--s4) 96px; }
  .page-head { margin-bottom: var(--s5); }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: var(--r); color: var(--text-3); font-size: 11px; font-weight: 500; }
  .bottom-nav .ico { width: 20px; height: 20px; display: inline-flex; }
  .bottom-nav .ico svg { width: 100%; height: 100%; display: block; }
  .bottom-nav a.active { color: var(--lapis); }
  .bottom-nav a:hover { text-decoration: none; }
  h1 { font-size: var(--fs-xl); }
}

/* ------------------------------------------------------------------ marks: block + badge */
/* The square block is the state mark everywhere: running, stopped, failed, pending. */
.mark {
  display: inline-block; width: 9px; height: 9px; flex: none;
  background: var(--stone); border-radius: 2px;
}
.mark.active, .mark.online { background: var(--grass); box-shadow: 0 0 0 3px color-mix(in srgb, var(--grass) 20%, transparent); }
.mark.activating, .mark.deactivating, .mark.reloading { background: var(--gold); animation: blink 1.1s steps(2, start) infinite; }
.mark.failed, .mark.offline { background: var(--redstone); }
.mark.inactive { background: var(--stone); }
@keyframes blink { 50% { opacity: .35; } }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: var(--r-sm);
  background: var(--stone-soft); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; line-height: 1;
}
.badge.ok { background: var(--grass-soft); color: var(--grass); }
.badge.warn { background: var(--gold-soft); color: var(--gold); }
.badge.bad { background: var(--redstone-soft); color: var(--redstone); }
.badge.info { background: var(--lapis-soft); color: var(--lapis); }
a.badge:hover { text-decoration: none; filter: brightness(.96); }

/* ------------------------------------------------------------------ surfaces */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s5); box-shadow: var(--shadow-card);
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }
.card-head h3 { margin-right: var(--s1); }
.card-head .lead { flex-basis: 100%; color: var(--text-2); font-size: var(--fs-sm); max-width: 70ch; }
.card .foot { margin-top: var(--s4); display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.card.danger-zone { border-color: color-mix(in srgb, var(--redstone) 35%, var(--line)); }

.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }

.empty { text-align: center; color: var(--text-2); padding: var(--s7) var(--s4); }
.empty h3 { color: var(--text); margin-bottom: var(--s2); }
.empty .btn { margin-top: var(--s4); }

.notice { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--gold-soft); color: var(--gold); font-weight: 500; }
.notice.bad { background: var(--redstone-soft); color: var(--redstone); }
.notice.info { background: var(--lapis-soft); color: var(--lapis); }
.notice.ok { background: var(--grass-soft); color: var(--grass); }

/* skeleton */
.skel { position: relative; overflow: hidden; background: var(--inset); border-radius: 6px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-line { height: 14px; margin: 8px 0; }
.skel-line.w40 { width: 40%; } .skel-line.w60 { width: 60%; } .skel-line.w80 { width: 80%; }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--ctl); padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--text);
  font-size: var(--fs); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--lapis); border-color: var(--lapis); color: var(--on-lapis); }
.btn.primary:hover:not(:disabled) { background: var(--lapis-hover); border-color: var(--lapis-hover); }
.btn.danger { color: var(--redstone); border-color: color-mix(in srgb, var(--redstone) 35%, var(--line-strong)); }
.btn.danger:hover:not(:disabled) { background: var(--redstone-soft); border-color: var(--redstone); }
.btn.danger.solid { background: var(--redstone); border-color: var(--redstone); color: #fff; }
.btn.danger.solid:hover:not(:disabled) { filter: brightness(.92); background: var(--redstone); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); border-color: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); }
.btn.icon { width: var(--ctl); padding: 0; }
.btn.icon.sm { width: 28px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; height: 44px; padding: 0 var(--s5); font-size: var(--fs-md); }
.btn.discord:hover:not(:disabled) { background: #4752c4; border-color: #4752c4; }

input, select, textarea {
  height: var(--ctl); padding: 0 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r);
  font: inherit; min-width: 0; width: 100%;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { border-color: var(--lapis); box-shadow: var(--focus); outline: none; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--lapis); margin: 0; }
input[type="file"] { padding: 6px 10px; height: auto; }
textarea { height: auto; padding: var(--s2) 10px; }
select { padding-right: 28px; appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--text-3); }
.form { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.form .wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; }
.inline { display: flex; gap: var(--s2); align-items: center; }
.inline input { flex: 1; }

.seg { display: inline-flex; background: var(--inset); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button { height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 500; }
.seg button svg { width: 15px; height: 15px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card), 0 0 0 1px var(--line); }
.seg button:hover:not(.active) { color: var(--text); }

/* ------------------------------------------------------------------ HUD meter */
.hud { display: flex; flex-direction: column; gap: 5px; min-width: 160px; }
.hud .k { display: flex; justify-content: space-between; gap: var(--s2); font-size: var(--fs-xs); color: var(--text-3); }
.hud .k b { color: var(--text-2); font-weight: 500; }
.hud .bar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; height: 8px; }
.hud .bar i { display: block; background: color-mix(in srgb, var(--text) 9%, transparent); border-radius: 1.5px; }
.hud .bar i.on { background: var(--grass); }
.hud .bar.warn i.on { background: var(--gold); }
.hud .bar.bad i.on { background: var(--redstone); }

/* ------------------------------------------------------------------ dashboard */
.node { margin-bottom: var(--s7); }
.node-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.node-head h2 { font-size: var(--fs-lg); }
.node-head .host { color: var(--text-3); font-size: var(--fs-sm); }
.node-huds { display: flex; gap: var(--s5) var(--s6); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--s5); }
.node-huds .backup { display: flex; gap: var(--s1); align-items: center; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); padding-bottom: 1px; }

/* The server tile: the player figure is the one loud thing on the page */
.inst {
  position: relative; cursor: pointer;
  display: flex; flex-direction: column; gap: var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s4) var(--s4) var(--s3);
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.inst:hover { border-color: var(--line-strong); }
.inst:focus-visible { box-shadow: var(--focus); }
.inst .title { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.inst .title strong { font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inst .title .port { color: var(--text-3); font-size: var(--fs-sm); }
.inst .title .state { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.inst .hero { display: flex; align-items: flex-end; gap: var(--s3); }
.inst .hero .n { font-size: var(--fs-hero); font-weight: 650; letter-spacing: -0.03em; line-height: 1; }
.inst .hero .of { color: var(--text-3); font-size: var(--fs-sm); padding-bottom: 3px; }
.inst .hero .k { margin-left: auto; color: var(--text-3); font-size: var(--fs-xs); padding-bottom: 3px; }
.cap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; height: 6px; }
.cap i { display: block; border-radius: 1.5px; background: color-mix(in srgb, var(--text) 9%, transparent); }
.cap i.on { background: var(--grass); }
.inst.inactive .cap i.on, .inst.offline .cap i.on, .inst.failed .cap i.on { background: var(--stone); }
.inst .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px var(--s3); font-size: var(--fs-sm); }
.inst .facts > div { min-width: 0; }
.inst .facts .k { color: var(--text-3); font-size: var(--fs-xs); }
.inst .facts .v { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.inst .foot { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-top: -4px; }
.inst.new {
  flex-direction: row; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 56px; padding: var(--s3) var(--s4);
  border-style: dashed; border-color: var(--line-strong); box-shadow: none; background: transparent;
  color: var(--text-2); font-weight: 500;
}
.inst.new svg { width: 16px; height: 16px; }
.inst.new:hover { color: var(--lapis); border-color: var(--lapis); text-decoration: none; }

/* instance page */
.inst-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
.inst-head h1 { display: flex; align-items: center; gap: var(--s3); }
.inst-head .state { color: var(--text-2); }
.inst-head .actions { margin-left: auto; display: flex; gap: var(--s2); flex-wrap: wrap; }
.stats {
  display: flex; flex-wrap: wrap; gap: var(--s3) 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: var(--s3) 0; margin-bottom: var(--s6);
}
.stat { flex: 1 1 130px; min-width: 0; padding: 0 var(--s4); border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat .k { color: var(--text-3); font-size: var(--fs-xs); margin-bottom: 2px; }
.stat .v { font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.stat:first-child .v { font-size: var(--fs-xl); }
@media (max-width: 640px) {
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3) var(--s4); }
  .stat { padding: 0; border-left: 0; }
  .inst-head .actions { margin-left: 0; flex-basis: 100%; }
  .inst-head .actions .btn { height: 32px; padding: 0 12px; font-size: var(--fs-sm); }
}

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s5); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text-2); padding: 10px 12px; cursor: pointer; font-size: var(--fs-md); font-weight: 500; white-space: nowrap; transition: color var(--dur) var(--ease); }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--text); }

/* console */
.console {
  background: var(--console-bg); color: var(--console-text);
  border: 1px solid var(--line); border-radius: var(--r);
  height: 54vh; min-height: 280px; overflow-y: auto; padding: var(--s3) var(--s4);
  font: var(--fs-sm)/1.55 var(--mono); white-space: pre-wrap; word-break: break-word;
  overscroll-behavior: contain;
}
.console .warn { color: #e9b64a; }
.console .error { color: #f27a70; }
.console .cmd { color: #93a8ff; }
.console-input { display: flex; gap: var(--s2); margin-top: var(--s3); }
.console-input .wrap { flex: 1; position: relative; }
.console-input .wrap::before { content: "/"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-family: var(--mono); pointer-events: none; }
.console-input input { font-family: var(--mono); padding-left: 24px; }

.players { display: flex; flex-wrap: wrap; gap: var(--s2); }
.player { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 10px; font-weight: 500; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--text-3); font-weight: 500; font-size: var(--fs-xs); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; }
.card.flush thead th { background: var(--surface-2); }
@media (max-width: 640px) {
  table.stackable thead { display: none; }
  table.stackable tr { display: block; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
  table.stackable td { display: flex; gap: var(--s3); justify-content: space-between; border: 0; padding: 3px 0; text-align: left; }
  table.stackable td.num { text-align: right; }
  table.stackable td::before { content: attr(data-k); color: var(--text-3); font-size: var(--fs-xs); flex: none; }
  table.stackable td.nok::before { display: none; }
  tbody tr:hover td { background: none; }
}

/* copy block */
.copy { display: flex; gap: var(--s2); align-items: stretch; }
.copy code { flex: 1; background: var(--inset); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; overflow-x: auto; white-space: nowrap; font-size: var(--fs-sm); }

/* key-value list */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s4); font-size: var(--fs-sm); margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }

/* ------------------------------------------------------------------ drawer (job output) */
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 50;
  width: min(660px, 100%);
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-deep);
  display: flex; flex-direction: column;
  animation: slide-in var(--dur) var(--ease);
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.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; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer pre { flex: 1; margin: 0; padding: var(--s3) var(--s4); overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--console-bg); color: var(--console-text); font-size: var(--fs-sm); line-height: 1.55; }

/* ------------------------------------------------------------------ modal */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgb(10 14 18 / .45); display: flex; align-items: center; justify-content: center; padding: var(--s4); animation: fade var(--dur) var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-deep); width: min(480px, 100%); padding: var(--s5); animation: pop var(--dur) var(--ease); }
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: 0; } }
.modal h3 { margin-bottom: var(--s3); }
.modal p { color: var(--text-2); margin-bottom: var(--s3); }
.modal .actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }
.modal .field { margin-top: var(--s3); }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; bottom: var(--s4); right: var(--s4); z-index: 70; display: flex; flex-direction: column; gap: var(--s2); max-width: min(420px, calc(100% - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--shadow-float); animation: pop var(--dur) var(--ease); font-weight: 500; }
.toast::before { content: ""; width: 9px; height: 9px; margin-top: 6px; border-radius: 2px; background: var(--grass); flex: none; }
.toast.error::before { background: var(--redstone); }
.toast.info::before { background: var(--lapis); }
@media (max-width: 900px) { .toasts { bottom: 84px; right: var(--s3); left: var(--s3); max-width: none; } }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); background: var(--bg); }
.login .box { width: min(380px, 100%); }
.login .wordmark { display: flex; align-items: center; gap: 12px; font: 700 1.3rem/1 var(--pixel); letter-spacing: .03em; margin-bottom: var(--s5); justify-content: center; }
.login .wordmark img { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 4px; }
.login .card { padding: var(--s6); }
.login h1 { margin-bottom: var(--s2); }
.login .lead { color: var(--text-2); margin-bottom: var(--s5); }
.login .btn.discord { width: 100%; }
.login .notice { margin-bottom: var(--s4); }
.login .theme { margin-top: var(--s4); display: flex; justify-content: center; }

/* ------------------------------------------------------------------ profile */
.profile-head { display: flex; gap: var(--s4); align-items: center; margin-bottom: var(--s5); }
.profile-head .avatar { width: 56px; height: 56px; }
.profile-head .who h2 { margin-bottom: 2px; }
.mc-preview { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); }
.mc-preview .head { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 4px; background: var(--inset); flex: none; object-fit: cover; }
.mc-preview .head.fallback { display: grid; place-items: center; font: 700 .8rem var(--pixel); color: var(--text-3); }
.mc-preview .name { font-weight: 600; }
.mc-preview .uuid { color: var(--text-3); font-size: var(--fs-xs); }
