/* ============================================================
   LeaveTracker Pro - Modern Premium Design System
   ============================================================ */

/* ---------- CSS Variables / Design Tokens ---------- */
:root {
    /* Primary Palette */
    --primary-50: #EEF2FF;
    --primary-100: #E0E7FF;
    --primary-200: #C7D2FE;
    --primary-300: #A5B4FC;
    --primary-400: #818CF8;
    --primary-500: #6366F1;
    --primary-600: #4F46E5;
    --primary-700: #4338CA;
    --primary-800: #3730A3;
    --primary-900: #312E81;

    /* Neutral Palette */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Surfaces */
    --bg-page: #f2f0ff;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-header: #ffffff;
    --bg-input: rgba(248, 250, 252, 0.7);
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    
    --border-light: #e2e8f0;
    --border-dim: #f1f5f9;

    /* Semantic Colors */
    --success-50: #F0FDF4; --success-500: #22C55E; --success-600: #16A34A;
    --warning-50: #FFFBEB; --warning-500: #F59E0B; --warning-600: #D97706;
    --danger-50: #FEF2F2; --danger-500: #EF4444; --danger-600: #DC2626;
    --info-50: #EFF6FF; --info-500: #3B82F6; --info-600: #2563EB;

    /* Layout */
    --sidebar-width: 280px;
    --header-height: 64px;
    --border-radius: 12px;
    --transition-base: 250ms ease;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

[data-theme='dark'] {
    --bg-page: #000000;
    --bg-card: #111111;
    --bg-sidebar: #000000;
    --bg-header: #111111;
    --bg-input: #1a1a1a;
    
    --text-main: #ffffff;
    --text-muted: #e5e5e5;
    --text-dim: #a3a3a3;
    
    --border-light: #262626;
    --border-dim: #1a1a1a;

    /* Fallback aliases used in inline JS templates */
    --surface-off: #181818;
    --border-color: #2a2a2a;
    
    --gray-50: #111111;
    --gray-100: #1a1a1a;
    --gray-200: #262626;
    --gray-300: #333333;
    --gray-600: #a3a3a3;
    --gray-800: #f5f5f5;
    --gray-900: #ffffff;
    
    --success-50: rgba(34, 197, 94, 0.05);
    --danger-50: rgba(239, 68, 68, 0.05);
    --warning-50: rgba(245, 158, 11, 0.05);
    --primary-50: rgba(99, 102, 241, 0.05);
    --primary-100: rgba(99, 102, 241, 0.12);
    --primary-700: #a5b4fc;
    --danger-100: rgba(239, 68, 68, 0.15);
    --danger-700: #fca5a5;
    --success-100: rgba(34, 197, 94, 0.15);
    --success-700: #86efac;
    --warning-100: rgba(245, 158, 11, 0.15);
    --warning-200: rgba(245, 158, 11, 0.25);
    --warning-700: #fcd34d;
    --warning-800: #fbbf24;
    
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.8);
}

/* ============================================================
   GLOBAL DARK MODE — All Inputs, Selects, Textareas & Modals
   ============================================================ */
[data-theme='dark'] input,
[data-theme='dark'] select,
[data-theme='dark'] textarea {
    background: var(--bg-input) !important;
    color: var(--text-main) !important;
    border-color: var(--border-light) !important;
    color-scheme: dark;
}

[data-theme='dark'] input:focus,
[data-theme='dark'] select:focus,
[data-theme='dark'] textarea:focus {
    background: #222222 !important;
    border-color: var(--primary-500) !important;
    outline: none;
}

[data-theme='dark'] input::placeholder,
[data-theme='dark'] textarea::placeholder {
    color: var(--text-dim) !important;
}

[data-theme='dark'] input:disabled,
[data-theme='dark'] select:disabled,
[data-theme='dark'] textarea:disabled {
    background: #141414 !important;
    color: var(--text-dim) !important;
    opacity: 0.75;
    cursor: not-allowed;
}

[data-theme='dark'] input[type="file"] {
    color: var(--text-muted) !important;
    background: var(--bg-input) !important;
}

[data-theme='dark'] input[type="checkbox"],
[data-theme='dark'] input[type="radio"] {
    accent-color: var(--primary-500);
}

[data-theme='dark'] select option {
    background: #1a1a1a;
    color: var(--text-main);
}

[data-theme='dark'] label {
    color: var(--text-muted) !important;
}

