:root {
    --primary: #006838;
    --primary-hover: #004c29;
    --bg-dark: #f4fdf8;
    --bg-panel: #ffffff;
    --bg-elevated: #e6f6ee;
    --text-main: #1f2937;
    --text-muted: #4b5563;
    --border: rgba(0, 0, 0, 0.1);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-sm: 4px;
    --transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    overflow: hidden;
}

/* Base Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    flex-shrink: 0;
    min-height: 0;
    overflow-y: auto;
    transform: translateZ(0);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    color: var(--primary);
}

.logo h2 {
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: 600;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.25rem;
    padding: 0 1rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.nav-item:hover {
    background-color: var(--bg-elevated);
    color: var(--text-main);
}

.nav-item.active {
    background-color: rgba(0, 104, 56, 0.15);
    color: var(--primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #3cb371);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
}

.user-info .name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info .role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    transform: translateZ(0);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background-color: var(--bg-dark);
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem 1rem;
    width: 400px;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 104, 56, 0.2);
}

.search-bar i {
    color: var(--text-muted);
    margin-right: 0.75rem;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 104, 56, 0.3);
}

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

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background-color: var(--bg-elevated);
    color: var(--text-main);
    border: 1px solid rgba(0,0,0,0.1);
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background-color: var(--bg-elevated);
    color: var(--text-main);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 0 2rem 1.5rem;
}

.stat-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(0, 104, 56, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.warning {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.danger {
    background-color: var(--danger-bg);
    color: var(--danger);
}

.stat-details p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.stat-details h3 {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Table */
.table-container {
    padding: 0;
}

.staff-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-panel);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.staff-table th {
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 500;
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.staff-table td {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.staff-table tbody tr {
    transition: background-color 0.15s ease;
}

.staff-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.employee-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.employee-cell .avatar {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.employee-details .name {
    font-weight: 600;
}

.employee-details .email {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

.badge-working {
    background-color: var(--success-bg);
    color: var(--success);
}
.badge-expired {
    background-color: var(--danger-bg);
    color: var(--danger);
}
.badge-warning {
    background-color: var(--warning-bg);
    color: var(--warning);
}
.badge-gray {
    background-color: var(--bg-elevated);
    color: var(--text-muted);
}
.badge-primary {
    background-color: rgba(0, 104, 56, 0.15);
    color: var(--primary);
}

.action-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    background-color: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: var(--bg-elevated);
    color: var(--primary);
}

/* Modal / Slide-out Panel */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 100;
    display: none;
    justify-content: flex-end;
}

.modal-overlay.active {
    display: flex;
    backdrop-filter: blur(8px);
}

.modal-panel {
    width: 750px;
    max-width: 100%;
    background-color: var(--bg-panel);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    border-left: 1px solid var(--border);
}

.modal-overlay.modal-centered {
    justify-content: center;
    align-items: center;
}

.modal-overlay.modal-centered .modal-panel {
    height: auto;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    border-left: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.employee-title {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.modal-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #3cb371);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 2rem;
}

.modal-avatar:hover .avatar-overlay {
    opacity: 1 !important;
}

.employee-title h2 {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: var(--text-main);
    background-color: var(--bg-elevated);
}

.modal-tabs {
    display: flex;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border);
    gap: 2rem;
    background-color: var(--bg-dark);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 1.25rem 0;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    position: relative;
    font-family: inherit;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px 3px 0 0;
}

.badge-count {
    background-color: var(--bg-elevated);
    color: var(--text-main);
    padding: 0.1rem 0.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

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

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

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

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input:not([type="radio"]):not([type="checkbox"]), .form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    outline: none;
}
.form-group select {
    color-scheme: light;
}

.form-group input:not([type="radio"]):not([type="checkbox"]):focus, .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 104, 56, 0.2);
}

.form-group input.readonly-input {
    background-color: rgba(0,0,0,0.03);
    color: var(--text-muted);
    cursor: default;
    border-color: transparent;
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.family-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.family-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.family-card {
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.family-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border);
}

.family-name-display {
    font-size: 1.1rem;
    color: var(--primary);
}

.remove-family-btn {
    color: var(--text-muted);
}
.remove-family-btn:hover {
    background-color: var(--danger-bg);
    color: var(--danger);
}

.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    background-color: rgba(0,0,0,0.02);
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px dashed var(--border);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state.active {
    display: flex;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background-color: var(--bg-dark);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent; 
}
 
::-webkit-scrollbar-thumb {
    background: var(--bg-elevated); 
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569; 
}

/* Enhanced Dashboard Layout */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    padding: 0 2rem 2rem;
    align-items: start;
}

.table-container {
    padding: 0; 
}

.section-title {
    font-size: 1.05rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }
