:root {
  --sidebar-width: 250px;
  --sidebar-bg: #1e2635;
  --sidebar-bg-hover: #2b3648;
  --sidebar-text: #aeb8c9;
  --sidebar-active: #4f7cff;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f4f6fb;
  color: #2d3748;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px;
  font-size: 1.05rem; font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand i { color: var(--sidebar-active); font-size: 1.3rem; }
.sidebar-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav .nav-link,
.sidebar-footer .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 22px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .92rem;
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i,
.sidebar-footer .nav-link i { width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover,
.sidebar-footer .nav-link:hover { background: var(--sidebar-bg-hover); color: #fff; }
.sidebar-nav .nav-link.active {
  background: var(--sidebar-bg-hover);
  color: #fff;
  border-left-color: var(--sidebar-active);
}
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.07); padding: 8px 0; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1035;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e5e9f2;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; flex: 1; }
.topbar-user .dropdown-toggle {
  color: #2d3748; text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.topbar-user i { font-size: 1.4rem; color: var(--sidebar-active); }

.page-body { padding: 22px; flex: 1; }
.page-footer {
  padding: 14px 22px; text-align: center;
  color: #8a94a6; font-size: .85rem;
  border-top: 1px solid #e5e9f2; background: #fff;
}

/* ---------- Stat cards ---------- */
.stat-card {
  border: none; border-radius: 12px; color: #fff;
  overflow: hidden; position: relative;
}
.stat-card .stat-body { padding: 18px 20px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .82rem; opacity: .9; margin-top: 6px; }
.stat-card .stat-icon {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 2.6rem; opacity: .22;
}
.bg-grad-blue   { background: linear-gradient(135deg,#4f7cff,#3358d4); }
.bg-grad-green  { background: linear-gradient(135deg,#22c55e,#15803d); }
.bg-grad-orange { background: linear-gradient(135deg,#f59e0b,#d97706); }
.bg-grad-red    { background: linear-gradient(135deg,#ef4444,#b91c1c); }
.bg-grad-purple { background: linear-gradient(135deg,#8b5cf6,#6d28d9); }
.bg-grad-teal   { background: linear-gradient(135deg,#14b8a6,#0f766e); }
.bg-grad-pink   { background: linear-gradient(135deg,#ec4899,#be185d); }
.bg-grad-slate  { background: linear-gradient(135deg,#64748b,#334155); }

/* ---------- Cards / tables ---------- */
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card-header { background: #fff; border-bottom: 1px solid #eef1f7; font-weight: 600; border-radius: 12px 12px 0 0 !important; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; border-bottom-width: 1px; }
.table td { vertical-align: middle; }
.btn-icon { padding: .25rem .5rem; }

/* ---------- Login ---------- */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,#1e2635,#3358d4);
  padding: 20px;
}
.login-card { width: 100%; max-width: 400px; border-radius: 14px; }
.login-card .login-head { text-align: center; padding: 28px 20px 8px; }
.login-card .login-head i { font-size: 2.4rem; color: var(--sidebar-active); }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-backdrop.show { display: block; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .page-footer, .no-print, .sidebar-backdrop { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
  body { background: #fff; }
  .invoice-print { box-shadow: none !important; border: none !important; }
}

.invoice-print { max-width: 800px; margin: 0 auto; background: #fff; padding: 40px; }
.invoice-print .inv-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px; }
.invoice-print h2 { margin: 0; }
.invoice-print .inv-table th { background: #f4f6fb; }