[data-theme='dark'] small {
    color: var(--text-dim) !important;
}

[data-theme='dark'] .modal {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-light);
}

[data-theme='dark'] .modal-header {
    border-bottom: 1px solid var(--border-light);
}

[data-theme='dark'] .modal-footer {
    border-top: 1px solid var(--border-light);
}

[data-theme='dark'] .modal-header h2,
[data-theme='dark'] .modal-header h3 {
    color: var(--text-main) !important;
}

[data-theme='dark'] .modal-overlay {
    background: rgba(0, 0, 0, 0.75) !important;
}

[data-theme='dark'] .card {
    background: var(--bg-card);
    border-color: var(--border-light);
}

[data-theme='dark'] .card-header {
    background: var(--bg-card) !important;
    border-bottom-color: var(--gray-200);
}

[data-theme='dark'] .card-footer {
    border-top-color: var(--gray-200);
}

[data-theme='dark'] .card-header h3 {
    color: var(--text-main);
}

/* Delegation card inner sections — override inline style fallbacks */
[data-theme='dark'] .card [style*="surface-off"],
[data-theme='dark'] .card > div > div[style*="background"] {
    background: var(--bg-input) !important;
    border-color: var(--border-light) !important;
    color: var(--text-main) !important;
}

[data-theme='dark'] .card [style*="background:var(--surface-off"] {
    background: #181818 !important;
}

[data-theme='dark'] .card [style*="gray-900"] {
    color: var(--text-main) !important;
}

[data-theme='dark'] .card [style*="gray-600"] {
    color: var(--text-dim) !important;
}



/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { color: var(--primary-600); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-700); }

img { max-width: 100%; height: auto; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============================================================
   LOGIN PAGE - MODERN PREMIUM DESIGN
   ============================================================ */
/* ============================================================
   MODERN SPLIT LOGIN LAYOUT
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    background: #f8fafc;
    font-family: var(--font-sans);
}

.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Left Hero Section */
.login-hero {
    flex: 1.2;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
    color: white;
}

.login-hero::before {
    content: '';
    position: absolute;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, transparent 70%);
    top: -200px;
    left: -200px;
}

.theme-toggle-login {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 100;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle-login:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(15deg) scale(1.1);
}

.hero-content {
    max-width: 540px;
    position: relative;
    z-index: 10;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand-logo i {
    font-size: 32px;
    color: var(--primary-400);
}

.brand-logo span {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.hero-content h1 {
    font-size: 3.25rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.125rem;
    color: #94a3b8;
    line-height: 1.6;
    transition: background var(--transition-base), color var(--transition-base);
    margin-bottom: 28px;
}

.hero-image {
    width: 85%;
    max-width: 480px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.hero-image img {
    width: 100%;
    display: block;
}

/* Right Form Side */
.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    padding: 60px;
}

.login-form-container {
    width: 100%;
    max-width: 420px;
}

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

.login-header h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-header p {
    color: var(--text-dim);
    font-size: 1rem;
}

/* Responsive Fixes Override */
@media (max-width: 1100px) {
    .hero-content h1 { font-size: 2.75rem; }
}

@media (max-width: 900px) {
    .login-hero { display: none; }
    .login-form-side { background: #f8fafc; }
    .login-form-container {
        padding: 40px;
        background: var(--bg-card);
        border-radius: 24px;
        box-shadow: var(--shadow-xl);
    }
}

@media (max-width: 480px) {
    .login-form-side { padding: 20px; }
    .login-form-container { padding: 32px 24px; }
}

/* ============================================================
   STRUCTURED PAPER FORM DESIGN (Leave Application)
   ============================================================ */
.form-paper {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 10px 30px rgba(0,0,0,0.05);
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-main);
    line-height: 1.5;
    position: relative;
    border-top: 5px solid var(--primary-500);
}

.form-paper.apply-form-full {
    border: none;
    border-radius: 0;
    box-shadow: none;
    min-height: calc(100vh - 70px);
    padding: 40px 10%;
    margin: -28px;
    width: calc(100% + 56px);
}

@media (max-width: 768px) {
    .form-paper.apply-form-full {
        margin: -12px -10px;
        width: calc(100% + 20px);
        padding: 32px 20px;
    }
}

@media (max-width: 480px) {
    .form-paper.apply-form-full {
        margin: -10px -8px;
        width: calc(100% + 16px);
        padding: 24px 12px;
    }
}


.form-paper .form-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

.form-header-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 40px;
    margin-bottom: 32px;
}

.form-header-item {
    border-bottom: 1px dotted var(--text-dim);
    padding-bottom: 4px;
}

.form-header-item .label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.form-header-item .value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
}

