:root {
  --bg: #061624;
  --panel: #0b2134;
  --panel-2: #102b43;
  --border: #1f4563;
  --text: #edf6ff;
  --muted: #8eabc0;
  --green: #51d273;
  --red: #ef6b72;
  --gold: #f0be59;
  --cyan: #4fd7ff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 75% 0%, #153b58 0, var(--bg) 48%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
input { color: var(--text); }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: rgba(3, 18, 31, .95);
  border-right: 1px solid var(--border);
  padding: 22px 14px;
  display: flex; flex-direction: column;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 22px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #6b3bd6, #2f8cff);
  font-weight: 900; font-size: 21px;
  box-shadow: 0 0 30px rgba(90, 80, 230, .25);
}
.brand-title { font-weight: 800; font-size: 18px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
nav { display: grid; gap: 8px; }
.nav-item {
  text-align: left; border: 1px solid transparent; color: #b9cedd;
  background: transparent; padding: 12px 13px; border-radius: 9px; cursor: pointer;
}
.nav-item:hover, .nav-item.active { background: #102a40; border-color: #254b66; color: white; }
.account-box { margin-top: auto; padding: 14px 9px 8px; border-top: 1px solid rgba(49,83,109,.45); }
.account-user { font-weight: 800; margin-bottom: 6px; overflow-wrap: anywhere; }
.role-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 900; letter-spacing: .07em; }
.role-badge.admin { color: #8ee5ff; background: rgba(79,215,255,.12); border: 1px solid rgba(79,215,255,.35); }
.role-badge.viewer { color: #ffd47b; background: rgba(240,190,89,.12); border: 1px solid rgba(240,190,89,.35); }
.logout-btn { margin-top: 10px; padding: 0; border: 0; background: transparent; color: #86a8bf; cursor: pointer; }
.logout-btn:hover { color: white; }
.sidebar-foot { color: #5f7d92; font-size: 12px; padding: 12px 8px 0; }
.content { padding: 28px; max-width: 1500px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
h1 { margin: 0; font-size: 30px; }
h2 { margin: 0; font-size: 17px; }
p { color: var(--muted); margin: 7px 0 0; }
.card {
  background: linear-gradient(180deg, rgba(16, 43, 67, .94), rgba(9, 31, 49, .96));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 45px rgba(0,0,0,.18);
}
.status-pill { padding: 10px 18px; border-radius: 999px; font-weight: 800; letter-spacing: .04em; font-size: 13px; }
.status-pill.online { background: rgba(81,210,115,.14); color: #77ed96; border: 1px solid rgba(81,210,115,.45); }
.status-pill.offline { background: rgba(239,107,114,.14); color: #ff858b; border: 1px solid rgba(239,107,114,.45); }
.status-pill.starting, .status-pill.loading { background: rgba(240,190,89,.14); color: #ffd47b; border: 1px solid rgba(240,190,89,.4); }
.actions { padding: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.action {
  border: 1px solid #31536d; color: white; background: #17364e;
  padding: 10px 15px; border-radius: 8px; cursor: pointer; font-weight: 700;
}
.action:hover:not(:disabled) { filter: brightness(1.12); }
.action:disabled { opacity: .45; cursor: not-allowed; }
.action.green { background: #185936; border-color: #26744a; }
.action.red { background: #642d35; border-color: #80404a; }
.action.gold { background: #685121; border-color: #8c7132; }
.viewer-note { color: #b8cede; margin-right: auto; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric-card { padding: 18px; min-height: 160px; }
.metric-label { color: #a7bfd0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.gauge { width: 118px; height: 118px; border-radius: 50%; margin: 12px auto 0; display: grid; place-items: center; position: relative; background: conic-gradient(var(--cyan) 0deg, #173349 0deg); }
.gauge::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #0c263b; }
.gauge-text { position: relative; z-index: 1; font-size: 22px; font-weight: 850; }
.big-number { font-size: 30px; font-weight: 850; margin-top: 28px; }
.small-muted { color: var(--muted); font-size: 12px; margin-top: 8px; }
.details-card { padding: 8px 18px; margin-bottom: 18px; }
.detail-row { display: flex; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid rgba(66,105,132,.25); }
.detail-row:last-child { border-bottom: 0; }
.detail-row span { color: var(--muted); }
.quick-console { padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.ghost-btn { background: transparent; color: #83dfff; border: 0; cursor: pointer; font-weight: 700; }
pre {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 13px/1.52 "Cascadia Mono", "Consolas", monospace;
  color: #cce6f8; background: #020c13; border: 1px solid #18374c; border-radius: 10px;
}
#mini-console { height: 230px; overflow: auto; padding: 13px; }
.console-card { padding: 14px; }
#full-console { height: calc(100vh - 190px); min-height: 440px; overflow: auto; padding: 15px; }
.console-controls { display: flex; align-items: center; gap: 14px; color: var(--muted); }
.console-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.command-card { padding: 16px; margin-bottom: 16px; }
.command-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; }
.prompt-mark { font: 800 20px "Cascadia Mono", Consolas, monospace; color: #61dcff; }
#command-input {
  width: 100%; background: #020c13; border: 1px solid #27506c; border-radius: 8px;
  padding: 10px 12px; outline: none;
}
#command-input:focus { border-color: #4fd7ff; box-shadow: 0 0 0 3px rgba(79,215,255,.08); }
#command-output { min-height: 80px; max-height: 220px; overflow: auto; padding: 11px; margin-top: 11px; }
.toast {
  position: fixed; right: 20px; bottom: 20px; max-width: 430px;
  background: #102c42; border: 1px solid #315a76; border-radius: 10px;
  padding: 12px 15px; opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: .2s ease; box-shadow: 0 14px 40px rgba(0,0,0,.35);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #8f4850; color: #ffadb2; }
code { color: #8ee5ff; }
.login-body { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-wrap { width: min(440px, 100%); }
.login-card { padding: 24px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-brand h1 { font-size: 26px; }
.login-form { display: grid; gap: 15px; }
.login-form label { display: grid; gap: 7px; color: #bdd1df; font-size: 13px; font-weight: 700; }
.login-form input { background: #061725; border: 1px solid #2a506b; border-radius: 8px; padding: 11px 12px; outline: none; }
.login-form input:focus { border-color: #4fd7ff; box-shadow: 0 0 0 3px rgba(79,215,255,.08); }
.login-submit { margin-top: 4px; }
.login-error { margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; color: #ffadb2; background: rgba(239,107,114,.10); border: 1px solid rgba(239,107,114,.35); }
.login-note { color: #6f91a8; font-size: 12px; margin-top: 16px; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; flex-direction: row; align-items: center; gap: 12px; }
  .brand { padding: 0; }
  nav { display: flex; }
  .account-box { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: 8px; }
  .account-user, .logout-btn { display: none; }
  .sidebar-foot { display: none; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .content { padding: 16px; }
  .sidebar { overflow-x: auto; }
  .brand-sub { display: none; }
  .metrics-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .command-row { grid-template-columns: auto 1fr; }
  .command-row .action { grid-column: 2; }
}

body[data-role="viewer"] .admin-only { display: none !important; }
body[data-role="admin"] .viewer-only { display: none !important; }
