/* ── Variables ───────────────────────────────────────────── */
:root {
  --sidebar-width: 250px;
  --sidebar-collapsed: 68px;
  --topbar-height: 60px;
  --sidebar-bg: #1a2332;
  --sidebar-hover: rgba(255,255,255,.07);
  --sidebar-active: rgba(13,110,253,.2);
  --sidebar-text: rgba(255,255,255,.75);
  --sidebar-section: rgba(255,255,255,.35);
  --primary: #0d6efd;
}

/* ── Reset / Base ────────────────────────────────────────── */
* { box-sizing: border-box; }
body { background: #f0f2f5; font-family: 'Segoe UI', system-ui, sans-serif; margin: 0; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; height: 100vh; width: var(--sidebar-width);
  background: var(--sidebar-bg); display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden; z-index: 1030;
  transition: width .25s ease;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }

.sidebar-brand {
  display: flex; align-items: center; padding: 18px 20px;
  color: #fff; font-size: 1rem; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.08);
  white-space: nowrap; min-height: var(--topbar-height);
}
.sidebar-brand i { font-size: 1.4rem; flex-shrink: 0; }

.sidebar-nav { padding: 12px 0 20px; flex: 1; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }

.nav-section {
  padding: 14px 20px 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--sidebar-section);
  white-space: nowrap; overflow: hidden;
}

.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 20px; color: var(--sidebar-text); font-size: .875rem;
  border-radius: 0; transition: all .15s ease; white-space: nowrap;
}
.sidebar-nav .nav-link i { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--sidebar-active); color: #fff; border-left: 3px solid var(--primary); }

/* Collapsed sidebar */
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar .nav-link span { display: none; }
body.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: 11px; }
body.sidebar-collapsed .main-wrapper { margin-left: var(--sidebar-collapsed); }

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

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 1020;
  height: var(--topbar-height); background: #fff;
  border-bottom: 1px solid #e9ecef;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-left, .topbar-right { display: flex; align-items: center; }

/* ── Page Content ────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }
.page-footer { border-top: 1px solid #e9ecef; background: #fff; }

/* ── Auth Layout ─────────────────────────────────────────── */
.auth-body {
  background: linear-gradient(135deg, #1a2332 0%, #2c3e50 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.auth-wrapper { width: 100%; max-width: 440px; padding: 20px; }
.auth-card {
  background: #fff; border-radius: 16px;
  padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.auth-logo { text-align: center; margin-bottom: 28px; }

/* ── Cards ───────────────────────────────────────────────── */
.stat-card { transition: transform .15s ease, box-shadow .15s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,.12) !important; }

/* ── Avatar ──────────────────────────────────────────────── */
.avatar-sm {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 600; flex-shrink: 0;
}

/* ── Tables ──────────────────────────────────────────────── */
.table th { font-size: .8rem; font-weight: 600; letter-spacing: .3px; }
.table td { font-size: .875rem; vertical-align: middle; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { font-weight: 500; font-size: .75em; }

/* ── Dark Mode ───────────────────────────────────────────── */
[data-bs-theme="dark"] body { background: #12181f; }
[data-bs-theme="dark"] .topbar { background: #1e2530; border-color: #2d3748; }
[data-bs-theme="dark"] .page-content { background: #12181f; }
[data-bs-theme="dark"] .card { background: #1e2530; border-color: #2d3748 !important; }
[data-bs-theme="dark"] .table-light { background: #2d3748; }
[data-bs-theme="dark"] .page-footer { background: #1e2530; border-color: #2d3748; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .page-content { padding: 16px; }
}

/* ── Utilities ───────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.fs-xs { font-size: .75rem; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Status indicators */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 4px;
}

/* Payslip button */
.btn-payslip { background: #e74c3c; color: #fff; border: none; }
.btn-payslip:hover { background: #c0392b; color: #fff; }

/* Timeline */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content:''; position:absolute; left:10px; top:0; bottom:0; width:2px; background:#e9ecef; }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content:''; position:absolute; left:-24px; top:4px;
  width:10px; height:10px; border-radius:50%; background: var(--primary);
  border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary);
}
