/* ═══════════════════════════════════════════════════════════
   Leave Manager - Complete Stylesheet
   No external dependencies. System fonts only.
   ═══════════════════════════════════════════════════════════ */

:root {
  --sidebar-bg: #1E3A5F;
  --sidebar-hover: #2A4F7A;
  --sidebar-active: #35608F;
  --brand-500: #2980C4;
  --brand-600: #1A568E;
  --brand-700: #1E3A5F;
  --success: #059669;
  --danger: #DC2626;
  --warning: #D97706;
  --info: #2563EB;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.5;
}

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo-img {
  width: 100%;
  max-width: 140px;
  height: auto;
  display: block;
  /* no filter needed - sidebar SVG has white text built in */
  opacity: 0.9;
}

.sidebar-title { font-size: 18px; font-weight: 600; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-item, .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item:hover, .nav-link:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active, .nav-link.active { background: var(--sidebar-active); color: white; font-weight: 500; }
.nav-item svg, .nav-link svg { width: 14px; height: 14px; flex-shrink: 0; }

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 8px 16px;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-avatar.eng { background: #3B82F6; color: white; }
.user-avatar.mkt { background: #8B5CF6; color: white; }

.user-name { font-size: 14px; font-weight: 500; color: white; }
.user-email { font-size: 12px; color: rgba(255,255,255,0.6); }
.user-role { font-size: 12px; color: rgba(255,255,255,0.5); text-transform: capitalize; }

.btn-logout {
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.4); }

.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 32px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
}

.page-header p {
  color: var(--gray-500);
  font-size: 14px;
  margin-top: 4px;
}

/* ── Cards ── */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  padding: 20px;
  margin-bottom: 20px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }

.stat-label { font-size: 13px; color: var(--gray-500); margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ── Dashboard Welcome ── */
.dashboard-welcome {
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #2A5A8F 100%);
  border-radius: 14px;
  padding: 28px 32px;
  margin-bottom: 24px;
  color: white;
}
.dashboard-welcome h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.dashboard-welcome p {
  font-size: 14px;
  opacity: 0.75;
}

/* ── Dashboard Stats Row ── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-wrap svg { width: 20px; height: 20px; }
.stat-icon-blue { background: #EFF6FF; color: #2563EB; }
.stat-icon-amber { background: #FFFBEB; color: #D97706; }
.stat-icon-green { background: #ECFDF5; color: #059669; }

/* ── Section Headers ── */
.section-header {
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--gray-800);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-200);
}

/* ── Leave Cycle Sections ── */
.cycle-section {
  margin-bottom: 8px;
}
.cycle-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-200);
}
.cycle-section-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0;
}
.cycle-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.cycle-badge-current {
  background: #ECFDF5;
  color: #059669;
}
.cycle-badge-next {
  background: #EFF6FF;
  color: #2563EB;
}
.cycle-section-next {
  opacity: 0.85;
}
.cycle-section-next .balance-card {
  border-left-style: dashed;
}

/* ── Cycle Divider ── */
.cycle-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0 24px;
}
.cycle-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gray-300), transparent);
}
.cycle-divider-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gray-400);
  white-space: nowrap;
  padding: 4px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 20px;
  background: var(--gray-50, #f9fafb);
}

/* ── Balance Cards ── */
.balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.balance-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  padding: 20px 22px;
  position: relative;
  /* overflow: visible so the Other Leave tooltip can float above card bounds */
  overflow: visible;
  border-left: 4px solid var(--accent, var(--brand-500));
}
.balance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.balance-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
}
.balance-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.balance-big {
  font-size: 36px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 14px;
}
.balance-total {
  font-size: 16px;
  font-weight: 400;
  color: var(--gray-400);
  margin-left: 2px;
}
.balance-bar-wrap {
  margin-bottom: 10px;
}
.balance-bar-bg {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}
.balance-bar-used {
  height: 100%;
  border-radius: 4px 0 0 4px;
  transition: width 0.5s ease;
}
.balance-bar-pending {
  height: 100%;
  opacity: 0.35;
  transition: width 0.5s ease;
}
.balance-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--gray-500);
}
.legend-pending { color: var(--warning); font-weight: 500; }
.legend-remaining { margin-left: auto; font-weight: 500; color: var(--gray-700); }

