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

:root {
  --bg:        #09090f;
  --sidebar:   #0f0f1a;
  --card:      #13131e;
  --card2:     #191926;
  --border:    #1e1e30;
  --border2:   #252538;
  --cyan:      #00d4ff;
  --violet:    #7c5cfc;
  --green:     #00d97e;
  --red:       #e63757;
  --yellow:    #f6c343;
  --orange:    #fd7e14;
  --text:      #e8e8f0;
  --muted:     #888896;
  --dim:       #55556a;
  --sidebar-w: 240px;
  --header-h:  60px;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

/* ── Layout ─────────────────────────────────────────── */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; color: #09090f; letter-spacing: -1px;
  flex-shrink: 0;
}
.logo-title { font-size: 13px; font-weight: 700; letter-spacing: -.2px; line-height: 1.2; }
.logo-sub   { font-size: 10px; color: var(--dim); letter-spacing: .5px; text-transform: uppercase; }

nav { padding: 12px 10px; flex: 1; }
.nav-section { margin-bottom: 20px; }
.nav-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--dim); padding: 0 10px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none;
  cursor: pointer; transition: all .15s;
  font-size: 13.5px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: .8; }
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-item.active { background: rgba(0,212,255,.08); color: var(--cyan); }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 2px;
  background: var(--cyan);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
}
.admin-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: rgba(255,255,255,.03);
}
.admin-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.admin-info { flex: 1; min-width: 0; }
.admin-name  { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-role  { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
}
.page-title { font-size: 16px; font-weight: 700; letter-spacing: -.3px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── Cards ──────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
}
.card-title {
  font-size: 13px; font-weight: 700; letter-spacing: -.1px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 14px;
}

/* ── Stats Grid ─────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; position: relative; overflow: hidden;
  transition: border-color .2s, transform .15s;
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 10px; }
.stat-value { font-size: 32px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat-icon  { position: absolute; right: 18px; top: 18px; opacity: .12; }
.stat-card.cyan  .stat-value { color: var(--cyan); }
.stat-card.cyan  .stat-icon  { color: var(--cyan); opacity: .15; }
.stat-card.violet .stat-value { color: var(--violet); }
.stat-card.green  .stat-value { color: var(--green); }
.stat-card.yellow .stat-value { color: var(--yellow); }

/* ── Progress bars ──────────────────────────────────── */
.metric-row { margin-bottom: 18px; }
.metric-row:last-child { margin-bottom: 0; }
.metric-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.metric-name { font-size: 13px; font-weight: 500; }
.metric-val  { font-size: 13px; font-weight: 700; }
.progress { height: 6px; background: rgba(255,255,255,.05); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.progress-fill.cyan   { background: linear-gradient(90deg, var(--cyan), #00a8cc); }
.progress-fill.violet { background: linear-gradient(90deg, var(--violet), #5a3fcc); }
.progress-fill.green  { background: linear-gradient(90deg, var(--green), #00a862); }
.progress-fill.warn   { background: linear-gradient(90deg, var(--yellow), var(--orange)); }
.progress-fill.danger { background: linear-gradient(90deg, var(--red), #c0193a); }

/* ── Table ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 0 16px 12px 0;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 14px 16px 14px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
.td-actions { display: flex; gap: 6px; align-items: center; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.badge.active   { background: rgba(0,217,126,.12); color: var(--green);  }
.badge.active::before { background: var(--green); }
.badge.suspended{ background: rgba(246,195,67,.12); color: var(--yellow); }
.badge.suspended::before { background: var(--yellow); }
.badge.deleted  { background: rgba(230,55,87,.12); color: var(--red); }
.badge.deleted::before  { background: var(--red); }
.badge.running  { background: rgba(0,217,126,.12); color: var(--green); }
.badge.running::before  { background: var(--green); animation: pulse 2s infinite; }
.badge.exited   { background: rgba(255,255,255,.06); color: var(--muted); }
.badge.exited::before   { background: var(--dim); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* ── Buttons ────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; text-decoration: none; }
.btn svg { flex-shrink: 0; }
.btn-primary  { background: linear-gradient(135deg, var(--cyan), var(--violet)); color: #09090f; }
.btn-primary:hover  { opacity: .9; transform: translateY(-1px); }
.btn-ghost    { background: rgba(255,255,255,.05); color: var(--text); border: 1px solid var(--border2); }
.btn-ghost:hover    { background: rgba(255,255,255,.09); }
.btn-danger   { background: rgba(230,55,87,.12); color: var(--red); border: 1px solid rgba(230,55,87,.25); }
.btn-danger:hover   { background: rgba(230,55,87,.2); }
.btn-warn     { background: rgba(246,195,67,.12); color: var(--yellow); border: 1px solid rgba(246,195,67,.25); }
.btn-warn:hover     { background: rgba(246,195,67,.2); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ── Forms / Inputs ─────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text); font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,.08);
}
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888896' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.field select option { background: var(--card2); }

.search-wrap { position: relative; }
.search-wrap input { padding-left: 36px; }
.search-wrap .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--dim); pointer-events: none; }

/* ── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity .2s;
  pointer-events: none;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 14px; padding: 28px;
  width: 100%; max-width: 480px;
  transform: translateY(12px); transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-title { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; transition: color .15s, background .15s; }
.modal-close:hover { color: var(--text); background: rgba(255,255,255,.05); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Toast notifications ────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  backdrop-filter: blur(16px);
  animation: slideUp .25s ease;
  max-width: 380px;
}
.toast.success { background: rgba(0,217,126,.15); border: 1px solid rgba(0,217,126,.3); color: var(--green); }
.toast.error   { background: rgba(230,55,87,.15);  border: 1px solid rgba(230,55,87,.3);  color: var(--red); }
.toast.info    { background: rgba(0,212,255,.12);   border: 1px solid rgba(0,212,255,.3);  color: var(--cyan); }

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

/* ── Empty state ────────────────────────────────────── */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon { opacity: .2; margin-bottom: 16px; }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13px; }

/* ── Misc ───────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-cyan { color: var(--cyan); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-size: 12px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: rgba(124,92,252,.15); color: var(--violet); }
.secret-val { letter-spacing: 2px; font-family: monospace; color: var(--muted); }

/* Loading spinner */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border2); border-top-color: var(--cyan); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Pagination */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 20px; }
.page-btn { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--border2); background: none; color: var(--muted); cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.page-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.page-btn.active { background: rgba(0,212,255,.12); border-color: rgba(0,212,255,.3); color: var(--cyan); font-weight: 700; }
.page-btn:disabled { opacity: .3; cursor: not-allowed; }

/* Container status dots */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.running { background: var(--green); animation: pulse 2s infinite; box-shadow: 0 0 6px var(--green); }
.dot.exited  { background: var(--dim); }
.dot.paused  { background: var(--yellow); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .sidebar-logo .logo-title, .sidebar-logo .logo-sub,
  .nav-item span, .nav-section-label, .admin-info { display: none; }
  .sidebar-logo { justify-content: center; padding: 16px; }
  .admin-chip { justify-content: center; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-item.active::before { left: 0; top: 10%; bottom: 10%; }
  .content { padding: 20px 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
