/* ─── RESET & BASE ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w:    240px;
  --navy:         #0f1c3f;
  --navy-mid:     #162040;
  --navy-light:   #1e2d55;
  --navy-hover:   #243468;
  --accent:       #4f8ef7;
  --accent-glow:  #3b7de8;
  --accent-soft:  rgba(79,142,247,.12);
  --gold:         #f5c842;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --purple:       #8b5cf6;
  --bg:           #f0f4fb;
  --surface:      #ffffff;
  --surface2:     #f8faff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --text-light:   #94a3b8;
  --radius:       14px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md:    0 4px 24px rgba(0,0,0,.1);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.15);
  --transition:   .2s ease;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── APP SHELL ─────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ───────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  background-image: linear-gradient(180deg, #0f1c3f 0%, #0a1428 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #7eb3ff);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: white; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,142,247,.4);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: .85rem; font-weight: 700; color: white; letter-spacing: .5px; }
.brand-sub  { font-size: .7rem; color: rgba(255,255,255,.4); letter-spacing: .3px; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: rgba(255,255,255,.55);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  letter-spacing: .2px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(79,142,247,.25), rgba(79,142,247,.08));
  color: #fff;
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}
.nav-icon { font-size: 1rem; width: 22px; text-align: center; flex-shrink: 0; }
.nav-label { white-space: nowrap; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; justify-content: space-between; align-items: center;
}
.sf-year  { font-size: .75rem; color: rgba(255,255,255,.35); font-weight: 600; }
.sf-version { font-size: .7rem; color: rgba(255,255,255,.25); }

/* ─── MAIN CONTENT ──────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

/* ─── PAGE HEADER ───────────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.ph-title { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.ph-sub   { color: var(--text-muted); font-size: .875rem; margin-top: 4px; }
.ph-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ─── BUTTONS ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  font-size: .85rem; font-weight: 600; font-family: inherit;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  letter-spacing: .2px;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-glow));
  color: white;
  box-shadow: 0 2px 12px rgba(79,142,247,.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(79,142,247,.45); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger  { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-icon { padding: 7px; border-radius: 6px; }

/* ─── CARDS ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-body { padding: 22px; }

/* ─── STAT CARDS ────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.accent::before { background: linear-gradient(90deg, var(--accent), #7eb3ff); }
.stat-card.success::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card.danger::before  { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.purple::before  { background: linear-gradient(90deg, var(--purple), #a78bfa); }
.stat-card.gold::before    { background: linear-gradient(90deg, var(--gold), #fde68a); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 16px;
}
.stat-card.accent  .stat-icon { background: rgba(79,142,247,.12); }
.stat-card.success .stat-icon { background: rgba(16,185,129,.12); }
.stat-card.warning .stat-icon { background: rgba(245,158,11,.12); }
.stat-card.danger  .stat-icon { background: rgba(239,68,68,.12); }
.stat-card.purple  .stat-icon { background: rgba(139,92,246,.12); }
.stat-card.gold    .stat-icon { background: rgba(245,200,66,.12); }

.stat-value {
  font-size: 2rem; font-weight: 800;
  line-height: 1; color: var(--text);
  margin-bottom: 5px;
}
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.stat-trend { font-size: .75rem; margin-top: 8px; color: var(--text-light); }

/* ─── TABLES ─────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface2);
  padding: 11px 16px;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(226,232,240,.6);
  font-size: .875rem;
  color: var(--text);
  vertical-align: middle;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface2); }
tbody tr:last-child td { border-bottom: none; }

/* ─── BADGES ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge-success  { background: rgba(16,185,129,.12);  color: #059669; }
.badge-danger   { background: rgba(239,68,68,.12);   color: #dc2626; }
.badge-warning  { background: rgba(245,158,11,.12);  color: #d97706; }
.badge-accent   { background: rgba(79,142,247,.12);  color: #2563eb; }
.badge-purple   { background: rgba(139,92,246,.12);  color: #7c3aed; }
.badge-neutral  { background: var(--border);         color: var(--text-muted); }
.badge-gold     { background: rgba(245,200,66,.15);  color: #b45309; }

/* ─── FORMS ─────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }

label {
  font-size: .8rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
}
input, select, textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }
.form-hint { font-size: .75rem; color: var(--text-light); }

/* ─── MODAL ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,15,35,.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(20px) scale(.97);
  transition: transform .25s ease;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: var(--surface2);
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text-muted);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body   { padding: 24px; }
.modal-footer { padding: 18px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ─── CALENDAR ───────────────────────────────────────────────────────── */
.year-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.month-cal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.month-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: white;
  font-weight: 700; font-size: .9rem; text-align: center; letter-spacing: .5px;
}
.week-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.week-day-header {
  text-align: center; padding: 8px 4px 6px;
  font-size: .7rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px;
  background: var(--surface2);
}
.cal-day {
  position: relative;
  text-align: center; padding: 7px 4px;
  font-size: .8rem; cursor: default;
  border-radius: 6px; margin: 1px;
  transition: background var(--transition);
  min-height: 32px; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 2px;
}
.cal-day.empty { opacity: 0; pointer-events: none; }
.cal-day.weekend { color: var(--text-muted); }
.cal-day.holiday { background: rgba(245,158,11,.15); color: #b45309; font-weight: 600; }
.cal-day.on-leave { background: rgba(79,142,247,.18); color: #1d4ed8; font-weight: 700; border-radius: 6px; }
.cal-day.today { background: var(--accent); color: white; font-weight: 700; border-radius: 6px; }
.cal-day.cancelled { background: rgba(239,68,68,.1); color: #b91c1c; text-decoration: line-through; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; margin: 0 auto; }

/* ─── ALERTS & TOAST ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: .875rem; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 18px;
}
.alert-success { background: rgba(16,185,129,.1); border-left: 3px solid var(--success); color: #065f46; }
.alert-danger  { background: rgba(239,68,68,.1);  border-left: 3px solid var(--danger);  color: #991b1b; }
.alert-warning { background: rgba(245,158,11,.1); border-left: 3px solid var(--warning); color: #92400e; }
.alert-info    { background: var(--accent-soft);  border-left: 3px solid var(--accent);  color: #1e40af; }

.toast {
  position: fixed; bottom: 28px; right: 28px;
  padding: 14px 20px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: .875rem; font-weight: 500;
  z-index: 9999; max-width: 380px;
  animation: slideInToast .3s ease;
}
@keyframes slideInToast { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-success { background: var(--success); color: white; }
.toast-error   { background: var(--danger);  color: white; }
.toast-warning { background: var(--warning); color: white; }

/* ─── DASHBOARD SPECIFIC ─────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; margin-top: 5px;
}
.activity-text { font-size: .875rem; color: var(--text); line-height: 1.5; }
.activity-meta { font-size: .75rem; color: var(--text-light); margin-top: 2px; }

/* ─── SEARCH / FILTER BAR ───────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.filter-bar input, .filter-bar select {
  max-width: 180px; padding: 8px 12px; font-size: .85rem;
}
.filter-bar input { max-width: 240px; }

/* ─── EMPTY STATE ────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-weight: 600; margin-bottom: 6px; }
.empty-state p  { font-size: .875rem; }

/* ─── EMPLOYEE AVATAR ────────────────────────────────────────────────── */
.emp-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7eb3ff);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: .8rem; flex-shrink: 0;
}

/* ─── LEAVE TYPE PILLS ───────────────────────────────────────────────── */
.lt-annual    { background: rgba(79,142,247,.12);  color: #2563eb; }
.lt-sick      { background: rgba(239,68,68,.12);   color: #dc2626; }
.lt-comp      { background: rgba(139,92,246,.12);  color: #7c3aed; }
.lt-carry     { background: rgba(245,200,66,.15);  color: #b45309; }
.lt-emergency { background: rgba(245,158,11,.12);  color: #d97706; }
.lt-unpaid    { background: rgba(100,116,139,.12); color: #475569; }

/* ─── REPORT TABLE ───────────────────────────────────────────────────── */
.report-summary th { background: var(--navy); color: white; }
.report-summary th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.report-summary th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.month-totals td { background: var(--surface2); font-weight: 600; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .year-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
  .year-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .form-group.span-2,
  .form-grid .form-group.span-3 { grid-column: span 1; }
}

/* ─── UTILITIES ──────────────────────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-gap { gap: 8px; }
.align-center { align-items: center; }
.font-bold { font-weight: 700; }
.separator { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
