:root {
  --brand-red: #ed0000;
  --brand-red-dark: #c50000;
  --brand-green: #0f8e38;
  --font-heading: 'Baloo 2', sans-serif;
  --font-body: 'Varela Round', sans-serif;
  --lt-color-gray-100: #f8f9fc;
  --lt-color-gray-200: #f1f3f9;
  --lt-color-gray-300: #dee3ed;
  --lt-color-gray-400: #c2c9d6;
  --lt-color-gray-500: #8f96a3;
  --lt-color-gray-600: #5e636e;
  --lt-color-gray-700: #2f3237;
  --lt-color-gray-800: #1d1e20;
  --lt-color-gray-900: #111213;
  --lt-shadowDefault: 0 2px 6px -1px rgba(0, 0, 0, 0.16), 0 1px 4px -1px rgba(0, 0, 0, 0.04);
  --lt-shadowActive: 0 0 8px -2px rgba(0, 0, 0, 0.1), 0 6px 20px -3px rgba(0, 0, 0, 0.2);
  --lt-color-white: #fff;
  --lt-color-black: #111213;
  --lt-color-transparent: rgba(255, 255, 255, 0);
  --lt-color-background-light: var(--lt-color-gray-100);
  --lt-color-background-default: var(--lt-color-gray-200);
  --lt-color-background-dark: var(--lt-color-gray-300);
  --lt-color-border-light: var(--lt-color-gray-200);
  --lt-color-border-default: var(--lt-color-gray-300);
  --lt-color-border-dark: var(--lt-color-gray-400);
  --lt-color-text-very-light: var(--lt-color-gray-500);
  --lt-color-text-light: var(--lt-color-gray-600);
  --lt-color-text-default: var(--lt-color-gray-700);
  --lt-color-text-dark: var(--lt-color-gray-800);
  --lt-color-overlay-default: #fff;
  --lt-color-overlay-dark: #fff;
  --lt-color-overlay-transparent: rgba(0, 0, 0, 0.1);
  --lt-shadow-website-overlay: 0 0 7px 0 rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

input, textarea, pre, p, span, td, th, label, h1, h2, h3, h4 {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

button, .menu-item, .nav-link, .sidebar, .erp-module-card, .payslip-card {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Allow natural scrolling and dragging for touch interactions */
.main-content *,
.lm-body *,
table *,
tbody tr,
tbody td {
  -webkit-user-drag: auto;
  touch-action: auto;
  pointer-events: auto;
}

html, body, .container, .admin-container, .lm-container {
  overscroll-behavior: auto;
  touch-action: pan-y;
  scroll-behavior: smooth;
}

html {
  overflow-y: auto;
  height: 100%;
}

.container {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content, .lm-body {
  flex: 1;
  overflow-y: auto;
  touch-action: pan-y !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin-top: 0;
  -webkit-user-drag: auto;
  pointer-events: auto !important;
}

/* Ensure children of scrollable containers allow touch scrolling */
.main-content > *, .lm-body > * {
  touch-action: auto;
  -webkit-user-drag: auto;
}

/* Ensure hamburger button is hidden by default on larger screens */
.hamburger {
  display: none;
}

/* Hide hamburger when auth (login/register) is visible */
.auth-visible .hamburger {
  display: none !important;
}

/* Hide hamburger on home page */
#erpHome ~ .hamburger,
#erpHome ~ .mobile-backdrop {
  display: none !important;
}

/* Hide home button when header is hidden */
.top-header.hidden .header-home-btn {
  display: none !important;
}

body {
  font-family: var(--font-body);
  background: #f5f5f5;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
  touch-action: pan-y;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Heading Styles */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
}

h4 {
  font-size: 18px;
}


/* Hide scrollbar for body in Chrome/Safari */
body::-webkit-scrollbar {
  display: none;
}

/* Loading Screen Styles */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
  visibility: visible;
}

.loading-screen:not(.hidden) ~ .top-header {
  visibility: hidden;
  opacity: 0;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}

.loading-logo {
  animation: fadeInScale 0.8s ease-out;
}

.loading-logo-img {
  width: 150px;
  height: 150px;
  object-fit: contain;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(217, 35, 34, 0.2);
  border-top-color: var(--brand-red);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.loading-text {
  font-size: 16px;
  color: #666;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  font-weight: 500;
  letter-spacing: 0.5px;
}

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Prevent body scrolling when auth forms are visible */
.no-scroll {
  overflow: hidden !important;
  height: 100vh;
  position: fixed;
  width: 100%;
}

/* On mobile, ensure no-scroll still works but doesn't break viewport */
@media (max-width: 480px) {
  /* CRITICAL: Enable scrolling on mobile body */
  body {
    overflow: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
  }
  
  /* Allow main content to scroll on mobile */
  .main-content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    margin-left: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Scroll lock class for auth screens */
  body.no-scroll {
    overflow: hidden !important;
    height: 100vh;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
  }
  
  body.no-scroll > * {
    overflow: hidden;
  }
}

/* ─────────────────────────────────────────────────────────
   SCROLL CONTAINMENT & ISOLATION FOR SMOOTH SCROLLING
   ───────────────────────────────────────────────────────── */

/* ERP Home Page - Isolated scroll container */
.erp-home {
  padding: 40px 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-height: 100%;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.auth-page {
  -webkit-overflow-scrolling: touch;
}

.modal-body,
.profile-modal-body,
.leave-request-modal-body,
.leave-details-modal-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Download button should be the brand red */
.btn-download {
  background: var(--brand-red) !important;
  color: #fff !important;
  border: none !important;
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(217, 35, 34, 0.18);
}

body.auth-visible {
  background: linear-gradient(135deg, #f5f1e8 0%, #e8f0e8 50%, #f0e8f0 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.auth-visible .main-content.full-width {
  background: white;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  margin: 0;
  width: 100%;
  min-height: 100vh;
  height: 100vh;
}

body.auth-visible .form-container {
  min-height: 100vh;
  height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

/* MOBILE SCROLL FIX: Ensure body scrolling is always enabled on mobile */
@media (max-width: 480px) {
  body {
    overflow: auto !important;  /* CRITICAL: Allow body scrolling on mobile */
    height: auto !important;    /* Use auto height on mobile */
    overflow-x: hidden;
  }

  .container {
    height: auto;  /* Don't lock height on mobile */
  }

  .main-content {
    margin-left: 0 !important;  /* CRITICAL: Remove sidebar offset on mobile */
    width: 100% !important;     /* Use full width on mobile */
    overflow-x: hidden;         /* Hide horizontal scroll */
    overflow-y: auto;           /* Allow vertical scroll */
    -webkit-overflow-scrolling: touch;  /* iOS momentum */
    min-height: auto;           /* Auto height on mobile */
  }

  body.auth-visible {
    padding: 0;
    margin: 0;
    background: white;
  }

  #loginPage,
  #signupPage {
    width: 100%;
    min-height: 100vh;
    height: 100%;
    margin: 0;
    padding: 0;
    background: white;
    pointer-events: auto !important;
    z-index: 1 !important;
  }

  /* Ensure mobile-backdrop doesn't interfere with auth screens */
  #loginPage .mobile-backdrop,
  #signupPage .mobile-backdrop {
    display: none !important;
    pointer-events: none !important;
    z-index: -1 !important;
  }

  /* Ensure mobile auth UI elements are clickable */
  .mauth-screen,
  .mauth-screen * {
    pointer-events: auto !important;
    z-index: 10 !important;
  }

  .login-form-panel {
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 20px 16px;
    background: white;
  }

  /* ──── BOTTOM PADDING FOR SMOOTH SCROLLING ON MOBILE ──── */
  .modal-body,
  .profile-modal-body {
    padding-bottom: 150px !important;
  }

  .erp-home,
  #erpHome,
  #availablePayslipsSection,
  .payslips-page-container,
  .payslips-grid,
  .payslips-grid-wrapper,
  .dashboard {
    padding-bottom: 80px !important;
  }
}

body.auth-visible .login-layout {
  height: 100%;
}


/* Ensure header doesn't show on login page */
body.auth-visible .top-header,
body.auth-visible .site-footer,
body.auth-visible .sidebar {
  display: none !important;
  visibility: hidden !important;
}

body.auth-visible {
  overflow: hidden;
}

body.auth-visible .main-content,
body.auth-visible .container,
body.auth-visible .auth-page {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  display: flex;
}

body.auth-visible .main-content {
  background: white;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

.auth-logo-container {
  position: fixed;
  top: 30px;
  left: 30px;
  z-index: 100;
  display: none;
}

body.auth-visible .auth-logo-container {
  display: block;
}

.auth-page-logo {
  width: 90px;
  height: auto;
  object-fit: contain;
}

.auth-container {
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  max-width: 500px;
  width: 100%;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100vh;
  background: white;
  color: #333;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.04);
  z-index: 1000;
  border-right: 1px solid #e5e7eb;
}

.sidebar.hidden {
  display: none;
  pointer-events: none;
  touch-action: none;
}

/* Sidebar Header */
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.sidebar-logo-section {
  width: 100%;
  display: flex;
  justify-content: center;
}

.sidebar-logo-section .logo {
  width: 70px;
  height: auto;
  object-fit: contain;
  filter: brightness(1);
  transition: transform 0.3s ease;
}

.sidebar-logo-section .logo:hover {
  transform: scale(1.05);
}

.sidebar-title-section {
  text-align: center;
  width: 100%;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: #1a1a2e;
  font-family: 'Poppins', 'Montserrat', sans-serif;
  letter-spacing: -0.3px;
}

.sidebar-subtitle {
  font-size: 12px;
  color: #7a7a94;
  margin: 4px 0 0 0;
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.5px;
}

/* Sidebar Menu */
.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-menu::-webkit-scrollbar {
  width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 10px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 10px;
  transition: background 0.3s ease;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

.sidebar-menu-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #999;
  text-transform: capitalize;
  letter-spacing: 0.8px;
  margin: 0 0 8px 12px;
  padding: 0;
}

.sidebar-payslips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: transparent;
  color: #555;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', 'Roboto', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  position: relative;
}

.menu-item:hover {
  background: #f5f5f5;
  border-color: #e0e0e0;
  color: #1a1a2e;
  transform: translateX(3px);
}

.menu-item:active {
  transform: translateX(2px);
}

.menu-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 16px;
  flex-shrink: 0;
}

.menu-item-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.menu-item-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item-badge {
  background: #ed0000;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 24px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(237, 0, 0, 0.2);
}

.menu-item-arrow {
  font-size: 12px;
  color: #ccc;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.menu-item:hover .menu-item-arrow {
  color: #999;
  transform: translateX(2px);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  color: #666;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', 'Roboto', sans-serif;
  transition: all 0.3s ease;
  width: 100%;
  white-space: nowrap;
}

.sidebar-logout-btn:hover {
  background: #f5f5f5;
  border-color: #d0d0d0;
  color: #333;
  transform: none;
  box-shadow: none;
}

.sidebar-logout-btn:active {
  transform: translateY(0);
}

.sidebar-logout-btn i {
  font-size: 14px;
}

.hidden {
  display: none !important;
}

/* Ensure modals are hidden by default to prevent FOUC */
.modal {
  display: none;
}

.modal.visible {
  display: flex;
}

.sidebar-header .logo {
  width: 100px;
  height: auto;
  margin-bottom: 15px;
  object-fit: contain;
}

.sidebar-header h2 {
  font-size: 22px;
  margin-bottom: 10px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  color: white;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0 0 0;
  width: 100%;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  width: 100%;
  text-align: left;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}

.nav-link.active {
  color: white;
}

.nav-link .nav-icon {
  font-size: 16px;
  min-width: 20px;
}

.nav-link .nav-text {
  flex: 1;
}

.nav-btn {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  text-align: left;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: white;
}

.nav-btn.active {
  background: white;
  color: var(--brand-red);
  border-color: var(--brand-red);
}

.sidebar-footer {
  text-align: center;
  margin-top: 50px;
}

.btn-logout {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.btn-logout:hover {
  background: white;
  color: var(--brand-red);
}

.main-content {
  margin-left: 250px;
  width: calc(100% - 250px);
  padding: 30px;
  background: white;
  min-height: auto;  /* Use auto on desktop, mobile fixes below */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;  /* iOS momentum scrolling */
}

.main-content.full-width {
  margin-left: 0;
  width: 100%;
}

/* Scrollbar styling for main content */
.main-content::-webkit-scrollbar {
  width: 8px;
}

.main-content::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.main-content::-webkit-scrollbar-thumb {
  background: #999;
  border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
  background: #666;
}

/* Scrollbar styling for line manager body */
.lm-body::-webkit-scrollbar {
  width: 8px;
}

.lm-body::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.lm-body::-webkit-scrollbar-thumb {
  background: #999;
  border-radius: 4px;
}

.lm-body::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.form-container {
  padding: 40px 35px;
  animation: slideUp 0.5s ease-out;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  max-width: 420px;
  width: 100%;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: visible;
  height: auto;
  display: block;
}

.form-container::before {
  display: none;
}

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

.form-container.hidden {
  display: none;
}

.form-container h1 {
  color: #333;
  margin-bottom: 30px;
  text-align: center;
  font-size: 24px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.form-logo {
  width: 150px;
  height: auto;
  margin: 0 auto 20px;
  display: block;
  object-fit: contain;
}

.form-logo-large {
  width: 60px;
  height: auto;
  display: inline-block;
  object-fit: contain;
}

/* LOGIN LAYOUT */
.login-layout {
  display: flex;
  width: 100%;
  height: 100%;
}

.login-promo {
  flex: 1;
  background: linear-gradient(135deg, #2d5f3f 0%, #1a4d2e 100%);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 60px 40px;
  position: relative;
  overflow: hidden;
}

.login-promo::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800"><defs><pattern id="pattern" x="0" y="0" width="200" height="200" patternUnits="userSpaceOnUse"><rect width="200" height="200" fill="none"/><circle cx="100" cy="100" r="80" fill="rgba(255,255,255,0.03)"/></pattern></defs><rect width="1200" height="800" fill="url(%23pattern)"/></svg>');
  background-repeat: repeat;
  opacity: 0.5;
}

.promo-content {
  position: relative;
  z-index: 2;
}

.promo-title {
  font-size: 42px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.3;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.promo-subtitle {
  font-size: 18px;
  margin-bottom: 40px;
  opacity: 0.95;
  line-height: 1.4;
}

.promo-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-item {
  font-size: 15px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-form-panel {
  flex: 1;
  background: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 50px;
  overflow-y: auto;
}

.login-form-content {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.form-logo-top {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
}

.form-logo-top img {
  height: 50px;
  width: auto;
  object-fit: contain;
}

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-header h1 {
  font-size: 32px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 8px 0;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.login-subtitle {
  font-size: 14px;
  color: #999;
  margin: 0;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  letter-spacing: 0.5px;
}

.form-group input:not([type="checkbox"]) {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-group input:focus {
  border-color: #1f2937;
  box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.1);
  outline: none;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  width: 100%;
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: color 0.2s;
  z-index: 10;
}

.password-toggle:hover {
  color: #374151;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}

.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #333;
}

.form-checkbox label {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: #666;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.leave-modal-content .form-group label {
  text-transform: none;
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: #000;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  letter-spacing: 0.5px;
}

.btn-login:hover {
  background: #222;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-login:active {
  transform: translateY(0);
}

.form-footer-links {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 20px;
}

.form-footer-links a {
  color: #d92322;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.form-footer-links a:hover {
  text-decoration: underline;
}

.login-footer-text {
  text-align: center;
  font-size: 13px;
  color: #666;
  margin-top: 24px;
}

.login-footer-text a {
  color: #d92322;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.login-footer-text a:hover {
  text-decoration: underline;
}

.auth-footer-small {
  text-align: center;
  font-size: 11px;
  color: #999;
  margin-top: 32px;
  letter-spacing: 0.5px;
}

.form-titles {
  text-align: center;
  margin-bottom: 35px;
  padding: 0;
  padding-top: 0;
}

.app-title {
  text-align: center;
  color: #666;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 8px;
  margin-top: 0;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  letter-spacing: 0.5px;
}

.app-subtitle {
  text-align: center;
  color: #333;
  font-size: 28px;
  font-weight: 700;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  margin: 0;
}

.form-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  color: #999;
  font-size: 12px;
}

.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #666;
  font-weight: 600;
  font-size: 14px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: Georgia, serif;
  transition: all 0.3s ease;
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  background: #ffffff;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 4px rgba(217, 35, 34, 0.1);
  background: #ffffff;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  width: 100%;
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s;
  user-select: none;
  -webkit-user-select: none;
}

.password-toggle:hover {
  color: #333;
}

.btn-primary {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  margin-top: 20px;
  margin-bottom: 0;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(217, 35, 34, 0.25);
  background: #b91a19;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  padding: 10px 20px;
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
  margin-top: 10px;
}

.btn-secondary:hover {
  background: #ebebeb;
}

/* Back to Dashboard link-style button (used in available payslips section) */
.btn-link {
  display: inline-block;
  background: transparent;
  color: var(--brand-red);
  border: 2px solid var(--brand-red);
  padding: 14px 24px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.06s;
}

.btn-link:hover {
  background: var(--brand-red);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.18);
}

.btn-link:active {
  transform: translateY(0);
}


/* Small spinner used in buttons */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}


.toggle-text {
  text-align: center;
  margin-top: 12px;
  margin-bottom: 0;
  color: #666;
  font-size: 13px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.toggle-text a {
  color: var(--brand-green);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.3s;
}

.toggle-text a:hover {
  color: #0a6a2a;
  text-decoration: underline;
}

.form-links {
  margin-top: 20px;
}

.message {
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 8px;
  text-align: center;
  /* keep element out of layout and always available; control visibility via opacity */
  position: fixed !important;
  right: 20px !important;
  top: 20px !important;
  left: auto !important;
  transform: translateX(400px) scale(0.98) !important;
  z-index: 10002;
  max-width: 92%;
  width: 420px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 180ms ease, visibility 200ms;
}

.message.visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1) !important;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.dashboard {
  padding: 40px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-height: 100%;
  touch-action: pan-y;
}

.dashboard.hidden {
  display: none;
}

#leaveDashboard {
  touch-action: pan-y;
}

/* Dashboard Header - Welcome Section */
.dashboard-header {
  display: flex;
  flex-direction: row;
  gap: 20px;
  align-items: flex-start;
}

.welcome-section {
  background: white !important;
  padding: 18px 22px !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  color: #333 !important;
  min-width: 250px !important;
  flex-shrink: 0 !important;
  border: 1px solid #e5e7eb !important;
}

.welcome-title {
  font-size: 20px !important;
  font-weight: 600 !important;
  color: #888 !important;
  margin: 0 0 6px 0 !important;
  text-transform: capitalize !important;
  font-family: 'Inter', 'Roboto', sans-serif !important;
  letter-spacing: 0.5px !important;
}

.welcome-name {
  font-size: 20px !important;
  font-weight: 700 !important;
  color: #1a1a2e !important;
  margin: 0 !important;
  font-family: 'Poppins', 'Montserrat', sans-serif !important;
}

/* Staff Info Cards */
.staff-info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  flex: 1;
}

.info-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
}

.info-card:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  border-color: #d0d0d0;
}

.info-label {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  text-transform: capitalize;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
  font-family: 'Inter', 'Roboto', sans-serif;
}

.info-value {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
  font-family: 'Poppins', 'Montserrat', sans-serif;
}

/* Payslip Section */
.payslip-section {
  background: white;
  padding: 28px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
  margin-top: 20px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 20px 0;
  font-family: 'Poppins', 'Montserrat', sans-serif;
  letter-spacing: -0.3px;
}

/* Form Styling */
.payslip-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  text-transform: capitalize;
  font-family: 'Inter', 'Roboto', sans-serif;
  letter-spacing: 0.2px;
}

