:root {
  --bg: #0d121c;
  --panel: #131b2a;
  --panel-2: #1b263b;
  --border: #24344d;
  --text: #eef2f6;
  --muted: #8c9eb5;
  --accent: #10b981;
  --accent-hover: #059669;
  --danger: #ef4444;
  --blue: #3b82f6;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top, #1b263b 0%, var(--bg) 80%);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Auth */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}
.logo { font-size: 48px; margin-bottom: 6px; }
h1, h2, h3, h4 { margin: 0; }
.sub { color: var(--muted); font-size: 0.88rem; margin: 4px 0 16px; }

.tabs {
  display: flex;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.tab.active { background: var(--panel-2); color: #fff; }

.field {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 12px;
}
input, select {
  background: #090e17;
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
}
input:focus, select:focus { outline: none; border-color: var(--blue); }

button {
  font-family: inherit;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}
.btn-primary { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: #fff; }
.btn-full { width: 100%; margin-top: 8px; }
.btn-icon { background: transparent; color: var(--muted); font-size: 1.2rem; }
.err { color: #f87171; font-size: 0.85rem; margin: 0 0 10px; }

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.nav-brand { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.nav-user { display: flex; align-items: center; gap: 14px; font-size: 0.9rem; color: var(--muted); }

.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }

/* Servers Grid */
.servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}
.server-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.server-card:hover { transform: translateY(-2px); border-color: var(--blue); }
.server-card.selected { border-color: var(--blue); background: var(--panel-2); }
.server-title-row { display: flex; justify-content: space-between; align-items: center; }
.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  text-transform: uppercase;
}
.status-badge.online { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.status-badge.stopped { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.server-ip {
  background: #090e17;
  padding: 6px 10px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #93c5fd;
  display: inline-block;
  margin-top: 4px;
}

/* Detail Section */
.detail-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
}
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 14px;
}
.row { display: flex; gap: 10px; align-items: center; }
.detail-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}
@media (max-width: 850px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.console-card {
  background: #090e17;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.console-box {
  background: #05080e;
  border-radius: 10px;
  padding: 12px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #93c5fd;
  height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 10px 0;
}
.console-input-row { display: flex; gap: 8px; }
.console-input-row input { flex: 1; }

.options-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

/* Modals */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  padding: 24px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.subdomain-input-wrap {
  display: flex;
  align-items: center;
  background: #090e17;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.subdomain-input-wrap input {
  border: 0;
  border-radius: 0;
  flex: 1;
}
.subdomain-suffix {
  padding: 0 12px;
  background: var(--panel-2);
  color: #93c5fd;
  font-size: 0.85rem;
  border-left: 1px solid var(--border);
  height: 42px;
  display: flex;
  align-items: center;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 200;
}