.leave-type-section {
    margin-bottom: 32px;
}

.leave-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.leave-type-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-input);
}

.leave-type-option:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.leave-type-option input {
    display: none;
}

.leave-type-option span {
    font-size: 0.938rem;
    font-weight: 500;
    color: var(--text-main);
}

.leave-type-option .radio-circle {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    position: relative;
}

.leave-type-option input:checked + span + .radio-circle {
    border-color: var(--primary-500);
    background: var(--bg-card);
}

.leave-type-option input:checked + span + .radio-circle::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: var(--primary-500);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.leave-type-option.selected {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.form-date-range {
    margin: 24px 0;
    font-size: 1rem;
    color: var(--text-main);
}

.reason-box {
    margin-top: 24px;
}

.reason-box label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

.reason-box textarea {
    width: 100%;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    min-height: 100px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.signature-date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.sign-area {
    border-bottom: 1px dotted var(--text-dim);
    padding-bottom: 4px;
    position: relative;
    min-height: 40px;
}

.sign-area .label {
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Form Paper Specific Responsive */
@media (max-width: 768px) {
    .form-header-grid, .leave-type-grid, .signature-date-grid {
        grid-template-columns: 1fr;
    }
    .form-paper {
        padding: 24px;
    }
}

/* ============================================================
   DARK MODE OVERRIDES — Leave Application Form
   ============================================================ */
[data-theme='dark'] .form-paper {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 4px 24px rgba(0,0,0,0.6);
}

[data-theme='dark'] .form-paper .form-section-title {
    color: var(--text-main);
    border-bottom-color: var(--border-light);
}

[data-theme='dark'] .form-paper h2 {
    color: var(--text-main) !important;
}

[data-theme='dark'] .form-paper p {
    color: var(--text-muted) !important;
}

[data-theme='dark'] .form-header-item {
    border-bottom-color: var(--border-light);
}

[data-theme='dark'] .form-header-item .label {
    color: var(--text-muted);
}

[data-theme='dark'] .form-header-item .value {
    color: var(--text-main);
}

[data-theme='dark'] .form-header-item input {
    color: var(--text-main) !important;
    background: transparent !important;
}

[data-theme='dark'] .leave-type-option {
    background: var(--bg-input);
    border-color: var(--border-light);
    color: var(--text-main);
}

[data-theme='dark'] .leave-type-option:hover {
    background: var(--gray-200);
    border-color: var(--primary-500);
}

[data-theme='dark'] .leave-type-option span {
    color: var(--text-main);
}

[data-theme='dark'] .leave-type-option small {
    color: var(--text-dim) !important;
}

[data-theme='dark'] .leave-type-option.selected {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-500);
}

[data-theme='dark'] .form-paper input[type="date"],
[data-theme='dark'] .form-paper input[type="text"],
[data-theme='dark'] .form-paper textarea {
    background: var(--bg-input) !important;
    color: var(--text-main) !important;
    border-color: var(--border-light) !important;
    color-scheme: dark;
}

[data-theme='dark'] .form-paper input[type="date"]:focus,
[data-theme='dark'] .form-paper input[type="text"]:focus,
[data-theme='dark'] .form-paper textarea:focus {
    border-color: var(--primary-500) !important;
    outline: none;
}

[data-theme='dark'] .form-paper input::placeholder,
[data-theme='dark'] .form-paper textarea::placeholder {
    color: var(--text-dim);
}

[data-theme='dark'] #attachmentGroup {
    background: var(--bg-input) !important;
    border-color: var(--border-light) !important;
}

[data-theme='dark'] #attachmentGroup label,
[data-theme='dark'] #attachmentGroup p {
    color: var(--text-muted) !important;
}

[data-theme='dark'] #attachmentGroup input[type="file"] {
    color: var(--text-main) !important;
}

[data-theme='dark'] .sign-area {
    border-bottom-color: var(--border-light);
}

[data-theme='dark'] .signature-box {
    background: var(--bg-input);
    border-color: var(--border-light);
}

[data-theme='dark'] .signature-box:hover {
    background: var(--gray-200);
    border-color: var(--primary-400);
}