.form-group input,
.form-group select {
  padding: 12px 14px;
  border: 1px solid #d8dce6;
  border-radius: 6px;
  font-size: 14px;
  font-family: Georgia, serif;
  background: white;
  transition: all 0.2s ease;
  color: #2c3e50;
}

.form-group input::placeholder,
.form-group select::placeholder {
  color: #bdbdbd;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: #f9fafb;
}

.form-group input:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

/* Select Wrapper with Icon */
.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrapper select {
  width: 100%;
  appearance: none;
  padding-right: 36px;
}

.select-wrapper i {
  position: absolute;
  right: 12px;
  pointer-events: none;
  color: #7f8c8d;
  font-size: 14px;
}

/* Button Styling */
.btn-generate {
  padding: 12px 24px !important;
  background: #1a1a2e !important;
  color: white !important;
  border: none !important;
  border-radius: 6px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  font-family: 'Inter', 'Roboto', sans-serif !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
  letter-spacing: 0.3px !important;
  width: 100% !important;
  margin-top: 8px !important;
}

.btn-generate:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
  background: #0f1519 !important;
}

.btn-generate:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.2) !important;
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Payslip Display Section */
.payslip-display {
  background: white;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid #e8ecf1;
  margin-top: 20px;
}

.payslip-display.hidden {
  display: none;
}

.payslip-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
}

.payslip-actions.hidden {
  display: none;
}

.payslip-list {
  background: white;
  padding: 20px;
  border-radius: 5px;
  margin-top: 30px;
}

.payslip-list p {
  color: #999;
  text-align: center;
}