/* ── Other Leave info tooltip ── */
.other-leave-info {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.other-leave-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  background: var(--gray-900);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  padding: 10px 13px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 100;
  pointer-events: none;
  white-space: normal;
}
.other-leave-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--gray-900);
}
.other-leave-info:hover .other-leave-tooltip,
.other-leave-info:focus .other-leave-tooltip,
.other-leave-info:focus-within .other-leave-tooltip {
  display: block;
}

/* ── Upcoming Leave Card ── */
.upcoming-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden;
  margin-bottom: 24px;
}
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.upcoming-item:last-child { border-bottom: none; }
.upcoming-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.upcoming-info { flex: 1; }
.upcoming-type { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.upcoming-dates { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.empty-state-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 32px;
  text-align: center;
  color: var(--gray-400);
  font-size: 14px;
  margin-bottom: 24px;
}

.progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--brand-500);
  color: white;
}
.btn-primary:hover { background: var(--brand-600); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #047857; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #B91C1C; }

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}
.btn-secondary:hover { background: var(--gray-300); }

.btn-warning {
  background: #f59e0b;
  color: white;
}
.btn-warning:hover { background: #d97706; }

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { background: var(--gray-50); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-800);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(41,128,196,0.1);
}

.form-input.error { border-color: var(--danger); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-recommended { background: #DBEAFE; color: #1E40AF; }
.badge-approved { background: #D1FAE5; color: #065F46; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-cancelled { background: var(--gray-200); color: var(--gray-600); }

/* ── Tables ── */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.data-table tr:hover td { background: var(--gray-50); }

.type-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

/* ── Login Page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1E3A5F 0%, #2A4F7A 50%, #1a3050 100%);
}

.login-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 0;
  width: 100%;
  max-width: 500px;
}

.login-logo {
  width: 100%;
  padding: 32px 24px 16px;
  text-align: center;
  margin: 0;
}

.login-logo img {
  width: 100%;
  max-width: 420px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.login-form-body {
  padding: 8px 40px 40px;
}

.login-form-body h1 {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 16px;
}

.login-subtitle {
  text-align: center;
  color: var(--gray-500);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-input-group {
  position: relative;
  margin-bottom: 16px;
}

.login-input-group svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--gray-400);
}

.login-input-group input {
  width: 100%;
  padding: 12px 12px 12px 44px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input-group input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(41,128,196,0.1);
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--brand-500);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}

.login-btn:hover { background: var(--brand-600); }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.login-error {
  background: #FEE2E2;
  color: #991B1B;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.login-error.show { display: block; }

.demo-links {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.demo-links span {
  font-size: 12px;
  color: var(--gray-400);
}

.demo-link {
  font-size: 12px;
  color: var(--brand-500);
  cursor: pointer;
  text-decoration: none;
  margin: 0 4px;
}

.demo-link:hover { text-decoration: underline; }

/* ── Approval Cards ── */
.approval-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s ease;
}

.approval-card.fading { opacity: 0; transform: translateX(20px); }

.approval-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.approval-info { flex: 1; }
.approval-name { font-weight: 600; font-size: 15px; color: var(--gray-900); }
.approval-department { font-size: 13px; color: var(--gray-500); font-weight: 500; }
.approval-dept { font-size: 13px; color: var(--gray-500); }
.approval-dates { font-size: 14px; color: var(--gray-700); margin-top: 8px; }
.approval-reason { font-size: 13px; color: var(--gray-500); margin-top: 4px; font-style: italic; }
.approval-balance { font-size: 12px; color: var(--gray-400); margin-top: 6px; }
.info-row { display: flex; gap: 6px; margin-bottom: 4px; font-size: 0.875rem; }
.info-label { color: var(--gray-500); flex-shrink: 0; }

.approval-audit-trail {
  margin-top: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--gray-600);
  border-left: 3px solid var(--brand-500);
}
.approval-audit-trail .audit-step { margin-bottom: 3px; }
.approval-audit-trail .audit-step:last-child { margin-bottom: 0; }
.approval-audit-trail .audit-label { font-weight: 600; color: var(--gray-700); }

.approval-actions { display: flex; gap: 8px; padding-top: 4px; border-top: 1px solid var(--gray-100); justify-content: flex-end; }

/* ── Overlap / Capacity Warnings ── */
.overlap-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #92400e;
  line-height: 1.5;
}
.overlap-warning-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  line-height: 1;
}
.overlap-warning-title {
  font-weight: 700;
  margin-bottom: 2px;
  color: #78350f;
}
.approval-overlap-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 0.78rem;
  color: #92400e;
  line-height: 1.4;
}
.overlap-badge {
  display: inline-block;
  background: #f59e0b;
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Calendar ── */
/* ── Calendar ── */
.calendar-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  padding: 24px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.cal-nav-btn svg { width: 16px; height: 16px; color: var(--gray-600); }
.cal-nav-btn:first-child svg { transform: rotate(180deg); }
.cal-nav-btn:hover { background: var(--gray-200); }

.cal-today-btn {
  padding: 6px 14px;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 4px;
}
.cal-today-btn:hover { background: var(--gray-50); border-color: var(--gray-400); }

.cal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  min-width: 200px;
  text-align: center;
}