[data-theme='dark'] .reason-box label,
[data-theme='dark'] .form-group label,
[data-theme='dark'] .leave-type-section label,
[data-theme='dark'] .form-paper label {
    color: var(--text-muted) !important;
}

[data-theme='dark'] .signature-date-grid {
    border-top-color: var(--border-light);
}

[data-theme='dark'] .form-paper .sign-area .label,
[data-theme='dark'] .form-paper .sign-area span {
    color: var(--text-muted) !important;
}


/* ============================================================
   DIGITAL SIGNATURE PAD
   ============================================================ */
.signature-box {
    width: 100%;
    min-height: 120px;
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    background: var(--bg-input);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    margin-top: 10px;
}

.signature-box:hover {
    background: var(--gray-100);
    border-color: var(--primary-400);
}

.signature-box i {
    font-size: 1.5rem;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.signature-box span {
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--text-dim);
}

.signature-box img {
    max-height: 100px;
    width: auto;
    object-fit: contain;
}

.signature-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.signature-modal-overlay.show {
    display: flex;
}

.signature-modal {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    animation: zoomInScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomInScale {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.signature-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.signature-modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
}

.signature-modal-tabs {
    display: flex;
    background: var(--gray-50);
    padding: 6px;
    gap: 6px;
}

.sig-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}

.sig-tab.active {
    background: var(--bg-card);
    color: var(--primary-600);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.signature-modal-body {
    padding: 24px;
}

.sig-content {
    display: none;
}

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

.draw-container {
    border: 2px solid var(--gray-100);
    border-radius: 12px;
    background: var(--bg-card);
    cursor: crosshair;
    position: relative;
    touch-action: none;
}

#sig-canvas {
    width: 100%;
    height: 200px;
    display: block;
}

.canvas-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

.upload-sig-area {
    border: 2px dashed var(--gray-200);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-sig-area:hover {
    background: var(--gray-50);
    border-color: var(--primary-300);
}

.signature-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
/* ---------- Form Elements Enhancements ---------- */
.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    transition: color 0.2s ease;
}

.form-group .input-wrapper {
    position: relative;
    border-radius: 12px;
}

.form-group .input-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 1.5px solid var(--border-light);
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font-sans);
    color: var(--text-main);
    background: var(--bg-input);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-500);
    background: var(--bg-input);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), 0 4px 6px -1px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

.form-group input:focus + i,
.form-group input:focus ~ i {
    color: var(--primary-500);
    transform: translateY(-50%) scale(1.1);
}

.form-group input.is-invalid {
    border-color: var(--danger-500);
    box-shadow: 0 0 0 3px var(--danger-50);
}

.form-group .error-text {
    font-size: 0.75rem;
    color: var(--danger-500);
    margin-top: 4px;
    display: none;
}

.form-group.has-error .error-text { display: block; }

.form-group select {
    padding-left: 14px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input, select, textarea {
    background-color: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-50);
}

/* Checkbox & Toggle */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-switch .slider {
    width: 44px;
    height: 24px;
    background: var(--gray-300);
    border-radius: 12px;
    position: relative;
    transition: var(--transition-base);
}

.toggle-switch .slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--bg-card);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .slider {
    background: var(--primary-500);
}

.toggle-switch input:checked + .slider::after {
    transform: translateX(20px);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    line-height: 1.5;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
    transform: translateY(-2px) scale(1.01);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-500), var(--success-700));
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-500), #B91C1C);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-outline {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1.5px solid var(--gray-200);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    padding: 8px 12px;
}

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

.btn-sm { padding: 6px 14px; font-size: 0.813rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; width: 40px; height: 40px; }

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

.spinner-dark {
    border-color: rgba(0,0,0,0.1);
    border-top-color: var(--primary-600);
}

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

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width var(--transition-slow);
    overflow: hidden;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon i { font-size: 18px; color: white; }

.sidebar-brand .brand-text h2 {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-brand .brand-text span {
    font-size: 0.688rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Sidebar User */
.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-user .user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-400), #EC4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    color: white;
}

.sidebar-user .user-info {
    overflow: hidden;
    white-space: nowrap;
}

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

.sidebar-user .user-info .user-role {
    font-size: 0.75rem;
    color: var(--primary-300);
    text-transform: capitalize;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.sidebar-nav .nav-section {
    margin-bottom: 8px;
}

.sidebar-nav .nav-section-title {
    font-size: 0.688rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    padding: 8px 12px;
    font-weight: 600;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--gray-300);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    margin-bottom: 2px;
}