/* Responsive Dashboard Styles */
@media (max-width: 1024px) {
  .dashboard {
    padding: 32px;
    gap: 28px;
  }

  .dashboard-header {
    flex-direction: row;
    gap: 18px;
  }

  .welcome-section {
    padding: 18px 20px;
    min-width: 220px;
  }

  .welcome-name {
    font-size: 16px;
  }

  .staff-info-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
  }

  .info-card {
    padding: 20px;
  }

  .info-value {
    font-size: 20px;
  }

  .payslip-section {
    padding: 28px;
  }

  .section-title {
    font-size: 18px;
    margin-bottom: 24px;
  }

  .form-rows {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  /* Payslips responsive for tablet */
  .payslips-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .btn-back-simple {
    align-self: flex-start;
  }

  .payslips-grid-wrapper {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
  }

  .pagination-container {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .pagination-controls {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .dashboard {
    padding: 24px;
    gap: 24px;
  }

  .dashboard-header {
    flex-direction: row;
    gap: 16px;
  }

  .welcome-section {
    padding: 16px 18px;
    min-width: 180px;
  }

  .welcome-title {
    font-size: 11px;
  }

  .welcome-name {
    font-size: 14px;
  }

  .staff-info-cards {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
  }

  .info-card {
    padding: 18px;
  }

  .info-label {
    font-size: 12px;
  }

  .info-value {
    font-size: 18px;
  }

  .payslip-section,
  .payslip-display {
    padding: 24px;
  }

  .section-title {
    font-size: 16px;
    margin-bottom: 20px;
  }

  .form-rows {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .form-group label {
    font-size: 13px;
  }

  .form-group input,
  .form-group select {
    padding: 11px 12px;
    font-size: 14px;
  }

  .btn-generate {
    padding: 12px 24px;
    font-size: 14px;
    margin-top: 12px;
  }

  /* Payslips responsive for small devices */
  .payslips-page-container {
    padding: 32px 16px;
  }

  .payslips-title {
    font-size: 28px;
  }

  .payslips-grid-wrapper {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
  }

  .payslip-card-header {
    padding: 20px;
  }

  .payslip-card-icon {
    font-size: 28px;
  }

  .payslip-card-body {
    padding: 20px;
  }

  .payslip-card-footer {
    padding: 14px 20px 20px;
  }
}

@media (max-width: 480px) {
  .main-content, .lm-body {
    touch-action: pan-y !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    contain: style paint;
    pointer-events: auto !important;
  }

  .main-content > *, .lm-body > * {
    touch-action: auto !important;
    -webkit-user-drag: auto;
    pointer-events: auto !important;
  }

  /* ──── LEAVE DASHBOARD MOBILE REDESIGN IN PROGRESS ──── */
  /* Will be visible with new card-based layout via embedded CSS */

  .dashboard-header {
    flex-direction: column;
    gap: 14px;
  }

  .welcome-section {
    padding: 14px 16px;
    border-radius: 8px;
    min-width: unset;
    width: 100%;
  }

  .welcome-title {
    font-size: 11px;
    margin-bottom: 3px;
  }

  .welcome-name {
    font-size: 15px;
  }

  .staff-info-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
  }

  .info-card {
    padding: 12px;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
  }

  .info-label {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .info-value {
    font-size: 13px;
    text-align: left;
  }

  .payslip-section,
  .payslip-display {
    padding: 20px;
    border-radius: 10px;
  }

  .section-title {
    font-size: 15px;
    margin-bottom: 18px;
  }

  .form-rows {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-group {
    gap: 8px;
  }

  .form-group label {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .form-group input,
  .form-group select {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 5px;
  }

  .form-group input:focus,
  .form-group select:focus {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .select-wrapper i {
    right: 10px;
    font-size: 13px;
  }

  .btn-generate {
    padding: 11px 20px;
    font-size: 13px;
    margin-top: 10px;
    border-radius: 5px;
  }

  .payslip-actions {
    flex-direction: column;
    gap: 10px;
  }

  .payslip-actions .btn-primary {
    width: 100%;
  }
}

.payslip-list ul {
  list-style-position: inside;
  color: #333;
}

.payslip-list li {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.payslip-list li:last-child {
  border-bottom: none;
}

/* ========== AVAILABLE PAYSLIPS REDESIGN ========== */

.payslips-page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  touch-action: pan-y;
}

.payslips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  gap: 30px;
}

.payslips-header-content {
  flex: 1;
}

.payslips-title {
  font-size: 36px;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.payslips-title i {
  color: var(--brand-red);
}

.payslips-subtitle {
  font-size: 15px;
  color: #718096;
  margin: 0;
  font-weight: 500;
}

.btn-back-simple {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #2d3748;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-back-simple:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
  transform: translateX(-2px);
}

.payslips-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Payslips Grid */
.payslips-grid-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  animation: fadeIn 0.4s ease-out;
}

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

/* Payslip Card */
.payslip-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid #e8e8e8;
}

.payslip-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Gradient Variants */
.payslip-card.gradient-1 {
  background: white !important;
}

.payslip-card.gradient-2 {
  background: white !important;
}

.payslip-card.gradient-3 {
  background: white !important;
}

.payslip-card.gradient-4 {
  background: white !important;
}

.payslip-card.gradient-1 .payslip-card-header,
.payslip-card.gradient-2 .payslip-card-header,
.payslip-card.gradient-3 .payslip-card-header,
.payslip-card.gradient-4 .payslip-card-header {
  background: white !important;
}

/* Card Header */
.payslip-card-header {
  padding: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: white;
  color: #1a202c;
  position: relative;
  z-index: 1;
}

.payslip-card-icon {
  font-size: 20px;
  opacity: 1;
  flex: 1;
  color: var(--brand-red);
}

.payslip-card-badge {
  background: var(--brand-red);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Card Body */
.payslip-card-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.payslip-card-month {
  font-size: 14px;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.payslip-card-year {
  font-size: 12px;
  color: #666;
  margin: 0;
  font-weight: 600;
}

.payslip-card-meta {
  margin-top: 8px;
}

.payslip-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #22863a;
  background: #f0f6fc;
  padding: 6px 10px;
  border-radius: 6px;
}

.payslip-status i {
  font-size: 12px;
}

.payslip-card-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid #edf2f7;
  display: none;
  gap: 8px;
}

.payslip-card-footer.hidden {
  display: none !important;
}

.payslip-status {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #22863a;
  background: #f0f6fc;
  padding: 6px 10px;
  border-radius: 6px;
}

.profile-container {
  background: white;
  padding: 40px;
  border-radius: 8px;
  margin: 30px auto 0;
  max-width: 600px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.profile-container h2 {
  color: var(--brand-red);
  margin-bottom: 30px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  font-size: 28px;
  font-weight: 600;
  text-align: center;
}

.update-profile-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.update-profile-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.update-profile-form label {
  color: #333;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.update-profile-form input,
.update-profile-form select {
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 15px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  background: #fafafa;
  transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
}

.update-profile-form input::placeholder {
  color: #999;
}

.update-profile-form input:hover,
.update-profile-form select:hover {
  background: #fff;
  border-color: #d0d0d0;
}

.update-profile-form input:focus,
.update-profile-form select:focus {
  outline: none;
  border-color: var(--brand-red);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

#updateProfileMessage {
  padding: 14px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  margin-top: 10px;
}

#updateProfileMessage.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

#updateProfileMessage.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 25px;
  justify-content: center;
  flex-wrap: wrap;
}

.form-actions .btn-secondary {
  flex: 1;
  min-width: 140px;
  padding: 12px 20px;
  background: #f5f5f5;
  color: #333;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 0;
}

.form-actions .btn-secondary:hover {
  background: #ebebeb;
  border-color: #d0d0d0;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.form-actions .btn-secondary:active {
  transform: translateY(0);
}

.form-actions .btn-primary {
  flex: 1;
  min-width: 140px;
  padding: 12px 20px;
  background: var(--brand-red);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 0;
}

.form-actions .btn-primary:hover {
  background: #b81a19;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.25);
}

.form-actions .btn-primary:active {
  transform: translateY(0);
}

/* Payslips Table Styles */
.payslips-table-container {
  width: 100%;
  overflow-x: auto;
}

.payslips-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.payslips-table thead {
  background: #f5f5f5;
  border-bottom: 2px solid #ddd;
}

.payslips-table th {
  padding: 15px;
  text-align: left;
  font-weight: 700;
  color: #333;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  font-size: 14px;
}

.payslips-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  color: #555;
}

.payslips-table tbody tr:hover {
  background: #f9f9f9;
}

.payslips-table tbody tr:last-child td {
  border-bottom: none;
}

/* Pagination Styles */
.pagination-container {
  display: none !important;
}


.pagination-info {
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pagination-btn {
  background: white;
  color: var(--brand-green);
  border: 2px solid var(--brand-green);
  padding: 8px 12px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--brand-green);
  color: white;
}

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

.pagination-page-input {
  width: 60px;
  padding: 8px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

.pagination-page-input:focus {
  outline: none;
  border-color: var(--brand-green);
}

.payslip-display {
  margin-top: 30px;
  padding: 25px;
  background: #f9f9f9;
  border-radius: 5px;
  border: 1px solid #eee;
  width: 100%;
  box-sizing: border-box;
}

.payslip-display h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 18px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  word-wrap: break-word;
}

.payslip-display.hidden {
  display: none;
}

#payslipContent {
  background: white;
  padding: 18px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-family: 'Courier New', monospace !important;
  font-size: 13px;
  line-height: 1.7;
  color: #333;
  overflow-x: auto;
  overflow-y: auto;
  /* Preserve exact whitespace and line breaks from the original .txt */
  white-space: pre !important;
  /* Ensure tabs/indentation render consistently */
  tab-size: 4;
  -moz-tab-size: 4;
  /* Prevent wrapping or collapse by other rules */
  word-break: normal;
  white-space-collapse: preserve;
  /* guarded: non-standard but harmless */
  max-height: 600px;
}

.status-table {
  background: white;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
}

.status-table table {
  width: 100%;
  border-collapse: collapse;
}

.status-table th {
  background: #f5f5f5;
  padding: 10px;
  text-align: left;
  font-weight: 600;
  color: #333;
  font-size: 13px;
  border-bottom: 2px solid #ddd;
}

.status-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
  color: #666;
  font-size: 13px;
}

.status-table tr:hover {
  background: #f9f9f9;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 20px;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 5px;
}

.btn-pagination {
  padding: 10px 16px;
  background: var(--brand-green);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  transition: all 0.2s;
}

.btn-pagination:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(15, 142, 56, 0.12);
}

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

.page-info {
  font-weight: 600;
  color: #333;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  min-width: 80px;
  text-align: center;
}

.staff-info-section {
  padding: 30px;
  background: white;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.staff-info-section h1 {
  color: #333;
  margin-bottom: 25px;
  font-family: Georgia, serif;
  font-size: 28px;
}

.staff-controls {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.search-box {
  flex: 1;
  min-width: 250px;
}

.search-box input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  font-family: Georgia, serif;
}

.search-box input:focus {
  outline: none;
  border-color: #667eea;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  font-family: Georgia, serif;
}

.filter-group select {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  font-family: Georgia, serif;
  background: white;
  cursor: pointer;
}

.filter-group select:focus {
  outline: none;
  border-color: #667eea;
}

.staff-table-container {
  margin-bottom: 20px;
}

.staff-table {
  background: white;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
}

.staff-table table {
  width: 100%;
  border-collapse: collapse;
}

.staff-table th {
  background: #f5f5f5;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
  font-size: 13px;
  border-bottom: 2px solid #ddd;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.staff-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  color: #666;
  font-size: 13px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.staff-table tr:hover {
  background: #f9f9f9;
}

.btn-action {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.btn-remove {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.btn-remove:hover {
  background: #fecaca;
  color: #7f1d1d;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(217, 35, 34, 0.15);
}

.btn-remove:active {
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

.site-footer {
  font-size: 13px;
  color: #666;
  text-align: center;
  margin-top: 18px;
  opacity: 0.9;
}

/* Modal styles for payslip preview */
.modal {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10050;
}

/* Show modal only when it has the visible class or inline style display: flex */
.modal[style*="display: flex"],
.modal.visible {
  display: flex;
}

/* Lock body scroll when any modal is visible */
body.no-scroll,
body.left-modal-open {
  overflow: hidden !important;
  touch-action: none;
}

.modal.hidden {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Ensure modals stay hidden in mobile view after logout */
@media (max-width: 480px) {
  .modal.hidden,
  .modal.hidden * {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
  }
}

.modal-backdrop {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.modal-content {
  position: relative;
  background: #fff;
  width: 90%;
  max-width: 980px;
  max-height: 90vh;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 10051;
  display: flex;
  flex-direction: column;
}

.leave-modal-content {
  max-width: 600px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid #cce0ff;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
}

.view-details-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  background-color: #fff;
  padding: 16px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.06) 0%, rgba(118, 75, 162, 0.04) 100%);
  border-left: 3px solid #667eea;
  transition: all 0.2s ease;
}

.detail-row:hover {
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.12);
}

.detail-label {
  font-weight: 600;
  color: #1f2d5a;
  min-width: 40%;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.detail-value {
  font-weight: 500;
  color: #223366;
  text-align: right;
  font-size: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #eee;
}

.modal-body {
  padding: 12px 18px;
  overflow: auto;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

.leave-modal-content .modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid #d4e1ff;
  background: linear-gradient(135deg, #4a76d0 0%, #5a8fdb 100%);
}

.leave-modal-content .modal-header h3 {
  color: #fff;
  margin: 0;
  font-size: 1.2rem;
}

.leave-modal-content .modal-close {
  color: #fff;
  font-size: 20px;
}

.leave-modal-content .modal-body {
  background-color: rgba(236, 243, 255, 0.65);
  margin: 0 14px;
  border-radius: 8px;
}

.leave-modal-content .modal-footer {
  border-top: none;
  background: transparent;
  justify-content: center;
}

.leave-modal-content .btn-secondary {
  background: #4a76d0;
  color: #fff;
  border: none;
  font-weight: 600;
  width: 100%;
  max-width: 120px;
  border-radius: 8px;
  padding: 10px 16px;
}

.leave-modal-content .btn-secondary:hover {
  background: #3860b8;
}

.modal-body pre {
  background: #fff;
  padding: 18px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  white-space: pre;
  tab-size: 4;
  line-height: 1.6;
  color: #111;
  max-height: 100%;
  overflow: auto;
}

@media (max-width: 1024px) {
  .login-layout {
    flex-direction: column;
  }

  .login-promo {
    padding: 40px 30px;
    min-height: 250px;
  }

  .promo-title {
    font-size: 28px;
  }

  .promo-subtitle {
    font-size: 16px;
  }

  .login-form-panel {
    padding: 40px 30px;
  }

  .login-form-content {
    max-width: 100%;
  }

  .login-header,
  .login-header h1,
  .login-header p {
    text-align: center !important;
    margin-left: auto;
    margin-right: auto;
  }

  .login-form-panel {
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .login-layout {
    flex-direction: column;
    height: auto;
  }

  .login-promo {
    padding: 24px 16px;
    min-height: 160px;
    max-height: 240px;
    overflow: hidden;
  }

  .login-form-panel {
    padding: 24px 16px;
  }

  .login-form-content {
    max-width: 100%;
  }

  .promo-title {
    font-size: 24px;
  }

  .promo-subtitle {
    font-size: 14px;
    margin-bottom: 30px;
  }

  .login-form-panel {
    padding: 30px 20px;
  }

  .form-logo-top img {
    height: 40px;
  }

  .login-header {
    margin-bottom: 30px;
  }

  .login-header h1 {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .login-layout {
    flex-direction: column;
    height: auto;
    margin-top: 0;
    background: white;
  }

  .login-promo {
    display: none;
  }

  .login-form-panel {
    padding: 18px 12px;
    justify-content: flex-start;
    min-height: auto;
    background: white;
    height: 100vh;
  }

  .promo-title {
    font-size: 20px;
    margin-bottom: 12px;
  }

  .promo-subtitle {
    font-size: 13px;
    margin-bottom: 20px;
  }

  .promo-features {
    gap: 10px;
  }

  .feature-item {
    font-size: 12px;
  }

  .login-form-panel {
    padding: 0 15px 20px 15px;
    justify-content: flex-start;
  }

  .login-form-content {
    max-width: 100%;
  }

  .form-logo-top img {
    height: 35px;
  }

  .login-header {
    text-align: right;
    margin-bottom: 25px;
  }

  .login-header h1 {
    font-size: 20px;
    margin-bottom: 4px;
  }

  .login-subtitle {
    font-size: 12px;
  }

  .form-group {
    margin-bottom: 18px;
  }

  .form-group input:not([type="checkbox"]) {
    padding: 10px 12px;
    font-size: 13px;
  }

  .btn-login {
    padding: 12px;
    font-size: 14px;
  }

  .auth-footer-small {
    font-size: 10px;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 10px;
  }

  .main-content.full-width {
    padding: 15px;
  }

  .form-container {
    padding: 30px 20px;
    border-radius: 16px;
    max-width: 100%;
  }

  .form-container h1 {
    font-size: 20px;
    margin-bottom: 16px;
    line-height: 1.3;
  }

  .form-header {
    margin-left: 0;
    margin-top: 0;
    margin-right: 0;
    padding: 15px 25px;
    display: none;
  }

  .auth-logo-container {
    top: 20px;
    left: 20px;
  }

  .auth-page-logo {
    width: 75px;
  }

  .form-logo-large {
    width: 70px;
  }

  .app-title {
    font-size: 15px;
    margin-bottom: 6px;
  }

  .app-subtitle {
    font-size: 24px;
  }

  .form-group {
    margin-bottom: 18px;
  }

  .form-group input,
  .form-group select {
    padding: 12px 14px;
    font-size: 16px;
  }

  .btn-primary {
    padding: 12px;
    font-size: 15px;
  }

  .toggle-text {
    font-size: 13px;
    margin-top: 14px;
  }

  .dashboard {
    padding: 16px;
  }

  .dashboard h1 {
    font-size: 22px;
    margin-bottom: 12px;
    color: white;
    background: var(--brand-red);
    border: 2px solid var(--brand-red);
    padding: 12px 14px;
    border-radius: 6px;
    font-weight: 600;
    width: auto;
    align-self: flex-end;
  }

  .dashboard > p {
    font-size: 13px;
    margin-bottom: 14px;
  }

  .payslip-section,
  .upload-section,
  .status-section {
    margin-top: 16px;
    padding: 14px;
    border-radius: 6px;
  }

  .payslip-section h2,
  .upload-section h2,
  .status-section h2 {
    font-size: 15px;
    margin-bottom: 14px;
  }

  .form-group {
    margin-bottom: 12px;
  }

  .form-group label {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .form-group input,
  .form-group select {
    padding: 11px;
    font-size: 15px;
    border-radius: 5px;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 40px;
    font-size: 13px;
    padding: 10px;
  }

  .sidebar {
    width: 200px;
  }

  .main-content {
    margin-left: 200px;
    width: calc(100% - 200px);
    padding: 20px;
  }

  .status-table {
    font-size: 12px;
  }

  .status-table th,
  .status-table td {
    padding: 8px 5px;
  }

  

  /* Available Payslips section for 600px */
  .payslips-table th {
    padding: 10px 8px;
    font-size: 12px;
  }

  .payslips-table td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .pagination-container {
    gap: 10px;
  }

  .pagination-btn {
    padding: 10px;
    font-size: 13px;
  }

  .btn-link {
    padding: 11px;
    font-size: 14px;
  }

/* Additional tighter mobile tweaks for phones */
@media (max-width: 480px) {

  /* Sidebar starts hidden off-canvas */
  .sidebar {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    width: 75%;
    max-width: 320px;
    height: 100vh;
    z-index: 10000;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
    transform: translateX(-110%);
    transition: transform 240ms ease-out;
  }

  /* Sidebar always visible when on any page (not hidden by dashboard) */
  .sidebar {
    display: flex !important;
    visibility: visible !important;
  }

  /* When dashboard or mpay module is shown, sidebar should still respect toggle */
  #mpayDashboard ~ .sidebar,
  .dashboard ~ .sidebar {
    display: flex !important;
    visibility: visible !important;
  }

  /* Sidebar visible state for mobile (overlay) */
  .sidebar.mobile-visible {
    transform: translateX(0);
    overflow-y: auto;
    flex-direction: column;
    z-index: 10000 !important;
  }

  .sidebar-header {
    flex-shrink: 0;
  }

  .sidebar-menu {
    flex: 1;
    overflow: visible;
  }

  .sidebar-footer {
    margin-top: auto;
    flex-shrink: 0;
  }

  /* Make main content full width and reduce padding */
  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 0;
    min-height: 100%;
    max-height: none;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
  }

  .main-content > * {
    flex-shrink: 0;
  }

  /* Ensure body allows scrolling in mobile */
  body {
    overflow-y: auto;
  }

  /* Auth page mobile positioning - move card up */
  body.auth-visible {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 10px;
  }

  body.auth-visible .main-content.full-width {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 50px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .auth-page-logo {
    width: 70px;
  }

  /* Dashboard improvements */
  .dashboard {
    padding: 12px 10px;
    background: white;
    width: 100%;
  }

  /* GLOBAL: Disable all backdrops */
  .mobile-backdrop,
  body .mobile-backdrop,
  * .mobile-backdrop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    opacity: 0 !important;
  }

  /* Hamburger button - hidden on all screens by default */
  .header-hamburger {
    display: none !important;
    background: var(--brand-red);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    transition: all 0.2s ease;
  }

  /* Hide avatar when hamburger is shown on small screens */
  .header-hamburger.show ~ .header-menu-btn {
    display: none;
  }

@media (max-width: 768px) {
  /* Hide scrollbars on mobile but keep scrolling working */
  * {
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE/Edge */
  }

  *::-webkit-scrollbar {
    display: none;               /* Chrome/Safari */
  }

  .main-content {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
  }

  .dashboard,
  .payslips-page-container,
  #availablePayslipsSection {
    overflow-y: visible;
    overflow-x: hidden;
    min-height: 100%;
  }
}

  /* Show hamburger on mobile/tablet screens (max 768px) */
  @media (max-width: 768px) {
    .header-hamburger.show {
      display: flex !important;
    }
  }

  /* Ensure hamburger hidden on large screens (769px and above) */
  @media (min-width: 769px) {
    .header-hamburger {
      display: none !important;
    }

    .header-hamburger.show {
      display: none !important;
    }
  }

  /* Legacy hamburger for backward compatibility */
  .hamburger {
    position: fixed;
    top: 16px;
    left: 12px;
    z-index: 10001;
    background: var(--brand-red);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    display: none;
    align-items: center;
    justify-content: center;
  }

  .hamburger.show {
    display: flex !important;
  }

  /* Hide hamburger during loading state */
  .loading-screen:not(.hidden) ~ .top-header ~ .sidebar ~ .container .hamburger {
    display: none !important;
    pointer-events: none;
  }

  /* Backdrop DISABLED - no overlay */
  .mobile-backdrop {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  .mobile-backdrop.show {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  /* Sidebar always visible, no z-index issues */
  .sidebar.mobile-visible {
    z-index: 10000 !important;
  }

  /* Ensure dashboard content is clickable */
  #dashboard,
  #mpayDashboard {
    pointer-events: auto !important;
    z-index: 100 !important;
    position: relative;
    margin-top: 40px;
  }

  /* Ensure mobile-backdrop doesn't interfere with dashboard - DISABLED EVERYWHERE */
  #dashboard .mobile-backdrop,
  .dashboard .mobile-backdrop,
  #mpayDashboard .mobile-backdrop {
    display: none !important;
    pointer-events: none !important;
    z-index: -1 !important;
    visibility: hidden !important;
  }

  /* Ensure mpay sheet is above backdrop */
  .mpay-sheet {
    z-index: 10000 !important;
  }

  /* Hide hamburger button when payslip module is shown */
  #dashboard:not(.hidden) .header-hamburger,
  .dashboard:not(.hidden) ~ .top-header .header-hamburger {
    display: none !important;
  }

  /* Ensure user-initial is visible in payslip module */
  .user-initial {
    display: none !important;
  }

  /* Home button styling */
  .header-home-btn {
    background: #c50000;
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
  }

  .header-home-btn.hidden {
    display: none !important;
  }

  .header-home-btn:hover {
    background: #a00000;
    transform: scale(1.05);
  }

  .header-home-btn:active {
    transform: scale(0.95);
  }

  .header-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .header-menu-btn:hover {
    opacity: 0.8;
  }

  /* Ensure all mpay elements are clickable */
  #mpayDashboard,
  #mpayDashboard * {
    pointer-events: auto !important;
  }

  /* Dashboard improvements */
  .dashboard {
    padding: 12px 8px 4px 8px;
    background: white;
    width: 100%;
    margin-bottom: 0;
  }

  .dashboard h1 {
    font-size: 20px;
    margin-bottom: 12px;
    line-height: 1.3;
    margin-top: 8px;
    color: white;
    background: var(--brand-red);
    border: 2px solid var(--brand-red);
    padding: 12px 14px;
    border-radius: 6px;
    font-weight: 600;
    width: auto;
    align-self: flex-end;
  }

  .dashboard > p {
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.5;
    color: #666;
  }

  .staff-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
    padding: 16px 12px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
  }

  .staff-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .staff-info-item strong {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
    text-transform: capitalize;
    letter-spacing: 0.5px;
  }

  .staff-info-item span {
    font-size: 14px;
    color: #333;
    font-weight: 600;
  }

  /* Payslip section styling */
  .payslip-section,
  .upload-section,
  .status-section {
    margin-top: 12px;
    margin-bottom: 8px;
    padding: 12px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #efefef;
  }

  .payslip-section h2,
  .upload-section h2,
  .status-section h2 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #333;
  }

  /* Form improvements */
  .form-container {
    padding: 12px 10px 0 10px;
    max-width: 100%;
    margin: 0;
  }

  .form-logo {
    width: 120px;
  }

  .app-title {
    font-size: 14px;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .form-group label {
    font-size: 13px;
    margin-bottom: 8px;
    display: block;
  }

  .form-group input,
  .form-group select {
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 100%;
  }

  .form-group input:focus,
  .form-group select:focus {
    border-color: var(--brand-red);
    outline: none;
    box-shadow: 0 0 0 3px rgba(217, 35, 34, 0.1);
  }

  .btn-primary {
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    width: 100%;
    border-radius: 6px;
    margin-top: 4px;
    margin-bottom: 4px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .btn-secondary {
    padding: 12px 14px;
    font-size: 14px;
    min-height: 44px;
  }

  .toggle-text {
    margin: 6px 0 0 0;
    font-size: 12px;
  }

  /* Larger list items for easier tapping */
  .payslip-list {
    background: white;
    padding: 12px;
    border-radius: 6px;
    margin-top: 16px;
    border: 1px solid #eee;
  }

  .payslip-list h2 {
    font-size: 16px;
    margin-bottom: 14px;
  }

  .payslip-list li {
    padding: 12px 0;
    font-size: 14px;
    border-bottom: 1px solid #eee;
  }

  .payslip-list li:last-child {
    border-bottom: none;
  }

  /* Payslip display */
  #payslipContent {
    font-size: 13px;
    max-height: 65vh;
    padding: 12px;
    line-height: 1.6;
    overflow-x: auto;
    overflow-y: auto;
    white-space: pre;
    background: #fafafa;
    border-radius: 6px;
  }

  .payslip-display {
    padding: 12px;
    margin-top: 12px;
  }

  .payslip-display h2 {
    font-size: 15px;
    margin-bottom: 12px;
  }

  .payslip-actions {
    margin-bottom: 12px;
  }

  /* Available Payslips section */
  #availablePayslipsSection {
    padding: 8px 0;
  }

  .btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: var(--brand-red);
    text-decoration: none;
    cursor: pointer;
  }

  .payslips-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
  }

  .payslips-table {
    width: 100%;
    font-size: 12px;
  }

  .payslips-table thead {
    background: #f0f0f0;
  }

  .payslips-table th {
    padding: 10px 8px;
    font-size: 11px;
    text-transform: capitalize;
    letter-spacing: 0.5px;
    color: #666;
    font-weight: 600;
  }

  .payslips-table td {
    padding: 10px 8px;
    font-size: 12px;
  }

  .payslips-table tbody tr {
    border-bottom: 1px solid #eee;
  }

  /* Pagination improvements */
  .pagination-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
  }

  .pagination-info {
    text-align: center;
    font-size: 12px;
    color: #666;
  }

  .pagination-controls {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
  }

  .pagination-controls > span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    order: 1;
  }

  .pagination-btn {
    padding: 6px 8px;
    font-size: 11px;
    min-height: 32px;
    flex: 0 1 auto;
    border-radius: 4px;
  }

  .pagination-page-input {
    width: 50px;
    padding: 8px;
    font-size: 12px;
    text-align: center;
  }

  /* Payslips mobile redesign */
  .payslips-page-container {
    padding: 20px 12px;
  }

  .payslips-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 25px;
  }

  .btn-back-simple {
    align-self: flex-start;
    padding: 10px 16px;
    font-size: 13px;
  }

  .payslips-title {
    font-size: 22px;
    margin-bottom: 4px;
  }

  .payslips-subtitle {
    font-size: 13px;
  }

  .payslips-grid-wrapper {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .payslip-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: auto;
  }

  .payslip-card-header {
    padding: 16px;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    width: 100px;
    min-width: 100px;
  }

  .payslip-card-icon {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .payslip-card-badge {
    padding: 4px 8px;
    font-size: 11px;
  }

  .payslip-card-body {
    padding: 16px;
    flex: 1;
    justify-content: center;
  }

  .payslip-card-month {
    font-size: 18px;
  }

  .payslip-card-footer {
    display: none;
  }

  .payslip-card:active {
    opacity: 0.95;
  }

  .payslips-empty {
    padding: 40px 20px;
  }

  .payslips-empty i {
    font-size: 36px;
  }

  .payslips-empty p {
    font-size: 14px;
  }

  .pagination-container {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .pagination-info {
    font-size: 13px;
  }

  .pagination-controls {
    flex-direction: column;
    width: 100%;
  }

  .pagination-btn {
    width: 100%;
    padding: 12px;
    font-size: 13px;
    min-height: 44px;
  }

  .pagination-input-group {
    width: 100%;
    justify-content: center;
    padding: 8px 0;
    font-size: 13px;
  }

  .pagination-page-input {
    width: 60px;
    padding: 8px;
  }
}

  .payslip-actions button {
    width: 100%;
    min-height: 44px;
  }

  .download-dropdown {
    margin-bottom: 12px;
  }

  .dropdown-toggle {
    font-size: 14px;
    padding: 12px;
    min-height: 44px;
  }

  .dropdown-item {
    font-size: 13px;
    padding: 12px 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Make staff controls stack vertically */
  .staff-controls {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .search-box,
  .filter-group {
    width: 100%;
  }

  .pagination-controls {
    padding: 12px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .pagination-btn {
    flex: 1;
    min-width: auto;
    min-height: 32px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .pagination-page-input {
    width: 50px;
    padding: 8px;
    font-size: 14px;
  }

  .nav-btn {
    font-size: 14px;
    padding: 12px;
    min-height: 44px;
  }

  .btn-link {
    padding: 12px;
    font-size: 14px;
    margin-bottom: 16px;
  }

  .btn-pagination {
    padding: 12px 14px;
    font-size: 14px;
  }

  .btn-logout {
    min-height: 44px;
    font-size: 14px;
  }

  /* Ensure no horizontal overflow */
  html,
  body {
    overflow-x: hidden;
  }
}

/* Download Dropdown Menu Styles */
.download-dropdown {
  position: relative;
  width: 100%;
  display: inline-block;
}

.dropdown-toggle {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 10px;
}

.dropdown-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.dropdown-toggle:active {
  transform: translateY(0);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
  z-index: 1000;
  overflow: hidden;
}

.dropdown-menu.hidden {
  display: none;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: white;
  color: #333;
  border: none;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: #f5f5f5;
}

.dropdown-item:active {
  background: #e8e8e8;
}

.dropdown-item:first-child {
  border-top: none;
}

.dropdown-item:not(:last-child) {
  border-bottom: 1px solid #eee;
}

/* Modal: extra mobile tweaks for better readability and touch targets */
@media (max-width: 480px) {
  .modal-content {
    width: 98%;
    max-width: 98%;
    margin: 0 6px;
    border-radius: 8px;
  }

  .modal-header,
  .modal-footer {
    padding: 10px 12px;
  }

  .modal-body {
    padding: 8px 12px;
    overflow: auto;
  }

  .modal-body pre {
    font-size: 12px;
    line-height: 1.5;
    padding: 10px;
    max-height: 70vh;
    overflow-x: auto;
    overflow-y: auto;
    white-space: pre;
    word-wrap: normal;       /* changed */
    word-break: normal;      /* add this */
    -webkit-overflow-scrolling: touch;
  }

  /* My Profile Modal Mobile Styles */
  .profile-modal-header {
    padding: 20px 16px;
  }

  .profile-modal-header-content {
    gap: 12px;
  }

  .profile-modal-icon {
    font-size: 24px;
    min-width: 24px;
  }

  .profile-modal-title {
    font-size: 18px;
  }

  .profile-modal-subtitle {
    font-size: 12px;
  }

  .profile-modal-body {
    padding: 20px 16px;
    max-height: calc(90vh - 120px);
  }

  .profile-modal-footer {
    padding: 16px;
    flex-direction: column;
    gap: 10px;
  }

  .profile-modal-close-btn {
    width: 100%;
    justify-content: center !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
  }

  .modal-footer {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .modal-footer .btn-primary,
  .modal-footer .btn-secondary,
  .modal-footer button {
    width: 100%;
    padding: 12px;
    font-size: 15px;
  }

  /* Hide PDF download button on mobile */
  #modalDownloadPdf {
    display: none;
  }

  .modal-close {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 18px;
    padding: 6px;
  }

  /* Reduce footer spacing on mobile */
  .site-footer {
    margin: 4px 0 0 0;
    padding: 8px 0;
    font-size: 11px;
  }

  /* Update Profile Section Mobile */
  .profile-container {
    padding: 24px 16px;
    margin-top: 20px;
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .profile-container h2 {
    font-size: 22px;
    margin-bottom: 24px;
  }

  .update-profile-form {
    gap: 16px;
  }

  .update-profile-form label {
    font-size: 13px;
  }

  .update-profile-form input,
  .update-profile-form select {
    padding: 11px 12px;
    font-size: 16px;
    border-radius: 5px;
  }

  .form-actions {
    gap: 10px;
    margin-top: 20px;
  }

  .form-actions .btn-secondary,
  .form-actions .btn-primary {
    flex: 1;
    min-width: 110px;
    padding: 11px 14px;
    font-size: 14px;
    border-radius: 5px;
  }

  #updateProfileMessage {
    font-size: 13px;
    padding: 12px 14px;
  }
}

/* Dark overlay shown on logout for mobile users */
.logout-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 9999;
  display: none;
}

.logout-overlay.visible {
  opacity: 1;
  pointer-events: auto;
  display: block;
}

/* Remove dark overlay from logout modal on mobile */
@media (max-width: 480px) {
  .logout-modal-mobile {
    background: transparent !important;
  }
}

#payslipModal .modal-body,
#payslipModal .modal-body pre {
  touch-action: pan-x pan-y;
}

/* ========== ERP Home Page Styles ========== */

.erp-home {
  padding: 30px;
  background: white;
  width: 100%;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease-in;
}

.erp-home.hidden {
  display: none;
}

.erp-header {
  text-align: center;
  margin-bottom: 50px;
}

.erp-logo {
  width: 120px;
  height: auto;
  margin-bottom: 20px;
  object-fit: contain;
}

.erp-header h1 {
  color: #333;
  font-size: 32px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  margin-bottom: 10px;
  font-weight: 600;
}

.erp-subtitle {
  color: #666;
  font-size: 18px;
  margin-top: 10px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
}

.erp-subtitle span {
  color: var(--brand-red);
  font-weight: 600;
}

.erp-modules-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 40px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.erp-module-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  height: auto;
}

.erp-module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.erp-module-card:hover {
  border-color: var(--brand-red);
  box-shadow: 0 8px 24px rgba(217, 35, 34, 0.15);
  transform: translateY(-6px);
}

.erp-module-card:hover::before {
  transform: scaleX(1);
}

.module-icon {
  font-size: 42px;
  margin-bottom: 16px;
  display: block;
}

.erp-module-card h3 {
  color: #333;
  font-size: 19px;
  margin-bottom: 10px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  font-weight: 600;
}

.erp-module-card p {
  color: #666;
  font-size: 13px;
  margin-bottom: 16px;
  font-family: 'Avenirltstd book', Arial, sans-serif;
  line-height: 1.4;
}

.module-arrow {
  display: block;
  color: var(--brand-red);
  font-size: 20px;
  font-weight: 600;
  transition: transform 0.3s ease;
  margin-top: auto;
  padding-top: 15px;
  text-align: center;
}

.erp-module-card:hover .module-arrow {
  transform: translateX(6px);
}

/* Responsive for tablets */
@media (max-width: 768px) {
  .erp-header h1 {
    font-size: 26px;
  }

  .erp-subtitle {
    font-size: 16px;
  }

  .erp-modules-container {
    grid-template-columns: repeat(1, 1fr);
    gap: 20px;
    margin-bottom: 30px;
  }

  .erp-module-card {
    padding: 25px;
  }

  .module-icon {
    font-size: 40px;
    margin-bottom: 15px;
  }

  .erp-module-card h3 {
    font-size: 19px;
    margin-bottom: 10px;
  }
}

/* Responsive for mobile */
@media (max-width: 480px) {
  .erp-home {
    padding: 16px;
    margin-left: 0;
    width: 100%;
  }

  .erp-header {
    margin-bottom: 30px;
  }

  .erp-logo {
    width: 100px;
    margin-bottom: 15px;
  }

  .erp-header h1 {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .erp-subtitle {
    font-size: 14px;
    margin-top: 8px;
  }

  .erp-modules-container {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 25px;
  }

  .erp-module-card {
    padding: 20px;
    border-radius: 8px;
    min-height: 200px;
    height: 100%;
  }

  .module-icon {
    font-size: 36px;
    margin-bottom: 12px;
  }

  .erp-module-card h3 {
    font-size: 17px;
    margin-bottom: 8px;
  }

  .erp-module-card p {
    font-size: 13px;
    margin-bottom: 15px;
  }

  .module-arrow {
    font-size: 18px;
    margin-top: 8px;
  }
}

/* ========== Top Header Styles ========== */

.top-header {
  position: fixed;
  top: 0;
  left: 280px;
  right: 0;
  height: 60px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  z-index: 10002;
  display: flex;
  align-items: center;
  padding: 0 20px;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.top-header.hidden {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  padding: 0 !important;
}

.header-content {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.header-back-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--brand-red);
  cursor: pointer;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}

.header-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-red);
  flex-shrink: 0;
  padding: 0 4px;
}

.header-icon-avatar {
  display: flex;
  flex-shrink: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
  color: var(--brand-red);
}

.header-icon-arrow {
  display: flex;
  flex-shrink: 0;
}



.header-back-btn.hidden {
  display: none;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
  font-family: 'Poppins', 'Montserrat', sans-serif;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

.header-spacer {
  flex: 1;
}

.header-user-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.header-menu-btn {
  background: white;
  border: 2px solid var(--brand-red);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: var(--brand-red);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.header-menu-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(217, 35, 34, 0.3);
}

.user-initial {
  font-size: 16px;
}

.header-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  min-width: 180px;
  margin-top: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 1001;
  overflow: hidden;
}

.header-dropdown.hidden {
  display: none;
}

.header-dropdown .dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: white;
  border: none;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: Georgia, serif;
  color: #333;
}

