/* ── Layout ─────────────────────────────────────────────── */
.db-body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  margin: 0;
}

/* Sidebar */
.db-sidebar {
  width: 240px;
  min-height: 100vh;
  background: #0a0e1a;
  border-right: 1px solid var(--surface2);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}
.db-sidebar.collapsed { transform: translateX(-240px); }

.db-brand {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.25rem 1rem;
  font-size: .95rem;
  font-weight: 600;
  border-bottom: 1px solid var(--surface2);
  letter-spacing: .04em;
}

.db-section-label {
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 1rem 1.25rem .4rem;
}

.db-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .75rem; }

.db-nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: .875rem;
  transition: background .15s, color .15s;
  position: relative;
}
.db-nav-link i { font-size: 1rem; flex-shrink: 0; }
.db-nav-link span:first-of-type { flex: 1; }
.db-nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.db-nav-link.active {
  background: rgba(79,142,247,.15);
  color: var(--accent);
  font-weight: 500;
}
.db-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.db-badge {
  background: var(--surface2);
  color: var(--muted);
  font-size: .7rem;
  padding: .15em .6em;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}

.db-sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  font-size: .75rem;
  color: var(--muted);
  border-top: 1px solid var(--surface2);
}

/* Main area */
.db-main {
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  flex: 1;
  transition: margin-left .25s ease;
}
.db-main.expanded { margin-left: 0; }

/* Topbar */
.db-topbar {
  height: 56px;
  background: #0d1117;
  border-bottom: 1px solid var(--surface2);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 90;
}
.db-toggle-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 6px;
  line-height: 1;
  transition: color .15s, background .15s;
}
.db-toggle-btn:hover { color: var(--text); background: var(--surface2); }
.breadcrumb { font-size: .8rem; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--muted); }
.breadcrumb-item.active { color: var(--muted); }

/* Content */
.db-content { flex: 1; padding: 1.75rem 2rem; }

/* Footer */
.db-footer {
  padding: .75rem 2rem;
  font-size: .75rem;
  color: var(--muted);
  border-top: 1px solid var(--surface2);
}

/* ── Stat cards ─────────────────────────────────────────── */
.db-stat {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: border-color .2s, transform .2s;
}
.db-stat:hover { border-color: var(--accent); transform: translateY(-2px); }
.db-stat-icon {
  width: 52px; height: 52px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.db-stat-val { font-size: 2rem; font-weight: 700; line-height: 1; }
.db-stat-lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: .25rem; }

/* ── Panel / Table ──────────────────────────────────────── */
.db-panel {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: 12px;
  overflow: hidden;
}
.db-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--surface2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.db-panel-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; }

/* Status pill in tables */
.s-pill { display:inline-flex; align-items:center; gap:.35rem; font-size:.72rem; font-weight:600;
  padding:.25em .7em; border-radius:99px; text-transform:uppercase; }
.s-pending  { background:rgba(100,116,139,.15); color:#94a3b8; }
.s-running  { background:rgba(79,142,247,.15);  color:var(--accent); }
.s-done     { background:rgba(34,197,94,.15);   color:var(--success); }
.s-failed   { background:rgba(239,68,68,.15);   color:var(--error); }
.s-admin    { background:rgba(124,58,237,.15);  color:#a78bfa; }
.s-user     { background:rgba(100,116,139,.15); color:#94a3b8; }
.s-info     { background:rgba(79,142,247,.15);  color:var(--accent); }
.s-warn     { background:rgba(245,158,11,.15);  color:var(--warn); }
.s-error    { background:rgba(239,68,68,.15);   color:var(--error); }
.s-system   { background:rgba(124,58,237,.15);  color:#a78bfa; }
.s-debug    { background:rgba(100,116,139,.15); color:#94a3b8; }

/* ── Donut progress bars ─────────────────────────────────── */
.mini-progress { height: 4px; border-radius: 2px; background: var(--surface2); overflow: hidden; margin-top: .4rem; }
.mini-progress-bar { height: 100%; border-radius: 2px; }

/* ── Avatar ─────────────────────────────────────────────── */
.db-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: .85rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.db-avatar.sm { width: 28px; height: 28px; font-size: .75rem; }

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