.sidebar-nav .nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.sidebar-nav .nav-item.active {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.sidebar-nav .nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-nav .nav-item .badge {
    margin-left: auto;
    background: var(--danger-500);
    color: white;
    font-size: 0.688rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-footer .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--gray-400);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.sidebar-footer .nav-item:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-500);
}

/* ---------- Main Content ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
    background: var(--surface-page);
}

/* ---------- Top Header ---------- */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.top-header .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-header .header-left .menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-600);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
}

.top-header .header-left .menu-toggle:hover {
    background: var(--gray-100);
}

.top-header .page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.top-header .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.125rem;
}

.header-btn:hover {
    background: var(--gray-100);
    color: var(--text-muted);
}

.header-btn .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger-500);
    border-radius: 50%;
    border: 2px solid white;
}

/* Notifications Dropdown */
.notifications-dropdown {
    position: absolute;
    top: calc(var(--header-height) - 4px);
    right: 24px;
    width: 380px;
    max-height: 500px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
    display: none;
    z-index: 200;
    overflow: hidden;
}

.notifications-dropdown.show { display: block; animation: fadeIn 0.2s ease; }

.notifications-dropdown .dropdown-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notifications-dropdown .dropdown-header h3 {
    font-size: 0.938rem;
    font-weight: 700;
}

.notifications-dropdown .dropdown-header button {
    font-size: 0.75rem;
    color: var(--primary-600);
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.notifications-dropdown .notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-50);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

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

.notification-item.unread { background: var(--primary-50); }
.notification-item.unread:hover { background: var(--primary-100); }

.notification-item .notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.notification-item .notif-icon.info { background: var(--info-50); color: var(--info-600); }
.notification-item .notif-icon.success { background: var(--success-50); color: var(--success-600); }
.notification-item .notif-icon.warning { background: var(--warning-50); color: var(--warning-600); }
.notification-item .notif-icon.error { background: var(--danger-50); color: var(--danger-600); }

.notification-item .notif-content { flex: 1; min-width: 0; }

.notification-item .notif-content .notif-title {
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}

.notification-item .notif-content .notif-message {
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item .notif-time {
    font-size: 0.688rem;
    color: var(--gray-400);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---------- Page Container ---------- */
.page-container {
    padding: 28px;
    max-width: 1400px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
}

.card:hover { 
    box-shadow: var(--shadow-lg); 
}

.card-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to right, var(--bg-card), var(--gray-50));
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); }

/* ---------- Stats Cards ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card.primary { 
    background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%); 
    border-top: 3px solid var(--primary-500); 
}
.stat-card.success { 
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%); 
    border-top: 3px solid var(--success-500); 
}
.stat-card.warning { 
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%); 
    border-top: 3px solid var(--warning-500); 
}
.stat-card.danger  { 
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%); 
    border-top: 3px solid var(--danger-500); 
}
.stat-card.info    { 
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%); 
    border-top: 3px solid var(--info-500); 
}

[data-theme='dark'] .stat-card.primary,
[data-theme='dark'] .stat-card.success,
[data-theme='dark'] .stat-card.warning,
[data-theme='dark'] .stat-card.danger,
[data-theme='dark'] .stat-card.info { background: var(--bg-card); }



.stat-card::after {
    display: none;
}

.stat-card.primary::after { background: var(--primary-500); }
.stat-card.success::after { background: var(--success-500); }
.stat-card.warning::after { background: var(--warning-500); }
.stat-card.danger::after { background: var(--danger-500); }
.stat-card.info::after { background: var(--info-500); }

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card.primary .stat-icon { background: var(--primary-50); color: var(--primary-600); }
.stat-card.success .stat-icon { background: var(--success-50); color: var(--success-600); }
.stat-card.warning .stat-icon { background: var(--warning-50); color: var(--warning-600); }
.stat-card.danger .stat-icon { background: var(--danger-50); color: var(--danger-600); }
.stat-card.info .stat-icon { background: var(--info-50); color: var(--info-600); }

.stat-card .stat-info { flex: 1; }

.stat-card .stat-info .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-card .stat-info .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-card .stat-info .stat-sub {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 2px;
}

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

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

.data-table th {
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

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

.data-table .employee-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-table .employee-cell .avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.data-table .employee-cell .emp-info .emp-name {
    font-weight: 600;
    color: var(--text-main);
}

.data-table .employee-cell .emp-info .emp-id {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ---------- Status Badges ---------- */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

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

