:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #EFF6FF;
  --secondary: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --dark: #1E293B;
  --gray-900: #111827;
  --gray-800: #1F2937;
  --gray-700: #374151;
  --gray-600: #4B5563;
  --gray-500: #6B7280;
  --gray-400: #9CA3AF;
  --gray-300: #D1D5DB;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --gray-50: #F9FAFB;
  --white: #FFFFFF;
  --sidebar-width: 280px;
  --header-height: 64px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--gray-50); color: var(--gray-900); line-height: 1.5; }

/* ── Utilities ─────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-gray { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success { color: var(--secondary); }
.text-primary { color: var(--primary); }
.w-full { width: 100%; }

/* ── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; transition: var(--transition); text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-300); }
.btn-success { background: var(--secondary); color: var(--white); }
.btn-success:hover:not(:disabled) { background: #059669; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #DC2626; }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-icon { padding: 8px; border-radius: var(--radius); background: transparent; border: none; cursor: pointer; color: var(--gray-600); transition: var(--transition); }
.btn-icon:hover { background: var(--gray-100); color: var(--gray-900); }

/* ── Form Inputs ───────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 14px; font-weight: 500; color: var(--gray-700); }
.form-input {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius); font-size: 14px; background: var(--white);
  transition: var(--transition); outline: none; color: var(--gray-900);
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-input::placeholder { color: var(--gray-400); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ── Cards ─────────────────────────────────────── */
.card { background: var(--white); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }

/* ── Stats Cards ───────────────────────────────── */
.stat-card { background: var(--white); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-info h3 { font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-info p { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* ── Badge ─────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-green { background: #D1FAE5; color: #059669; }
.badge-red { background: #FEE2E2; color: #DC2626; }
.badge-yellow { background: #FEF3C7; color: #D97706; }
.badge-orange { background: #FFEDD5; color: #EA580C; }
.badge-blue { background: #DBEAFE; color: #2563EB; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ── Table ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: var(--gray-50); }
th { padding: 12px 16px; text-align: left; font-weight: 600; color: var(--gray-600); font-size: 13px; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* ── Toast Notifications ───────────────────────── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 18px; border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; min-width: 280px; max-width: 400px; display: flex; align-items: center; gap: 10px; animation: slideIn .3s ease; border-left: 4px solid; }
.toast-success { border-color: var(--secondary); color: #065F46; }
.toast-error { border-color: var(--danger); color: #991B1B; }
.toast-warning { border-color: var(--warning); color: #92400E; }
.toast-info { border-color: var(--info); color: #1E40AF; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Modal ─────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); }
.modal { background: var(--white); border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 500px; box-shadow: var(--shadow-lg); animation: modalIn .25s ease; }
.modal-lg { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Sidebar Layout ────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  background:
    radial-gradient(circle at top left, rgba(59,130,246,.24), transparent 32%),
    linear-gradient(180deg, #0F172A 0%, #111827 48%, #0B1120 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
  border-right: 1px solid rgba(255,255,255,.08);
  box-shadow: 18px 0 40px rgba(15,23,42,.18);
}
.sidebar-logo {
  padding: 24px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0));
}
.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -.02em;
}
.sidebar-logo p {
  font-size: 12px;
  color: rgba(255,255,255,.62);
  margin-top: 4px;
}
.sidebar-nav {
  flex: 1;
  padding: 18px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.38);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 12px 10px 6px;
  margin-top: 6px;
  position: relative;
}
.nav-section-title::after {
  content: '';
  display: block;
  width: 28px;
  height: 2px;
  border-radius: 999px;
  background: rgba(59,130,246,.55);
  margin-top: 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  color: rgba(255,255,255,.74);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(59,130,246,.12), transparent 70%);
  opacity: 0;
  transition: var(--transition);
}
.nav-link:hover {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.08);
  color: var(--white);
  transform: translateX(2px);
}
.nav-link:hover::before { opacity: 1; }
.nav-link.active {
  background: linear-gradient(135deg, rgba(37,99,235,.96), rgba(59,130,246,.92));
  color: var(--white);
  border-color: rgba(255,255,255,.12);
  box-shadow: 0 12px 24px rgba(37,99,235,.28);
}
.nav-link.active::before { opacity: 0; }
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
}
.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.nav-link span:not(.nav-icon) {
  position: relative;
  z-index: 1;
}
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.03));
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--white);
  flex-shrink: 0;
  box-shadow: 0 10px 24px rgba(37,99,235,.26);
}
.user-info p:first-child { font-size: 13px; font-weight: 700; color: var(--white); }
.user-info p:last-child { font-size: 11px; color: rgba(255,255,255,.58); margin-top: 2px; }

/* ── Main Content ──────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: var(--header-height); background: var(--white); border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow); }
.topbar-title { font-size: 18px; font-weight: 600; color: var(--gray-900); }
.page-content { padding: 28px 24px; flex: 1; }
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.page-header p { font-size: 14px; color: var(--gray-500); margin-top: 4px; }

/* ── Stats Grid ────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* ── Grid Layouts ──────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ── Clock Widget ──────────────────────────────── */
.clock-widget { background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%); border-radius: var(--radius-lg); padding: 32px; color: var(--white); text-align: center; }
.clock-time { font-size: 52px; font-weight: 700; letter-spacing: -2px; line-height: 1; }
.clock-date { font-size: 16px; opacity: .8; margin-top: 8px; }
.clock-status { margin-top: 20px; padding: 16px; background: rgba(255,255,255,.15); border-radius: var(--radius); }
.punch-btn { margin-top: 20px; width: 100%; padding: 16px; font-size: 18px; font-weight: 700; border-radius: var(--radius-lg); border: none; cursor: pointer; transition: var(--transition); }
.punch-btn-in { background: #10B981; color: var(--white); box-shadow: 0 4px 14px rgba(16,185,129,.4); }
.punch-btn-in:hover { background: #059669; transform: translateY(-1px); }
.punch-btn-out { background: #EF4444; color: var(--white); box-shadow: 0 4px 14px rgba(239,68,68,.4); }
.punch-btn-out:hover { background: #DC2626; transform: translateY(-1px); }

/* ── Status Indicator ──────────────────────────── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.green { background: var(--secondary); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.status-dot.red { background: var(--danger); }
.status-dot.yellow { background: var(--warning); }

/* ── Loading Spinner ───────────────────────────── */
.spinner { width: 24px; height: 24px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: absolute; inset: 0; background: rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center; border-radius: inherit; z-index: 10; }

/* ── Search Bar ────────────────────────────────── */
.search-box { position: relative; }
.search-box input { padding-left: 38px; }
.search-box .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 16px; pointer-events: none; }

/* ── Tabs ──────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab { padding: 10px 18px; border: none; background: none; color: var(--gray-500); font-size: 14px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover:not(.active) { color: var(--gray-700); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Calendar ──────────────────────────────────── */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-name { text-align: center; font-size: 12px; font-weight: 600; color: var(--gray-500); padding: 8px 0; }
.cal-day { min-height: 60px; border-radius: var(--radius); padding: 6px; font-size: 12px; border: 1px solid var(--gray-100); cursor: pointer; transition: var(--transition); }
.cal-day:hover { background: var(--gray-50); }
.cal-day.today { border-color: var(--primary); background: var(--primary-light); }
.cal-day.vacation { background: #D1FAE5; border-color: var(--secondary); }
.cal-day-num { font-weight: 600; color: var(--gray-700); }

/* ── Alert Banner ──────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 12px; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }

/* ── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}
