:root {
  --bg-primary: #000000;
  --bg-secondary: #09090b;
  --bg-card: #0c0c0e;
  --bg-card-hover: #121215;
  --border: #222226;
  --border-focus: #3f3f46;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent-white: #ffffff;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Subtle Gradient */
.glow-bg {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1000px;
  height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, rgba(16, 185, 129, 0.03) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-white);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

.brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
  color: var(--accent-white);
}

.brand-badge {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 6px;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 6px;
  background: rgba(18, 18, 22, 0.8);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  position: relative;
}

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

.nav-btn.active {
  background: #1e1e24;
  color: var(--accent-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.live-pill {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Main Container */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  position: relative;
  z-index: 1;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

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

.stat-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--accent-white);
}

.stat-online {
  color: var(--accent-emerald);
}

.stat-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: fadeIn 0.2s ease forwards;
}

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

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

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--accent-white);
}

.section-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-primary {
  background: var(--accent-white);
  color: #000000;
  font-weight: 600;
}

.btn-primary:hover {
  background: #e4e4e7;
  transform: translateY(-1px);
}

.glow-btn {
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.15);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-focus);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.2);
}

/* VM Cards */
.vm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 18px;
}

.vm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.vm-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.vm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.vm-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-white);
}

.vm-badge {
  font-size: 11px;
  font-family: 'Geist Mono', monospace;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #60a5fa;
  padding: 2px 8px;
  border-radius: 999px;
}

.vm-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.vm-meta-row {
  display: flex;
  justify-content: space-between;
}

.vm-meta-val {
  font-family: 'Geist Mono', monospace;
  color: var(--text-main);
}

.vm-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Terminal Window */
.terminal-wrapper {
  background: #08080a;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.terminal-header {
  background: #0f0f13;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.terminal-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot.red { background: #ef4444; }
.dot.yellow { background: #eab308; }
.dot.green { background: #22c55e; }

.terminal-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-family: 'Geist Mono', monospace;
  color: var(--text-dim);
}

.terminal-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.terminal-badge.running {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.terminal-progress-bar {
  background: #141419;
  border-bottom: 1px solid var(--border);
  padding: 10px 18px;
  position: relative;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.3) 0%, rgba(16, 185, 129, 0.4) 100%);
  transition: width 0.3s ease;
  z-index: 1;
}

.progress-meta {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: 'Geist Mono', monospace;
  color: #e4e4e7;
}

.terminal-body {
  padding: 18px;
  height: 480px;
  overflow-y: auto;
  font-family: 'Geist Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: #000000;
}

.term-line {
  margin-bottom: 4px;
  word-break: break-all;
  white-space: pre-wrap;
}

.term-line.system { color: #71717a; }
.term-line.info { color: #93c5fd; }
.term-line.command { color: #fbbf24; }
.term-line.output { color: #a1a1aa; }
.term-line.success { color: #34d399; font-weight: 500; }
.term-line.warning { color: #f59e0b; }
.term-line.error { color: #f87171; font-weight: 500; }

/* Table */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.vault-table th {
  padding: 14px 18px;
  color: var(--text-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  background: #0d0d10;
}

.vault-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

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

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-running { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-failed  { background: rgba(244, 63, 94, 0.15); color: #fb7185; }

/* Settings Card */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 680px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-white);
  margin-bottom: 6px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 8px;
}

.input {
  width: 100%;
  background: #111115;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.input:focus {
  border-color: var(--border-focus);
}

.font-mono {
  font-family: 'Geist Mono', monospace;
}

.copy-input-group {
  display: flex;
  gap: 8px;
}

.link {
  color: var(--accent-blue);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.help-text {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 5px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #0d0d11;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8);
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

.modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent-white);
}

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

.modal-close:hover {
  color: var(--text-main);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.row {
  display: flex;
  gap: 14px;
}

.col-8 { flex: 2; }
.col-4 { flex: 1; }

.radio-group {
  display: flex;
  gap: 18px;
}

.radio-label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* User pill */
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #141418;
  border: 1px solid var(--border);
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  font-size: 12px;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #18181b;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.25s ease forwards;
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); color: #34d399; }
.toast.error   { border-color: rgba(244, 63, 94, 0.4); color: #fb7185; }

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