.header-dropdown .dropdown-item:hover {
  background: #f5f5f5;
}

.header-dropdown .dropdown-item:active {
  background: #e8e8e8;
}

.header-dropdown .dropdown-item:not(:last-child) {
  border-bottom: 1px solid #eee;
}

/* Adjust main content to have top margin when header is visible */
.main-content {
  margin-top: 60px;
}

.main-content.full-width {
  margin-left: 0;
  width: 100%;
  margin-top: 0;
}

/* ERP home without header doesn't need top margin */
.erp-home {
  margin-top: 0;
}

/* Responsive for mobile */
@media (max-width: 480px) {
  .top-header {
    height: 40px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    left: 0;
    width: 100%;
  }

  .header-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .header-back-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 20px;
    min-width: 40px;
    min-height: 40px;
    color: var(--brand-red);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 8px;
    flex-shrink: 0;
  }

  .header-back-btn.hidden {
    display: none !important;
  }

  .header-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-red);
    flex-shrink: 0;
    padding: 0 4px;
  }

  .header-title {
    font-size: 16px;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-hamburger {
    display: none !important;
    width: 36px;
    height: 36px;
    font-size: 16px;
    margin-right: 4px;
  }

  .header-hamburger.show {
    display: flex !important;
  }

  .header-menu-btn {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }

  .header-dropdown {
    right: -10px;
    min-width: 160px;
  }

  .header-dropdown .dropdown-item {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* DESKTOP: Hide hamburger on screens 769px and above */
  @media (min-width: 769px) {
    .header-hamburger,
    .header-hamburger.show {
      display: none !important;
    }
  }

  /* TABLET: Hide hamburger on screens 481px to 768px */
  @media (min-width: 481px) and (max-width: 768px) {
    .header-hamburger,
    .header-hamburger.show {
      display: none !important;
    }
  }

  .main-content {
    margin-top: 56px;
  }
}

/* Settings Modal Styles */
.settings-modal {
  max-width: 520px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  border: 1px solid #d2e1fb;
  box-shadow: 0 20px 36px rgba(35, 64, 122, 0.2);
  overflow: hidden;
}

.settings-section {
  margin: 0;
}

.settings-section h4 {
  margin: 0 0 28px 0;
  font-size: 18px;
  font-weight: 700;
  color: #000000;
  text-transform: capitalize;
  letter-spacing: 0.5px;
  font-family: 'Baloo 2', sans-serif;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-section h4::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, #c50000 0%, #ff6b6b 100%);
  border-radius: 2px;
}

.user-info-display {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(197, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.03) 100%);
  border-radius: 14px;
  border: 1px solid rgba(197, 0, 0, 0.15);
  box-shadow: 0 4px 15px rgba(197, 0, 0, 0.08);
}

