:root,
html[data-theme='dark'] {
  --text: #f7f4ff;
  --muted: #aea8c8;
  --surface: rgba(22, 16, 35, 0.88);
  --surface-strong: rgba(14, 10, 25, 0.95);
  --surface-border: rgba(173, 155, 240, 0.24);
  --bg-layer-1: radial-gradient(circle at 14% 4%, rgba(236, 72, 153, 0.26), transparent 36%);
  --bg-layer-2: radial-gradient(circle at 88% 0%, rgba(96, 165, 250, 0.25), transparent 38%);
  --bg-layer-3: linear-gradient(112deg, rgba(9, 5, 18, 0.96), rgba(10, 6, 24, 0.98));
  --sidebar-bg: rgba(13, 9, 27, 0.92);
  --sidebar-text: #f7f4ff;
  --sidebar-sub: rgba(193, 185, 220, 0.88);
  --sidebar-item-bg: rgba(255, 255, 255, 0.04);
  --sidebar-item-hover-border: rgba(173, 155, 240, 0.45);
  --sidebar-item-selected-bg: rgba(244, 114, 182, 0.16);
  --sidebar-item-selected-border: rgba(244, 114, 182, 0.72);
  --sidebar-item-muted-bg: rgba(255, 255, 255, 0.02);
  --sidebar-icon-bg: rgba(255, 255, 255, 0.12);
  --topbar-bg: rgba(16, 11, 30, 0.78);
  --input-bg: rgba(11, 8, 20, 0.8);
  --input-border: rgba(173, 155, 240, 0.3);
  --elevated-bg: rgba(16, 11, 30, 0.84);
  --active-row-bg: rgba(96, 165, 250, 0.16);
  --notice-bg: rgba(14, 10, 25, 0.68);
  --notice-border: rgba(173, 155, 240, 0.45);
  --notice-text: #d5cef2;
  --secondary-btn-bg: rgba(17, 12, 30, 0.75);
  --secondary-btn-color: #f7f4ff;
  --secondary-btn-border: rgba(173, 155, 240, 0.45);
  --neutral-badge-bg: rgba(173, 155, 240, 0.15);
  --neutral-badge-color: #efe9ff;
  --neutral-badge-border: rgba(173, 155, 240, 0.35);
  --ring: rgba(236, 72, 153, 0.45);
  --shadow: 0 22px 48px rgba(4, 3, 10, 0.55);
  --shadow-neon: 0 0 0 1px rgba(244, 114, 182, 0.28), 0 16px 42px rgba(96, 165, 250, 0.16);
}

