:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-2: #0d1b30;
  --panel: rgba(18, 34, 58, 0.86);
  --panel-strong: rgba(25, 49, 82, 0.94);
  --line: rgba(126, 194, 255, 0.18);
  --text: #f3f8ff;
  --muted: #8ea4bd;
  --green: #29f39a;
  --blue: #55a7ff;
  --red: #ff4e7a;
  --amber: #ffd166;
  --shadow: 0 26px 90px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Avenir Next", "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(41, 243, 154, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 4%, rgba(85, 167, 255, 0.22), transparent 30rem),
    linear-gradient(135deg, #050b14 0%, #081626 42%, #0a1020 100%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

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

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.login-card,
.panel,
.hero {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, var(--panel), rgba(9, 19, 34, 0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card {
  width: min(460px, 100%);
  margin: 12vh auto;
  padding: 36px;
  border-radius: 34px;
}

.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  margin-bottom: 24px;
  background:
    radial-gradient(circle at 50% 50%, #07111f 0 27%, transparent 28%),
    conic-gradient(from 210deg, var(--green), var(--blue), #19416e, var(--green));
  box-shadow: 0 18px 46px rgba(41, 243, 154, 0.24);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 32px;
  border-radius: 34px;
  margin-bottom: 22px;
}

.hero h1,
.panel h2,
.login-card h1 {
  margin: 0;
  letter-spacing: -0.04em;
}

.hero h1 {
  font-size: clamp(34px, 5vw, 58px);
}

.panel h2 {
  font-size: 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  margin: 16px 0 0;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.grid {
  display: grid;
  gap: 18px;
}

.two {
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  margin-bottom: 18px;
}

.profile-grid {
  grid-template-columns: 380px minmax(0, 1fr);
}

.panel {
  position: relative;
  padding: 24px;
  border-radius: 28px;
}

.panel.menu-open {
  z-index: 60;
}

.shell > .panel {
  margin-top: 28px;
}

.panel.accent {
  background: linear-gradient(150deg, rgba(18, 55, 64, 0.9), rgba(15, 30, 53, 0.92));
}

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

.stack {
  display: grid;
  gap: 16px;
}

.server-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(142, 164, 189, 0.22);
  border-radius: 16px;
  outline: none;
  color: var(--text);
  background: rgba(3, 10, 20, 0.48);
  padding: 14px 15px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(41, 243, 154, 0.72);
  box-shadow: 0 0 0 4px rgba(41, 243, 154, 0.09);
  background: rgba(3, 10, 20, 0.7);
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch input {
  width: 20px;
}

button,
.primary,
.secondary,
.ghost {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  border: 0;
  border-radius: 15px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 850;
  letter-spacing: -0.01em;
  transition: transform 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

button:active,
.primary:active,
.secondary:active,
.ghost:active {
  transform: translateY(1px) scale(0.99);
}

.primary {
  color: #03130d;
  background: linear-gradient(135deg, var(--green), #7dffd0);
  box-shadow: 0 18px 40px rgba(41, 243, 154, 0.22);
}

.secondary {
  color: #06111f;
  background: linear-gradient(135deg, var(--blue), #9bd0ff);
}

.ghost {
  color: var(--text);
  border: 1px solid rgba(142, 164, 189, 0.22);
  background: rgba(255, 255, 255, 0.055);
}

.danger,
.danger-text {
  color: var(--red);
}

.wide {
  width: 100%;
}

.pulse {
  min-height: 68px;
  font-size: 18px;
}

.alert {
  margin: 0 0 18px;
  padding: 15px 17px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.alert.error {
  border-color: rgba(255, 78, 122, 0.34);
  background: rgba(255, 78, 122, 0.11);
}

.alert.success {
  border-color: rgba(41, 243, 154, 0.34);
  background: rgba(41, 243, 154, 0.1);
}

.alert.token {
  display: grid;
  gap: 8px;
}

code {
  word-break: break-all;
  color: #bfefff;
}

.table-wrap {
  overflow: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid rgba(142, 164, 189, 0.13);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tr.disabled {
  opacity: 0.48;
}

.right {
  position: relative;
  text-align: right;
}

.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu summary {
  display: inline-flex;
  width: 42px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  list-style: none;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu-popover {
  position: absolute;
  z-index: 9999;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 210px;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(142, 164, 189, 0.18);
  border-radius: 18px;
  background: rgba(10, 23, 39, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.action-menu:not([open]) .action-menu-popover {
  display: none;
}

.action-menu-popover button {
  width: 100%;
  justify-content: flex-start;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.action-menu-popover button:hover,
.action-menu summary:hover {
  filter: brightness(1.12);
}

.mini {
  min-height: 34px;
  border-radius: 11px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.badge.ok {
  color: #052017;
  background: var(--green);
}

.badge.off {
  color: #ffdce5;
  background: rgba(255, 78, 122, 0.2);
}

.counter {
  display: inline-flex;
  min-width: 42px;
  height: 42px;
  justify-content: center;
  align-items: center;
  border-radius: 15px;
  background: rgba(85, 167, 255, 0.14);
  color: #b9ddff;
  font-weight: 900;
}

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

.server-card {
  display: grid;
  gap: 10px;
  padding: 17px;
  border: 1px solid rgba(142, 164, 189, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
}

.server-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
}

.server-card span {
  color: var(--muted);
}

.server-card.online {
  border-color: rgba(41, 243, 154, 0.26);
}

.qr-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.qr {
  width: 100%;
  border-radius: 28px;
  padding: 16px;
  background: white;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(41, 243, 154, 0.32);
  border-radius: 999px;
  padding: 11px 18px;
  background: rgba(7, 17, 31, 0.94);
  color: var(--green);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .hero,
  .two,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    display: grid;
  }

  .server-form {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .hero-actions {
    flex-wrap: wrap;
  }
}
