:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-deep: #050814;
  --panel: rgba(12, 18, 35, 0.82);
  --panel-strong: rgba(17, 24, 43, 0.94);
  --panel-soft: rgba(20, 27, 48, 0.68);
  --line: rgba(115, 92, 255, 0.24);
  --line-strong: rgba(119, 92, 255, 0.55);
  --text: #f7f8ff;
  --muted: #9da8c4;
  --muted-2: #6f7a98;
  --purple: #7b5cff;
  --blue: #0084ff;
  --cyan: #00e6d2;
  --pink: #ff4d9d;
  --green: #00e602;
  --orange: #ffb020;
  --danger: #ff4d6d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  --font-display: Orbitron, "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --font-body: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 72%, rgba(0, 132, 255, 0.34), transparent 28%),
    radial-gradient(circle at 76% 14%, rgba(123, 92, 255, 0.28), transparent 24%),
    radial-gradient(circle at 52% 88%, rgba(255, 77, 157, 0.12), transparent 26%),
    linear-gradient(140deg, #050814 0%, #0a1020 46%, #050814 100%);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.82) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(123, 92, 255, 0.65) 0 1px, transparent 1.5px),
    linear-gradient(120deg, transparent 0 60%, rgba(0, 230, 210, 0.08) 61%, transparent 75%);
  background-position: 0 0, 42px 76px, 0 0;
  background-size: 150px 150px, 230px 230px, 100% 100%;
  opacity: 0.28;
}

body::after {
  background:
    linear-gradient(rgba(123, 92, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 132, 255, 0.04) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 82%, transparent);
}

button,
input {
  font: inherit;
}

button {
  letter-spacing: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 20, 0.82);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.32);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand p,
.panel p,
.topbar p {
  margin: 0.28rem 0 0;
  color: var(--muted);
}

.brand__mark {
  width: 44px;
  aspect-ratio: 1;
  border: 2px solid var(--purple);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 22px rgba(123, 92, 255, 0.5), inset 0 0 18px rgba(0, 132, 255, 0.24);
  flex: 0 0 auto;
}

.brand__mark::before {
  content: "";
  position: absolute;
  inset: 10px -8px;
  border: 3px solid transparent;
  border-top-color: var(--purple);
  border-bottom-color: var(--blue);
  border-radius: 50%;
  rotate: -34deg;
}

.brand__mark span,
.brand__mark span::before,
.brand__mark span::after {
  position: absolute;
  width: 7px;
  aspect-ratio: 1;
  background: var(--text);
  box-shadow: 0 0 14px var(--blue);
  transform: rotate(45deg);
}

.brand__mark span {
  top: 18px;
  left: 17px;
}

.brand__mark span::before,
.brand__mark span::after {
  content: "";
}

.brand__mark span::before {
  width: 5px;
  top: -14px;
  left: 13px;
}

.brand__mark span::after {
  width: 4px;
  top: 14px;
  left: 18px;
  background: var(--blue);
}

.brand__mark--large {
  width: 92px;
  margin: 0 auto 1.2rem;
}

.brand__mark--large span {
  top: 40px;
  left: 40px;
}

.topbar__actions,
.card-actions,
.inline-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form {
  margin-bottom: 1rem;
}

.inline-form input[type="text"] {
  flex: 1 1 280px;
}

.inline-form__actions {
  flex-basis: 100%;
}

.shell {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 1.25rem;
}

.panel {
  background: linear-gradient(145deg, var(--panel), rgba(7, 12, 26, 0.86));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(123, 92, 255, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(0, 132, 255, 0.08), transparent 34%);
  pointer-events: none;
}

.panel > * {
  position: relative;
}

.login-panel {
  max-width: 460px;
  margin: 5rem auto 0;
  padding: 2rem;
}

.login-panel__intro {
  text-align: center;
  margin-bottom: 1.5rem;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  font-size: 1.12rem;
}

h3 {
  font-size: 1rem;
  line-height: 1.35;
}

