*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-sidebar: #cbd5e1;
  --text-sidebar-muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-glow: rgba(37, 99, 235, 0.12);
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --sidebar-width: 268px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.12);
  --transition: 0.2s ease;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.text-muted-sm { color: var(--text-muted); font-size: 0.8rem; }

.brand-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.brand-icon.sm { width: 38px; height: 38px; font-size: 0.85rem; border-radius: 10px; flex-shrink: 0; }

/* Layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.08);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-title { font-weight: 700; font-size: 1.05rem; color: #fff; letter-spacing: -0.02em; }
.sidebar-company { font-size: 0.75rem; color: #60a5fa; margin-top: 2px; font-weight: 500; }

.sidebar-nav { flex: 1; padding: 1rem 0.85rem; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--text-sidebar);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 3px;
  text-align: left;
  text-decoration: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-item.active { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
.nav-item.active svg { opacity: 1; }

.nav-group { margin-bottom: 4px; }
.nav-group-toggle {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  padding: 0.7rem 0.9rem; border: none; background: transparent;
  color: var(--text-sidebar); font-size: 0.875rem; font-weight: 500;
  font-family: inherit; border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition); text-align: left;
}
.nav-group-toggle svg:first-child { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-group-toggle:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-chevron { width: 14px !important; height: 14px !important; margin-left: auto; transition: transform 0.2s ease; opacity: 0.6; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }
.nav-sub { display: none; padding-left: 0.5rem; margin-top: 2px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub-item {
  display: block; padding: 0.55rem 0.9rem 0.55rem 2.5rem;
  color: var(--text-sidebar-muted); font-size: 0.825rem; font-weight: 500;
  text-decoration: none; border-radius: var(--radius-sm); transition: var(--transition);
  margin-bottom: 2px;
}
.nav-sub-item:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-sub-item.active { background: rgba(37, 99, 235, 0.15); color: #93c5fd; }

.sidebar-footer {
  padding: 1.15rem 1.25rem 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.live-clock { text-align: center; margin-bottom: 0.85rem; padding: 0.75rem; background: rgba(255,255,255,0.04); border-radius: var(--radius-sm); }
.clock-time { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; letter-spacing: 0.5px; }
.clock-date { font-size: 0.7rem; color: var(--text-sidebar-muted); margin-top: 4px; }
.sidebar-user { font-size: 0.75rem; color: var(--text-sidebar-muted); text-align: center; margin-bottom: 0.65rem; word-break: break-all; }
.sidebar-footer .btn-ghost { color: var(--text-sidebar); border-color: rgba(255,255,255,0.15); }
.sidebar-footer .btn-ghost:hover { background: rgba(255,255,255,0.08); color: #fff; border-color: rgba(255,255,255,0.25); }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem 2.25rem;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 1.625rem; font-weight: 700; letter-spacing: -0.025em; color: var(--text-primary); }
.page-subtitle { color: var(--text-secondary); font-size: 0.925rem; margin-top: 0.2rem; }
.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Forms */
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.4rem; margin-top: 0.9rem; letter-spacing: 0.01em; }
.form-label:first-child { margin-top: 0; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.575rem 1.15rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-full { width: 100%; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card .stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.stat-card .stat-value { font-size: 1.875rem; font-weight: 700; margin-top: 0.4rem; letter-spacing: -0.02em; }
.stat-card .stat-value.accent { color: var(--accent); }
.stat-card .stat-value.success { color: var(--success); }
.stat-card .stat-value.warning { color: var(--warning); }
.stat-card .stat-value.info { color: var(--info); }

/* Cards & Tables */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 1rem; color: var(--text-primary); letter-spacing: -0.01em; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

.badge {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-active { background: #ecfdf5; color: var(--success); }
.badge-leave { background: #fffbeb; color: var(--warning); }
.badge-inactive { background: #f1f5f9; color: var(--text-muted); }
.badge-high { background: #fef2f2; color: var(--danger); }
.badge-medium { background: #fffbeb; color: var(--warning); }
.badge-low { background: #eff6ff; color: var(--info); }
.badge-progress { background: var(--accent-light); color: var(--accent); }
.badge-completed { background: #ecfdf5; color: var(--success); }
.badge-onhold { background: #f1f5f9; color: var(--text-muted); }

.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar .form-input, .toolbar .form-select { width: auto; min-width: 180px; margin: 0; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1.25rem;
}
.pagination-info { font-size: 0.85rem; color: var(--text-muted); margin-right: 0.5rem; }
.page-btn {
  padding: 0.4rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.bar-chart { display: flex; flex-direction: column; gap: 0.7rem; }
.bar-row { display: flex; align-items: center; gap: 0.75rem; }
.bar-label { width: 120px; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); text-align: right; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 24px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; min-width: 2px; }
.bar-fill.employee { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.bar-fill.project { background: linear-gradient(90deg, #0891b2, #06b6d4); }
.bar-fill.report { background: linear-gradient(90deg, #1d4ed8, #2563eb); }
.bar-fill.utilization { background: linear-gradient(90deg, #059669, #10b981); }
.bar-value { width: 48px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.action-btns { display: flex; gap: 0.35rem; }
.btn-icon { padding: 0.4rem; background: transparent; border: 1px solid var(--border); color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); font-size: 0.85rem; }
.btn-icon:hover { color: var(--text-primary); border-color: var(--border-light); background: var(--bg-card-hover); }
.btn-icon.danger:hover { color: var(--danger); border-color: var(--danger); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.modal {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px;
  width: 100%; max-width: 540px; max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; }
.checkbox-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 260px; overflow-y: auto; }
.checkbox-item { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem; border-radius: var(--radius-sm); cursor: pointer; }
.checkbox-item:hover { background: #f8fafc; }
.checkbox-item input { accent-color: var(--accent); width: 16px; height: 16px; }
.checkbox-item label { cursor: pointer; font-size: 0.875rem; flex: 1; }

/* Toast */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  padding: 0.85rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 1.25rem; }
  .charts-row, .form-row { grid-template-columns: 1fr; }
  .bar-label { width: 80px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .form-input, .toolbar .form-select { width: 100%; min-width: unset; }
}