html[data-theme='light'] {
  --text: #231b3b;
  --muted: #645d83;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --surface-border: rgba(115, 96, 170, 0.2);
  --bg-layer-1: radial-gradient(circle at 14% 4%, rgba(236, 72, 153, 0.19), transparent 38%);
  --bg-layer-2: radial-gradient(circle at 88% 0%, rgba(96, 165, 250, 0.22), transparent 42%);
  --bg-layer-3: linear-gradient(112deg, #f7f4ff 0%, #f2f6ff 55%, #eef2fb 100%);
  --sidebar-bg: rgba(35, 26, 67, 0.94);
  --sidebar-text: #f7f4ff;
  --sidebar-sub: rgba(222, 214, 246, 0.92);
  --sidebar-item-bg: rgba(255, 255, 255, 0.09);
  --sidebar-item-hover-border: rgba(173, 155, 240, 0.45);
  --sidebar-item-selected-bg: rgba(244, 114, 182, 0.16);
  --sidebar-item-selected-border: rgba(244, 114, 182, 0.68);
  --sidebar-item-muted-bg: rgba(255, 255, 255, 0.045);
  --sidebar-icon-bg: rgba(255, 255, 255, 0.2);
  --topbar-bg: rgba(255, 255, 255, 0.66);
  --input-bg: rgba(255, 255, 255, 0.95);
  --input-border: rgba(115, 96, 170, 0.25);
  --elevated-bg: rgba(255, 255, 255, 0.96);
  --active-row-bg: rgba(96, 165, 250, 0.13);
  --notice-bg: rgba(255, 255, 255, 0.72);
  --notice-border: rgba(115, 96, 170, 0.38);
  --notice-text: #4e4673;
  --secondary-btn-bg: rgba(255, 255, 255, 0.9);
  --secondary-btn-color: #30274f;
  --secondary-btn-border: rgba(115, 96, 170, 0.33);
  --neutral-badge-bg: rgba(97, 85, 137, 0.11);
  --neutral-badge-color: #4e4673;
  --neutral-badge-border: rgba(97, 85, 137, 0.26);
  --ring: rgba(236, 72, 153, 0.3);
  --shadow: 0 20px 45px rgba(48, 39, 79, 0.12);
  --shadow-neon: 0 0 0 1px rgba(244, 114, 182, 0.26), 0 18px 40px rgba(96, 165, 250, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  background: var(--bg-layer-1), var(--bg-layer-2), var(--bg-layer-3);
  background-attachment: scroll;
  position: relative;
  transition: background 0.28s ease, color 0.2s ease;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 22%, rgba(236, 72, 153, 0.09), transparent 34%),
    radial-gradient(circle at 82% 72%, rgba(59, 130, 246, 0.12), transparent 34%);
  opacity: 0.6;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

code {
  border: 1px solid rgba(236, 72, 153, 0.34);
  background: rgba(236, 72, 153, 0.1);
  color: #ffd4ea;
  padding: 0.1rem 0.34rem;
  border-radius: 0.4rem;
}

.app-shell {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 24px;
  backdrop-filter: none;
  box-shadow: var(--shadow-neon);
  padding: 28px;
}

.auth-title {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 2vw, 1.95rem);
  letter-spacing: 0.01em;
}

.auth-text {
  margin: 12px 0 24px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-actions {
  display: flex;
  justify-content: center;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid var(--surface-border);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: 100vh;
  backdrop-filter: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.02em;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(173, 155, 240, 0.25);
  background: rgba(0, 0, 0, 0.14);
}

.sidebar-caption {
  color: var(--sidebar-sub);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  padding: 0 10px;
}

.server-list {
  scroll-behavior: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
  contain: content;
}

.server-list::-webkit-scrollbar {
  width: 7px;
}

.server-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(203, 192, 240, 0.28);
}

.server-item {
  width: 100%;
  border: 1px solid transparent;
  background: var(--sidebar-item-bg);
  color: inherit;
  border-radius: 14px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.server-item:hover {
  border-color: var(--sidebar-item-hover-border);
  transform: translateY(-1px);
}

.server-item.selected {
  border-color: var(--sidebar-item-selected-border);
  background: var(--sidebar-item-selected-bg);
}

.server-item.not-installed {
  opacity: 0.74;
  background: var(--sidebar-item-muted-bg);
}

.server-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--sidebar-icon-bg);
  font-weight: 700;
}

.server-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.server-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.server-name {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 82%, transparent 100%);
}

.server-sub {
  font-size: 0.76rem;
  color: var(--sidebar-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 86%, transparent 100%);
}

.server-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.server-tag {
  min-width: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 4px 10px;
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
}

.server-tag-installed {
  color: #0f6c47;
  background: rgba(35, 214, 146, 0.2);
  border-color: rgba(22, 125, 83, 0.35);
}

.server-tag-install {
  color: var(--neutral-badge-color);
  background: var(--neutral-badge-bg);
  border-color: var(--neutral-badge-border);
}

.server-tag-access {
  color: rgba(238, 231, 255, 0.92);
  background: rgba(173, 155, 240, 0.14);
  border-color: rgba(173, 155, 240, 0.38);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge.ok {
  color: #0f6c47;
  background: rgba(35, 214, 146, 0.2);
  border-color: rgba(22, 125, 83, 0.35);
}

.badge.warn {
  color: #8a4f00;
  background: rgba(230, 136, 24, 0.2);
  border-color: rgba(138, 79, 0, 0.28);
}

.badge.error {
  color: #962b26;
  background: rgba(217, 72, 65, 0.2);
  border-color: rgba(150, 43, 38, 0.28);
}

.badge.neutral {
  color: var(--neutral-badge-color);
  background: var(--neutral-badge-bg);
  border-color: var(--neutral-badge-border);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  min-height: 76px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--surface-border);
  background: var(--topbar-bg);
  backdrop-filter: none;
}

.topbar-title {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  line-height: 1.2;
}

.topbar-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.content {
  scroll-behavior: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  contain: content;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: none;
}

.card h2,
.card h3 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.01em;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric {
  border: 1px solid var(--surface-border);
  background: var(--surface-strong);
  border-radius: 14px;
  padding: 14px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-value {
  margin-top: 8px;
  font-size: 1.3rem;
  font-weight: 700;
}

.health-list {
  display: grid;
  gap: 10px;
}

.health-item {
  border-radius: 14px;
  padding: 12px;
  border: 1px solid var(--surface-border);
  background: var(--surface-strong);
}

.health-item .title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
}

