:root {
  --sidebar-width: 260px;
  --sidebar-collapsed: 78px;
  --brand-primary: #4f46e5;
  --brand-primary-dark: #4338ca;
  --brand-accent: #06b6d4;
  --topbar-height: 64px;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --border-color: #e7e9f0;
  --text-main: #1f2430;
  --text-muted: #6b7280;
}

[data-bs-theme="dark"] {
  --surface: #161a24;
  --surface-2: #10131a;
  --border-color: #262c3a;
  --text-main: #e6e8ee;
  --text-muted: #9aa1b1;
}

* { box-sizing: border-box; }

body {
  background: var(--surface-2);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  transition: width .2s ease;
}
.app-wrapper.sidebar-collapsed .app-sidebar { width: var(--sidebar-collapsed); }
.app-wrapper.sidebar-collapsed .brand-text,
.app-wrapper.sidebar-collapsed .sidebar-nav span { display: none; }

.sidebar-brand {
  height: var(--topbar-height);
  display: flex; align-items: center; gap: .6rem;
  padding: 0 1.2rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-logo { height: 28px; width: 28px; object-fit: contain; }

.sidebar-nav { padding: .75rem; overflow-y: auto; flex: 1; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .8rem;
  padding: .65rem .9rem;
  border-radius: .6rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: .92rem;
  margin-bottom: .15rem;
  white-space: nowrap;
}
.sidebar-nav .nav-link i { width: 18px; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--surface-2); color: var(--brand-primary); }
.sidebar-nav .nav-link.active {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff;
}

/* Content */
.app-content { margin-left: var(--sidebar-width); flex: 1; min-width: 0; transition: margin-left .2s ease; }
.app-wrapper.sidebar-collapsed .app-content { margin-left: var(--sidebar-collapsed); }

.app-topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border-color);
}
.btn-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-muted);
}
.btn-icon:hover { background: var(--surface-2); color: var(--brand-primary); }

.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}

.notif-dot { position: absolute; top: 2px; right: 2px; font-size: .6rem; padding: .2rem .35rem; }
.notif-dropdown { width: 320px; max-height: 380px; overflow-y: auto; }

/* Cards */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(0,0,0,.06); }
.stat-icon {
  width: 52px; height: 52px; border-radius: .9rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff; flex-shrink: 0;
}
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: .85rem; }

.card { background: var(--surface); border: 1px solid var(--border-color); border-radius: 1rem; }
.table { color: var(--text-main); }

@media (max-width: 991px) {
  .app-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .app-wrapper.sidebar-mobile-open .app-sidebar { transform: translateX(0); }
  .app-content { margin-left: 0; }
}
