:root {
  --bg: #050505;
  --panel: #0a0a0a;
  --card: #111111;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f2f2f2;
  --muted: #8f8f8f;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --bad: #ff6b6b;
  --sans: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --sidebar: 72px;
  --space: 28px;
  --gap: 24px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(255, 255, 255, 0.05), transparent 55%),
    radial-gradient(700px 380px at 90% 0%, rgba(255, 255, 255, 0.03), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}

button, input, select { font: inherit; color: inherit; }

a { color: inherit; text-decoration: none; }

button {
  cursor: pointer;
  border: 0;
  background: none;
}

img { display: block; max-width: 100%; }

#app { min-height: 100vh; }

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 10px;
  background: rgba(0, 0, 0, 0.62);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.sidebar a,
.sidebar button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar a:hover,
.sidebar button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.sidebar a.is-active {
  color: #111;
  background: #fff;
}

.sidebar .grow { flex: 1; }

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: cover;
  margin-bottom: 8px;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #1a1a1a;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.content {
  padding: 36px 40px 56px;
  width: min(1240px, 100%);
  margin: 0 auto;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.section-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
  padding-bottom: 8px;
}

.page-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.045em;
}

.page-head p {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 52ch;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.live i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--ok);
  display: block;
  box-shadow: 0 0 0 4px rgba(62, 207, 142, 0.12);
}

.grid {
  display: grid;
  gap: var(--gap);
}

.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.15fr 0.85fr; }
.grid.cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%), var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
}

.card.hero,
.card.vps-card {
  min-height: 260px;
  padding: 28px;
}

.card.hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card.hero h3,
.card.vps-card h3 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.045em;
}

.card.status-ok { box-shadow: inset 0 0 0 1px rgba(62, 207, 142, 0.12); }
.card.status-warn { box-shadow: inset 0 0 0 1px rgba(240, 180, 41, 0.16); }
.card.status-bad { box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.18); }

.metric-card.ok strong { color: var(--ok); }
.metric-card.warn strong { color: var(--warn); }
.metric-card.bad strong { color: var(--bad); }

.metric {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.metric + strong,
.stat-row strong,
.resource strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.stat-row,
.vps-head,
.resource-head,
.list-row,
.path-row {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.stat-row {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 24px;
}

.stat-row > * { flex: 1 1 120px; }

.resource { margin-top: 20px; }
.resource strong { font-size: 18px; }

.tone.ok, .pill.ok { color: var(--ok); }
.tone.warn, .pill.warn { color: var(--warn); }
.tone.bad, .pill.bad { color: var(--bad); }

.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 10px;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #fff;
}

.bar.tone-ok > span { background: linear-gradient(90deg, #2fbf7b, #7dffc0); }
.bar.tone-warn > span { background: linear-gradient(90deg, #d9a21d, #ffd56a); }
.bar.tone-bad > span { background: linear-gradient(90deg, #e04444, #ff8d8d); }

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0;
  align-items: center;
}

.toolbar input,
.toolbar select,
.field input,
.auth input,
.field-block input,
.role-select {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0a0a0a;
  color: var(--text);
}

.toolbar input { min-width: min(280px, 100%); }

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filters button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.filters button.is-on {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.role-select,
select.role-select {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: #1a1a1a;
  color: #f4f4f4;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color-scheme: dark;
}

.role-select option {
  background: #1a1a1a;
  color: #f4f4f4;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.btn:hover { border-color: rgba(255, 255, 255, 0.28); }

.btn.solid {
  background: #fff;
  color: #111;
  border-color: #fff;
}

.btn.danger {
  color: var(--bad);
  border-color: rgba(255, 107, 107, 0.35);
}

.btn.tiny {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  margin-top: 6px;
}

.ip-cell .ip-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.chart {
  height: 180px;
  display: flex;
  align-items: end;
  gap: 4px;
  padding-top: 12px;
}

.chart > span {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 6px 6px 2px 2px;
  min-height: 4px;
}

.chart.stacked > span.stack-bar {
  display: flex;
  flex-direction: column-reverse;
  background: transparent;
  overflow: hidden;
}

.chart.stacked i {
  display: block;
  width: 100%;
  min-height: 0;
}

.chart.stacked i.v { background: rgba(255, 255, 255, 0.88); }
.chart.stacked i.c { background: rgba(62, 207, 142, 0.85); }
.chart.stacked i.l { background: rgba(240, 180, 41, 0.85); }

.path-row,
.list-row {
  margin-top: 0;
  padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.path-row:first-of-type,
.list-row:first-of-type {
  margin-top: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.field-block {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.field-block input { width: 100%; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 360px at 20% -10%, rgba(255, 255, 255, 0.08), transparent 55%),
    var(--bg);
}

.auth {
  width: min(400px, 100%);
  background: rgba(14, 14, 14, 0.96);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.auth img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin: 0 auto 18px;
}

.auth h1 {
  margin: 0 0 22px;
  text-align: center;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.auth-note {
  margin: 0 0 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.field { margin-bottom: 12px; }

.field input { width: 100%; }

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.auth .btn {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  font-size: 14px;
}

.auth .btn.solid:empty::after {
  content: "";
  width: 10px;
  height: 10px;
  border-right: 2px solid #111;
  border-top: 2px solid #111;
  transform: rotate(45deg);
}

.error {
  margin: 0 0 12px;
  color: var(--bad);
  font-size: 14px;
  text-align: center;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .grid.two,
  .grid.cards,
  .settings-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    z-index: 6;
  }
  .sidebar .grow { display: none; }
  .sidebar nav {
    display: flex;
    gap: 4px;
  }
  .content { padding: 22px 16px 40px; }
  .stack { gap: 28px; }
  .topbar { padding: 14px; }
  .grid.stats,
  .grid.two,
  .grid.cards,
  .settings-grid { grid-template-columns: 1fr; }
}