.text-xs { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.danger-text { color: var(--danger); font-size: 0.85rem; display: flex; align-items: center; gap: 0.35rem; margin-top: 0.35rem; }
.stat-subtext { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.35rem; }

.birthday-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.birthday-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bday-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.bday-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.bday-date {
    background-color: rgba(0, 104, 56, 0.15);
    color: var(--primary);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
}

.bday-info .bday-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
}
.bday-info .bday-dept {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.bday-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 2rem 0;
    font-style: italic;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-dark) url('login-bg.jpg') center/cover;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.login-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.6), rgba(30, 41, 59, 0.4));
}
.login-card {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 3rem 2.5rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
}
.login-logo i {
    font-size: 3rem;
    margin-bottom: 1rem;
}
.login-logo h2 {
    color: var(--text-main);
    font-size: 1.5rem;
}
.login-hint {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}
.hint-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    margin-top: 0.5rem;
}
.w-100 { width: 100%; }
.mt-3 { margin-top: 1.5rem; }
.text-danger { color: var(--danger); display: flex; align-items: center; gap: 0.4rem; }

/* Clickable Rows */
.staff-table tbody tr.clickable-row {
    cursor: pointer;
    transition: background 0.2s ease;
}
.staff-table tbody tr.clickable-row:hover {
    background-color: rgba(99, 102, 241, 0.05);
}
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
}
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
.alert-item {
    background: rgba(239, 68, 68, 0.05);
    border-left: 3px solid var(--danger);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}
.alert-item.warning-alert {
    background: rgba(245, 158, 11, 0.05);
    border-left: 3px solid var(--warning);
}
.alert-item-name {
    font-weight: 500;
    color: var(--text-main);
}
.alert-item-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ============================================================
   STAFF PERSONAL DASHBOARD
   ============================================================ */
.staff-profile-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.08);
}
}
.staff-profile-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.staff-avatar-lg {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #3cb371);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.75rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,104,56,0.3);
}
.staff-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.staff-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.staff-info-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.staff-info-label i { color: var(--primary); opacity: 0.8; }
.staff-info-value {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-main);
}

/* ============================================================
   LEAVE BALANCE CARD
   ============================================================ */
.leave-balance-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}
}
.leave-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.leave-stat-item {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    border: 1px solid transparent;
    transition: var(--transition);
}
.leave-stat-item:hover { border-color: var(--primary); }
.leave-stat-item.pending { background: var(--warning-bg); }
.leave-stat-item.rejected { background: var(--danger-bg); }
.leave-stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.35rem;
}
.leave-stat-item.pending .leave-stat-number { color: var(--warning); }
.leave-stat-item.rejected .leave-stat-number { color: var(--danger); }
.leave-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Leave Recent List */
.leave-recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}
.leave-recent-item:last-child { border-bottom: none; }
.leave-recent-type { font-weight: 500; color: var(--text-main); }
.leave-recent-dates { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.1rem; }

/* ============================================================
   LEAVE STATUS BADGES
   ============================================================ */
.badge-pending {
    background-color: var(--warning-bg);
    color: var(--warning);
}
.badge-approved {
    background-color: var(--success-bg);
    color: var(--success);
}
.badge-rejected {
    background-color: var(--danger-bg);
    color: var(--danger);
}

/* ============================================================
   FILTER TABS (Leave, Purchasing)
   ============================================================ */
.leave-filter-tabs, .purchasing-filter-tabs, .purchasing-approval-filter-tabs, .purchasing-execution-filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.leave-tab-btn, .approval-tab-btn, .purchasing-tab-btn, .purchasing-approval-tab-btn, .purchasing-execution-tab-btn, .pd-tab-btn, .pd-approval-tab-btn {
    padding: 0.4rem 1rem;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.leave-tab-btn:hover, .approval-tab-btn:hover, .purchasing-tab-btn:hover, .purchasing-approval-tab-btn:hover, .purchasing-execution-tab-btn:hover, .pd-tab-btn:hover, .pd-approval-tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0,104,56,0.06);
}
.leave-tab-btn.active, .approval-tab-btn.active, .purchasing-tab-btn.active, .purchasing-approval-tab-btn.active, .purchasing-execution-tab-btn.active, .pd-tab-btn.active, .pd-approval-tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============================================================
   SUPERVISOR CONFIG (Settings)
   ============================================================ */
