:root {
  /* ─── BACKGROUND (LIGHT GREY THEME) ───────────────────────────── */
  --bg-base: #f3f4f6;
  --bg-surface: #ffffff;
  --bg-elevated: #f9fafb;
  --bg-hover: #e5e7eb;
  --bg-active: #d1d5db;

  /* ─── BORDERS ───────────────────────────────────────────────── */
  --border: rgba(0,0,0,0.08);
  --border-bright: rgba(0,0,0,0.14);

  /* ─── TEXT (FIXED FOR LIGHT MODE) ───────────────────────────── */
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;

  /* ─── ACCENTS (SLIGHTLY TUNED FOR LIGHT UI) ─────────────────── */
  --accent: #2563eb;
  --accent-dim: rgba(37,99,235,0.12);
  --accent-glow: rgba(37,99,235,0.25);

  --green: #16a34a;
  --green-dim: rgba(22,163,74,0.12);
  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.12);
  --amber: #d97706;
  --amber-dim: rgba(217,119,6,0.12);
  --purple: #7c3aed;
  --purple-dim: rgba(124,58,237,0.12);

  --sidebar-w: 240px;
  --radius: 8px;
  --radius-lg: 12px;
  --font-mono: 'JetBrains Mono', monospace;
  --font-display: 'Syne', sans-serif;
}

/* ─── SHELL ─────────────────────────────────────────────────────────────── */
.shell {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

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

.brand-icon {
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  display: block;
  letter-spacing: -0.5px;
}
.brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 400;
  transition: all 0.15s;
  margin-bottom: 2px;
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0,212,255,0.2);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent);
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}
.nav-badge.online  { background: var(--green-dim);  color: var(--green); }
.nav-badge.running { background: var(--accent-dim);  color: var(--accent); }
.nav-badge.available { background: var(--purple-dim); color: var(--purple); }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; color: var(--text-primary); }
.user-role { font-size: 10px; color: var(--text-muted); }
.logout-btn {
  margin-left: auto;
  color: var(--text-muted);
  display: flex;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.15s;
}
.logout-btn:hover { color: var(--red); background: var(--red-dim); }
.logout-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* ─── MAIN ──────────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.topbar-time { font-family: var(--font-mono); color: var(--text-muted); }

.content-area {
  padding: 24px 28px;
  flex: 1;
}

/* ─── STAT CARDS ────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.stat-card.accent::before { background: var(--accent); }
.stat-card.green::before  { background: var(--green); }
.stat-card.red::before    { background: var(--red); }
.stat-card.amber::before  { background: var(--amber); }
.stat-card.purple::before { background: var(--purple); }

.stat-card:hover { border-color: var(--border-bright); }

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.green  .stat-value { color: var(--green); }
.stat-card.red    .stat-value { color: var(--red); }
.stat-card.amber  .stat-value { color: var(--amber); }
.stat-card.purple .stat-value { color: var(--purple); }
.stat-sub { font-size: 11px; color: var(--text-muted); }

/* ─── SECTION / PANEL ────────────────────────────────────────────────────── */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.panel-actions { display: flex; gap: 8px; }

/* ─── TABLE ─────────────────────────────────────────────────────────────── */
.data-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-secondary);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }
.mono { font-family: var(--font-mono); }

