:root {
  --bg-main: #0c0e14;
  --bg-sidebar: #12151e;
  --bg-card: #161a26;
  --bg-card-hover: #1c2232;
  --bg-input: #10131d;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --purple: #8b5cf6;
  --purple-bg: rgba(139, 92, 246, 0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --rose: #f43f5e;
  --rose-bg: rgba(244, 63, 94, 0.12);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* APP LAYOUT */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  flex-shrink: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.brand-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.brand-text span {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  transition: color 0.15s ease;
}

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

.nav-item:hover svg {
  color: var(--primary);
}

.nav-item.active {
  background-color: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.nav-item.active svg {
  color: #fff;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vps-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.vps-tag-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.vps-tag-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(18, 21, 30, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-left h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.refresh-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.content-body {
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.2s ease;
}

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

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

/* GRIDS */
.grid {
  display: grid;
  gap: 20px;
}
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 14px 18px; }
  .content-body { padding: 18px 18px 40px; }
}

/* CARDS */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* METRIC CARDS */
.metric-card {
  padding: 18px 20px;
}

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

.metric-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bg-blue { background-color: var(--blue-bg); color: var(--blue); }
.bg-purple { background-color: var(--purple-bg); color: var(--purple); }
.bg-green { background-color: var(--emerald-bg); color: var(--emerald); }
.bg-amber { background-color: var(--amber-bg); color: var(--amber); }
.bg-rose { background-color: var(--rose-bg); color: var(--rose); }

.metric-value {
  font-size: 26px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.metric-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* TABLES */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  padding: 10px 14px;
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

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

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.info-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.info-table td:first-child {
  color: var(--text-muted);
  width: 40%;
}

/* SERVICE GRID */
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.service-badge-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* BUTTONS & INPUTS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  cursor: pointer;
}

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

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

.btn-danger-outline {
  background-color: transparent;
  color: var(--rose);
  border-color: rgba(244, 63, 94, 0.3);
}
.btn-danger-outline:hover {
  background-color: var(--rose-bg);
}

.btn-ghost-sm {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn-ghost-sm:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.form-select, .form-input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.form-select:focus, .form-input:focus {
  border-color: var(--border-focus);
}

/* BADGES & PILLS */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-success { background-color: var(--emerald-bg); color: var(--emerald); }
.badge-success .badge-dot { background-color: var(--emerald); }
.badge-danger { background-color: var(--rose-bg); color: var(--rose); }
.badge-danger .badge-dot { background-color: var(--rose); }
.badge-warning { background-color: var(--amber-bg); color: var(--amber); }
.badge-warning .badge-dot { background-color: var(--amber); }
.badge-info { background-color: var(--blue-bg); color: var(--blue); }
.badge-info .badge-dot { background-color: var(--blue); }

.pill {
  padding: 3px 9px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* CONSOLE / LOGS */
.console-card {
  padding: 0;
  overflow: hidden;
}

.console-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.log-controls-left, .log-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.search-input {
  min-width: 220px;
}

.console-body {
  background-color: #080a0f;
  padding: 16px;
  max-height: 580px;
  overflow-y: auto;
}

.console-output {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: #d1d5db;
  white-space: pre-wrap;
  word-break: break-word;
}

/* DATABASE EXPLORER */
.db-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  margin-top: 14px;
}

.db-tables-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.db-tables-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.db-table-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 480px;
  overflow-y: auto;
}

.db-table-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.db-table-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}
.db-table-btn.active {
  background: var(--blue-bg);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--primary);
  font-weight: 600;
}

.db-data-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.db-data-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-indicator {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.db-table-responsive {
  max-height: 460px;
  overflow: auto;
}

/* UPTIME CARDS */
.uptime-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease;
}
.uptime-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.uptime-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.uptime-icon-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

.uptime-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
}
.uptime-url:hover {
  color: var(--primary);
  text-decoration: underline;
}

.uptime-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: var(--text-muted);
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: modalScale 0.2s ease;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  font-size: 13.5px;
  z-index: 2000;
  display: none;
  animation: slideUp 0.2s ease;
}
.toast.show {
  display: block;
}

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

/* UTILITIES */
.text-emerald { color: var(--emerald); }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.muted { color: var(--text-dim); }

.skeleton-loader {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
}