.supervisor-dept-block {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}
.supervisor-dept-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}
.supervisor-dept-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.supervisor-dept-name i { color: var(--primary); }
.supervisor-dept-body { padding: 1rem 1.1rem; }
.supervisor-default-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.supervisor-default-row label {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
    min-width: 130px;
}
.supervisor-default-row select {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-panel);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
}
.supervisor-override-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-panel);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    animation: fadeIn 0.2s ease;
}
.supervisor-override-row select {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}
.supervisor-override-row .override-type-select { min-width: 140px; }
.supervisor-override-row .override-supervisor-select { flex: 1; }
.remove-override-btn {
    width: 28px; height: 28px;
    border: none; background: transparent;
    color: var(--text-muted);
    cursor: pointer; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); flex-shrink: 0;
}
.remove-override-btn:hover { background: var(--danger-bg); color: var(--danger); }
.add-override-btn {
    font-size: 0.8rem;
    color: var(--primary);
    background: transparent;
    border: 1px dashed var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    margin-top: 0.4rem;
    display: inline-flex; align-items: center; gap: 0.35rem;
}
.add-override-btn:hover { background: rgba(0,104,56,0.08); }

/* Settings tab active indicator */
.modal-tabs .tab-btn[data-settings-tab] { min-width: 100px; text-align: center; }

/* ---- Leave Balance Per-Type ---- */
.leave-balance-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.leave-balance-type {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}
.leave-balance-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.leave-balance-bar-wrap {
    width: 80px;
    height: 5px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    flex-shrink: 0;
}
.leave-balance-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
}

/* ---- Leave Type Config Color Swatches ---- */
.lt-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
}
.lt-color-swatch:hover { box-shadow: 0 0 0 2px var(--bg-main), 0 0 0 4px var(--primary); }
.lt-color-swatch.selected { border-color: #fff; outline: 2px solid var(--primary); }

/* ---- Badge gray ---- */
.badge-gray { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }

/* ---- Admin leave overuse widget ---- */
.leave-overuse-widget {
    background: var(--bg-panel);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 1rem;
}
.leave-overuse-widget h4 {
    color: var(--danger);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

/* ============================================================
   CALENDAR WIDGET
   ============================================================ */
.calendar-widget {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    height: 100%;
}
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.calendar-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}
.calendar-nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.calendar-nav-btn:hover {
    background-color: var(--bg-elevated);
    color: var(--primary);
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}
.calendar-day-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    padding-bottom: 0.5rem;
}
.calendar-day-cell {
    padding: 0.5rem 0;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: default;
    border: 1px solid transparent;
}
.calendar-day-cell:hover:not(.empty) {
    background-color: var(--bg-elevated);
    border-color: var(--primary);
}
.calendar-day-cell.empty {
    color: transparent;
    pointer-events: none;
}
.calendar-day-cell.today {
    border-color: var(--primary);
    font-weight: bold;
}
.calendar-day-cell.holiday {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    font-weight: bold;
    cursor: pointer;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.calendar-day-cell.holiday:hover {
    border-color: var(--danger);
}
.calendar-day-cell.team-leave {
    background-color: rgba(168, 85, 247, 0.15);
    color: #9333ea;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #d8b4fe;
}
.calendar-day-cell.team-leave:hover {
    background-color: rgba(168, 85, 247, 0.25);
}

/* Sidebar Submenu */
.nav-group {
    display: flex;
    flex-direction: column;
}

.submenu {
    display: none;
    flex-direction: column;
    background-color: rgba(0, 0, 0, 0.02);
    margin: 0 0.5rem;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.submenu.active {
    display: flex;
}

.nav-item.has-submenu.active-parent .submenu-icon {
    transform: rotate(180deg);
}

.nav-item.has-submenu.active-parent {
    color: var(--primary);
}

/* Notifications */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: -10px;
    width: 350px;
    max-height: 400px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: none;
    flex-direction: column;
    z-index: 1000;
    margin-top: 0.5rem;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.notification-dropdown.active {
    display: flex;
}

.dropdown-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-dark);
}

.dropdown-body {
    overflow-y: auto;
    flex: 1;
}

.notification-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.notification-item:hover {
    background-color: var(--bg-elevated);
}

.notification-item.unread {
    background-color: rgba(0, 104, 56, 0.05);
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.icon-leave { background-color: var(--warning-bg); color: var(--warning); }
.icon-update { background-color: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.icon-success { background-color: var(--success-bg); color: var(--success); }
.icon-danger { background-color: var(--danger-bg); color: var(--danger); }

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================
   PURCHASING STYLES
   ============================================================ */
.purchasing-item-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--bg-main);
    color: var(--text-main);
}
.purchasing-item-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 104, 56, 0.2);
}

.purchasing-img-preview {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
    background-color: var(--bg-elevated);
    cursor: pointer;
}
.purchasing-img-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-main);
}
.purchasing-img-upload-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0, 104, 56, 0.05);
}


