:root {
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #3b82f6;
  --sidebar-text: #cbd5e1;
  --sidebar-width: 240px;
  --content-bg: #f1f5f9;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  min-height: 100vh;
  background: var(--content-bg);
  color: var(--text-primary);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--sidebar-hover);
}

.sidebar-header h2 {
  color: #ffffff;
  font-size: 1.25rem;
}

.nav-links {
  list-style: none;
  padding: 12px 0;
}

.nav-link {
  display: block;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav-link.active {
  background: var(--sidebar-active);
  color: #ffffff;
}

/* Main Content */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page h1 {
  margin-bottom: 24px;
  font-size: 1.5rem;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.summary-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.summary-card .label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.summary-card .value {
  font-size: 2rem;
  font-weight: 700;
}

.summary-card .accent {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  margin-top: 12px;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.data-table th,
.data-table td {
  padding: 14px 18px;
  text-align: left;
}

.data-table th {
  background: var(--sidebar-bg);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr:not(:last-child) td {
  border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-active   { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-on-leave { background: #fef9c3; color: #854d0e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-pending  { background: #fef9c3; color: #854d0e; }
.badge-rejected { background: #fee2e2; color: #991b1b; }

/* Department Cards */
.department-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.dept-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-left: 4px solid var(--sidebar-active);
}

.dept-card h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.dept-card .headcount {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.dept-card .headcount strong {
  color: var(--sidebar-active);
  font-size: 1.4rem;
}

/* ── Top Header Bar ── */

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.top-header__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-header__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0;
}

.top-header__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.user-info__name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-info__role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.logout-btn {
  padding: 8px 18px;
  background: none;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.logout-btn:hover {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

/* ── Sidebar scrollable nav ── */

.nav-links {
  list-style: none;
  padding: 12px 0;
  overflow-y: auto;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}

/* ── Notification Bell ── */

.notif-bell-wrapper {
  position: relative;
}

.notif-bell-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  position: relative;
  padding: 4px;
  line-height: 1;
}

.notif-bell-icon {
  display: inline-block;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  z-index: 5000;
  display: none;
  overflow: hidden;
}

.notif-dropdown--open {
  display: block;
}

.notif-dropdown__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.notif-dropdown__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.notif-mark-all {
  background: none;
  border: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: #3b82f6;
  cursor: pointer;
}

.notif-mark-all:hover {
  text-decoration: underline;
}

.notif-list {
  max-height: 320px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-color);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: #f8fafc;
}

.notif-item--unread {
  background: #eff6ff;
}

.notif-item--unread:hover {
  background: #dbeafe;
}

.notif-item__icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-item__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.notif-item__message {
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.35;
}

.notif-item__time {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.notif-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* ── Sidebar User & Role Badge ── */

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.sidebar-user__name {
  font-size: 0.8rem;
  color: var(--sidebar-text);
  font-weight: 500;
}

.sidebar-role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge--admin {
  background: #fee2e2;
  color: #991b1b;
}

.role-badge--manager {
  background: #fef9c3;
  color: #854d0e;
}

.role-badge--employee {
  background: #dcfce7;
  color: #166534;
}

/* ── Access Denied Page ── */

.access-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.access-denied__icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.access-denied__title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.access-denied__message {
  font-size: 0.92rem;
  max-width: 400px;
  line-height: 1.5;
}

/* ── Responsive: sidebar collapses on small screens ── */

@media (max-width: 768px) {
  .sidebar {
    width: 60px;
    overflow: hidden;
  }

  .sidebar-header h2 {
    display: none;
  }

  .nav-link {
    padding: 12px;
    text-align: center;
    font-size: 0;
  }

  .nav-link::first-letter {
    font-size: 0.9rem;
  }

  .content {
    margin-left: 60px;
    padding: 20px;
  }

  .top-header {
    flex-wrap: wrap;
    gap: 12px;
  }
}
