:root {
  --bg: #0a0b0f;
  --surface: #12141c;
  --surface2: #1a1d28;
  --border: #2a2f42;
  --text: #e8eaf0;
  --muted: #8b92a8;
  --accent: #7c6cff;
  --accent2: #4fd1c5;
  --danger: #ff6b7a;
  --warn: #ffc857;
  --ok: #5ee08a;
  --radius: 12px;
  --font: 'Outfit', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
}

.brand { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 2rem; }
.brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.4rem;
}
.brand h1 { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.04em; }
.brand p { font-size: 0.75rem; color: var(--muted); }

nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nav-item {
  background: none; border: none; color: var(--muted);
  text-align: left; padding: 0.65rem 0.85rem;
  border-radius: 8px; cursor: pointer; font: inherit; font-size: 0.95rem;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }

.sidebar-footer { padding-top: 1rem; border-top: 1px solid var(--border); }
.sys-status { font-size: 0.75rem; color: var(--muted); font-family: var(--mono); }

.content { flex: 1; padding: 2rem; overflow-y: auto; max-height: 100vh; }
.view { display: none; }
.view.active { display: block; }

.page-header { margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.75rem; font-weight: 700; }
.page-header p { color: var(--muted); margin-top: 0.25rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card h3 { margin-bottom: 1rem; font-size: 1rem; }
.mt { margin-top: 1.25rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat .val { font-size: 2rem; font-weight: 700; font-family: var(--mono); }
.stat .lbl { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.85rem; color: var(--muted); }
input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
small { font-size: 0.75rem; }
code { font-family: var(--mono); background: var(--surface2); padding: 0.1rem 0.35rem; border-radius: 4px; }

.form-actions { grid-column: 1 / -1; }

.btn {
  border: none; border-radius: 8px; padding: 0.55rem 1rem;
  font: inherit; cursor: pointer; font-weight: 600; font-size: 0.9rem;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.9; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: var(--surface2); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }

.service-row, .db-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.service-row:last-child, .db-row:last-child { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
  text-transform: uppercase;
}
.badge.running { background: rgba(94, 224, 138, 0.15); color: var(--ok); }
.badge.error { background: rgba(255, 107, 122, 0.15); color: var(--danger); }
.badge.deploying { background: rgba(255, 200, 87, 0.15); color: var(--warn); }
.badge.stopped, .badge.pending { background: rgba(139, 146, 168, 0.15); color: var(--muted); }

.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.empty { color: var(--muted); padding: 2rem; text-align: center; }

dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0;
  max-width: 720px;
  width: 90vw;
}
dialog::backdrop { background: rgba(0,0,0,0.6); }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
#modal-body { padding: 1.25rem; max-height: 60vh; overflow-y: auto; }

.log-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 0.75rem;
}

.domain-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border);
}
.domain-row:last-child { border-bottom: none; }

@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; }
  .service-row, .db-row { grid-template-columns: 1fr; }
}