.user-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c50000 0%, #ff6b6b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(197, 0, 0, 0.3);
  position: relative;
}

.user-avatar::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c50000 0%, #ff6b6b 100%);
  z-index: -1;
  filter: blur(8px);
  opacity: 0.4;
}

.user-name {
  font-size: 20px;
  font-weight: 700;
  color: #000000;
  letter-spacing: 0.3px;
  font-family: 'Baloo 2', sans-serif;
}

.settings-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.settings-info-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 12px;
  padding: 18px;
  border: 1.5px solid #e8e9eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04),
              0 0 1px rgba(197, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.settings-info-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #c50000 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.settings-info-item:hover {
  border-color: #c50000;
  box-shadow: 0 4px 16px rgba(197, 0, 0, 0.12),
              0 0 1px rgba(197, 0, 0, 0.2);
  transform: translateY(-2px);
}

.settings-info-item:hover::before {
  opacity: 1;
}

.info-label {
  font-size: 11px;
  color: #888888;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-family: 'Baloo 2', sans-serif;
  margin: 0;
}

.info-value {
  font-size: 15px;
  color: #000000;
  font-weight: 600;
  word-break: break-word;
  margin: 2px 0 0 0;
  letter-spacing: 0.2px;
}

@media (max-width: 600px) {
  .settings-info-grid {
    grid-template-columns: 1fr;
  }
}