.eyebrow,
.server-card__kicker {
  color: var(--purple);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stack {
  display: grid;
  gap: 0.8rem;
}

label {
  color: var(--muted);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  color: var(--text);
  background: rgba(8, 13, 30, 0.88);
  border: 1px solid rgba(120, 143, 190, 0.32);
  border-radius: 6px;
  min-height: 2.75rem;
  padding: 0.72rem 0.85rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

input::placeholder {
  color: var(--muted-2);
}

input:focus {
  outline: 2px solid rgba(123, 92, 255, 0.5);
  border-color: var(--purple);
}

.btn {
  border: 1px solid transparent;
  border-radius: 7px;
  background: linear-gradient(120deg, var(--purple), var(--blue));
  color: #fff;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 800;
  min-height: 2.55rem;
  padding: 0.68rem 1rem;
  text-transform: uppercase;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.btn:hover:not(:disabled) {
  box-shadow: 0 0 24px rgba(0, 132, 255, 0.42);
  transform: translateY(-1px);
}

.btn--small {
  min-height: 2.25rem;
  padding: 0.5rem 0.78rem;
}

.btn--ghost {
  background: rgba(7, 12, 26, 0.38);
  border-color: rgba(0, 132, 255, 0.58);
  color: var(--text);
}

.btn--danger {
  background: rgba(255, 77, 109, 0.14);
  border-color: var(--danger);
  color: #fff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-width: 620px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(10, 16, 33, 0.74);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 3rem;
  padding: 0.65rem 0.8rem;
  text-transform: uppercase;
}

.tab--active {
  background: linear-gradient(135deg, rgba(123, 92, 255, 0.36), rgba(13, 17, 40, 0.84));
  color: var(--text);
  border-color: var(--purple);
  box-shadow: 0 0 22px rgba(123, 92, 255, 0.22);
}

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

.server-card {
  min-height: 360px;
  background: linear-gradient(180deg, rgba(22, 31, 54, 0.86), rgba(8, 13, 27, 0.94));
  border: 1px solid rgba(105, 126, 184, 0.28);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  display: grid;
  grid-template-rows: 118px 1fr auto;
  overflow: hidden;
}

.server-card__hero {
  background:
    linear-gradient(180deg, rgba(5, 8, 20, 0.12), rgba(5, 8, 20, 0.82)),
    var(--server-hero-image, linear-gradient(135deg, rgba(20, 27, 43, 0.1), rgba(7, 16, 29, 0.1))),
    radial-gradient(circle at 28% 24%, rgba(0, 230, 210, 0.36), transparent 18%),
    radial-gradient(circle at 72% 30%, rgba(123, 92, 255, 0.56), transparent 24%),
    linear-gradient(135deg, #141b2b, #07101d);
  background-position: center;
  background-size: cover;
  border-bottom: 1px solid var(--line);
  position: relative;
  padding: 0.85rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.server-card__hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0 28%, rgba(255, 255, 255, 0.08) 29%, transparent 44%),
    radial-gradient(circle, rgba(255, 255, 255, 0.86) 0 1px, transparent 1.5px);
  background-size: 100% 100%, 72px 72px;
  opacity: 0.28;
}

.server-card__icon {
  width: 34px;
  aspect-ratio: 1;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow: 0 0 24px rgba(123, 92, 255, 0.62);
  position: relative;
  z-index: 1;
}

.server-card__icon::before {
  content: "";
  position: absolute;
  inset: 10px 9px 10px 12px;
  background: #fff;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.server-card__body {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.server-card__details,
.server-password {
  display: grid;
  gap: 0.55rem;
}

.server-card__actions {
  border-top: 1px solid rgba(115, 92, 255, 0.18);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  padding: 0.9rem 1rem 1rem;
}

.server-card__actions > .btn:not(.btn--icon) {
  width: 100%;
}

.btn--icon {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-width: 2.25rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.server-edit-panel {
  border-top: 1px solid rgba(115, 92, 255, 0.16);
  display: grid;
  gap: 0.75rem;
  grid-column: 1 / -1;
  padding-top: 0.75rem;
}

.image-controls,
.password-controls,
.manual-password {
  display: grid;
  gap: 0.55rem;
}

.manual-password {
  margin-bottom: 0.75rem;
}

.file-control {
  display: grid;
  gap: 0.4rem;
}

.file-control span {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.file-control input {
  width: 100%;
  color: var(--muted);
  font-size: 0.82rem;
}

.image-controls__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  color: var(--text);
  border-bottom: 1px solid rgba(115, 92, 255, 0.14);
  padding-bottom: 0.5rem;
}

.info-row span {
  color: var(--muted);
}

.info-row--empty {
  opacity: 0.1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid rgba(115, 92, 255, 0.18);
  padding: 0.8rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

code {
  background: rgba(7, 13, 28, 0.72);
  border: 1px solid rgba(120, 143, 190, 0.26);
  border-radius: 4px;
  color: #dce7ff;
  padding: 0.12rem 0.32rem;
  word-break: break-word;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(120, 143, 190, 0.28);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.28rem 0.55rem;
  text-transform: uppercase;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.chip::before {
  content: "";
  width: 7px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: currentColor;
  margin-right: 0.45rem;
  box-shadow: 0 0 12px currentColor;
}

.chip--online {
  background: rgba(0, 230, 2, 0.08);
  border-color: rgba(0, 230, 2, 0.36);
  color: var(--green);
}

.chip--offline {
  background: rgba(255, 77, 109, 0.08);
  border-color: rgba(255, 77, 109, 0.36);
  color: var(--danger);
}

.status,
.notice,
.empty-state {
  border-radius: 7px;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.status--info,
.notice {
  background: rgba(0, 132, 255, 0.1);
  border: 1px solid rgba(0, 132, 255, 0.32);
}

.status--success {
  background: rgba(0, 230, 210, 0.1);
  border: 1px solid rgba(0, 230, 210, 0.34);
}

.status--error {
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.38);
}

.empty-state {
  background: rgba(10, 16, 33, 0.72);
  border: 1px dashed var(--line);
  color: var(--muted);
  grid-column: 1 / -1;
  text-align: center;
}

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

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.section-title {
  color: var(--text);
  font-size: 0.92rem;
  margin-top: 1.25rem;
}

.group-card {
  background: linear-gradient(145deg, var(--panel-strong), rgba(9, 14, 30, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.group-card__header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.group-card__header input {
  flex: 1;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.check input {
  accent-color: var(--purple);
}

.server-perms {
  border-top: 1px solid rgba(115, 92, 255, 0.18);
  border-bottom: 1px solid rgba(115, 92, 255, 0.18);
  margin: 0.75rem 0;
  padding: 0.55rem 0;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar__actions {
    width: 100%;
  }

  .topbar__actions .btn {
    flex: 1;
  }

  .shell {
    padding: 0.85rem;
  }

  .tabs {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .inline-form {
    width: 100%;
  }

  .inline-form input[type="text"] {
    flex: 1 1 100%;
  }
}

@media (max-width: 520px) {
  .brand {
    align-items: flex-start;
  }

  .brand__mark {
    width: 38px;
  }

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

  .server-card {
    min-height: 0;
  }

  .info-row {
    display: grid;
    gap: 0.35rem;
  }
}