.cal-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--gray-500);
}
.cal-summary-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.cal-summary-item svg { width: 14px; height: 14px; }
.cal-summary-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
}

.cal-day-header {
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  background: var(--gray-50);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cal-weekend-header { color: var(--gray-400); }

.cal-day {
  min-height: 100px;
  padding: 6px;
  background: white;
  position: relative;
  transition: background 0.1s;
}
.cal-day:hover { background: #fafbfc; }

.cal-day.other-month { background: var(--gray-50); }
.cal-day.other-month .cal-date { color: var(--gray-300); }
.cal-day.other-month:hover { background: var(--gray-50); }

.cal-day.cal-weekend { background: #f8f9fb; }
.cal-day.cal-weekend:hover { background: #f4f5f7; }

.cal-day.today { background: #EFF6FF; }
.cal-day.today:hover { background: #e0efff; }

.cal-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  padding: 2px 4px;
  margin-bottom: 4px;
  display: inline-block;
}
.cal-date-today {
  background: var(--brand-500);
  color: white !important;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  padding: 0;
}

.cal-event {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  margin-top: 2px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  font-weight: 500;
  position: relative;
  transition: opacity 0.15s, transform 0.1s;
}
.cal-event:hover { opacity: 0.9; transform: translateY(-1px); overflow: visible; }

.cal-event-pending {
  font-weight: 600;
}

.cal-more {
  font-size: 10px;
  color: var(--gray-500);
  padding: 2px 6px;
  font-weight: 600;
  cursor: default;
}

/* ── Compact day cells (4+ events) ── */
.cal-day-compact {
  min-height: 110px;
}
.cal-day-compact .cal-event {
  font-size: 9px;
  padding: 1px 4px;
  margin-top: 1px;
  line-height: 1.3;
  border-radius: 3px;
}
.cal-day-compact .cal-date {
  margin-bottom: 2px;
}

/* ── Calendar Holiday Styling (Red) ── */
.cal-holiday {
  background: #fef2f2 !important;
  position: relative;
}
.cal-holiday .cal-date {
  color: #dc2626;
  font-weight: 700;
}
.cal-holiday-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #dc2626;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ── Calendar Block Leave Styling (Green) ── */
.cal-block-leave {
  background: #ecfdf5 !important;
  position: relative;
}
.cal-block-leave .cal-date {
  color: #059669;
  font-weight: 700;
}
.cal-block-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #059669;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ── Edit Non-Working Days Mode ── */
.cal-edit-hol-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  background: white;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 8px;
}
.cal-edit-hol-btn svg { width: 14px; height: 14px; }
.cal-edit-hol-btn:hover { border-color: var(--brand-500); color: var(--brand-500); }
.cal-edit-hol-btn.active {
  background: var(--brand-500);
  color: white;
  border-color: var(--brand-500);
}
.cal-edit-mode .cal-day[data-cal-date] {
  cursor: pointer;
  transition: background 0.12s ease;
}
.cal-edit-mode .cal-day[data-cal-date]:hover {
  outline: 2px solid var(--brand-500);
  outline-offset: -2px;
  z-index: 2;
}
.cal-edit-mode .cal-day.cal-selected {
  outline: 2.5px solid var(--brand-500);
  outline-offset: -2px;
  background: #eff6ff !important;
  z-index: 2;
}
.cal-edit-mode .cal-day.cal-holiday.cal-selected,
.cal-edit-mode .cal-day.cal-block-leave.cal-selected {
  outline-style: dashed;
}

/* ── Holiday Editor Toolbar ── */
.hol-toolbar {
  background: #f8fafc;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 0.82rem;
}
.hol-toolbar-top {
  margin-bottom: 10px;
}
.hol-toolbar-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--gray-500);
}
.hol-selection-count {
  font-weight: 700;
  color: var(--brand-600);
}
.hol-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.hol-range-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}
.hol-range-inputs label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--gray-600);
}
.hol-action-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.form-input-sm {
  padding: 5px 8px !important;
  font-size: 0.8rem !important;
  min-width: auto !important;
}
.btn-sm {
  padding: 5px 12px !important;
  font-size: 0.78rem !important;
  border-radius: 6px !important;
}
.btn-outline {
  background: white;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-600);
}
.btn-outline:hover {
  border-color: var(--brand-500);
  color: var(--brand-500);
}
.btn-danger {
  background: #dc2626;
  color: white;
  border: none;
}
.btn-danger:hover {
  background: #b91c1c;
}

