:root {
  --bg-base: #0d1117;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-card-hover: rgba(33, 38, 45, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #58a6ff;
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --accent: #238636;
  --accent-hover: #2ea043;
  --accent-blue: #1f6feb;
  --accent-blue-hover: #388bfd;
  --danger: #da3633;
  --danger-hover: #f85149;
  --warning: #d29922;
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(35, 134, 54, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(31, 111, 235, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Модалка входа */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 32px;
  text-align: center;
}

.logo-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent) 0%, #195e26 100%);
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 1px;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(35, 134, 54, 0.3);
}

.login-header h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  background: rgba(13, 17, 23, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: rgba(255, 255, 255, 0.05); border-color: var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

.btn-outline { background: transparent; border-color: var(--border-color); color: var(--text-muted); }
.btn-outline:hover { color: var(--text-main); border-color: var(--text-muted); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* Шапка */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-nav {
  position: sticky;
  top: 12px;
  margin: 12px 24px 0 24px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

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

.brand-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 6px;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
}

.nav-tabs {
  display: flex;
  gap: 6px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: #fff;
  background: rgba(35, 134, 54, 0.2);
  border: 1px solid rgba(35, 134, 54, 0.4);
}

.main-content {
  flex: 1;
  padding: 20px 24px;
  max-width: 1680px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== РАЗДЕЛЕННЫЙ ЭКРАН (СЕРВЕРЫ) ==================== */
.split-servers-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  height: calc(100vh - 120px);
}

@media (max-width: 1024px) {
  .split-servers-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* ЛЕВАЯ КОЛОНКА */
.left-servers-col {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  overflow: hidden;
}

.col-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.col-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.col-title-wrap h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.servers-count-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
}

.col-action-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.servers-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.selection-status-text {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Список серверов */
.servers-custom-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
  margin-bottom: 14px;
}

.server-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  transition: all 0.2s;
}

.server-item-row:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.3);
}

.server-item-row.selected {
  border-color: rgba(35, 134, 54, 0.6);
  background: rgba(35, 134, 54, 0.08);
}

.server-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-info-block {
  display: flex;
  flex-direction: column;
}

.server-name-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.server-endpoint-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.server-row-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

.status-online {
  background: rgba(35, 134, 54, 0.15);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.status-offline {
  background: rgba(218, 54, 51, 0.15);
  color: #f85149;
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.status-waiting {
  background: rgba(210, 153, 34, 0.15);
  color: #d29922;
  border: 1px solid rgba(210, 153, 34, 0.3);
}

/* Панель групповых действий */
.servers-bottom-actions {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
}

.actions-header-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.action-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-action {
  font-size: 0.85rem;
  padding: 9px 12px;
  justify-content: flex-start;
}

.btn-admin-api { background: rgba(31, 111, 235, 0.15); color: #58a6ff; border: 1px solid rgba(88, 166, 255, 0.3); }
.btn-admin-api:hover { background: rgba(31, 111, 235, 0.3); color: #fff; }

.btn-install { background: rgba(35, 134, 54, 0.15); color: #3fb950; border: 1px solid rgba(63, 185, 80, 0.3); }
.btn-install:hover { background: rgba(35, 134, 54, 0.3); color: #fff; }

.btn-uninstall { background: rgba(218, 54, 51, 0.15); color: #f85149; border: 1px solid rgba(248, 81, 73, 0.3); }
.btn-uninstall:hover { background: rgba(218, 54, 51, 0.3); color: #fff; }

.btn-check { background: rgba(255, 255, 255, 0.05); color: #e6edf3; border: 1px solid var(--border-color); }
.btn-check:hover { background: rgba(255, 255, 255, 0.12); }

/* ПРАВАЯ КОЛОНКА (ТЕРМИНАЛ) */
.right-terminal-col {
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: #06090e;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.terminal-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.terminal-dot.red { background: #f85149; }
.terminal-dot.yellow { background: #d29922; }
.terminal-dot.green { background: #3fb950; }

.terminal-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 6px;
}

.terminal-body {
  flex: 1;
  background: transparent;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  padding-right: 6px;
}

/* ВК ХЭШИ МОДАЛКА */
.vk-hashes-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vk-hashes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
}

.hash-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.hash-select-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Таблицы */
.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.users-table-container {
  overflow-x: auto;
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.3);
  padding: 14px 18px;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.key-code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.2);
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Редактор JSON */
.editor-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  padding: 16px;
}

.code-editor {
  flex: 1;
  width: 100%;
  background: #090d13;
  color: #e6edf3;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.6;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  resize: none;
  outline: none;
}

.editor-status {
  padding-top: 12px;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

.status-indicator.valid { color: #3fb950; }
.status-indicator.invalid { color: #f85149; }

/* Модалки */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 { font-size: 1.25rem; font-weight: 700; }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text-main); }

.modal-form { display: flex; flex-direction: column; gap: 16px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}

/* Настройки */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
}

.settings-card { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.info-list { display: flex; flex-direction: column; gap: 12px; }

.info-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  font-size: 0.9rem;
}

.info-label { color: var(--text-muted); }
.info-val { font-weight: 600; }

.hidden { display: none !important; }
.error-msg { color: #f85149; font-size: 0.85rem; }
