:root {
  --bg: #0a0c10;
  --surface: #11141a;
  --surface-2: #161a22;
  --surface-3: #1d222c;
  --border: #232935;
  --border-strong: #2e3542;
  --text: #e7eaf0;
  --muted: #8a93a6;
  --faint: #5d6576;
  --accent: #6d5dfc;
  --accent-hover: #7f71ff;
  --accent-soft: rgba(109, 93, 252, .14);
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --blue: #38bdf8;
  --radius: 10px;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
button { font: inherit; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; padding: 4px 8px 16px; }
.brand img { width: 28px; height: 28px; }
.brand-lg { justify-content: center; font-size: 18px; padding-bottom: 20px; }
.brand-lg img { width: 36px; height: 36px; }
.nav { display: grid; gap: 2px; }
.nav a, .nav-accounts a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; }
.nav a:hover, .nav-accounts a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active, .nav-accounts a.active { background: var(--accent-soft); color: var(--text); }
.nav a.active svg { color: var(--accent-hover); }
.nav-section { margin: 20px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; }
.nav-accounts { display: grid; gap: 1px; align-content: start; overflow-y: auto; flex: 1; min-height: 0; }
.nav-accounts a { padding: 6px 10px; font-size: 13px; }
.nav-accounts .nav-empty { color: var(--faint); font-size: 13px; padding: 6px 10px; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px 8px 0; margin-top: 8px; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: rgba(10, 12, 16, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; flex: 1; min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs .here { color: var(--text); font-weight: 500; }
.user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user img, .user .avatar-fallback { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); }
.user a { color: var(--muted); }
.user a:hover { color: var(--text); }
.menu-btn { display: none; }
.content { padding: 28px; max-width: 1400px; width: 100%; }

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 550; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: #15803d; border-color: #16a34a; color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: #b91c1c; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; height: 44px; font-size: 14px; }
.btn-discord:hover { background: #6a75f5; }
.btn-discord svg { fill: currentColor; stroke: none; width: 20px; height: 20px; }
.btn-block { width: 100%; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; }
.card-body { padding: 18px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.s-online .dot, .dot.s-online { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.s-connecting .dot, .s-reconnecting .dot { background: var(--yellow); box-shadow: 0 0 0 3px rgba(234, 179, 8, .18); animation: pulse 1.4s infinite; }
.s-authenticating .dot { background: var(--blue); box-shadow: 0 0 0 3px rgba(56, 189, 248, .2); animation: pulse 1.4s infinite; }
.s-offline .dot { background: var(--red); }
@keyframes pulse { 50% { opacity: .45; } }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 550;
  background: var(--surface-3); color: var(--muted); text-transform: capitalize;
}
.pill.s-online { background: rgba(34, 197, 94, .12); color: #4ade80; }
.pill.s-connecting, .pill.s-reconnecting { background: rgba(234, 179, 8, .12); color: #facc15; }
.pill.s-authenticating { background: rgba(56, 189, 248, .12); color: #7dd3fc; }
.pill.s-offline { background: rgba(239, 68, 68, .1); color: #f87171; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-size: 12px; font-family: var(--mono); }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 550; }
.field small { color: var(--faint); font-size: 12px; }
input[type=text], input[type=email], input:not([type]), input[type=search] {
  height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: inherit; outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin-bottom: 16px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.switch-row:first-child { border-top: 0; padding-top: 0; }
.switch-row b { display: block; font-weight: 550; }
.switch-row small { color: var(--muted); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); cursor: pointer; transition: .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { padding: 16px 18px; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 550; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 6px; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] { width: 280px; max-width: 100%; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; }
.seg button.active { background: var(--surface-3); color: var(--text); }

/* ---------- account list ---------- */
.acc-list { display: grid; gap: 10px; }
.acc-row {
  display: grid; grid-template-columns: minmax(220px, 1.6fr) 130px 120px 110px 100px auto; align-items: center; gap: 16px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .12s, background .12s;
}
.acc-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.acc-id { display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; }
.acc-id img { width: 40px; height: 40px; border-radius: 8px; background: var(--surface-3); image-rendering: pixelated; flex: none; }
.acc-id b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-id small { color: var(--faint); font-size: 12px; }
.acc-meta { display: grid; gap: 1px; font-size: 13px; }
.acc-meta small { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.acc-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* ---------- account detail ---------- */
.acc-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.acc-head img { width: 56px; height: 56px; border-radius: 10px; background: var(--surface-3); image-rendering: pixelated; }
.acc-head .title { flex: 1; min-width: 200px; }
.acc-head h1 { font-size: 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.acc-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.power { display: flex; gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-color: var(--accent); }

.console-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.console { display: flex; flex-direction: column; height: calc(100vh - 290px); min-height: 380px; overflow: hidden; }
.console-out {
  flex: 1; overflow-y: auto; padding: 14px 16px; background: #07080b; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.console-out .ln { display: flex; gap: 10px; }
.console-out .ts { color: #3f4654; flex: none; user-select: none; }
.console-out .ln.system .tx { color: #a5b4fc; }
.console-out .ln.error .tx { color: #fca5a5; }
.console-out .ln.command .tx { color: #fde68a; }
.console-out .ln.command .tx::before { content: "> "; color: #78716c; }
.console-in { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface); }
.console-in input { flex: 1; font-family: var(--mono); font-size: 13px; }
.console-tools { display: flex; gap: 6px; align-items: center; }
.chip { height: 26px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); font: 12px var(--mono); cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--accent); }
.side-stats { display: grid; gap: 10px; }
.mini { padding: 12px 14px; }
.mini .label { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.mini .value { font-size: 15px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.bar.food i { background: #f59e0b; }

.msa {
  display: flex; align-items: center; gap: 18px; padding: 16px 18px; margin-bottom: 16px; border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(56, 189, 248, .12), rgba(109, 93, 252, .1)); border: 1px solid rgba(56, 189, 248, .35); flex-wrap: wrap;
}
.msa .msg { flex: 1; min-width: 220px; }
.msa b { display: block; }
.msa small { color: var(--muted); }
.msa code { font: 700 22px var(--mono); letter-spacing: .12em; padding: 6px 14px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border-strong); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.danger { border-color: rgba(239, 68, 68, .35); }
.danger .card-head { border-color: rgba(239, 68, 68, .25); }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.danger-row:first-child { border-top: 0; padding-top: 0; }
.danger-row small { color: var(--muted); display: block; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.table td { vertical-align: middle; }
.user-cell { display: flex; align-items: center; gap: 10px; font-weight: 550; }
.user-cell img, .user-cell .avatar-fallback { width: 30px; height: 30px; border-radius: 50%; flex: none; }
.avatar-fallback { display: inline-grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 600; }

/* ---------- modal / toast ---------- */
.modal { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 460px; width: calc(100% - 32px); }
.modal::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
.modal-card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.modal .field input { width: 100%; }
.form-error, .login-error { color: #fca5a5; background: rgba(239, 68, 68, .1); border: 1px solid rgba(239, 68, 68, .3); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--surface-3); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; font-size: 13px; max-width: 360px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: toast-in .18s ease-out; }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(800px 400px at 50% 0%, rgba(109, 93, 252, .16), transparent), var(--bg); }
.login-card { width: min(400px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; text-align: center; }
.login-card h1 { font-size: 20px; }
.login-card > p.muted { margin: 8px 0 24px; }
.login-card .login-error { margin: 0 0 16px; text-align: left; }

/* ---------- minecraft colors ---------- */
.mc0 { color: #000 } .mc1 { color: #0000aa } .mc2 { color: #00aa00 } .mc3 { color: #00aaaa } .mc4 { color: #aa0000 } .mc5 { color: #aa00aa }
.mc6 { color: #ffaa00 } .mc7 { color: #aaaaaa } .mc8 { color: #555555 } .mc9 { color: #5555ff } .mca { color: #55ff55 } .mcb { color: #55ffff }
.mcc { color: #ff5555 } .mcd { color: #ff55ff } .mce { color: #ffff55 } .mcf { color: #ffffff }
.mcl { font-weight: 700 } .mco { font-style: italic } .mcn { text-decoration: underline } .mcm { text-decoration: line-through }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .acc-row { grid-template-columns: minmax(180px, 1fr) 120px 100px auto; }
  .acc-row .hide-md { display: none; }
  .console-layout { grid-template-columns: 1fr; }
  .side-stats { grid-template-columns: repeat(3, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; width: 260px; left: -270px; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  .menu-btn { display: inline-grid; }
  .content { padding: 18px; }
  .topbar { padding: 0 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .acc-row { grid-template-columns: 1fr auto; }
  .acc-row .acc-meta { display: none; }
  .side-stats { grid-template-columns: repeat(2, 1fr); }
  .user span { display: none; }
}
