/* ============================================ */
/* ðŸŽ¨ THEME SYSTEM - CSS Variables */
/* ============================================ */

:root {
    /* Default Theme */
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f8fafc;
    --bg-input: #ffffff;
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --accent-warning: #f59e0b;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.3);
    
    --gradient-login: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-header: linear-gradient(135deg, #0d7377, #14919b);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --font-main: 'Vazirmatn', 'Tahoma', sans-serif;
    
    --transition-fast: 0.15s;
    --transition-normal: 0.2s;
    --transition-slow: 0.3s;
}

/* ðŸŒ™ Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --bg-input: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    --border-color: #334155;
    --border-light: #475569;
    
    --accent-primary: #818cf8;
    --accent-secondary: #a78bfa;
    --accent-success: #34d399;
    --accent-danger: #f87171;
    --accent-warning: #fbbf24;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
    
    --gradient-login: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-header: linear-gradient(135deg, #0f766e, #115e59);
}

/* ðŸŒ¿ Nature Theme */
[data-theme="nature"] {
    --bg-primary: #f0fdf4;
    --bg-secondary: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #dcfce7;
    --bg-input: #ffffff;
    
    --text-primary: #14532d;
    --text-secondary: #166534;
    --text-muted: #15803d;
    --text-light: #22c55e;
    
    --border-color: #bbf7d0;
    --border-light: #dcfce7;
    
    --accent-primary: #16a34a;
    --accent-secondary: #15803d;
    --accent-success: #22c55e;
    --accent-danger: #dc2626;
    --accent-warning: #ca8a04;
    
    --shadow-sm: 0 1px 3px rgba(22,163,74,0.1);
    --shadow-md: 0 4px 12px rgba(22,163,74,0.15);
    --shadow-lg: 0 20px 60px rgba(22,163,74,0.2);
    
    --gradient-login: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    --gradient-header: linear-gradient(135deg, #14532d, #166534);
}

/* ðŸ’œ Luxury Theme */
[data-theme="luxury"] {
    --bg-primary: #faf5ff;
    --bg-secondary: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f3e8ff;
    --bg-input: #ffffff;
    
    --text-primary: #581c87;
    --text-secondary: #6b21a8;
    --text-muted: #7e22ce;
    --text-light: #a855f7;
    
    --border-color: #e9d5ff;
    --border-light: #f3e8ff;
    
    --accent-primary: #7c3aed;
    --accent-secondary: #6d28d9;
    --accent-success: #10b981;
    --accent-danger: #ef4444;
    --accent-warning: #f59e0b;
    
    --shadow-sm: 0 1px 3px rgba(124,58,237,0.1);
    --shadow-md: 0 4px 12px rgba(124,58,237,0.15);
    --shadow-lg: 0 20px 60px rgba(124,58,237,0.2);
    
    --gradient-login: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    --gradient-header: linear-gradient(135deg, #581c87, #7c3aed);
}

/* ============================================ */
/* ðŸ”„ Base Styles with CSS Variables */
/* ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-main);
    direction: rtl;
    background: var(--bg-primary);
    color: var(--text-secondary);
    line-height: 1.6;
    transition: background var(--transition-normal), color var(--transition-normal);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-login);
}

.login-container { width: 100%; max-width: 420px; padding: 20px; }

.login-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header { text-align: center; margin-bottom: 30px; }
.login-header .logo { font-size: 48px; margin-bottom: 15px; }
.login-header h1 { font-size: 24px; color: var(--text-primary); margin-bottom: 5px; }
.login-header p { color: var(--text-muted); font-size: 14px; }

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer a { color: var(--accent-primary); text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: background var(--transition-normal), border-color var(--transition-normal);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 { font-size: 18px; color: var(--text-primary); }
.sidebar-header p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.sidebar-nav { flex: 1; padding: 16px 0; }

.sidebar-nav a {
    display: block;
    padding: 12px 20px;
    border-radius: 0;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 2px;
    transition: all var(--transition-normal);
    font-size: 14px;
}

.sidebar-nav a:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.sidebar-nav a.active {
    background: var(--bg-hover);
    color: var(--accent-primary);
    font-weight: 600;
    border-right: 3px solid var(--accent-primary);
}

.sidebar-nav .submenu {
    padding-right: 0;
    margin-bottom: 4px;
    border-right: 3px solid var(--border-color);
    margin-right: 20px;
}

.sidebar-nav .submenu a {
    font-size: 13px;
    padding: 8px 16px 8px 20px;
    color: var(--text-muted);
    border-right: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-nav .submenu a:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.sidebar-nav .submenu a.active {
    background: var(--bg-hover);
    color: var(--accent-primary);
    font-weight: 600;
    border-right: 3px solid var(--accent-primary);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer p { font-size: 14px; margin-bottom: 10px; color: var(--text-primary); }

.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 { font-size: 24px; color: var(--text-primary); }

.date-display {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    transition: background var(--transition-normal), border-color var(--transition-normal);
}

.card h3 { font-size: 18px; margin-bottom: 16px; color: var(--text-primary); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: background var(--transition-normal), border-color var(--transition-normal);
}

.stat-card.blue { border-right: 4px solid #3b82f6; }
.stat-card.green { border-right: 4px solid var(--accent-success); }
.stat-card.red { border-right: 4px solid var(--accent-danger); }
.stat-card.yellow { border-right: 4px solid var(--accent-warning); }
.stat-card.purple { border-right: 4px solid #8b5cf6; }

.stat-icon { font-size: 32px; }

.stat-info h3 { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-info p { font-size: 14px; color: var(--text-muted); }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }

.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    background: var(--bg-hover);
    padding: 12px 16px;
    text-align: right;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.table tr:hover { background: var(--bg-hover); }

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-normal);
}

.btn-primary { background: var(--accent-primary); color: white; }
.btn-primary:hover { background: var(--accent-secondary); }

.btn-success { background: var(--accent-success); color: white; }
.btn-success:hover { opacity: 0.9; }

.btn-danger { background: var(--accent-danger); color: white; }
.btn-danger:hover { opacity: 0.9; }

.btn-warning { background: var(--accent-warning); color: white; }
.btn-warning:hover { opacity: 0.9; }

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover { background: var(--border-color); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--transition-normal), background var(--transition-normal);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-grid .full-width { grid-column: 1 / -1; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-right: 4px solid var(--accent-success);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-right: 4px solid var(--accent-danger);
}

.tabs { display: flex; gap: 8px; margin-bottom: 20px; }

.tab {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 14px;
    transition: all var(--transition-normal);
}

.tab.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.modal-content h3 { margin-bottom: 20px; color: var(--text-primary); }

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.quick-links { display: grid; gap: 12px; }

.quick-link {
    display: block;
    padding: 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
}

.quick-link:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.text-muted { color: var(--text-light); }
.text-center { text-align: center; }

/* Live Clock */
.live-clock {
    font-family: 'Vazirmatn', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
    background: var(--bg-hover);
    padding: 8px 16px;
    border-radius: var(--radius-md);
}

/* ==================== PERSIAN CALENDAR ==================== */
.pcal-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.pcal-header {
    background: var(--gradient-header);
    color: #fff;
    padding: 20px 24px;
    text-align: center;
    position: relative;
}

.pcal-header h2 { font-size: 22px; margin: 0; font-weight: 700; }

.pcal-header .pcal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.pcal-header .pcal-nav:hover { background: rgba(255,255,255,0.35); }
.pcal-header .pcal-nav.prev { left: 20px; }
.pcal-header .pcal-nav.next { right: 20px; }

.pcal-header .pcal-add {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 60px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.pcal-header .pcal-add:hover { background: rgba(255,255,255,0.35); }

.pcal-subheader {
    background: var(--bg-hover);
    padding: 8px;
    text-align: center;
    color: var(--accent-primary);
    font-size: 13px;
    font-weight: 600;
}

.pcal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-hover);
    border-bottom: 2px solid var(--border-color);
}

.pcal-weekday {
    text-align: center;
    padding: 12px 4px;
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 13px;
}

.pcal-weekday.friday { color: var(--accent-danger); }

.pcal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.pcal-day {
    min-height: 90px;
    background: var(--bg-card);
    padding: 8px;
    position: relative;
    transition: all var(--transition-normal);
}

.pcal-day:hover { background: var(--bg-hover); }
.pcal-day.empty { background: var(--bg-hover); }
.pcal-day.friday { background: var(--bg-hover); }
.pcal-day.holiday { background: var(--bg-hover); }
.pcal-day.today { box-shadow: inset 0 0 0 2px var(--accent-primary); }

.pcal-day-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    text-align: center;
    margin-bottom: 2px;
}

.pcal-day.friday .pcal-day-num { color: var(--accent-danger); }
.pcal-day.holiday .pcal-day-num { color: var(--accent-danger); }

.pcal-day-greg {
    font-size: 11px;
    color: var(--text-light);
    text-align: center;
    display: block;
    margin-bottom: 4px;
}

.pcal-day-events {
    direction: rtl;
    font-size: 11px;
    line-height: 1.5;
}

.pcal-event {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 1px 0;
    white-space: nowrap;
    overflow: hidden;
}

.pcal-event-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pcal-event.in .pcal-event-dot { background: var(--accent-success); }
.pcal-event.out .pcal-event-dot { background: var(--accent-danger); }
.pcal-event.late .pcal-event-dot { background: var(--accent-warning); }
.pcal-event.leave .pcal-event-dot { background: #8b5cf6; }

.pcal-event-text { overflow: hidden; text-overflow: ellipsis; }

.pcal-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 16px;
    background: var(--bg-hover);
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.pcal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.pcal-legend-box { width: 14px; height: 14px; border-radius: 4px; }

/* ==================== MONTHLY REPORT TABLE ==================== */
.report-table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.report-table th,
.report-table td {
    border: 1px solid var(--border-color);
    padding: 6px 4px;
    text-align: center;
}

.report-table th {
    background: var(--bg-hover);
    font-weight: 700;
    font-size: 11px;
    color: var(--text-secondary);
}

.report-table td { vertical-align: top; color: var(--text-primary); }

.report-table .row-num {
    width: 30px;
    background: var(--bg-hover);
    font-weight: 700;
}

.report-table .date-col { width: 80px; }
.report-table .day-col { width: 50px; }
.report-table .time-col { width: 55px; font-size: 11px; }
.report-table .work-col { width: 60px; font-size: 11px; font-weight: 700; }

.report-table .in-time { color: var(--accent-success); font-weight: 600; }
.report-table .out-time { color: var(--accent-danger); font-weight: 600; }
.report-table .late-cell { background: #fef3c7; color: #92400e; font-weight: 700; }
.report-table .leave-cell { background: #e0e7ff; color: #3730a3; font-weight: 600; }
.report-table .absent-cell { background: #fee2e2; color: #991b1b; font-weight: 600; }
.report-table .holiday-cell { background: #fef2f2; color: var(--accent-danger); font-weight: 600; }
.report-table .weekend-cell { background: var(--bg-hover); color: #92400e; }

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.report-summary-item { text-align: center; }

.report-summary-item h4 { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.report-summary-item p { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.report-summary-item .unit { font-size: 11px; color: var(--text-light); }

.print-signature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.print-signature-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
}

.print-signature-box h4 { font-size: 12px; margin-bottom: 40px; color: var(--text-secondary); }

.print-signature-line {
    border-top: 1px dashed var(--text-light);
    padding-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.print-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-light);
}

/* ==================== BACKUP SECTION ==================== */
.backup-card {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    background: var(--bg-hover);
}

.backup-card h4 { margin-bottom: 12px; color: var(--text-primary); }
.backup-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

@media (max-width: 768px) and (orientation: landscape) {
    .personnel-mobile .sidebar {
        height: 50px;
    }
    .personnel-mobile .sidebar-nav a {
        padding: 4px;
        font-size: 10px;
    }
    .personnel-mobile .sidebar-nav a .nav-icon {
        font-size: 16px;
    }
    .personnel-mobile .main-content {
        margin-bottom: 50px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .personnel-mobile .stats-grid {
        grid-template-columns: 1fr;
    }
    .personnel-mobile .page-header h1 {
        font-size: 18px;
    }
}

@media print {
    .sidebar, .no-print { display: none !important; }
    .main-content { margin: 0; padding: 0; }
    .report-table-container { padding: 0; box-shadow: none; }
}

@media (max-width: 768px) {
    .sidebar { width: 100%; transform: translateX(100%); transition: transform var(--transition-slow); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-right: 0; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

/* ==================== PERFORMANCE MODULE ==================== */
.filter-select {
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-family: inherit;
    min-width: 160px;
    color: var(--text-primary);
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.score-box {
    text-align: center;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
}

.score-box h4 { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.score-box p { font-size: 22px; font-weight: 700; }

.score-box.total {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.score-box.total h4 { color: var(--text-muted); }

.criteria-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 12px;
}

.criteria-table th,
.criteria-table td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: center;
}

.criteria-table th { background: var(--bg-hover); font-weight: 700; }

/* ==================== A4 COMBINED REPORT ==================== */
@media print {
    @page { size: A4 portrait; margin: 8mm; }
    .sidebar, .no-print { display: none !important; }
    .main-content { margin: 0; padding: 0; background: var(--bg-primary); }
    .a4-sheet { width: 100%; box-shadow: none; padding: 0; margin: 0; }
    body { background: var(--bg-primary); }
}

.a4-sheet {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.a4-header {
    text-align: center;
    border-bottom: 2px solid var(--text-primary);
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.a4-header h1 { font-size: 16px; margin-bottom: 4px; color: var(--text-primary); }
.a4-header div { font-size: 11px; color: var(--text-muted); }

.a4-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 12px 0 6px;
    border-right: 3px solid var(--accent-primary);
    padding-right: 8px;
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.mini-table th,
.mini-table td {
    border: 1px solid var(--border-color);
    padding: 4px 2px;
    text-align: center;
}

.mini-table th { background: var(--bg-hover); font-weight: 700; }
.mini-table td { vertical-align: top; color: var(--text-primary); }

.criteria-mini {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    margin-top: 6px;
}

.criteria-mini th,
.criteria-mini td {
    border: 1px solid var(--border-color);
    padding: 4px;
    text-align: center;
}

.criteria-mini th { background: var(--bg-hover); }

.sig-row { display: flex; gap: 10px; margin-top: 14px; }

.sig-box {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    text-align: center;
    font-size: 11px;
}

.sig-box .line {
    border-top: 1px dashed var(--text-light);
    margin-top: 30px;
    padding-top: 4px;
    color: var(--text-muted);
}

/* ==================== COLLAPSIBLE SIDEBAR STYLES ==================== */
.submenu-toggle {
    cursor: pointer;
    user-select: none;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
}

.submenu-toggle .submenu-arrow {
    font-size: 12px;
    margin-right: auto;
    margin-left: 8px;
    transition: transform var(--transition-normal);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow) ease, padding var(--transition-slow) ease;
    padding-right: 0;
    margin-bottom: 0;
    border-right: 3px solid var(--border-color);
    margin-right: 20px;
}

.submenu.open {
    max-height: 500px;
    padding-right: 0;
    margin-bottom: 4px;
}

.submenu a {
    font-size: 13px;
    padding: 8px 16px 8px 20px;
    color: var(--text-muted);
    border-right: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.submenu a:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.submenu a.active {
    background: var(--bg-hover);
    color: var(--accent-primary);
    font-weight: 600;
    border-right: 3px solid var(--accent-primary);
}

/* ==================== THEME SWITCHER ==================== */
.theme-switcher {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
}

.theme-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.theme-btn.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary);
}

.theme-btn .tooltip {
    position: absolute;
    right: 50px;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    font-family: var(--font-main);
}

.theme-btn:hover .tooltip {
    opacity: 1;
}

/* Auto theme indicator */
.theme-btn[data-theme="auto"] {
    background: linear-gradient(135deg, #f1f5f9 50%, #1e293b 50%);
}

/* Dark theme button */
.theme-btn[data-theme="dark"] {
    background: #1e293b;
    color: #f1f5f9;
}

/* Nature theme button */
.theme-btn[data-theme="nature"] {
    background: #16a34a;
    color: white;
}

/* Luxury theme button */
.theme-btn[data-theme="luxury"] {
    background: #7c3aed;
    color: white;
}

/* Default theme button */
.theme-btn[data-theme="default"] {
    background: #667eea;
    color: white;
}

/* Theme animation */
body.theme-transitioning {
    transition: background 0.5s ease, color 0.5s ease;
}

body.theme-transitioning * {
    transition: background-color 0.5s ease, border-color 0.5s ease, color 0.5s ease, box-shadow 0.5s ease !important;
}

/* Responsive theme switcher */
@media (max-width: 768px) {
    .theme-switcher {
        bottom: 10px;
        left: 10px;
        flex-direction: row;
    }
    
    .theme-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .theme-btn .tooltip {
        display: none;
    }
}

/* ==================== DARK MODE SPECIFIC FIXES ==================== */
[data-theme="dark"] .badge-success { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .badge-danger { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-warning { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .alert-success { background: #064e3b; color: #6ee7b7; border-right-color: var(--accent-success); }
[data-theme="dark"] .alert-error { background: #7f1d1d; color: #fca5a5; border-right-color: var(--accent-danger); }
[data-theme="dark"] .report-table .late-cell { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .report-table .leave-cell { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .report-table .absent-cell { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .report-table .holiday-cell { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .pcal-day.friday { background: #451a03; }
[data-theme="dark"] .pcal-day.holiday { background: #450a0a; }
[data-theme="dark"] .login-footer { border-top-color: var(--border-color); }
[data-theme="dark"] .stat-card.blue { border-right-color: #60a5fa; }
[data-theme="dark"] .stat-card.green { border-right-color: #34d399; }
[data-theme="dark"] .stat-card.red { border-right-color: #f87171; }
[data-theme="dark"] .stat-card.yellow { border-right-color: #fbbf24; }
[data-theme="dark"] .stat-card.purple { border-right-color: #c084fc; }
[data-theme="dark"] .pcal-event.leave .pcal-event-dot { background: #c084fc; }
[data-theme="dark"] .manager-badge { background: #6d28d9; }
[data-theme="dark"] .emergency-badge.emergency-yes { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .emergency-badge.emergency-no { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .leave-notif { background: var(--bg-hover); border-color: var(--border-color); }
[data-theme="dark"] .leave-notif.approved { background: #064e3b; border-color: #059669; }
[data-theme="dark"] .leave-notif.rejected { background: #450a0a; border-color: #dc2626; }
[data-theme="dark"] .perf-card { background: var(--bg-card); }
[data-theme="dark"] .mini-cal-day.present { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .mini-cal-day.late { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .mini-cal-day.leave { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .template-btn { background: #3730a3; color: #c7d2fe; }
[data-theme="dark"] .template-btn:hover { background: #4338ca; }
[data-theme="dark"] .msg-preview { background: #0f172a; color: #e2e8f0; }
[data-theme="dark"] .user-select-item { background: var(--bg-card); border-color: var(--border-color); }
[data-theme="dark"] .user-select-item:hover { border-color: var(--accent-primary); background: var(--bg-hover); }
[data-theme="dark"] .user-select-item.selected { border-color: var(--accent-primary); background: var(--bg-hover); }
[data-theme="dark"] .date-picker-content { background: var(--bg-card); }
[data-theme="dark"] .dp-day { color: var(--text-primary); }
[data-theme="dark"] .dp-day.disabled { color: var(--text-light); }
[data-theme="dark"] .dp-day.selected { background: var(--accent-primary); color: white; }
[data-theme="dark"] .dp-day:hover { background: var(--bg-hover); }
[data-theme="dark"] .dp-weekday { color: var(--text-muted); }
[data-theme="dark"] .dept-card { background: var(--bg-card); border-color: var(--border-color); }
[data-theme="dark"] .dept-header { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
[data-theme="dark"] .dept-table th { background: var(--bg-hover); }
[data-theme="dark"] .score-pos { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .score-neg { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .shift-card { background: var(--bg-card); border-color: var(--border-color); }
[data-theme="dark"] .rules-table th { background: var(--bg-hover); }
[data-theme="dark"] .log-type-in { color: #34d399; }
[data-theme="dark"] .log-type-out { color: #f87171; }
[data-theme="dark"] .log-late { background: #451a03; }
[data-theme="dark"] .log-manual { background: #1e1b4b; }
[data-theme="dark"] .time-input { background: var(--bg-input); color: var(--text-primary); border-color: var(--border-color); }
[data-theme="dark"] .time-input:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(129,140,248,0.2); }
[data-theme="dark"] .time-new { background: var(--bg-hover); color: var(--text-muted); border-color: var(--border-color); }
[data-theme="dark"] .pair-container:hover { background: #1e1b4b; }
[data-theme="dark"] .btn-icon { color: #f87171; }
[data-theme="dark"] .btn-icon:hover { background: #450a0a; }
[data-theme="dark"] .month-select-btn,
[data-theme="dark"] .user-select-btn { background: var(--bg-input); color: var(--text-primary); border-color: var(--border-color); }
[data-theme="dark"] .month-select-dropdown,
[data-theme="dark"] .user-select-dropdown { background: var(--bg-card); border-color: var(--border-color); }
[data-theme="dark"] .month-option:hover,
[data-theme="dark"] .user-option:hover { background: var(--bg-hover); }
[data-theme="dark"] .month-option.selected,
[data-theme="dark"] .user-option.selected { background: var(--accent-primary); color: white; }

/* ==================== NATURE THEME SPECIFIC FIXES ==================== */
[data-theme="nature"] .badge-success { background: #dcfce7; color: #14532d; }
[data-theme="nature"] .badge-danger { background: #fee2e2; color: #991b1b; }
[data-theme="nature"] .badge-warning { background: #fef3c7; color: #92400e; }
[data-theme="nature"] .alert-success { background: #dcfce7; color: #14532d; border-right-color: var(--accent-success); }
[data-theme="nature"] .alert-error { background: #fee2e2; color: #991b1b; border-right-color: var(--accent-danger); }
[data-theme="nature"] .stat-card.blue { border-right-color: #3b82f6; }
[data-theme="nature"] .stat-card.green { border-right-color: #22c55e; }
[data-theme="nature"] .stat-card.red { border-right-color: #ef4444; }
[data-theme="nature"] .stat-card.yellow { border-right-color: #eab308; }
[data-theme="nature"] .stat-card.purple { border-right-color: #a855f7; }
[data-theme="nature"] .pcal-event.leave .pcal-event-dot { background: #7c3aed; }
[data-theme="nature"] .manager-badge { background: #15803d; }
[data-theme="nature"] .template-btn { background: #dcfce7; color: #14532d; }
[data-theme="nature"] .template-btn:hover { background: #bbf7d0; }
[data-theme="nature"] .dept-header { background: linear-gradient(135deg, #16a34a, #15803d); }
[data-theme="nature"] .score-pos { background: #dcfce7; color: #14532d; }
[data-theme="nature"] .score-neg { background: #fee2e2; color: #991b1b; }

/* ==================== LUXURY THEME SPECIFIC FIXES ==================== */
[data-theme="luxury"] .badge-success { background: #f3e8ff; color: #581c87; }
[data-theme="luxury"] .badge-danger { background: #fee2e2; color: #991b1b; }
[data-theme="luxury"] .badge-warning { background: #fef3c7; color: #92400e; }
[data-theme="luxury"] .alert-success { background: #f3e8ff; color: #581c87; border-right-color: #7c3aed; }
[data-theme="luxury"] .alert-error { background: #fee2e2; color: #991b1b; border-right-color: var(--accent-danger); }
[data-theme="luxury"] .stat-card.blue { border-right-color: #6366f1; }
[data-theme="luxury"] .stat-card.green { border-right-color: #10b981; }
[data-theme="luxury"] .stat-card.red { border-right-color: #ef4444; }
[data-theme="luxury"] .stat-card.yellow { border-right-color: #f59e0b; }
[data-theme="luxury"] .stat-card.purple { border-right-color: #a855f7; }
[data-theme="luxury"] .pcal-event.leave .pcal-event-dot { background: #f59e0b; }
[data-theme="luxury"] .manager-badge { background: #6d28d9; }
[data-theme="luxury"] .template-btn { background: #f3e8ff; color: #581c87; }
[data-theme="luxury"] .template-btn:hover { background: #e9d5ff; }
[data-theme="luxury"] .dept-header { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
[data-theme="luxury"] .score-pos { background: #f3e8ff; color: #581c87; }
[data-theme="luxury"] .score-neg { background: #fee2e2; color: #991b1b; }