/* ── Calendar Hover Popup (fixed position, rendered via JS) ── */
#calPopup {
  display: none;
  position: fixed;
  background: white;
  color: var(--gray-800);
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14), 0 2px 6px rgba(0,0,0,0.08);
  border: 1px solid var(--gray-200);
  pointer-events: auto;
  min-width: 210px;
  max-width: 300px;
  animation: calPopupIn 0.12s ease;
}
#calPopup.visible { display: block; }

@keyframes calPopupIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.cal-popup-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--gray-900);
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-100);
}

.cal-popup-row {
  color: var(--gray-600);
  margin-bottom: 2px;
}

.cal-popup-label {
  font-weight: 600;
  color: var(--gray-700);
}

.cal-popup-status {
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}
.cal-popup-status.approved { background: #d1fae5; color: #065f46; }
.cal-popup-status.pending { background: #fef3c7; color: #92400e; }

.cal-popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-200);
}
.cal-popup-actions .btn-sm {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--gray-300);
  background: var(--gray-50);
}
.cal-popup-actions .btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.cal-popup-actions .btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}
.cal-popup-actions .btn-danger-outline {
  background: #fff;
  color: #dc2626;
  border-color: #dc2626;
}
.cal-popup-edit-form .form-group { margin-bottom: 6px; }
.cal-popup-edit-form label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 2px; color: var(--gray-600); }
.cal-popup-edit-form .form-control { width: 100%; font-size: 13px; padding: 4px 8px; border: 1px solid var(--gray-300); border-radius: 4px; }

/* ── Calendar Legend ── */
.cal-legend {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-200);
  flex-wrap: wrap;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-600);
}

.cal-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Filter Tabs ── */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--gray-100);
  border-radius: 10px;
  padding: 4px;
}

