:root {
  color-scheme: dark;
  --bg: #0b0b0b;
  --bg-soft: #121212;
  --panel: #171717;
  --panel-2: #1d1d1d;
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f4;
  --muted: #b3b3b3;
  --accent: #e5a00d;
  --accent-strong: #f5b31f;
  --accent-soft: rgba(229, 160, 13, 0.16);
  --ok: #7af0b4;
  --warn: #f5b31f;
  --danger: #ff6978;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #0a0a0a 0%, #111111 100%);
  color: var(--text);
}

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: #0f0f0f;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand { display: flex; gap: 14px; align-items: center; }
.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #181818;
  border: 1px solid rgba(229, 160, 13, 0.18);
  box-shadow: 0 0 28px rgba(229, 160, 13, 0.18);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand h1 { margin: 0 0 4px; font-size: 1.35rem; font-weight: 800; }
.brand p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.menu { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #171717;
  color: #d7d7d7;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.menu-item.active {
  background: linear-gradient(180deg, rgba(229, 160, 13, 0.22), rgba(229, 160, 13, 0.12));
  border-color: rgba(229, 160, 13, 0.36);
  color: #fff7df;
}
.sidebar-footer { margin-top: auto; color: var(--muted); font-size: 0.92rem; }

.content { padding: 28px; background: #111111; }
.topbar { margin-bottom: 24px; }
.topbar-kicker { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.version-pill, .refresh-inline {
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(229, 160, 13, 0.12);
  color: #ffd36e;
  border: 1px solid rgba(229, 160, 13, 0.2);
  font-size: 0.9rem;
}
.topbar h2 { margin: 0 0 8px; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
.topbar p { margin: 0; color: var(--muted); }

.view { display: none; }
.view.active { display: block; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px;
}
.content-grid, .kanban-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px;
}
.server-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.card {
  background: linear-gradient(180deg, #181818 0%, #151515 100%);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
.stat-card, .panel-card, .server-card { padding: 22px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-header h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.stat-value { font-size: 2rem; font-weight: 800; color: #fff; }
p { color: var(--muted); line-height: 1.6; }
.server-capacity-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0;
}
.server-capacity-value { font-size: 1.5rem; font-weight: 800; }
.server-capacity-meta, .server-percent, .server-mix-grid span { color: var(--muted); }
.server-percent { font-size: 1.1rem; font-weight: 700; color: #ffe29a; }
.occupancy-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 16px;
}
.occupancy-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #a96a00, #f5b31f);
}
.server-mix-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.server-mix-grid div {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
  background: #1b1b1b;
}
.server-mix-grid strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
  color: #fff4cf;
}
.badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px;
  font-size: 0.8rem; font-weight: 700; background: rgba(255,255,255,0.08); color: var(--muted);
}
.badge.ok { background: rgba(122,240,180,0.12); color: var(--ok); }
.badge.warn { background: rgba(229,160,13,0.14); color: var(--warn); }
.badge.danger { background: rgba(255,105,120,0.14); color: var(--danger); }

.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; background: #161616; }
.table th, .table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.table th { color: #d0d0d0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; background: #1a1a1a; }
.table td { vertical-align: top; color: #efefef; }

@media (max-width: 1040px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    padding: 18px 0 12px;
    gap: 16px;
    overflow: hidden;
  }
  .brand {
    padding: 0 16px;
    margin-bottom: 2px;
  }
  .brand-mark {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    box-shadow: 0 0 32px rgba(246, 174, 45, 0.24);
  }
  .brand h1 {
    font-size: 1.9rem;
    line-height: 1.05;
  }
  .brand p {
    font-size: 0.98rem;
  }
  .menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    padding: 0 16px 4px;
  }
  .menu::-webkit-scrollbar { display: none; }
  .menu-item {
    width: 100%;
    min-width: 0;
    text-align: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    background: #171717;
    color: #d2d2d2;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: none;
  }
  .menu-item.active {
    background: linear-gradient(180deg, rgba(98, 67, 10, 0.92), rgba(66, 45, 8, 0.94));
    color: #fff7df;
    border-color: rgba(229, 160, 13, 0.34);
    box-shadow:
      inset 0 0 0 1px rgba(229, 160, 13, 0.14),
      0 0 10px rgba(229, 160, 13, 0.12);
  }
  .sidebar-footer {
    display: none;
  }
  .content {
    padding: 14px 16px 24px;
  }
  .topbar {
    margin-bottom: 14px;
  }
  .topbar-kicker {
    gap: 8px;
  }
  .version-pill, .refresh-inline {
    padding: 8px 12px;
    font-size: 0.82rem;
  }
  .content-grid, .kanban-grid, .server-cards-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .server-mix-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
