:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1a1f2e;
  --sidebar-text: #a8b2d8;
  --sidebar-active: #4f86f7;
  --topbar-height: 56px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f0f2f7;
  margin: 0;
}

/* ─── Layout ─────────────────────────────────── */
.wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  transition: transform .25s ease;
  z-index: 1000;
}

.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }

.sidebar-brand {
  padding: 16px 20px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 2px;
  letter-spacing: .3px;
}

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sidebar-nav li { margin: 2px 8px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: .9rem;
  transition: all .15s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.sidebar-nav a.active {
  background: rgba(79, 134, 247, .2);
  color: var(--sidebar-active);
  font-weight: 600;
}

.sidebar-nav li.mt-auto { margin-top: auto; }

/* ─── Main Content ───────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}

.main-content.expanded { margin-left: 0; }

.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e5e9f0;
  position: sticky;
  top: 0;
  z-index: 999;
}

.content-area { flex: 1; }

/* ─── Stat Cards ─────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card.mini {
  padding: 16px;
  border: 2px solid transparent;
  transition: border-color .2s;
}

.stat-card.mini:hover { border-color: #4f86f7; }
.stat-card.border-primary { border-color: #4f86f7 !important; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card.mini .stat-value { font-size: 1.4rem; }
.stat-label { font-size: .8rem; color: #6b7280; }

.bg-primary-soft { background: #eff6ff; }
.bg-success-soft { background: #f0fdf4; }
.bg-warning-soft { background: #fffbeb; }
.bg-info-soft    { background: #f0f9ff; }

/* ─── Tables ─────────────────────────────────── */
.table th { font-size: .82rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .02em; }
.table td { font-size: .875rem; }

/* ─── Badges ─────────────────────────────────── */
.badge { font-weight: 500; letter-spacing: .02em; }

.status-running  { background-color: #d1fae5 !important; color: #065f46 !important; }
.status-paused   { background-color: #fef3c7 !important; color: #92400e !important; }
.status-pending  { background-color: #f3f4f6 !important; color: #374151 !important; }
.status-completed{ background-color: #dbeafe !important; color: #1e40af !important; }

/* ─── Buttons ────────────────────────────────── */
.btn-xs {
  padding: 2px 8px;
  font-size: .75rem;
  border-radius: 6px;
}

/* ─── Avatar ─────────────────────────────────── */
.avatar-circle {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f86f7, #764fb5);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ─── Site Selector ──────────────────────────── */
.site-selector { background: #f8fafc; transition: background .15s; }
.site-selector:has(.site-check:checked) { background: #eff6ff; border-color: #4f86f7 !important; }

/* ─── Cards ──────────────────────────────────── */
.card { border: 1px solid #e5e9f0; border-radius: 12px; }
.card-header { background: #f8fafc; border-bottom: 1px solid #e5e9f0; padding: 12px 16px; font-size: .9rem; }

/* ─── Progress ───────────────────────────────── */
.progress { background: #e5e9f0; }

/* ─── Font Mono ──────────────────────────────── */
.font-monospace { font-family: 'Consolas', 'Monaco', monospace; font-size: .85rem; }

.x-small { font-size: .75rem; }

/* ─── Sticky top fix ─────────────────────────── */
.sticky-top { top: 0; }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}
