:root {
  --bg: #081120;
  --sidebar: rgba(10, 18, 31, 0.92);
  --panel: rgba(18, 29, 48, 0.88);
  --panel-2: rgba(24, 38, 61, 0.9);
  --border: rgba(135, 166, 221, 0.16);
  --text: #edf4ff;
  --muted: #a9b8d6;
  --primary: #5b6dfb;
  --primary-hover: #4859e0;
  --success: #22a06b;
  --danger: #c95656;
  --warning: #f2b44f;
  --info: #4290ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --radius: 18px;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--site-bg, none);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 9, 16, 0.64), rgba(5, 9, 16, 0.86));
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  backdrop-filter: blur(4px);
  z-index: -1;
}

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

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.sidebar-brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-brand-text h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.sidebar-brand-text p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sidebar-section {
  margin-top: 22px;
}

.sidebar-title {
  color: #91a4cb;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px 8px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #edf4ff;
  background: transparent;
  transition: background 0.15s ease, transform 0.15s ease;
}

.nav-link:hover {
  background: rgba(91, 109, 251, 0.14);
  transform: translateX(2px);
}

.nav-link.active {
  background: rgba(91, 109, 251, 0.22);
  border: 1px solid rgba(91, 109, 251, 0.28);
}

.nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(120, 141, 184, 0.14);
  font-size: 15px;
  flex-shrink: 0;
}

.nav-label {
  font-weight: 600;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.page {
  max-width: 1250px;
  padding: 28px 24px 40px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.brand-box,
.server-title {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-icon,
.server-avatar {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.server-avatar.large {
  width: 84px;
  height: 84px;
}

.brand-fallback,
.server-avatar.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: bold;
  background: linear-gradient(135deg, #5b6dfb, #7a4fff);
}

.title-block h1 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.1;
}

.title-block p,
.server-title p {
  margin: 0;
  color: var(--muted);
}

.hero,
.card,
.server-card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero,
.card {
  background: var(--panel);
  border-radius: 22px;
  padding: 22px;
}

.hero {
  margin-bottom: 20px;
}

.hero h2 {
  margin: 0 0 12px;
  font-size: 28px;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.65;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

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

.panel-grid,
.mini-grid,
.server-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-grid {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.mini-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

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

.server-card {
  background: var(--panel-2);
  border-radius: 22px;
  padding: 18px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.server-card:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 109, 251, 0.28);
}

.server-card-head {
  display: flex;
  gap: 14px;
  align-items: center;
}

.server-card-info h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.server-card-info p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.server-card-actions,
.inline-form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.server-card-actions {
  margin-top: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.button.gray {
  background: rgba(124, 142, 179, 0.2);
}

.button.gray:hover {
  background: rgba(124, 142, 179, 0.32);
}

.button.danger {
  background: var(--danger);
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

.badge.ok {
  background: rgba(34, 160, 107, 0.18);
  color: #ddffee;
}

.badge.no {
  background: rgba(201, 86, 86, 0.18);
  color: #ffdede;
}

.badge.info {
  background: rgba(66, 144, 255, 0.18);
  color: #dcebff;
}

.alert {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
}

.alert.success {
  background: rgba(34, 160, 107, 0.16);
  border: 1px solid rgba(34, 160, 107, 0.28);
  color: #ddffee;
}

.alert.error {
  background: rgba(201, 86, 86, 0.18);
  border: 1px solid rgba(201, 86, 86, 0.28);
  color: #ffdede;
}

label {
  display: block;
  margin-top: 12px;
  margin-bottom: 7px;
  font-weight: bold;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: rgba(8, 15, 26, 0.92);
  color: #fff;
  border: 1px solid rgba(132, 154, 200, 0.24);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: Arial, sans-serif;
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: rgba(91, 109, 251, 0.74);
  box-shadow: 0 0 0 4px rgba(91, 109, 251, 0.14);
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: normal;
  color: var(--muted);
}

.check-row input {
  width: auto;
}

.simple-list,
.message-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.simple-list {
  max-height: 320px;
}

.message-list {
  max-height: 430px;
}

.simple-item,
.message-item {
  border-radius: 14px;
}

.simple-item {
  display: block;
  padding: 11px 12px;
  background: rgba(60, 78, 110, 0.42);
  transition: background 0.15s ease;
}

.simple-item:hover {
  background: rgba(77, 98, 140, 0.55);
}

.simple-item.active {
  background: rgba(91, 109, 251, 0.22);
  border: 1px solid rgba(91, 109, 251, 0.26);
}

.simple-item.static:hover {
  background: rgba(60, 78, 110, 0.42);
}

.message-item {
  background: rgba(9, 16, 27, 0.9);
  border: 1px solid rgba(132, 154, 200, 0.12);
  padding: 14px;
}

.message-headline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.message-text {
  color: #e9f0ff;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.bg-option {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(12, 20, 33, 0.88);
}

.bg-preview {
  height: 100px;
  background-size: cover;
  background-position: center;
}

.bg-option-footer {
  padding: 12px;
}

.footer-note {
  margin-top: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.mobile-top {
  display: none;
  padding: 16px 18px 0;
}

.mobile-top .button {
  width: 100%;
}

@media (max-width: 980px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .main-content {
    width: 100%;
  }

  .grid-2,
  .grid-3,
  .panel-grid,
  .mini-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .page {
    padding: 22px 16px 36px;
  }

  .server-card-actions,
  .inline-form-row {
    flex-direction: column;
  }

  .title-block h1 {
    font-size: 28px;
  }

  .hero h2 {
    font-size: 23px;
  }
}