:root {
    /* Premium Academic Palette */
    --primary-color: #0c4a6e; /* Deep Ocean Blue */
    --primary-hover: #075985;
    --primary-light: #f0f9ff;
    --accent-color: #0ea5e9; /* Vibrant Azure */
    --accent-hover: #0284c7;
    --sidebar-bg: #0f172a; /* Slate Dark */
    --bg-main: #f8fafc; /* Very Light Grey/Blue */
    --bg-card: #ffffff;
    --text-main: #0f172a; /* Sharp Dark Slate */
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --success-color: #10b981;
    --success-bg: #f0fdf4;
    --danger-color: #ef4444;
    --danger-bg: #fef2f2;
    --warning-color: #f59e0b;
    --warning-bg: #fffbe6;
    
    /* Academic Status Colors */
    --excellent-color: #059669;
    --improvement-color: #d97706;
    --followup-color: #dc2626;

    /* Vibrant Employee Colors (Gradient-ready) */
    --color-emp-1: #0ea5e9; /* Azure */
    --color-emp-2: #10b981; /* Emerald */
    --color-emp-3: #8b5cf6; /* Violet */
    --color-emp-4: #f59e0b; /* Amber */
    --color-emp-5: #ec4899; /* Pink */
    --color-emp-6: #6366f1; /* Indigo */

    /* Layout & Shadows */
    --sidebar-width: 280px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.12);
    --radius-md: 12px;
    --radius-lg: 24px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Header Gradient */
    --header-gradient: linear-gradient(135deg, #0c4a6e 0%, #075985 50%, #0369a1 100%);
}

/* GPU Acceleration & Performance Hints */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.emp-card, .summary-card, .btn, .modal-content {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Skeleton Loading Animation */
@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
}