.badge-status.pending { background: var(--warning-50); color: var(--warning-600); }
.badge-status.pending::before { background: var(--warning-500); }

.badge-status.approved { background: var(--success-50); color: var(--success-600); }
.badge-status.approved::before { background: var(--success-500); }

.badge-status.rejected { background: var(--danger-50); color: var(--danger-600); }
.badge-status.rejected::before { background: var(--danger-500); }

.badge-status.cancelled { background: var(--gray-100); color: var(--text-dim); }
.badge-status.cancelled::before { background: var(--gray-400); }

/* ---------- Leave Type Badge ---------- */
.leave-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.leave-type-badge .color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    padding: 24px 28px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-header .close-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1.125rem;
    transition: all var(--transition-fast);
}

.modal-header .close-btn:hover {
    background: var(--gray-100);
    color: var(--text-muted);
}

.modal-body { padding: 0 28px 24px; }

.modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-lg { max-width: 720px; }

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

.toast {
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    min-width: 340px;
    max-width: 440px;
    animation: toastIn 0.3s ease;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast.success::before { background: var(--success-500); }
.toast.error::before { background: var(--danger-500); }
.toast.warning::before { background: var(--warning-500); }
.toast.info::before { background: var(--info-500); }

.toast .toast-icon { font-size: 1.125rem; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success-500); }
.toast.error .toast-icon { color: var(--danger-500); }
.toast.warning .toast-icon { color: var(--warning-500); }
.toast.info .toast-icon { color: var(--info-500); }

.toast .toast-message {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.toast .toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    font-size: 0.875rem;
}

.toast .toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 6px;
    animation: toastProgress 4s linear forwards;
}

.toast.success .toast-progress { background: var(--success-500); }
.toast.error .toast-progress { background: var(--danger-500); }
.toast.warning .toast-progress { background: var(--warning-500); }
.toast.info .toast-progress { background: var(--info-500); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0; }
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); height: 0; padding: 0; margin: 0; overflow: hidden; }
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state .empty-icon {
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--gray-400);
    max-width: 400px;
    margin: 0 auto;
}

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--gray-100);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color var(--transition-fast);
    font-family: var(--font-sans);
}

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

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

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

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ---------- Calendar Container ---------- */
.calendar-wrapper {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.calendar-wrapper .fc {
    font-family: var(--font-sans);
}

.calendar-wrapper .fc-toolbar-title {
    font-size: 1.125rem !important;
    font-weight: 700;
}

.calendar-wrapper .fc-button {
    background: var(--primary-500) !important;
    border-color: var(--primary-500) !important;
    border-radius: var(--border-radius-sm) !important;
    font-size: 0.813rem !important;
    font-weight: 600 !important;
    padding: 6px 12px !important;
    box-shadow: none !important;
}

.calendar-wrapper .fc-button:hover {
    background: var(--primary-600) !important;
}

.calendar-wrapper .fc-button-active {
    background: var(--primary-700) !important;
}

.calendar-wrapper .fc-event {
    border-radius: 4px !important;
    padding: 2px 6px !important;
    font-size: 0.75rem !important;
    border: none !important;
}

.calendar-wrapper .fc-daygrid-day-top {
    font-size: 0.813rem;
    font-weight: 600;
}

/* ---------- Filters Bar ---------- */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 36px 8px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    font-size: 0.813rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition-fast);
}

.filter-select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* ---------- Progress Bar ---------- */
.progress-bar {
    height: 8px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width var(--transition-slow);
}

/* ---------- Actions Column ---------- */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btns .btn-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    background: var(--bg-card);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.813rem;
    transition: all var(--transition-fast);
}

.action-btns .btn-action:hover {
    background: var(--gray-50);
    color: var(--text-muted);
    border-color: var(--gray-300);
}

.action-btns .btn-action.approve:hover {
    background: var(--success-50);
    color: var(--success-600);
    border-color: var(--success-500);
}

.action-btns .btn-action.reject:hover {
    background: var(--danger-50);
    color: var(--danger-600);
    border-color: var(--danger-500);
}

/* ---------- Balance Cards Grid ---------- */
.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.balance-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    position: relative;
}

.balance-card:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.balance-card .balance-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.balance-card .balance-header .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.balance-card .balance-header .type-name {
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--text-muted);
}