/* --- Settings Section Layout --- */
.settings-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}
.settings-nav {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.settings-nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.85rem 1.25rem;
    text-align: left;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: inherit;
}
.settings-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}
.settings-nav-item.active {
    background: var(--primary);
    color: white;
    font-weight: 500;
}
.settings-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}
.settings-content-area {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

@media (max-width: 900px) {
    .settings-layout {
        flex-direction: column;
    }
    .settings-nav {
        flex: none;
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    .settings-nav-item {
        white-space: nowrap;
    }
}

#customAlertModal, #customConfirmModal, #customPromptModal {
    z-index: 9999 !important;
}

/* Print styles for Timesheet */
@media print {
    body, html, .app-container, .main-content {
        background: #fff !important;
        color: #000 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        height: auto !important;
        position: static !important;
    }
    .sidebar, .top-bar, .modal, .toast-container, .no-print {
        display: none !important;
    }
    #reportsSection h2,
    #reportsSection p,
    #reportsSection > div > div:first-of-type,
    #reportResultsArea {
        display: none !important;
    }
    #reportsSection, #reportsSection > div {
        display: block !important;
        position: static !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .timesheet-print-page {
        page-break-after: always;
        page-break-inside: avoid;
        width: 100%;
    }
    .timesheet-print-page:last-child {
        page-break-after: auto;
    }
    .timesheet-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 10px;
    }
    .timesheet-table th, .timesheet-table td {
        border: 1px solid #000;
        padding: 2px;
        text-align: center;
        color: #000;
    }
    .timesheet-header {
        text-align: center;
        margin-bottom: 20px;
    }
    .timesheet-header h1 {
        margin: 0;
        font-size: 16px;
    }
    .timesheet-header p {
        margin: 5px 0 0;
        font-size: 12px;
    }
    .timesheet-signatures {
        display: flex;
        justify-content: space-between;
        margin-top: 30px;
    }
    .timesheet-signature-box {
        text-align: center;
        width: 30%;
    }
}

.timesheet-table-container {
    overflow-x: auto;
    background: #fff;
    color: #000;
    padding: 20px;
    border-radius: 8px;
}
.timesheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.timesheet-table th, .timesheet-table td {
    border: 1px solid #000;
    padding: 4px;
    text-align: center;
    color: #000;
}
.timesheet-header {
    text-align: center;
    margin-bottom: 20px;
    color: #000;
}
.timesheet-header h1 {
    margin: 0;
    font-size: 20px;
    text-transform: uppercase;
}
.timesheet-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    color: #000;
}
.timesheet-signature-box {
    text-align: center;
    width: 30%;
}

/* ============================================================
   MOBILE RESPONSIVENESS
   ============================================================ */

/* Hide mobile menu button on desktop */
.mobile-menu-btn {
    display: none;
    margin-right: 1rem;
    font-size: 1.25rem;
    color: var(--primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Toggle Switch CSS */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
    -webkit-transform: translateX(16px);
    -ms-transform: translateX(16px);
    transform: translateX(16px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

@media (max-width: 768px) {
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: block;
    }

    /* Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Main Content Spacing */
    #dashboardSection, 
    #staffSection, 
    #userSection, 
    #sysLogSection, 
    #supervisorDashboardSection, 
    #staffDashboardSection {
        padding: 1rem 1rem !important;
    }

    /* Top Bar */
    .top-bar {
        padding: 0.75rem 1rem;
    }

    /* Dashboards Grids */
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .staff-dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 1.25rem;
    }

    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 1rem;
    }
    .staff-table {
        min-width: 600px; /* Force scroll */
    }

    /* Form Layouts */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .search-bar {
        width: 100% !important;
        max-width: none;
        margin: 0.5rem 0;
    }

    #staffActionsHeader {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

/* Consent Screen */
.consent-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color, #f4f6f8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 1rem;
}

.consent-container {
    background: var(--surface-color, #fff);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.consent-title {
    margin: 0;
    padding: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark, #1e293b);
    text-align: center;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.consent-subtitle {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted, #64748b);
    padding: 0.5rem 1.5rem 0;
    margin: 0;
}

.consent-content {
    padding: 1.5rem;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color, #334155);
}

.consent-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.consent-content li {
    margin-bottom: 0.75rem;
}

.consent-actions {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    display: flex;
    justify-content: center;
}

/* TomSelect Custom Overrides */
.ts-control, .ts-dropdown, .ts-control input {
    font-family: 'Inter', sans-serif !important;
    font-size: 0.9rem !important;
    color: var(--text-main) !important;
}
.ts-dropdown .option {
    padding: 0.5rem 0.8rem;
}
.ts-wrapper.single.input-active .ts-control .item {
    display: none !important;
}
.ts-wrapper.single.input-active .ts-control input {
    width: 100% !important;
}
