:root {
  --bg: #050914;
  --bg-2: #071020;
  --panel: rgba(13, 24, 43, 0.86);
  --panel-2: rgba(18, 34, 59, 0.88);
  --line: rgba(147, 197, 253, 0.18);
  --line-strong: rgba(98, 212, 255, 0.42);
  --text: #f7fbff;
  --muted: #9fb1c8;
  --blue: #2f80ff;
  --cyan: #62d4ff;
  --green: #42e7a8;
  --danger: #ff657a;
  --warn: #f3c96b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 4%, rgba(47, 128, 255, 0.18), transparent 32rem),
    radial-gradient(circle at 88% 16%, rgba(98, 212, 255, 0.12), transparent 34rem),
    linear-gradient(180deg, #050914 0%, #071020 54%, #050914 100%);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }

#app {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 9, 20, 0.84);
  backdrop-filter: blur(18px);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffffff, #62d4ff 48%, #2f80ff);
  color: #031021;
  font-weight: 900;
  box-shadow: 0 0 38px rgba(47, 128, 255, 0.34);
}

.brand strong {
  display: block;
  font-size: 16px;
}

small,
p {
  color: var(--muted);
}

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

button,
.button-link,
.ghost {
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 850;
  min-height: 42px;
  padding: 11px 14px;
  cursor: pointer;
  transition: transform 170ms ease, border-color 170ms ease, background 170ms ease, box-shadow 170ms ease;
}

button {
  background: linear-gradient(135deg, #ffffff, #62d4ff 45%, #2f80ff);
  color: #031021;
  box-shadow: 0 14px 36px rgba(47, 128, 255, 0.2);
}

button:hover,
.button-link:hover,
.ghost:hover {
  transform: translateY(-1px);
}

nav button,
.ghost {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  color: #dce8f8;
  border-color: rgba(147, 197, 253, 0.08);
  box-shadow: none;
}

nav button::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 50%;
  background: rgba(98, 212, 255, 0.38);
  box-shadow: 0 0 12px rgba(98, 212, 255, 0.18);
}

nav button.active,
nav button:hover,
.ghost:hover {
  border-color: rgba(98, 212, 255, 0.38);
  background: linear-gradient(135deg, rgba(47, 128, 255, 0.18), rgba(98, 212, 255, 0.08));
}

.site-link {
  margin-top: auto;
  text-align: center;
}

main {
  min-width: 0;
  padding: clamp(20px, 3vw, 34px);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 46px);
}

h2 {
  font-size: 23px;
}

.hidden { display: none !important; }

.auth {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 420px));
  gap: 18px;
  align-content: center;
  justify-content: center;
}

.panel,
.server-card,
.metrics article,
.control-panel,
.plan-card,
.detail-grid article,
.service-shell {
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    radial-gradient(circle at 16% 8%, rgba(98, 212, 255, 0.09), transparent 17rem),
    linear-gradient(180deg, rgba(13, 24, 43, 0.94), rgba(8, 16, 31, 0.82));
  box-shadow: var(--shadow);
}

.panel,
.server-card,
.metrics article,
.control-panel {
  padding: 18px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(147, 197, 253, 0.14);
  border-radius: 8px;
  background: #050b15;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(98, 212, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.16);
}

textarea {
  min-height: 110px;
  resize: vertical;
  font-family: inherit;
}

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

.metrics article {
  min-height: 116px;
}

.metrics span {
  display: block;
  font-size: 38px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 26px rgba(98, 212, 255, 0.22);
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.server-card {
  display: grid;
  gap: 12px;
}

.server-card .top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.server-console {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.server-list {
  display: grid;
  gap: 10px;
}

.server-list-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(147, 197, 253, 0.12);
  text-align: left;
  box-shadow: none;
}

.server-list-item:hover,
.server-list-item.selected {
  border-color: var(--line-strong);
  background: rgba(47, 128, 255, 0.14);
}

.server-list-item span:first-child {
  display: grid;
  gap: 4px;
}

.control-panel {
  min-height: 560px;
}

.control-header,
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.status-stack,
.actions,
.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(147, 197, 253, 0.18);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge.active,
.badge.running {
  color: var(--green);
  border-color: rgba(66, 231, 168, 0.36);
}

.badge.suspended,
.badge.failed {
  color: var(--danger);
  border-color: rgba(255, 101, 122, 0.36);
}

.badge.stopped,
.badge.inactive {
  color: var(--warn);
  border-color: rgba(243, 201, 107, 0.32);
}

.actions button,
.quick-actions button,
.button-link {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: rgba(147, 197, 253, 0.14);
  box-shadow: none;
}

.actions button:hover,
.quick-actions button:hover,
.button-link:hover {
  border-color: var(--line-strong);
  background: rgba(47, 128, 255, 0.16);
}

.actions button.danger,
.quick-actions button.danger,
button.danger {
  color: var(--danger);
}

.button-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.detail-grid article {
  padding: 14px;
  display: grid;
  gap: 6px;
}

.detail-grid strong {
  word-break: break-word;
}

.plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.billing-game {
  max-width: 260px;
  margin-top: 12px;
}

.plan-card {
  padding: 18px;
  display: grid;
  gap: 16px;
  transition: transform 170ms ease, border-color 170ms ease;
}

.plan-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
}

.plan-card .price {
  color: var(--cyan);
  font-size: 25px;
}

.plan-specs {
  display: grid;
  gap: 9px;
}

.plan-specs span {
  border-bottom: 1px solid rgba(147, 197, 253, 0.12);
  padding-bottom: 8px;
  color: var(--muted);
}

.plan-card button:disabled {
  opacity: .58;
  cursor: not-allowed;
}

.panel-section,
.access-block {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
}

.checks input {
  width: auto;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 1fr auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(147, 197, 253, 0.12);
  padding: 12px 0;
}

.member-row > div:first-child {
  display: grid;
  gap: 4px;
}

.member-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.member-perms span {
  border: 1px solid rgba(147, 197, 253, 0.14);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.logs {
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  background: #030711;
  border: 1px solid rgba(147, 197, 253, 0.14);
  border-radius: 8px;
  padding: 14px;
  color: #c8d3df;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.admin-provisioning {
  margin-top: 16px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(147, 197, 253, 0.12);
}

.db-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.db-tables,
.db-content,
.db-query {
  display: grid;
  gap: 10px;
}

.db-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(147, 197, 253, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.table-scroll {
  max-height: 420px;
  overflow: auto;
  border: 1px solid rgba(147, 197, 253, 0.14);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: #050b15;
}

th,
td {
  border-bottom: 1px solid rgba(147, 197, 253, 0.12);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0d182b;
}

td {
  color: #c8d3df;
}

td em {
  color: var(--muted);
  font-style: normal;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: none;
  max-width: min(420px, calc(100% - 36px));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  background: #071020;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

@media (max-width: 1020px) {
  #app {
    grid-template-columns: 1fr;
  }

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

  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-link {
    margin-top: 0;
  }

  .auth,
  .split,
  .metrics,
  .server-console,
  .detail-grid,
  .plans,
  .member-row,
  .db-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  main {
    padding: 16px;
  }

  header,
  .control-header,
  .section-title {
    display: grid;
  }

  nav {
    grid-template-columns: 1fr;
  }

  .quick-actions,
  .actions {
    display: grid;
  }

  .quick-actions > *,
  .actions > * {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