.balance-card .balance-numbers {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 12px;
}

.balance-card .balance-numbers .available {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--gray-900);
    display: block;
    margin-bottom: 4px;
}

/* ---------- Two Column Grid ---------- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

/* ---------- Holiday List ---------- */
.holiday-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-50);
    transition: background var(--transition-fast);
}

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

.holiday-item .holiday-date {
    width: 52px;
    height: 52px;
    background: var(--danger-50);
    border-radius: var(--border-radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.holiday-item .holiday-date .day {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--danger-600);
    line-height: 1;
}

.holiday-item .holiday-date .month {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--danger-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.holiday-item .holiday-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.holiday-item .holiday-full-date {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show { display: flex; }

.loading-overlay .loader {
    text-align: center;
}

.loading-overlay .loader .spinner-lg {
    width: 48px;
    height: 48px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.loading-overlay .loader p {
    font-size: 0.875rem;
    color: var(--text-dim);
    font-weight: 500;
}

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

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

/* ---------- Review Dialog ---------- */
.review-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}





/* ---------- Mobile Overlay ---------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

/* ---------- Quick Action Cards ---------- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.quick-action-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.quick-action-card:hover {
    border-color: var(--primary-400);
    background: var(--gray-50);
    box-shadow: var(--shadow-xl);
    transform: translateY(-5px) scale(1.03);
}

.quick-action-card i {
    font-size: 1.75rem;
    color: var(--primary-500);
    transition: transform var(--transition-base);
}

.quick-action-card:hover i {
    transform: scale(1.1) rotate(5deg);
}

/* ---------- Leave Type Selector Pills ---------- */
.leave-type-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.leave-type-pill {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--gray-200);
    background: var(--bg-card);
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.leave-type-pill:hover {
    border-color: var(--primary-300);
    color: var(--primary-600);
}

.leave-type-pill.selected {
    background: var(--primary-50);
    border-color: var(--primary-500);
    color: var(--primary-700);
}

.leave-type-pill .color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
/* ---------- Utilities & New Elements ---------- */
.warning-glow {
    box-shadow: 0 0 0 2px var(--warning-500), 0 0 20px rgba(245, 158, 11, 0.2) !important;
    border-color: var(--warning-200) !important;
}

.low-warning {
    font-size: 0.625rem;
    font-weight: 800;
    color: var(--warning-600);
    background: var(--warning-50);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.badge-status-sm {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.form-select-sm {
    padding: 6px 12px;
    font-size: 0.813rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    outline: none;
    background: var(--bg-card);
    cursor: pointer;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 320px; /* Slightly wider for the grid */
        z-index: 1001;
    }

    .sidebar-nav {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        padding: 15px !important;
    }

    .sidebar-nav .nav-section {
        display: contents !important; /* Flatten sections for the grid */
    }

    .sidebar-nav .nav-section-title {
        grid-column: 1 / -1 !important;
        margin-top: 20px !important;
        margin-bottom: 5px !important;
        text-align: left !important;
        color: rgba(255,255,255,0.4) !important;
    }

    .sidebar-nav .nav-item {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        background: rgba(255,255,255,0.04) !important;
        border: 1px solid rgba(255,255,255,0.06) !important;
        padding: 20px 10px !important;
        border-radius: 12px !important;
        height: auto !important;
        gap: 10px !important;
    }

    .sidebar-nav .nav-item i {
        font-size: 1.25rem !important;
        margin-right: 0 !important;
        color: var(--primary-400) !important;
    }

    .sidebar-nav .nav-item span {
        font-size: 0.75rem !important;
        font-weight: 500 !important;
        white-space: normal !important;
        line-height: 1.2 !important;
    }

    .sidebar-nav .nav-item.active {
        background: var(--primary-600) !important;
        color: white !important;
    }

    .sidebar-nav .nav-item.active i {
        color: white !important;
    }

    .sidebar-footer {
        padding: 15px !important;
        border-top: 1px solid rgba(255,255,255,0.08) !important;
    }

    .sidebar.open {
        transform: translateX(0);
    }

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

    .top-header {
        padding: 0 16px;
    }

    .top-header .header-left .menu-toggle {
        display: flex;
    }

    .top-header .page-title {
        font-size: 1.125rem;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .stats-grid, .quick-actions, .leave-type-grid, .balance-grid {
        grid-template-columns: 1fr 1fr !important;
        display: grid !important;
        gap: 12px !important;
    }

    .stat-card, .quick-action-card {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 16px 10px !important;
        gap: 8px !important;
    }

    .stat-card .stat-icon {
        margin-right: 0 !important;
        margin-bottom: 8px !important;
        width: 38px !important;
        height: 38px !important;
        font-size: 1rem !important;
    }

    .stat-card-value {
        font-size: 1.5rem !important;
    }

    .stat-card-label {
        font-size: 0.75rem !important;
        white-space: nowrap;
    }

    .balance-card {
        padding: 16px 12px !important;
    }

    .balance-card .balance-header {
        margin-bottom: 8px !important;
    }

    .balance-card .balance-numbers .available {
        font-size: 1.25rem !important;
    }

    /* Stack tables on mobile */
    .data-table thead {
        display: none; /* Hide headers */
    }

    .data-table tr {
        display: block;
        margin-bottom: 16px;
        padding: 16px;
        background: var(--bg-card);
        border: 1.5px solid var(--gray-200);
        border-radius: var(--border-radius);
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 0;
        border-bottom: 1px solid var(--gray-50);
        text-align: right;
        font-size: 0.813rem;
        gap: 16px;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.688rem;
        color: var(--text-dim);
        text-align: left;
        padding-right: 12px;
        min-width: 100px;
        flex-shrink: 0;
    }

    .data-table td .employee-cell {
        justify-content: flex-end;
        text-align: right;
    }

    .data-table td .action-btns {
        justify-content: flex-end;
    }

    .data-table td .leave-type-badge {
        padding: 4px 8px;
    }

    .page-container {
        padding: 12px 10px;
    }

    .form-paper {
        padding: 24px 16px;
        border-radius: 8px;
    }

    .grid-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .leave-type-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .leave-type-option {
        padding: 12px;
    }

    .form-header-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }



    .stat-card {
        padding: 12px;
    }

    .quick-action-card {
        padding: 16px 12px !important;
    }

    .quick-action-card i {
        font-size: 1.25rem !important;
        margin-bottom: 8px !important;
    }

    .quick-action-card span {
        font-size: 0.813rem !important;
    }

    .stat-card-value {
        font-size: 1.5rem !important;
    }

    .stat-card-label {
        font-size: 0.75rem !important;
    }

    .modal-body {
        padding: 0 20px 20px;
    }

    .modal-footer {
        padding: 16px 20px 20px;
    }

    .notifications-dropdown {
        right: 8px;
        width: calc(100vw - 16px);
        top: 60px;
    }

    .toast-container {
        top: auto;
        bottom: 16px;
        left: 16px;
        right: 16px;
    }

    .toast { min-width: auto; }
}

@media (max-width: 480px) {
    .stats-grid, .quick-actions, .leave-type-grid, .balance-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .page-container {
        padding: 10px 8px !important;
    }

    .form-paper {
        padding: 20px 12px !important;
    }

    .stat-card, .quick-action-card, .balance-card {
        padding: 12px 8px !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 6px !important;
    }

    .balance-card .balance-header {
        justify-content: center !important;
    }

    .balance-card .balance-numbers .available {
        font-size: 1.125rem !important;
    }

    .stat-card .stat-icon {
        margin-right: 0 !important;
        margin-bottom: 8px !important;
    }

    .stat-info {
        text-align: center !important;
    }

    .stat-card-value {
        font-size: 1.375rem !important;
    }

    .stat-card-label {
        font-size: 0.688rem !important;
        white-space: nowrap;
    }

    .quick-action-card i {
        font-size: 1.125rem !important;
    }

    .quick-action-card span, .quick-action-card h4 {
        font-size: 0.75rem !important;
    }

    .login-card {
        padding: 32px 20px;
        margin: 12px;
    }
    
    .brand h1 {
        font-size: 1.25rem;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select {
        width: 100%;
    }
}

/* ---------- Print Styles ---------- */
@media print {
    body * { visibility: hidden; }
    #viewLeaveModal, #viewLeaveModal * { visibility: visible; }
    #viewLeaveModal { 
        position: absolute; 
        left: 0; 
        top: 0; 
        width: 100%; 
        background: white !important;
        backdrop-filter: none !important;
    }
    .signature-modal { 
        box-shadow: none !important; 
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .signature-modal-header, .signature-modal-footer, .btn-close { display: none !important; }
    .form-paper { box-shadow: none !important; border: none !important; }
}