.settings-modal {
  max-width: 90%;
}

/* ==================== LEAVE MODULE STYLES ==================== */

/* Leave Dashboard Header */
.leave-header {
  background: white;
  color: #333;
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.leave-header-title {
  flex: 1;
}

.leave-header-controls {
  display: flex;
  gap: 16px;
  align-items: center;
}

.leave-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
}

.leave-date-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leave-date-selector label {
  font-size: 12px;
  font-weight: 500;
  color: #666;
}

.leave-date-selector input[type="date"] {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 160px;
}

.leave-date-selector input[type="date"]:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

.leave-date-selector input[type="date"]:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.7);
}

/* Leave Sections */
.leave-section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
  touch-action: auto;
  -webkit-user-drag: auto;
}

.leave-section h2 {
  font-size: 18px;
  color: #333;
  margin-bottom: 16px;
  font-weight: 600;
  padding-bottom: 12px;
}

/* Leave Entitlements Table */
.leave-entitlements-container,
.leave-requests-container {
  overflow-x: auto;
  touch-action: auto;
  -webkit-user-drag: auto;
}

.leave-requests-container::-webkit-scrollbar {
  height: 8px;
}

.leave-requests-container::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.leave-requests-container::-webkit-scrollbar-thumb {
  background: #999;
  border-radius: 4px;
}