.filter-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-tab.active {
  background: white;
  color: var(--gray-900);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.filter-tab:hover:not(.active) { color: var(--gray-700); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.show .modal { transform: scale(1); }

.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--gray-900); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 10px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 360px;
}

.toast.show { transform: translateX(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }

/* ── Charts ── */
.chart-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 20px;
}

.chart-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 16px;
}

.bar-chart { display: flex; flex-direction: column; gap: 12px; }

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-label { width: 100px; font-size: 13px; color: var(--gray-600); flex-shrink: 0; }

.bar-track {
  flex: 1;
  height: 24px;
  background: var(--gray-100);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.8s ease;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  color: white;
  font-weight: 600;
}

.bar-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  width: 60px;
  text-align: right;
}

/* Donut chart */
.donut-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.donut-svg { width: 150px; height: 150px; }

.donut-legend { display: flex; flex-direction: column; gap: 8px; }

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.donut-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; color: var(--gray-600); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ── Loading ── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.6s linear infinite;
}

.spinner.dark {
  border-color: var(--gray-200);
  border-top-color: var(--brand-500);
}

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  background: white;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.pagination button:hover { background: var(--gray-50); }
.pagination button.active { background: var(--brand-500); color: white; border-color: var(--brand-500); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Mobile hamburger ── */
.hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  padding: 8px;
  background: var(--sidebar-bg);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: white;
}

.hamburger svg { width: 24px; height: 24px; }

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 35;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.sidebar-overlay.open {
  opacity: 1;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .sidebar-overlay { display: block; pointer-events: none; }
  .sidebar-overlay.open { pointer-events: auto; }
  .page-container { padding: 16px; padding-top: 56px; }
  .form-row { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .cal-day { min-height: 60px; }
  .approval-actions .btn { flex: 1; justify-content: center; }
}

/* ── Utility ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* ── Notification Bell & Panel ── */
.notif-bell-btn {
  position: relative;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  padding: 10px 16px;
}

.notif-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.notif-panel {
  position: fixed;
  bottom: 80px;
  left: 220px;
  width: 360px;
  max-height: 420px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  border: 1px solid var(--gray-200);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.9rem;
}

.notif-mark-all {
  font-size: 0.78rem;
  color: var(--brand-600);
  cursor: pointer;
}

.notif-list {
  overflow-y: auto;
  max-height: 340px;
  flex: 1;
}

.notif-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background .15s;
}

.notif-item:hover {
  background: var(--gray-50);
}

.notif-unread {
  background: #eff6ff;
  border-left: 3px solid var(--brand-500);
}

.notif-message {
  font-size: 0.82rem;
  color: var(--gray-800);
  line-height: 1.4;
}

.notif-time {
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-top: 3px;
}

.notif-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.85rem;
}

.notif-loading {
  padding: 24px 16px;
  text-align: center;
  color: var(--gray-400);
}

@media (max-width: 768px) {
  .notif-panel {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 70px;
  }
}

/* ── Messages ── */
.msg-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.msg-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
}

.msg-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  background: #fff;
  cursor: pointer;
  transition: background .15s;
  gap: 12px;
}

.msg-row:hover {
  background: var(--gray-50);
}

.msg-unread {
  background: #eff6ff;
  border-left: 3px solid var(--brand-500);
}

.msg-row-left {
  flex: 1;
  min-width: 0;
}

.msg-sender {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--gray-800);
  margin-bottom: 2px;
}

.msg-subject {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 2px;
}

.msg-preview {
  font-size: 0.8rem;
  color: var(--gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-row-right {
  flex-shrink: 0;
}

.msg-time {
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* Thread */
.thread-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.thread-msg {
  padding: 14px 18px;
  border-radius: 12px;
  max-width: 85%;
}

.thread-msg-other {
  background: #f1f5f9;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.thread-msg-self {
  background: var(--brand-50, #eff6ff);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.thread-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.8rem;
}

.thread-msg-body {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--gray-800);
}