.health-item .detail {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.section-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.field-row label {
  font-size: 0.84rem;
  font-weight: 700;
}

.input,
.select,
.textarea,
.limit-input {
  width: 100%;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input:focus,
.select:focus,
.textarea:focus,
.limit-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
}

.textarea {
  min-height: 90px;
  resize: vertical;
}

.channel-table {
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  overflow: hidden;
}

.channel-row {
  display: grid;
  grid-template-columns: 26px 1fr 120px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--surface-border);
  background: var(--elevated-bg);
}

.channel-row:last-child {
  border-bottom: 0;
}

.channel-row.active {
  background: var(--active-row-bg);
}

.channel-name {
  font-weight: 600;
  font-size: 0.91rem;
}

.channel-meta {
  color: var(--muted);
  font-size: 0.77rem;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.toggle-item {
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--elevated-bg);
  padding: 9px 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.toggle-item input {
  accent-color: #f472b6;
}

.role-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.command-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.command-item {
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--elevated-bg);
  padding: 10px 12px;
}

.command-name {
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
}

.command-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}



.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  gap: 8px;
  transition: transform 0.12s ease, opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.btn:hover {
  transform: translateY(-1px);
}


.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}


.btn.primary {
  color: #fff;
  border-color: rgba(244, 114, 182, 0.58);
  background: linear-gradient(135deg, #f472b6 0%, #60a5fa 100%);
  box-shadow: 0 10px 24px rgba(96, 165, 250, 0.28);
}


.btn.secondary {
  color: var(--secondary-btn-color);
  border-color: var(--secondary-btn-border);
  background: var(--secondary-btn-bg);
}


.btn.ghost {
  color: #f0f5ff;
  border-color: rgba(240, 245, 255, 0.45);
  background: transparent;
}


.btn.preset-save-btn {
  color: #eaf3ff;
  border-color: rgba(96, 165, 250, 0.65);
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.3);
}

.btn.preset-load-btn {
  color: var(--secondary-btn-color);
  border-color: var(--secondary-btn-border);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.16), rgba(30, 41, 59, 0.12));
}

.btn.danger {
  color: #ffe9ea;
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(153, 27, 27, 0.32);
}

html[data-theme='light'] .btn.danger {
  color: #a12626;
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(239, 68, 68, 0.12);
}


.btn-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon svg {
  width: 14px;
  height: 14px;
}

.preset-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.preset-chip-list {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-chip {
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--elevated-bg);
  font-size: 0.78rem;
  color: var(--text);
}

.empty-inline {
  margin-top: 10px;
  border: 1px dashed var(--surface-border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 3, 10, 0.64);
  backdrop-filter: none;
}

.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 51;
  display: grid;
  place-items: center;
  padding: 20px;
  pointer-events: none;
}

.modal-card {
  width: min(560px, 100%);
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-neon);
  padding: 18px;
  pointer-events: auto;
}

.preset-load-modal {
  width: min(620px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.modal-actions-row {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-actions-split {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.inline-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.helper {
  color: var(--muted);
  font-size: 0.81rem;
}

.notice {
  border: 1px dashed var(--notice-border);
  background: var(--notice-bg);
  border-radius: 14px;
  padding: 16px;
  color: var(--notice-text);
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  background: rgba(20, 14, 35, 0.95);
  color: #f4f8ff;
  border: 1px solid rgba(173, 155, 240, 0.38);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 0.84rem;
  box-shadow: 0 18px 30px rgba(16, 12, 28, 0.34);
}

.empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted);
}

.mobile-top {
  display: none;
}

@media (max-width: 1180px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .role-columns,
  .grid.cols-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .server-item {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .server-badges {
    width: auto;
  }

  .server-tag {
    min-width: 88px;
    padding: 4px 8px;
    font-size: 0.71rem;
  }
  .modal-card {
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow: auto;
  }

  .modal-actions-split {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-btn-group {
    width: 100%;
    justify-content: flex-end;
  }
  .layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--surface-border);
    max-height: 46vh;
    height: auto;
  }

  .mobile-top {
    display: block;
  }

  .content {
    padding: 16px;
    overflow: visible;
  }

  .topbar {
    padding: 13px 14px;
  }

  .grid.cols-4,
  .grid.cols-2 {
    grid-template-columns: 1fr;
  }
}














