:root {
  --bg: #080b12;
  --sidebar: #0d111c;
  --panel: #111827;
  --panel2: #151f31;
  --border: #253047;
  --text: #f8fafc;
  --muted: #94a3b8;
  --blue: #5865f2;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(88, 101, 242, 0.18), transparent 35%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

code,
pre {
  font-family: Consolas, monospace;
}

.center-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
}

.login-card {
  width: min(520px, 100%);
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 36px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.logo {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--blue), #9333ea);
  font-size: 34px;
  font-weight: 900;
}

.button,
button {
  border: 0;
  color: white;
  background: var(--blue);
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform .12s ease, opacity .12s ease;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  opacity: .92;
}

.button.discord {
  margin-top: 16px;
  background: #5865f2;
}

.badge {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 800;
  margin-bottom: 12px;
}

.badge.warning {
  background: rgba(245, 158, 11, .16);
  color: var(--yellow);
}

.badge.danger {
  background: rgba(239, 68, 68, .16);
  color: var(--red);
}

.hint {
  margin-top: 18px;
  background: #050814;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  color: var(--muted);
  text-align: left;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: rgba(13, 17, 28, .9);
  border-right: 1px solid var(--border);
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 34px;
}

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), #9333ea);
  font-weight: 900;
  font-size: 22px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 10px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
}

nav a:hover,
.nav-active {
  background: rgba(88, 101, 242, .15);
  color: white;
}

.user-box {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  background: #0a0f1d;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
}

.user-box span {
  color: var(--muted);
  font-size: 12px;
}

.user-box strong {
  display: block;
  margin-top: 4px;
}

.dashboard {
  padding: 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: rgba(17, 24, 39, .78);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.good {
  color: var(--green);
}

.bad {
  color: var(--red);
}

.panel {
  background: rgba(17, 24, 39, .72);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .22);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
}

.panel-head span {
  color: var(--muted);
}

.bot-grid {
  display: grid;
  gap: 16px;
}

.bot-card {
  background: linear-gradient(180deg, rgba(21, 31, 49, .96), rgba(13, 18, 30, .96));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
}

.bot-card-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.bot-card h3 {
  margin: 0;
  font-size: 21px;
}

.bot-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.status-online {
  background: rgba(34, 197, 94, .16);
  color: var(--green);
}

.status-stopped {
  background: rgba(239, 68, 68, .16);
  color: var(--red);
}

.status-error {
  background: rgba(239, 68, 68, .16);
  color: var(--red);
}

.status-warn {
  background: rgba(245, 158, 11, .16);
  color: var(--yellow);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.metrics div {
  background: #090e1a;
  border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 16px;
  padding: 12px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  display: block;
  margin-top: 5px;
}

.path {
  color: var(--muted);
  background: #070b14;
  border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 14px;
  padding: 10px;
  font-size: 13px;
  word-break: break-all;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.actions button {
  padding: 9px 12px;
}

button.danger {
  background: var(--red);
}

button.success {
  background: var(--green);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty.error {
  color: var(--red);
}

.log-drawer {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(900px, calc(100vw - 48px));
  height: 520px;
  min-width: 520px;
  min-height: 340px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  background: #050814;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65);
  display: none;
  overflow: hidden;
  z-index: 20;
  resize: both;
}

.log-drawer.open {
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.log-drawer.dragging {
  user-select: none;
  opacity: .96;
}

.log-header {
  padding: 14px 16px;
  background: #0c1221;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
}

.log-header span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.log-header strong {
  display: block;
}

.log-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.log-header-actions button {
  padding: 8px 10px;
  background: #1f2937;
  border: 1px solid var(--border);
}

.log-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: #080d18;
  border-bottom: 1px solid var(--border);
}

.log-toolbar input[type="search"] {
  flex: 1;
  background: #050814;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.log-toolbar label {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

#logOutput {
  margin: 0;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  color: #d1d5db;
  font-size: 12px;
  line-height: 1.45;
}

.log-line {
  margin: 0;
  padding: 2px 0;
  min-height: 17px;
}

.log-system {
  color: #93c5fd;
}

.log-error {
  color: #fca5a5;
}

.log-log {
  color: #d1d5db;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .user-box {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    margin-top: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .log-drawer {
    min-width: 0;
    width: calc(100vw - 18px) !important;
    height: 70vh !important;
    right: 9px !important;
    bottom: 9px !important;
    left: auto !important;
    top: auto !important;
  }

  .log-header {
    cursor: default;
    align-items: flex-start;
    flex-direction: column;
  }

  .log-header-actions {
    margin-top: 8px;
    width: 100%;
    justify-content: flex-start;
  }
}