.leave-requests-container::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.leave-entitlements-table,
.leave-requests-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.leave-entitlements-table thead,
.leave-requests-table thead {
  background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
  color: white;
}

.leave-entitlements-table th,
.leave-requests-table th {
  padding: 16px 12px;
  text-align: left;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.leave-entitlements-table td,
.leave-requests-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #4b5563;
  font-weight: 700;
}

.leave-entitlements-table tbody tr:hover,
.leave-requests-table tbody tr:hover {
  background-color: #f5fdf7;
  transition: background-color 0.2s ease;
}

.text-center {
  text-align: center;
}

/* Leave Tabs */
.leave-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  border-bottom: 2px solid #e0e0e0;
}

.leave-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: white;
  border: 1px solid #dee3ed;
  cursor: pointer;
  color: var(--lt-color-text-light);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.leave-tab-btn i {
  font-size: 16px;
  display: flex;
  align-items: center;
}

.leave-tab-btn:hover {
  color: var(--brand-red);
  background-color: #f8f9fc;
  border-color: #2e7d32;
}

.leave-tab-btn.active {
  color: white;
  background-color: #2e7d32;
  border-color: white;
}

.leave-tab-content {
  display: none;
}

.leave-tab-content.active {
  display: block;
}

/* Calendar Styles */
.leave-calendar-container {
  background: white;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e0e0e0;
}

.calendar-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.calendar-nav-btn {
  padding: 8px 12px;
  background: #2e7d32;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.3s;
}

.calendar-nav-btn:hover {
  background: #1b5e20;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  user-select: none;
}

.calendar-day-name {
  font-weight: 600;
  text-align: center;
  color: #667eea;
  padding: 4px 0;
  font-size: 11px;
}

.calendar-date {
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  background: white;
  font-size: 10px;
  transition: all 0.2s;
  padding: 0;
}

.calendar-date:hover:not(.empty) {
  background: #f0f0f0;
  border-color: #667eea;
}

.calendar-date.empty {
  background: #fafafa;
  cursor: default;
}

.calendar-date.today {
  background: #667eea;
  color: white;
  font-weight: bold;
  border-color: #667eea;
}

.calendar-date.has-leave {
  background: #27ae60;
  color: white;
  font-weight: bold;
  border-color: #27ae60;
}

.calendar-date.is-holiday {
  background: #f39c12;
  color: white;
  font-weight: bold;
  border-color: #f39c12;
}

/* Dual Month Calendar View */
.calendar-view-wrapper {
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.calendar-navigation {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-bottom: 2px solid #f0f0f0;
  background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
  flex-wrap: wrap;
}

.calendar-filter-info {
  flex: 1;
  min-width: 300px;
}

.info-legend {
  background: rgba(255, 255, 255, 0.15);
  padding: 12px 16px;
  border-radius: 6px;
  border-left: 4px solid white;
}

.info-badge {
  color: white;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-date-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
}

.calendar-date-selector label {
  color: white;
  font-size: 13px;
  font-weight: 600;
  margin: 0;
}

.calendar-date-selector input[type="date"] {
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  background: white;
  color: #333;
}

.dual-months-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  padding: 15px;
  background: white;
}

.month-column {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 12px;
}

.month-column .calendar-header {
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: 20px;
  padding-bottom: 12px;
}

.month-column .calendar-header h3 {
  color: #333;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin: 0;
}

.calendar-legend {
  display: flex;
  justify-content: center;
  gap: 15px;
  padding: 10px 15px;
  border-top: 1px solid #eee;
  background: #f9f9f9;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #333;
  font-weight: 500;
}

.legend-box {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid #ddd;
}

.legend-box.today {
  background: #667eea;
  border-color: #667eea;
}

.legend-box.has-leave {
  background: #27ae60;
  border-color: #27ae60;
}

.legend-box.is-holiday {
  background: #f39c12;
  border-color: #f39c12;
}

/* Responsive dual calendar */
@media (max-width: 1200px) {
  .dual-months-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .calendar-navigation {
    flex-direction: column;
    align-items: stretch;
  }
  
  .calendar-filter-info {
    min-width: 100%;
  }
}

/* Leave Modal */
.leave-modal-content {
  max-width: 600px !important;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.duration-toggle {
  display: flex;
  gap: 20px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  padding: 8px 12px;
  border-radius: 6px;
  border: 2px solid #e0e0e0;
  background: #fafafa;
  transition: all 0.2s ease;
}

.toggle-label:hover {
  border-color: #667eea;
  background: #f0f4ff;
}

.toggle-label input[type="radio"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #667eea;
  flex-shrink: 0;
}

.toggle-label input[type="radio"]:checked + span {
  color: #667eea;
  font-weight: 600;
}

.duration-section {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  background: #fafafa;
  margin-bottom: 16px;
  animation: slideDown 0.3s ease;
}

.duration-section.hidden {
  display: none;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notes-group {
  position: relative;
}

.notes-wrapper {
  position: relative;
}

.notes-wrapper textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s ease;
}

.notes-wrapper textarea:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.notes-wrapper .char-count {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 12px;
  color: #999;
  background: white;
  padding: 0 4px;
}

.leave-create-btn {
  background: var(--brand-green) !important;
  color: white !important;
  padding: 12px 20px !important;
  border-radius: 6px !important;
  border: none !important;
  font-weight: 600 !important;
  font-family: var(--font-body) !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 6px rgba(15, 142, 56, 0.15) !important;
  margin-left: auto !important;
}

.leave-create-btn:hover {
  background-color: #0a6b2a !important;
  border-color: #0a6b2a !important;
  box-shadow: 0 4px 12px rgba(15, 142, 56, 0.25) !important;
}

.leave-create-btn:active {
  transform: scale(0.98) !important;
}

/* Enhanced Leave Request Modal Styles */
.leave-request-modal-content {
  max-width: 600px !important;
  overflow: hidden;
}

.leave-request-modal-header {
  background: #ffffff !important;
  padding: 20px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border: 1px solid #e0e0e0;
  border-bottom: none;
}

.leave-request-modal-header-content {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  color: #333;
  flex: 1;
}

.leave-request-modal-icon {
  font-size: 24px;
  color: #333;
  min-width: 24px;
  opacity: 0.8;
}

.leave-request-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #333 !important;
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
}

.leave-request-modal-subtitle {
  font-size: 11px;
  color: #666;
  margin: 0;
  font-weight: 400;
}

.leave-request-modal-header .modal-close {
  color: #666;
  opacity: 0.7;
  font-size: 28px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  border: none;
  background: none;
  margin-top: -4px;
}

.leave-request-modal-header .modal-close:hover {
  opacity: 1;
  color: #333;
  transform: none;
}

.leave-request-modal-body {
  padding: 32px;
  background-color: white;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

.leave-request-modal-footer {
  padding: 20px 32px;
  background: white;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid #e2e8f0;
}

.leave-request-cancel-btn {
  background-color: transparent !important;
  color: #333 !important;
  border: 1px solid #ddd !important;
  padding: 11px 24px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: none !important;
}

.leave-request-cancel-btn:hover {
  background-color: #f5f5f5 !important;
  border-color: #999 !important;
  transform: none !important;
  box-shadow: none !important;
}

.leave-request-cancel-btn:active {
  transform: none !important;
}

.leave-request-submit-btn {
  background: #27ae60 !important;
  color: white !important;
  border: none !important;
  padding: 11px 28px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.2) !important;
}

.leave-request-submit-btn:hover {
  background-color: #229954 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3) !important;
}

.leave-request-submit-btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 6px rgba(39, 174, 96, 0.2) !important;
}

/* Enhanced Leave Details Modal Styles */
.leave-details-modal-content {
  max-width: 600px !important;
  overflow: hidden;
}

.leave-details-modal-header {
  background: #ffffff !important;
  padding: 20px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border: 1px solid #e0e0e0;
  border-bottom: none;
}

.leave-details-modal-header-content {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  color: #333;
  flex: 1;
}

.leave-details-modal-icon {
  font-size: 24px;
  color: #333;
  min-width: 24px;
  opacity: 0.8;
}

.leave-details-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #333 !important;
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
}

