:root {
  --bg: #0f131a;
  --surface: #171d27;
  --surface-2: #1f2735;
  --border: #2c374b;
  --text: #e6edf3;
  --muted: #8b98ab;
  --primary: #4f8cff;
  --success: #2ea043;
  --warn: #d29922;
  --danger: #f85149;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error-text { color: var(--danger); font-size: 0.88rem; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo { font-size: 1.5rem; color: #f5b942; }
.badge-sub { display: block; font-size: 0.78rem; color: var(--muted); }

.power-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.pill {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.pill.online { background: rgba(46, 160, 67, 0.2); color: #56d364; }
.pill.offline { background: rgba(248, 81, 73, 0.2); color: #ff7b72; }

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #111; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { border-color: var(--danger); color: #ff7b72; }
.btn.ghost { background: transparent; }
.btn.small { padding: 0.3rem 0.65rem; font-size: 0.82rem; }

.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
}
.stat-card .label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.25rem; }
.stat-card strong { font-size: 1.15rem; }

.tabs { display: flex; gap: 0.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--primary); }

.panel { display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.panel.active { display: block; }

.quick-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.console-box {
  background: #090c10;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem;
  height: 360px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.cmd-bar, .inline-form { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
input, select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}
.cmd-bar input { flex: 1; }

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.subcard { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0.85rem; }
.subcard h3 { margin: 0 0 0.6rem; font-size: 0.95rem; }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.list li:last-child { border-bottom: none; }
.list li.empty { color: var(--muted); font-style: italic; }

.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.props-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.85rem; }
.prop-item label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.25rem; }
.prop-item input { width: 100%; }

.overlay {
  position: fixed; inset: 0;
  background: rgba(9, 12, 16, 0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  width: 100%;
  max-width: 380px;
}
.auth-card form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }

.toast {
  position: fixed; bottom: 1.25rem; right: 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--primary);
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 200;
}