/* ─── STATUS BADGES ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
}
.badge-online, .badge-running  { background: var(--green-dim);  color: var(--green);  }
.badge-online::before, .badge-running::before { background: var(--green); }
.badge-offline, .badge-stopped { background: var(--red-dim);    color: var(--red);    }
.badge-offline::before, .badge-stopped::before { background: var(--red); }
.badge-suspended               { background: var(--amber-dim);  color: var(--amber);  }
.badge-suspended::before       { background: var(--amber); }
.badge-unknown, .badge-creating{ background: var(--bg-hover); color: var(--text-muted); }
.badge-unknown::before, .badge-creating::before { background: var(--text-muted); }
.badge-available               { background: var(--green-dim);  color: var(--green);  }
.badge-available::before       { background: var(--green); }
.badge-assigned                { background: var(--accent-dim); color: var(--accent); }
.badge-assigned::before        { background: var(--accent); }
.badge-reserved                { background: var(--amber-dim);  color: var(--amber);  }
.badge-reserved::before        { background: var(--amber); }
.badge-active                  { background: var(--green-dim);  color: var(--green);  }
.badge-active::before          { background: var(--green); }
.badge-inactive                { background: var(--red-dim);    color: var(--red);    }
.badge-inactive::before        { background: var(--red); }

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; fill: currentColor; }

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover { background: #33ddff; border-color: #33ddff; box-shadow: 0 0 12px var(--accent-glow); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-bright);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-bright); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(255,79,106,0.3);
}
.btn-danger:hover { background: var(--red-dim); }

.btn-success {
  background: transparent;
  color: var(--green);
  border-color: rgba(0,230,118,0.3);
}
.btn-success:hover { background: var(--green-dim); }

.btn-warning {
  background: transparent;
  color: var(--amber);
  border-color: rgba(255,179,0,0.3);
}
.btn-warning:hover { background: var(--amber-dim); }

.btn-sm { padding: 5px 11px; font-size: 11px; }
.btn-xs { padding: 3px 8px; font-size: 10px; border-radius: 5px; }

.btn-group { display: flex; gap: 4px; }

/* ─── FORMS ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.form-label .required { color: var(--red); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-bright);
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-muted); }
.form-select { cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  margin-top: 18px;
}

/* ─── TOAST ──────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.25s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast.warning { border-left: 3px solid var(--amber); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } }

/* ─── VM ACTION BUTTONS ─────────────────────────────────────────────────── */
.vm-actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* ─── SPEC CHIP ─────────────────────────────────────────────────────────── */
.spec-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.spec-chip {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ─── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; fill: currentColor; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 15px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ─── LOADING ────────────────────────────────────────────────────────────── */
.loading-row td { text-align: center; padding: 40px; color: var(--text-muted); }
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── TABS ───────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.tab-btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-btn.active { background: var(--accent-dim); color: var(--accent); border-color: rgba(0,212,255,0.3); }

/* ─── IP PROGRESS BAR ────────────────────────────────────────────────────── */
.ip-bar { width: 100%; height: 4px; background: var(--bg-base); border-radius: 2px; overflow: hidden; }
.ip-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s; }

/* ─── PLAN CARD ──────────────────────────────────────────────────────────── */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 20px;
}
.plan-card {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.2s;
  position: relative;
}
.plan-card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.plan-card.inactive { opacity: 0.5; }
.plan-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.plan-price {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--font-display);
  margin-bottom: 14px;
}
.plan-price span { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.plan-specs { margin-bottom: 16px; }
.plan-spec-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.plan-spec-row:last-child { border-bottom: none; }
.plan-spec-key { color: var(--text-muted); }
.plan-spec-val { color: var(--text-primary); font-weight: 500; }
.plan-actions { display: flex; gap: 6px; }
.plan-status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* ─── LOGIN ──────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(0,212,255,0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(179,136,255,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  padding: 48px 44px;
  width: 420px;
  max-width: 95vw;
  position: relative;
}
.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo .icon { font-size: 44px; color: var(--accent); filter: drop-shadow(0 0 14px var(--accent)); }
.login-logo h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  margin-top: 10px;
}
.login-logo p { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.login-error {
  background: var(--red-dim);
  border: 1px solid rgba(255,79,106,0.3);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ─── NODE CARD ──────────────────────────────────────────────────────────── */
.node-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px;
}
.node-card {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all 0.2s;
}
.node-card:hover { border-color: var(--border-bright); }
.node-card.online  { border-top: 2px solid var(--green); }
.node-card.offline { border-top: 2px solid var(--red); }
.node-card.unknown { border-top: 2px solid var(--text-muted); }
.node-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.node-name { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.node-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.node-detail-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 11.5px; border-bottom: 1px solid var(--border); }
.node-detail-row:last-of-type { border-bottom: none; margin-bottom: 14px; }
.node-detail-key { color: var(--text-muted); }
.node-detail-val { color: var(--text-secondary); font-family: var(--font-mono); }
.node-card-actions { display: flex; gap: 6px; }

/* ─── CONFIRM DIALOG ────────────────────────────────────────────────────── */
.confirm-box { text-align: center; padding: 10px 0; }
.confirm-box .icon { font-size: 40px; margin-bottom: 14px; }
.confirm-box h3 { font-size: 16px; margin-bottom: 8px; }
.confirm-box p { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }

/* ─── DASHBOARD ACTIVITY ─────────────────────────────────────────────────── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.activity-dot.green  { background: var(--green);  box-shadow: 0 0 6px var(--green); }
.activity-dot.red    { background: var(--red);    box-shadow: 0 0 6px var(--red); }
.activity-dot.amber  { background: var(--amber);  box-shadow: 0 0 6px var(--amber); }
.activity-dot.accent { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.activity-text { font-size: 12.5px; color: var(--text-secondary); flex: 1; }
.activity-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

/* ─── SCROLLBAR ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