.leave-details-modal-subtitle {
  font-size: 11px;
  color: #666;
  margin: 0;
  font-weight: 400;
}

.leave-details-modal-header .modal-close {
  color: #666;
  opacity: 0.7;
  font-size: 28px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  border: none;
  background: none;
  margin-top: -4px;
}

.leave-details-modal-header .modal-close:hover {
  opacity: 1;
  color: #333;
  transform: none;
}

.leave-details-modal-body {
  padding: 32px;
  background-color: #fafbfc;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

.leave-details-modal-footer {
  padding: 20px 32px;
  background: white;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid #e2e8f0;
}

.leave-details-close-btn {
  background: #3498db !important;
  color: white !important;
  border: none !important;
  padding: 11px 24px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2) !important;
}

.leave-details-close-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3) !important;
  background: #2980b9 !important;
}

.leave-details-close-btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2) !important;
}

/* Enhanced My Profile Modal Styles */
#settingsModal {
  justify-content: flex-end !important;
  animation: slideInFromRight 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

#settingsModal.hidden {
  animation: slideOutToRight 0.3s cubic-bezier(0.55, 0.055, 0.675, 0.19) !important;
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutToRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.profile-modal-content {
  width: 100% !important;
  max-width: 500px !important;
  height: 100vh !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  border-radius: 0 !important;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.25) !important;
  display: flex;
  flex-direction: column;
}

.profile-modal-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 100%);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
  border-bottom: 1px solid #e8e9eb;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.profile-modal-header-content {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #000;
  flex: 1;
  position: relative;
}

.profile-modal-icon {
  font-size: 24px;
  color: #c50000;
  min-width: 24px;
}

.profile-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #000000;
  margin: 0;
  letter-spacing: 0.2px;
  font-family: 'Baloo 2', sans-serif;
}

.profile-modal-subtitle {
  display: none;
}

.profile-modal-header .modal-close {
  color: #888;
  opacity: 1;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border: none;
  background: none;
  border-radius: 4px;
  position: relative;
}

.profile-modal-header .modal-close:hover {
  color: #c50000;
  background: rgba(197, 0, 0, 0.1);
  transform: rotate(90deg);
}

.profile-modal-body {
  padding: 40px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  max-height: calc(90vh - 180px);
  overflow-y: auto;
  position: relative;
}

.mobile-close-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  background: linear-gradient(135deg, #c50000 0%, #e74c3c 100%);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(197, 0, 0, 0.3);
  transition: all 0.3s ease;
  z-index: 10;
}

.mobile-close-btn:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 16px rgba(197, 0, 0, 0.4);
}

.profile-modal-body::-webkit-scrollbar {
  width: 8px;
}

.profile-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.profile-modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #c50000 0%, #ff6b6b 100%);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.profile-modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #a50000 0%, #e55555 100%);
}

.profile-modal-footer {
  padding: 20px 0 0 0;
  margin-top: 20px;
  border-top: 2px solid #e5e9f0;
}

.info-notice {
  background: linear-gradient(135deg, #fff8f8 0%, #ffe8e8 100%);
  border-left: 4px solid #c50000;
  border-radius: 8px;
  padding: 16px;
}

.notice-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 700;
  color: #c50000;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Baloo 2', sans-serif;
}

.notice-header i {
  font-size: 16px;
}

.notice-text {
  font-size: 13px;
  color: #333333;
  line-height: 1.5;
  margin: 0 0 12px 0;
  font-weight: 500;
}

.notice-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: #444444;
  line-height: 1.6;
}

.notice-list li {
  padding-left: 20px;
  margin-bottom: 6px;
  position: relative;
}

.notice-list li:before {
  content: "•";
  position: absolute;
  left: 8px;
  color: #c50000;
  font-weight: 700;
  font-size: 16px;
}

.notice-email-link {
  color: #c50000;
  text-decoration: none;
  border-bottom: 2px solid #c50000;
  transition: all 0.3s ease;
  cursor: pointer;
}

.notice-email-link:hover {
  color: #a50000;
  border-bottom-color: #a50000;
  opacity: 0.85;
}

/* Mobile Modal Styles */
@media (max-width: 768px) {
  .profile-modal-content {
    height: auto !important;
    max-height: 85vh !important;
    border-radius: 16px 16px 0 0 !important;
  }

  .profile-modal-header {
    padding: 16px;
  }

  .profile-modal-header-content {
    gap: 10px;
  }

  .profile-modal-icon {
    font-size: 20px;
  }

  .profile-modal-title {
    font-size: 14px;
  }

  .profile-modal-subtitle {
    display: none;
  }

  .profile-modal-header .modal-close {
    display: none;
  }

  .profile-modal-body {
    padding: 24px 16px 80px 16px;
    max-height: calc(85vh - 80px);
  }

  .mobile-close-btn {
    display: flex;
  }

  .settings-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .settings-section h4 {
    font-size: 13px;
    margin-bottom: 12px;
  }
}

.profile-modal-footer {
  padding: 24px 32px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-top: 1px solid #e8e9eb;
}

.profile-modal-close-btn {
  color: white !important;
  border: none !important;
  padding: 12px 28px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
  font-family: 'Baloo 2', sans-serif !important;
  letter-spacing: 0.3px !important;
}

.profile-modal-close-btn:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 8px 24px rgba(197, 0, 0, 0.4) !important;
  background: linear-gradient(135deg, #c50000 0%, #ff6b6b 100%) !important;
}

.profile-modal-close-btn:active {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(197, 0, 0, 0.3) !important;
}

.info-banner {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding: 12px 16px;
  border-radius: 4px;
  color: #1565c0;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-banner.hidden {
  display: none;
}

.error-banner {
  background: #ffebee;
  border-left: 4px solid #f44336;
  padding: 14px 16px;
  border-radius: 6px;
  color: #c62828;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex !important;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(244, 67, 54, 0.15);
  animation: slideDown 0.3s ease;
}

.error-banner::before {
  content: '⚠️';
  font-size: 16px;
  flex-shrink: 0;
  margin-right: 4px;
}

.error-banner.hidden {
  display: none !important;
  animation: none;
}

/* Action Buttons in Table */
.action-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s;
  margin-right: 4px;
}

.edit-btn {
  background: #2196f3;
  color: white;
}

.edit-btn:hover {
  background: #1976d2;
}

.delete-btn {
  background: #f44336;
  color: white;
}

.delete-btn:hover {
  background: #d32f2f;
}

.view-btn {
  background: #4caf50;
  color: white;
}

.view-btn:hover {
  background: #388e3c;
}

/* sidebar-leave Styles */
#sidebarLeave {
  border-right: 1px solid #e0e0e0;
}

.sidebar-content {
  padding: 20px 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: #f5f5f5;
  border-left-color: #667eea;
  color: #667eea;
}

.sidebar-icon {
  font-size: 18px;
}

.sidebar-text {
  font-size: 13px;
  font-weight: 500;
}

/* Textarea */
textarea {
  font-family: Georgia, serif;
  resize: vertical;
  padding: 10px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
}

textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Small text for character count */
small {
  display: block;
  margin-top: 4px;
  color: #999;
  font-size: 11px;
}

/* Responsive */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .leave-header {
    padding: 20px 16px;
  }

  .leave-header-title p {
    display: none;
  }

  .leave-header h1 {
    font-size: 22px;
  }

  .leave-section {
    padding: 16px;
    margin-bottom: 16px;
  }

  .leave-entitlements-table,
  .leave-requests-table {
    font-size: 13px;
  }

  .leave-entitlements-table th,
  .leave-requests-table th,
  .leave-entitlements-table td,
  .leave-requests-table td {
    padding: 8px 4px;
  }

  .leave-tabs {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px;
    border-bottom: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .leave-tab-btn {
    padding: 10px 8px;
    font-size: 11px;
    font-weight: 600;
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 6px;
    border: 1px solid #dee3ed;
    gap: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .leave-tab-btn i {
    font-size: 13px;
  }

  .leave-tab-btn:not(.leave-create-btn) {
    flex-shrink: 1;
  }

  .leave-create-btn {
    flex: 1 1 auto !important;
    padding: 10px 8px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    margin-left: 0 !important;
    width: auto !important;
    border-radius: 6px !important;
    gap: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-date {
    font-size: 11px;
  }
}

/* ═══════════════════════════════════════════════════════════
   SCROLL FIX — Module isolation patch
   Add this block at the END of styles.css so it wins the
   cascade without touching existing rules.
   ═══════════════════════════════════════════════════════════ */

/* 1. Let the page scroll normally in all authenticated views.
      .no-scroll and .auth-visible should ONLY be active on
      the login/signup screens — the JS already adds/removes
      them, but these rules tighten the guard. */

body:not(.auth-visible) {
  overflow-y: auto !important;
  touch-action: pan-y !important;
}

/* 2. ERP home: full-width, no sidebar offset, scrolls freely */
body:not(.auth-visible) #erpHome:not(.hidden) ~ * .main-content,
#mainContent.full-width {
  margin-left: 0 !important;
  width: 100% !important;
  overflow-y: auto !important;
  touch-action: pan-y !important;
}

/* 3. Leave module: sidebar is hidden, so main-content must
      be full-width and scroll independently */
#leaveDashboard:not(.hidden) {
  overflow-y: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

/* 4. Payslip module: main-content scrolls, not the body */
#dashboard:not(.hidden),
#availablePayslipsSection:not(.hidden) {
  overflow-y: visible;   /* let .main-content handle scroll */
  touch-action: pan-y;
}

/* 5. main-content scroll container — one clear rule.
      The existing margin-top:60px rule stays; we just make
      sure overflow is always set correctly. */
.main-content:not(.full-width) {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
}

/* 6. full-width mode (home + leave module): no left offset,
      scrolls on the element itself */
.main-content.full-width {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  margin-top: 60px !important; /* keep header clearance */
}

/* Exception: on the auth screen the full-width content
   must NOT scroll (login form fills the viewport) */
body.auth-visible .main-content.full-width {
  overflow-y: hidden !important;
  margin-top: 0 !important;
}

/* 7. Mobile: ensure the body itself scrolls on all module
      pages (not just the inner container) */
@media (max-width: 480px) {
  body:not(.auth-visible) {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
  }

  /* Remove the fixed height that traps scroll inside
     the wrong container on mobile */
  .container {
    height: auto !important;
    min-height: 100vh;
  }

  .main-content,
  .main-content.full-width {
    overflow-y: visible !important;
    min-height: 100vh;
    height: auto !important;
    margin-top: 56px !important; /* mobile header height */
  }

  /* Each page section scrolls with the document,
     not with a nested overflow container */
  .erp-home,
  #leaveDashboard,
  #dashboard,
  #availablePayslipsSection {
    overflow-y: visible !important;
    min-height: calc(100vh - 56px);
  }
}