.skeleton-text { height: 1rem; width: 100%; margin-bottom: 0.5rem; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-card { height: 200px; width: 100%; border-radius: var(--radius-lg); }

.data-loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.data-loading-overlay.active {
    display: flex;
}

.data-loading-inner {
    background: var(--bg-card, #fff);
    color: var(--text-main, #0f172a);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    max-width: 320px;
}

.data-loading-inner i {
    font-size: 2rem;
    color: var(--primary-color, #0c4a6e);
    margin-bottom: 0.75rem;
}

.data-loading-inner p {
    margin: 0 0 0.35rem;
    font-weight: 800;
    font-size: 1.05rem;
}

.data-loading-inner small {
    color: var(--text-muted, #64748b);
    font-size: 0.8rem;
}

.app-update-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #0c4a6e, #075985);
    color: #fff;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(110%);
    transition: transform 0.35s ease;
}

.app-update-banner.visible,
.app-update-banner:not([hidden]) {
    transform: translateY(0);
}

.app-update-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
}

.app-update-inner i {
    font-size: 1.1rem;
    animation: spin-slow 2s linear infinite;
}

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

.app-update-btn {
    background: #fff;
    color: #0c4a6e;
    border: none;
    border-radius: 8px;
    padding: 0.45rem 1rem;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.app-update-btn:hover {
    background: #e0f2fe;
}

body.dark-mode {
    --primary-color: #38bdf8;
    --sidebar-bg: #020617;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(51, 65, 85, 0.5);
    --header-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
}

/* Typography & Utils */
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-muted { color: var(--text-muted); }

/* App Layout */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo-icon {
    font-size: 2rem;
    color: var(--primary-color);
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: var(--radius-md);
}

.sidebar-header h1 {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
}

.sidebar-header p {
    font-size: 0.8rem;
    color: #9CA3AF;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav .nav-btn {
    background: transparent;
    color: #9CA3AF;
    border: none;
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: right;
}

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

.sidebar-nav .nav-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-footer .theme-toggle-btn {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-md);
    color: #A0B2C6;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-family: inherit;
    display: flex;
    align-items: center;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--bg-main);
}

/* Mobile Top Bar */
.mobile-top-bar {
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    z-index: 99;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-weight: 800;
    font-size: 1.2rem;
}

.mobile-menu-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
}

.sidebar-footer .header-date {
    background: rgba(255,255,255,0.1);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    color: #9CA3AF;
}

/* Layout Container */
.app-container {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s ease;
}

.active-view {
    display: block;
}

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

/* Home Hero */
.home-hero {
    text-align: center;
    margin-bottom: 3rem;
    margin-top: 1rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Premium Header Banner */
.header-banner {
    background: var(--header-gradient);
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    color: white;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-banner::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.header-banner::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -5%;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

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

.banner-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.banner-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.banner-actions {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 1rem;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: var(--success-bg);
    color: var(--success-color);
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Admin Extra Actions */
.admin-actions-bar {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
}

.stats-overview {
    display: flex;
    gap: 2rem;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Employees Grid (The Premium Cards) */
.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.emp-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    cursor: pointer;
    border: 1px solid var(--border-color);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    contain: layout;
}

.emp-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.emp-card-top {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
}

.btn-quick-add-task {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    position: absolute;
    top: 1rem;
    left: 1rem;
}

.btn-quick-add-task:hover {
    background: white;
    color: var(--primary-color);
    transform: scale(1.1);
}

.emp-card-top::after {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 150px;
    height: 150px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.emp-info h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
}

.emp-info p {
    font-size: 0.95rem;
    opacity: 0.9;
}

.emp-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    backdrop-filter: blur(5px);
}

.emp-card-bottom {
    padding: 1.5rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.btn-add-task-floating {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: var(--shadow-md);
}

.btn-add-task-floating:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.emp-progress-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 700;
}

.emp-progress-bar-container {
    height: 8px;
    background: #E0E6ED;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    position: relative;
    transform: translateZ(0); /* Stability */
}

.emp-progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease;
}

.emp-stats-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: 700;
}

.emp-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.emp-stat.pending { color: var(--warning-color); }
.emp-stat.completed { color: var(--success-color); }

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary:hover { background-color: #111D28; }

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

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

.btn-text:hover {
    color: var(--primary-color);
    background: rgba(0,0,0,0.05);
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 1rem;
    cursor: pointer;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-main);
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-back:hover {
    background: #e2e8f0;
}

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

.modal.active { display: flex; }

.modal-content {
    background: #ffffff;
    width: 90%;
    max-width: 800px;
    min-height: 60vh;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.modal-header h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #000000;
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-body { 
    padding: 3rem; 
    flex: 1; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Forms */
.form-group { margin-bottom: 1.2rem; }
.form-row { display: flex; gap: 1rem; }
.form-group.half { flex: 1; }

.form-group label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 800;
    font-size: 1.1rem;
    color: #000000;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1.1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.predefined-tasks-box {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    background: var(--bg-main);
}

/* Employee View New Design */
.emp-banner {
    border-radius: var(--radius-lg);
    color: white;
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: background-color 0.3s;
}

.emp-banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.btn-back-banner {
    position: absolute;
    top: -0.5rem;
    right: 0;
    background: transparent;
    color: rgba(255,255,255,0.9);
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-back-banner:hover { color: white; }

.emp-banner-center {
    text-align: right;
    margin-top: 1.5rem;
}

.emp-banner-center h2 {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 0.3rem;
}

.emp-banner-center span {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Circular Progress */
.circular-progress {
    position: relative;
    width: 80px;
    height: 80px;
}

.circular-progress svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: rgba(255,255,255,0.2);
    stroke-width: 2.5;
}

.circle {
    fill: none;
    stroke: white;
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dasharray 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.circular-progress .percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.perc-val {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
}

.perc-label {
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 2px;
}

/* Status Labels */
.eval-label {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

.excellent { background: #D1FAE5; color: #065F46; }
.very-good { background: #DBEAFE; color: #1E40AF; }
.good { background: #E0E7FF; color: #3730A3; }
.acceptable { background: #EDE9FE; color: #5B21B6; }
.needs-improvement { background: #FEF3C7; color: #92400E; }
.needs-followup { background: #FEE2E2; color: #991B1B; }

.emp-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.filter-group-dropdown {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.filter-group-dropdown select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    color: var(--text-main);
    background: var(--bg-main);
    outline: none;
}

/* Tasks Boxes */
.tasks-container-new {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.tasks-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tasks-box .box-header {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pending-box .box-header { background-color: #FFF9E6; color: #D48806; }
.pending-box .box-header h3 { color: #D48806; font-size: 1.1rem; margin: 0;}
.completed-box .box-header { background-color: #F6FFED; color: #389E0D; }
.completed-box .box-header h3 { color: #389E0D; font-size: 1.1rem; margin: 0;}

.badge {
    background: rgba(0,0,0,0.05);
    padding: 0.1rem 0.6rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.box-content {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.quick-add-small {
    display: flex;
    padding: 0.8rem 1rem;
    background: #FAFAFA;
    border-bottom: 1px solid var(--border-color);
}

.quick-add-small input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 0 6px 6px 0;
    padding: 0.5rem 0.8rem;
    font-family: inherit;
    outline: none;
}
.quick-add-small button {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px 0 0 6px;
    font-weight: 700;
    cursor: pointer;
}

/* Task Row Style (Matching Screenshot) */
.task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 0.8rem;
    background: #FAFAFA;
    transition: all 0.2s;
}

.task-row:hover { background: white; box-shadow: var(--shadow-sm); }

.task-row-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.task-checkbox-round {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    appearance: none;
    outline: none;
    cursor: pointer;
    position: relative;
}

.task-checkbox-round:checked {
    background: var(--success-color);
    border-color: var(--success-color);
}
.task-checkbox-round:checked::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
}

.task-row-info { display: flex; flex-direction: column; gap: 0.3rem; }
.task-row-title { font-weight: 700; font-size: 1rem; color: var(--text-main); }
.task-row.completed .task-row-title { text-decoration: line-through; color: var(--text-muted); }
.task-row-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 1rem; }

.task-row-delete {
    color: var(--danger-color);
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
}
.task-row-delete:hover { background: rgba(231, 76, 60, 0.1); }

/* Basic Tasks Section */
.basic-tasks-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.basic-tasks-section .box-header {
    background: #E6F7FF;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.basic-tasks-section .box-header h3 {
    color: #1890FF;
    font-size: 1.1rem;
    margin: 0;
    display: flex; align-items: center; gap: 0.5rem;
}

.basic-tasks-list {
    padding: 1rem;
}

.basic-task-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}
.basic-task-row:last-child { border-bottom: none; }
.basic-task-row:hover { background: #FAFAFA; }

.basic-task-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.basic-task-number {
    width: 28px; height: 28px;
    background: #E6F7FF;
    color: #1890FF;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.basic-task-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1rem;
}

.btn-add-basic {
    color: #1890FF;
    background: transparent;
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: background 0.2s;
}
.btn-add-basic:hover { background: #E6F7FF; }

/* Report Builder Styles */
.report-settings {
    background: var(--bg-main);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

/* نافذة التقارير — تمرير يعمل */
body.modal-open {
    overflow: hidden;
}

#reportBuilderModal .modal-content.report-modal {
    width: 94%;
    max-width: 900px;
    max-height: 92vh;
    height: 92vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#reportBuilderModal .modal-header {
    padding: 1rem 1.25rem;
    flex-shrink: 0;
}

#reportBuilderModal .modal-header h2 {
    font-size: 1.25rem;
}

#reportBuilderModal .modal-body {
    padding: 1rem 1.25rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#reportBuilderModal .report-settings-wrap,
#reportBuilderModal .report-settings,
#reportBuilderModal .report-quick-actions {
    flex-shrink: 0;
}

.btn-report-settings-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-main);
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    color: var(--primary-color);
    cursor: pointer;
    min-height: 44px;
}

.btn-report-fullpage {
    display: none;
}

/* عارض التقرير بملء الشاشة — جوال */
.report-mobile-viewer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: #e2e8f0;
    flex-direction: column;
}

.report-mobile-viewer.active {
    display: flex;
}

body.report-viewer-open {
    overflow: hidden;
}

.report-mobile-viewer-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: #0c4a6e;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.report-mobile-viewer-toolbar span {
    flex: 1;
}

.report-mobile-viewer-toolbar .btn-mob-print,
.report-mobile-viewer-toolbar .btn-mob-close {
    border: none;
    border-radius: 8px;
    min-height: 44px;
    min-width: 44px;
    padding: 8px 14px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    cursor: pointer;
}

.report-mobile-viewer-toolbar .btn-mob-print {
    background: #059669;
    color: #fff;
}

.report-mobile-viewer-toolbar .btn-mob-close {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.report-mobile-viewer-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 12px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.report-mobile-viewer-scroll .pdf-document {
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

#reportBuilderModal .report-modal-actions {
    flex-shrink: 0;
}

.report-preview-scroll {
    flex: 1 1 0%;
    min-height: 0;
    height: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #cbd5e1;
    overflow-y: auto !important;
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    isolation: isolate;
}

.report-preview-scroll .preview-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #e2e8f0;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.report-preview-scroll .preview-header h3 {
    margin: 0;
    font-size: 0.9rem;
}

.report-scroll-mobile-btns {
    display: none;
    gap: 6px;
    flex-shrink: 0;
}

.btn-scroll-hint {
    border: none;
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    min-height: 36px;
    touch-action: manipulation;
    white-space: nowrap;
}

.report-preview-scroll .pdf-document {
    margin: 12px auto;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ورقة PDF كاملة العرض — للتصدير والمعاينة */
.pdf-export-sheet,
.pdf-document.pdf-compact {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.pdf-letterhead {
    width: 100%;
    margin-bottom: 16px;
}

.pdf-letterhead-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #0c4a6e;
}

.pdf-head-side {
    background: #0c4a6e;
    color: white;
    text-align: center;
    font-weight: 800;
    font-size: 11px;
    padding: 12px 6px;
    vertical-align: middle;
}

.pdf-head-center {
    background: #f0f9ff;
    text-align: center;
    padding: 14px 12px;
    vertical-align: middle;
}

.pdf-org-name {
    font-size: 11px;
    color: #475569;
    font-weight: 600;
    margin-bottom: 4px;
}

.pdf-main-title {
    font-size: 20px;
    font-weight: 900;
    color: #0c4a6e;
    margin: 0 0 6px;
    line-height: 1.3;
    white-space: normal;
    word-wrap: break-word;
}

.pdf-dept-name {
    font-size: 13px;
    font-weight: 700;
    color: #075985;
}

.pdf-period-bar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    background: #0c4a6e;
    color: white;
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
    margin-top: -1px;
}

.pdf-archive-footer {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 2px solid #0c4a6e;
    font-size: 9px;
    color: #64748b;
    width: 100%;
}

.pdf-archive-footer table {
    width: 100%;
}

.report-quick-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    padding: 12px;
    background: var(--primary-light);
    border-radius: 10px;
}

.report-quick-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-color);
}

.report-date-range {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.report-date-range input {
    flex: 1;
    min-width: 120px;
}

.report-stats-text {
    padding: 10px 12px;
    background: var(--bg-main);
    border-radius: 8px;
    font-size: 0.9rem;
}

.report-modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-download-pdf {
    min-height: 48px;
    padding: 12px 24px !important;
    font-size: 1rem !important;
}

.btn-pdf-report {
    min-height: 48px;
    font-weight: 700;
}

/* Analytics View */
.analytics-header {
    text-align: center;
    margin-bottom: 2rem;
    margin-top: 1rem;
}
.analytics-header h2 {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}
.analytics-header p {
    font-size: 1.1rem;
    color: var(--text-muted);
}
.analytics-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}
.filter-controls {
    display: flex;
    gap: 2rem;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.filter-group label {
    font-weight: 700;
    color: var(--text-muted);
    margin: 0;
}
.filter-group select {
    padding: 0.6rem 2rem 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-weight: 700;
    color: var(--text-main);
    background: var(--bg-main);
    outline: none;
}
.analytics-top-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.analytics-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.analytics-card.primary { background: linear-gradient(135deg, #4A90E2, #2196F3); color: white; }
.analytics-card.success { background: linear-gradient(135deg, #2ECC71, #27AE60); color: white; }
.analytics-card.warning { background: linear-gradient(135deg, #FFE58F, #FFF1B8); color: #D48806; }
.analytics-card.danger { background: linear-gradient(135deg, #FFE0E0, #FFEDED); color: #E74C3C; }

.ac-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 1rem;
}
.ac-badge {
    background: rgba(255,255,255,0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
}
.warning .ac-badge { background: rgba(212, 136, 6, 0.1); }
.danger .ac-badge { background: rgba(231, 76, 60, 0.1); }

.ac-value {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}
.ac-title {
    font-size: 1.2rem;
    font-weight: 800;
}
.ac-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}
.ac-icon {
    position: absolute;
    bottom: -15px;
    left: -15px;
    font-size: 5rem;
    opacity: 0.1;
    transform: rotate(-15deg);
}

.analytics-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
.chart-card h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.pdf-document {
    background: #ffffff;
    padding: 1.5rem 1.75rem;
    min-height: auto;
    color: #0f172a;
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    direction: rtl;
    text-align: right;
    line-height: 1.5;
    font-size: 11px;
    width: 100%;
    box-sizing: border-box;
}

.pdf-compact { font-size: 11px; line-height: 1.45; }

.pdf-kpi-table {
    width: 100% !important;
    border-collapse: collapse;
    margin-top: 0;
    table-layout: fixed;
}

.pdf-kpi-table td {
    border: 1px solid #cbd5e1;
    padding: 12px 8px;
    text-align: center;
    background: #f8fafc;
    vertical-align: middle;
}

.pdf-kpi-table b { font-size: 18px; color: #0c4a6e; display: block; margin-bottom: 2px; }
.pdf-kpi-table small { font-size: 10px; color: #64748b; display: block; }
.pdf-kpi-table .kpi-done { background: #ecfdf5; }
.pdf-kpi-table .kpi-done b { color: #059669; }
.pdf-kpi-table .kpi-pending { background: #fffbeb; }
.pdf-kpi-table .kpi-pending b { color: #d97706; }

.pdf-block { margin-bottom: 14px; page-break-inside: avoid; }

.pdf-block-title {
    font-size: 13px;
    font-weight: 800;
    color: white;
    background: #075985;
    padding: 8px 14px;
    margin: 0 0 0;
    border-radius: 0;
    width: 100%;
    box-sizing: border-box;
}

.pdf-block-sub { font-size: 10px; font-weight: 600; color: #64748b; }

.pdf-data-table {
    width: 100% !important;
    border-collapse: collapse;
    font-size: 10px;
    table-layout: fixed;
}

.pdf-data-table th {
    background: #0c4a6e;
    color: white;
    padding: 8px 10px;
    text-align: right;
    font-weight: 700;
    font-size: 10px;
}

.pdf-data-table td {
    border: 1px solid #e2e8f0;
    padding: 7px 10px;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.pdf-data-table tr:nth-child(even) { background: #f8fafc; }
.pdf-data-table .row-done td { color: #065f46; }
.pdf-data-table .row-pending td { color: #92400e; }
.pdf-data-table .col-task { word-break: break-word; }
.pdf-data-table .col-note { font-size: 9px; color: #64748b; }

.pdf-summary-employees { margin-bottom: 16px; }

.pdf-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 700;
}

.pdf-badge.excellent { background: #d1fae5; color: #065f46; }
.pdf-badge.improvement { background: #fef3c7; color: #92400e; }
.pdf-badge.followup { background: #fee2e2; color: #991b1b; }

.pdf-emp-block { page-break-inside: auto; }

.pdf-footer-line {
    text-align: center;
    font-size: 8px;
    color: #94a3b8;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
}

.pdf-empty-msg {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
}

.pdf-mini-label { font-size: 10px; font-weight: 700; margin: 8px 0 4px; color: #d97706; }

.pdf-header {
    text-align: center;
    border-bottom: 3px solid #0c4a6e;
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
}

.pdf-logo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 1rem;
}

.pdf-logo-row i {
    font-size: 2.5rem;
    color: #0c4a6e;
}

.pdf-header h2 {
    color: #0c4a6e;
    margin: 0 0 4px;
    font-weight: 900;
    font-size: 1.5rem;
}

.pdf-subtitle { font-weight: 700; color: #334155; margin: 0; font-size: 1rem; }
.pdf-university { color: #64748b; margin: 4px 0 0; font-size: 0.9rem; }

.pdf-meta-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 1rem;
}

.pdf-summary-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 1rem;
}

.pdf-summary-item {
    background: #f1f5f9;
    padding: 10px 18px;
    border-radius: 10px;
    text-align: center;
    min-width: 90px;
}

.pdf-summary-item strong {
    display: block;
    font-size: 1.4rem;
    color: #0c4a6e;
}

.pdf-summary-item span { font-size: 0.75rem; color: #64748b; }
.pdf-summary-item.done { background: #ecfdf5; }
.pdf-summary-item.done strong { color: #059669; }
.pdf-summary-item.pending { background: #fffbeb; }
.pdf-summary-item.pending strong { color: #d97706; }

.pdf-section {
    margin-bottom: 2rem;
    page-break-inside: avoid;
}

.pdf-section-title {
    background: linear-gradient(135deg, #0c4a6e, #075985);
    color: white;
    padding: 12px 16px;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.pdf-emp-name { font-weight: 800; font-size: 1.1rem; }
.pdf-emp-title { font-size: 0.85rem; opacity: 0.9; }

.pdf-emp-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-top: none;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.pdf-task-group { margin-bottom: 1rem; }

.pdf-group-title {
    font-size: 0.95rem;
    font-weight: 800;
    padding: 8px 12px;
    margin: 0 0 8px;
    border-radius: 6px;
}

.pdf-group-title.done-title { background: #ecfdf5; color: #059669; }
.pdf-group-title.pending-title { background: #fffbeb; color: #d97706; }

.pdf-task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pdf-task-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fafafa;
    font-size: 0.95rem;
}

.pdf-task-item::before { display: none; }

.pdf-task-check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.85rem;
}

.pdf-task-done .pdf-task-check { background: #d1fae5; color: #059669; }
.pdf-task-pending .pdf-task-check { background: #fef3c7; color: #d97706; }

.pdf-task-body { flex: 1; }
.pdf-task-body strong { display: block; margin-bottom: 4px; color: #0f172a; }
.pdf-evidence { display: block; font-size: 0.85rem; color: #475569; margin-top: 4px; }
.pdf-task-meta { display: block; font-size: 0.78rem; color: #94a3b8; margin-top: 6px; }

.pdf-empty {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
}

.pdf-empty i { font-size: 2.5rem; margin-bottom: 1rem; display: block; }

.pdf-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px dashed #cbd5e1;
    font-size: 0.8rem;
    color: #94a3b8;
}

.pdf-custom-text {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #fffbeb;
    border: 2px dashed #f59e0b;
    border-radius: 8px;
    font-weight: 500;
    min-height: 60px;
}

.page-break-inside-avoid {
    page-break-inside: avoid;
}

@media (max-width: 768px) {
    /* Header adjustments */
    .app-header {
        padding: 0.8rem 1rem;
    }
    .logo-text h1 {
        font-size: 1.1rem;
    }
    .logo-text p {
        font-size: 0.7rem;
    }
    .header-nav .nav-btn span { 
        display: none; 
    }
    .header-nav .nav-btn {
        padding: 0.5rem;
        font-size: 1.2rem; /* Larger icon for touch */
    }
    .header-date {
        display: none; /* Hide date on very small screens to save space */
    }

    /* Container adjustments */
    .app-container {
        padding: 1rem;
    }

    /* Home Hero */
    .hero-title {
        font-size: 1.8rem !important;
    }
    .hero-subtitle {
        font-size: 1rem;
    }

    /* Admin actions */
    .admin-actions-bar {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem;
    }
    .stats-overview {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        font-size: 1rem;
    }
    .actions-buttons {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.8rem;
    }
    .actions-buttons .btn {
        width: 100%;
    }

    /* Grid & Lists */
    .employees-grid { 
        grid-template-columns: 1fr; 
    }
    .tasks-container-new { 
        grid-template-columns: 1fr; 
    }
    
    .analytics-filters {
        flex-direction: column;
        gap: 1.5rem;
    }
    .filter-controls {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
    }
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    .analytics-charts-row {
        grid-template-columns: 1fr;
    }

    /* Employee Banner */
    .emp-banner {
        padding: 1.5rem 1rem;
    }
    .emp-banner-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    .emp-banner-center {
        margin-top: 1rem;
        text-align: center;
    }
    .emp-banner-center h2 {
        font-size: 1.8rem;
    }
    .btn-back-banner {
        position: relative;
        top: 0;
        right: auto;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
    
    /* Employee Controls */
    .emp-controls { 
        flex-direction: column; 
        gap: 1rem; 
        align-items: stretch; 
        padding: 1rem;
    }
    .emp-controls .btn,
    .btn-add-main {
        width: 100%;
        min-height: 52px;
        font-size: 1.05rem !important;
        padding: 1rem !important;
    }
    .filter-group-dropdown { 
        justify-content: space-between; 
        width: 100%;
    }
    .filter-group-dropdown select {
        flex: 1;
        margin-right: 1rem;
    }

    /* Modals & Forms */
    .modal-content {
        padding: 0;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    /* Quick Add */
    .quick-add-small {
        flex-direction: column;
        gap: 0.5rem;
    }
    .quick-add-small input {
        border-radius: 6px;
    }
    .quick-add-small button {
        border-radius: 6px;
        width: 100%;
    }

    /* Task Rows */
    .task-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .task-row-right {
        align-items: flex-start;
    }
    .task-row-delete {
        align-self: flex-end;
    }
    
    .basic-task-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .btn-add-basic {
        align-self: flex-end;
    }

    .pdf-document {
        padding: 1rem;
        min-height: auto;
    }
}

/* Native Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #pdfPrintArea, #pdfPrintArea * {
        visibility: visible;
    }
    #pdfPrintArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none !important;
    }
    .modal, .modal-content, .modal-body {
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    .pdf-document {
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }
    .pdf-custom-text {
        border: none !important;
        background: transparent !important;
    }
    .modal-actions, .close-modal, .report-settings, .preview-header {
        display: none !important;
    }
}

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

.toast {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    border-right: 4px solid var(--success-color);
    animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-error {
    border-right-color: var(--danger-color);
}

.toast.fade-out {
    opacity: 0;
    transform: translateX(20px);
}

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

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent;
    border: none;
    color: #A0B2C6;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

@media (min-width: 769px) {
    .mobile-top-bar {
        display: none;
    }
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-around;
        padding: 0.5rem;
        z-index: 1000;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    
    .sidebar-header, .sidebar-footer {
        display: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        width: 100%;
        gap: 0;
    }
    
    .sidebar-nav .nav-btn {
        flex-direction: column;
        padding: 0.5rem;
        font-size: 0.75rem;
        text-align: center;
        gap: 5px;
    }
    
    .sidebar-nav .nav-btn i {
        font-size: 1.2rem;
    }
    
    .main-content {
        padding-bottom: 70px; /* Space for bottom nav */
    }
    
    .app-container {
        padding: 1rem;
    }
    
    .employees-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-overview {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .admin-actions-bar {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Analytics Detailed Table (Image Style) */
.analytics-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.analytics-card-main {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.analytics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5rem;
}

.header-info h2 {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.header-info p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.period-tabs {
    background: #f1f5f9;
    padding: 5px;
    border-radius: 12px;
    display: flex;
    gap: 5px;
}

.tab-btn {
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(19, 168, 158, 0.3);
}

.table-wrapper {
    overflow-x: auto;
}

.performance-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: 1rem;
}

.performance-table th {
    padding: 1.2rem 1rem;
    text-align: right;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.performance-table td {
    padding: 1.2rem 1rem;
    background: var(--bg-card);
    vertical-align: middle;
}

.performance-table tr td:first-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-right: 1px solid var(--border-color);
}

.performance-table tr td:last-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-left: 1px solid var(--border-color);
}

.performance-table tr {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.performance-table tbody tr:hover td {
    background-color: var(--primary-light);
}

.performance-table td {
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.emp-info-cell {
    display: flex;
    flex-direction: column;
}

.emp-name-bold {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.emp-subtitle-sm {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.reports-count-badge {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.perc-result-bold {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-color);
    text-align: center;
}

.btn-add-tasks-sm {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    margin: 0 auto;
}

.btn-add-tasks-sm:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.analytics-footer-actions {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

/* --- Evidence & Performance Enhancements --- */
.performance-breakdown-mini {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin-left: 2rem;
    font-size: 0.9rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
}

.breakdown-item .value {
    font-weight: 700;
}

.evidence-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.evidence-badge.status-good {
    background: var(--success-bg);
    color: var(--success-color);
}

.evidence-badge.status-warning {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.evidence-controls {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.evidence-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.evidence-text-input {
    flex-grow: 1;
    font-size: 0.85rem;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #f9fafb;
    color: var(--text-main);
    transition: all 0.2s;
}

.evidence-text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.evidence-file-label {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.evidence-file-label:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.evidence-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

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

.trend-up {
    color: var(--success-color);
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 2px;
}

.trend-down {
    color: var(--danger-color);
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 2px;
}

/* Base refinement overrides */
.emp-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease !important;
}

.emp-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: var(--shadow-hover) !important;
}

.task-row {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 16px;
    transition: all 0.2s;
}

.task-row:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.task-row.completed {
    border-color: var(--success-color);
    background: #fdfdfd;
}

.eval-label {
    font-size: 0.85rem;
    padding: 2px 12px;
    border-radius: 20px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 5px;
}

.eval-label.excellent {
    background: var(--success-bg);
    color: var(--success-color);
}

.eval-label.improvement {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.eval-label.followup {
    background: var(--danger-bg);
    color: var(--danger-color);
}

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

.btn-outline-danger {
    background: transparent;
    border: 1.5px solid var(--danger-color);
    color: var(--danger-color);
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.reset-group {
    background: #fff5f5;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid #feb2b2;
    display: flex;
    gap: 5px;
}


/* Premium Academic Theme Extensions */

.summary-card.daily { border-right-color: var(--color-emp-1); }
.summary-card.weekly { border-right-color: var(--color-emp-2); }
.summary-card.monthly { border-right-color: var(--color-emp-4); }
.summary-card.total { border-right-color: var(--accent-color); }

.summary-card.daily .summary-icon { background: var(--primary-light); color: var(--color-emp-1); }
.summary-card.weekly .summary-icon { background: #f5f3ff; color: var(--color-emp-2); }
.summary-card.monthly .summary-icon { background: #ecfdf5; color: var(--color-emp-4); }
.summary-card.total .summary-icon { background: #fffbeb; color: var(--accent-color); }

/* Layout Stability */
.app-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.section-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.3rem;
}

/* Polished Employee Profile Banner */
.home-hero {
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.emp-banner::after {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.2), transparent);
}

.emp-banner-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.emp-banner-center h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.emp-banner-center span {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 600;
}

/* Dashboard Summary Horizontal Layout */
.dashboard-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-right: 5px solid var(--primary-color);
    transition: all 0.3s ease;
}

.summary-card.daily { border-right-color: #00D2FF; }
.summary-card.weekly { border-right-color: #9D50BB; }
.summary-card.monthly { border-right-color: #61FF70; }
.summary-card.total { border-right-color: #FFB75E; }

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    filter: brightness(1.05);
}

.summary-info .label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.summary-info h3 {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-main);
    margin: 0;
}

.summary-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Visibility Control */
body:not(.can-edit) .emp-controls .btn-primary,
body:not(.can-edit) .quick-add-small,
body:not(.can-edit) .task-row-delete,
body:not(.can-edit) .reset-group,
body:not(.can-edit) .btn-danger,
body:not(.can-edit) .btn-add-task-floating {
    display: none !important;
}

body.can-edit .btn-add-task-floating {
    display: flex !important;
}

body.can-edit .emp-controls .btn-primary {
    display: inline-flex !important;
}

/* Rest of file... */
.circular-progress {
    width: 100px;
    height: 100px;
    position: relative;
}

.circle-bg {
    fill: none;
    stroke: rgba(255,255,255,0.2);
    stroke-width: 2.8;
}

.circle {
    fill: none;
    stroke: white;
    stroke-width: 2.8;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s ease;
}

.percentage {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.perc-val { font-size: 1.4rem; font-weight: 800; }
.perc-label { font-size: 0.7rem; font-weight: 700; opacity: 0.8; }
/* History Modal Styles */
.history-item {
    transition: background-color 0.2s ease;
}

.history-item:hover {
    background-color: var(--primary-light) !important;
}

body.dark-mode .history-item:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.btn-history:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-2px);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--primary-color);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Tooltip style for performance scores */
.eval-label {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.eval-label.excellent { background: var(--success-bg); color: var(--success-color); }
.eval-label.improvement { background: var(--warning-bg); color: var(--warning-color); }
.eval-label.followup { background: var(--danger-bg); color: var(--danger-color); }

/* Animation for numbers */
@keyframes countUp {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.perc-val {
    animation: countUp 0.5s ease-out;
}

/* ========== بوابة الدخول ========== */
.login-gate {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--header-gradient);
    padding: 1.5rem;
}

.login-gate-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    animation: loginFadeIn 0.4s ease-out;
}

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

.login-gate-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-gate-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.login-gate-brand h1 {
    font-size: 1.15rem;
    color: var(--primary-color);
    font-weight: 800;
    margin-bottom: 0.35rem;
    font-family: 'Tajawal', sans-serif;
}

.login-file-warning {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.5;
    margin-bottom: 14px;
    text-align: right;
}

.login-file-warning i {
    margin-left: 6px;
}

.login-password-step {
    margin-top: 4px;
}

.login-gate-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
    background: var(--bg-main);
    padding: 6px;
    border-radius: 12px;
}

.login-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-fast);
    font-family: 'Tajawal', sans-serif;
}

.login-tab.active {
    background: var(--bg-card);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.login-panel .form-group {
    margin-bottom: 1rem;
}

.login-panel label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-main);
}

.login-select,
.login-panel input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-main);
}

.login-submit-btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 14px !important;
    font-size: 1.05rem !important;
}

.login-hint {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1rem;
    line-height: 1.5;
}

.sidebar-user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    margin: 0 12px 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
    font-weight: 700;
}

.sidebar-user-badge i {
    font-size: 1.2rem;
    opacity: 0.85;
}

.view-only-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(255,255,255,0.25);
    padding: 2px 8px;
    border-radius: 20px;
    vertical-align: middle;
    margin-right: 6px;
}

body:not(.can-edit) .basic-task-row,
body:not(.can-edit) .task-row input,
body:not(.can-edit) .task-row textarea,
body:not(.can-edit) .task-row .btn-icon {
    pointer-events: none;
    opacity: 0.85;
}

body:not(.can-edit) .btn-quick-add-task {
    display: none !important;
}

/* تقارير PDF وجداول الإدارة — مخفية عن الموظفين */
body.role-employee .admin-only,
body.role-employee #btnHomePdf,
body.role-employee #btnEmpPdfReport,
body.role-employee .btn-pdf-admin-only,
body.role-employee .btn-pdf-report,
body.role-employee #reportBuilderModal,
body.role-employee #reportMobileViewer {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

body.role-employee #dashboardSummary,
body.role-employee #adminHomeActions {
    display: none !important;
}

body.role-employee .integrated-report {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    max-height: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    overflow: visible !important;
}

.employee-quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 1rem;
}

.employee-quick-stats .eq-stat {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
}

.employee-quick-stats .eq-stat b {
    display: block;
    font-size: 1.5rem;
    color: var(--primary-color);
    line-height: 1.2;
}

.employee-quick-stats .eq-stat small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.emp-card.is-loading .emp-progress-row span {
    color: transparent;
    background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1s infinite;
    border-radius: 4px;
    min-width: 40px;
    min-height: 1.2em;
    display: inline-block;
}

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

#appLayout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

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

.password-field-wrap input {
    width: 100%;
    padding-left: 44px !important;
}

.pwd-toggle-btn {
    position: absolute;
    left: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 1rem;
}

.pwd-toggle-btn:hover {
    color: var(--primary-color);
}

.view-only-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--warning-bg);
    color: var(--warning-color);
    font-weight: 700;
    font-size: 0.95rem;
    border-bottom: 2px solid var(--warning-color);
}

.own-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(255,255,255,0.35);
    padding: 2px 8px;
    border-radius: 20px;
    vertical-align: middle;
    margin-right: 6px;
}

.view-only-mode .emp-controls,
.view-only-mode .btn-add-task-floating,
.view-only-mode .quick-add-small {
    display: none !important;
}

.read-only-task,
.read-only-row {
    opacity: 0.95;
    cursor: default !important;
}

.task-readonly-evidence {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* زر الدخول معطّل حتى إدخال كلمة المرور */
.login-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.login-password-group {
    margin-top: 1.25rem;
}

.login-select,
.login-panel input[type="password"],
.quick-add-small input,
.evidence-text-input,
.form-group input,
.form-group select,
.form-group textarea {
    font-size: 16px !important; /* منع تكبير iOS تلقائياً */
    min-height: 48px;
}

.mobile-user-name {
    display: block;
    font-size: 0.75rem;
    opacity: 0.85;
    font-weight: 600;
}

.mobile-task-bar {
    position: fixed;
    bottom: 72px;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.mobile-bar-btn {
    flex: 1;
    min-height: 48px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-main);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Tajawal', sans-serif;
    color: var(--text-main);
}

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

/* ========== تحسينات الجوال الشاملة ========== */
@media (max-width: 768px) {
    body {
        -webkit-text-size-adjust: 100%;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }

    .login-gate {
        padding: 1rem;
        align-items: flex-start;
        padding-top: max(1.5rem, env(safe-area-inset-top));
    }

    .login-gate-card {
        max-width: 100%;
        padding: 1.5rem 1.25rem;
        margin-top: 0.5rem;
    }

    .login-gate-brand h1 {
        font-size: 1rem;
    }

    .login-tab {
        min-height: 44px;
        font-size: 0.85rem;
    }

    .login-submit-btn {
        min-height: 52px;
        margin-top: 1.5rem !important;
    }

    .login-select {
        margin-bottom: 0.5rem;
    }

    .header-banner {
        padding: 1.25rem 1rem !important;
    }

    .banner-title {
        font-size: 1.35rem !important;
    }

    .banner-subtitle {
        font-size: 0.9rem !important;
        line-height: 1.5;
    }

    .home-date-filter {
        flex-direction: column !important;
        width: 100% !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    .home-date-filter input {
        width: 100%;
    }

    .dashboard-summary {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

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

    .summary-card h3 {
        font-size: 1.4rem !important;
    }

    .emp-card {
        min-height: auto;
    }

    .emp-card-top {
        padding: 14px !important;
    }

    .emp-card h3 {
        font-size: 1rem !important;
    }

    .integrated-report .section-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }

    .report-filters {
        flex-direction: column !important;
        width: 100%;
    }

    .report-filters input,
    .report-filters select {
        width: 100% !important;
        min-height: 44px;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .performance-table {
        min-width: 520px;
        font-size: 0.85rem;
    }

    .performance-table th,
    .performance-table td {
        padding: 10px 8px;
    }

    .main-content {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    body.on-employee-view .main-content {
        padding-bottom: calc(145px + env(safe-area-inset-bottom));
    }

    .emp-banner-left {
        flex-direction: column;
        width: 100%;
    }

    .btn-add-task-floating {
        width: 100%;
        justify-content: center;
        margin: 0 !important;
    }

    .circular-progress {
        width: 80px;
        height: 80px;
        margin: 0 auto;
    }

    .tasks-box {
        margin-bottom: 1rem;
    }

    .box-header h3 {
        font-size: 1rem;
    }

    .quick-add-small input {
        min-height: 48px;
        font-size: 16px !important;
    }

    .quick-add-small button {
        min-height: 48px;
        font-size: 1rem;
    }

    .task-checkbox-round,
    .nav-btn,
    .emp-card,
    .btn,
    .login-tab {
        min-height: 44px;
        min-width: 44px;
    }

    .basic-task-row {
        padding: 14px 12px !important;
    }

    .basic-task-title {
        font-size: 0.95rem !important;
        line-height: 1.4;
    }

    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92vh;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
    }

    .modal-body {
        max-height: 70vh;
        overflow-y: auto;
    }

    .sidebar.open {
        flex-direction: column;
        max-height: 85vh;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .sidebar.open .sidebar-header,
    .sidebar.open .sidebar-footer,
    .sidebar.open .sidebar-user-badge {
        display: flex !important;
    }

    .sidebar.open .sidebar-nav {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .sidebar.open .sidebar-nav .nav-btn {
        flex-direction: row;
        justify-content: flex-start;
        width: 100%;
        padding: 12px 16px;
        min-height: 48px;
    }

    .sidebar-nav .nav-btn span {
        font-size: 0.7rem;
    }

    .toast-container {
        bottom: calc(90px + env(safe-area-inset-bottom));
        left: 10px;
        right: 10px;
    }

    .section-header p {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    #reportBuilderModal .modal-content.report-modal {
        width: 100%;
        max-height: 100dvh;
        height: 100dvh;
        border-radius: 0;
    }

    .btn-report-settings-toggle {
        display: flex !important;
        width: 100%;
        margin-bottom: 8px;
        min-height: 44px;
    }

    body.report-mobile-mode #reportBuilderModal .modal-body {
        overflow: hidden !important;
    }

    body.report-mobile-mode .report-settings-wrap.collapsed {
        display: none;
    }

    body.report-mobile-mode .report-preview-scroll {
        flex: 1 1 0%;
        min-height: 0;
        height: 0;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    body.report-mobile-mode .report-preview-scroll .preview-header {
        position: sticky;
        top: 0;
    }

    .btn-report-fullpage {
        display: inline-flex !important;
    }

    .report-scroll-mobile-btns {
        display: flex !important;
    }

    .report-scroll-desktop-hint {
        display: none !important;
    }

    .report-quick-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .report-quick-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    .report-modal-actions {
        flex-direction: column;
    }

    .report-actions-right,
    .report-actions-left {
        width: 100%;
        flex-direction: column;
    }

    .report-actions-right .btn,
    .btn-download-pdf {
        width: 100%;
    }

    .pdf-document {
        padding: 1.25rem 1rem;
    }

    .pdf-summary-bar {
        flex-direction: column;
    }

    .pdf-summary-item {
        width: 100%;
    }
}

@media (max-width: 380px) {
    .dashboard-summary {
        grid-template-columns: 1fr !important;
    }
}
