:root {
    /* Color Palette - Custom Brand */
    --bg-body: rgb(168, 169, 155);
    --bg-card: rgb(221, 218, 211);
    --text-primary: #000000;
    --text-secondary: rgba(0, 0, 0, 0.6);
    --border-color: rgba(0, 0, 0, 0.1);

    --primary: rgb(221, 218, 211);
    --primary-hover: #D0CFC5;
    --success: #34C759;
    --warning: #FF9F0A;
    --danger: #FF3B30;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
    --header-h: 64px;
    --glass-bg: rgba(245, 244, 242, 0.85);
    --glass-border: rgba(221, 218, 211, 0.5);
}

[data-theme="dark"] {
    /* Color Palette - Softer Dark */
    --bg-body: #121212;
    --bg-card: #1C1C1E;
    --text-primary: #F2F2F7;
    --text-secondary: #98989D;
    --border-color: #2C2C2E;
    --primary: #0A84FF;
    --glass-bg: rgba(28, 28, 30, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
}

[data-theme="space"] {
    /* Color Palette - Deep Space (Registration Theme) */
    --bg-body: #0f0f23;
    --bg-card: rgba(255, 255, 255, 0.05);
    /* Glass effect base */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary: #6366f1;
    /* Indigo */
    --primary-hover: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

[data-theme="midnight"] {
    /* Color Palette - Cyberpunk/Midnight */
    --bg-body: #09090b;
    /* Zinc 950 */
    --bg-card: #18181b;
    /* Zinc 900 */
    --text-primary: #f4f4f5;
    /* Zinc 100 */
    --text-secondary: #a1a1aa;
    /* Zinc 400 */
    --border-color: #27272a;
    /* Zinc 800 */
    --primary: #d946ef;
    /* Fuchsia 500 */
    --primary-hover: #c026d3;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
}

[data-theme="ocean"] {
    /* Color Palette - Deep Ocean (Replaces Forest) */
    --bg-body: #0b1120;
    /* Slate 950 */
    --bg-card: #1e293b;
    /* Slate 800 */
    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --border-color: #334155;
    /* Slate 700 */
    --primary: #38bdf8;
    /* Sky 400 */
    --primary-hover: #0ea5e9;
    --success: #22c55e;
    --warning: #fbbf24;
    --danger: #ef4444;
}

[data-theme="sunset"] {
    /* Color Palette - Sunset/Retrowave */
    --bg-body: #1e1b4b;
    /* Indigo 950 */
    --bg-card: #312e81;
    /* Indigo 900 */
    --text-primary: #e0e7ff;
    /* Indigo 100 */
    --text-secondary: #a5b4fc;
    /* Indigo 300 */
    --border-color: #4338ca;
    /* Indigo 700 */
    --primary: #f472b6;
    /* Pink 400 */
    --primary-hover: #ec4899;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
}

[data-theme="royal"] {
    /* Color Palette - Royal Luxury */
    --bg-body: #000000;
    /* Pure Black */
    --bg-card: #1c1917;
    /* Stone 900 */
    --text-primary: #fafaf9;
    /* Stone 50 */
    --text-secondary: #a8a29e;
    /* Stone 400 */
    --border-color: #44403c;
    /* Stone 700 */
    --primary: #fbbf24;
    /* Amber 400 (Gold) */
    --primary-hover: #f59e0b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* Space Theme Specific Overrides */
[data-theme="space"] body {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%) fixed;
}

[data-theme="space"] .header {
    background: rgba(15, 15, 35, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="space"] .project-card,
[data-theme="space"] .profile-card,
[data-theme="space"] .task-card-emp,
[data-theme="space"] .modal,
[data-theme="space"] .mobile-menu {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Theme Dropdown */
.theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1100;
    min-width: 160px;
    backdrop-filter: blur(10px);
}

.theme-dropdown.active {
    display: flex;
}

.theme-option {
    padding: 10px 12px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.theme-option:hover {
    background: var(--bg-body);
}

.theme-option.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 10;
}

.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-h);
}

@supports (backdrop-filter: blur(20px)) {
    .header {
        background: transparent;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
}

[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .header {
    background: rgba(28, 28, 30, 0.85);
}


.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.logo img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

/* Snow Canvas */
#snowCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

#snowCanvas.active {
    opacity: 1;
    pointer-events: none;
}

/* Main Controls */
.main-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 24px 0;
}

.search-wrapper {
    position: relative;
    width: auto;
}

.search-input {
    width: 260px;
    height: 40px;
    padding: 12px;
    padding-left: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    /* Initial border */
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--primary);
    outline: none;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    display: flex;
}

/* Main Tabs */
.main-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 14px;
    width: fit-content;
    border: 1px solid var(--border-color);
    margin: 0;
}

.main-tab-btn {
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
}

.main-tab-btn:hover {
    color: var(--text-primary);
}

.main-tab-btn.active {
    background: var(--bg-body);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* Card */
.project-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.project-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.status-badge.ok {
    color: var(--success);
    background: rgba(52, 199, 89, 0.15);
}

.status-badge.warning {
    color: var(--warning);
    background: rgba(255, 159, 10, 0.15);
}

.status-badge.danger {
    color: var(--danger);
    background: rgba(255, 59, 48, 0.15);
}

.status-badge.completed {
    color: var(--text-secondary);
    background: rgba(128, 128, 128, 0.15);
}

/* Card Actions */
.card-complete-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    flex-shrink: 0;
}

.card-complete-btn:hover {
    border-color: var(--success);
    color: var(--success);
    background: rgba(52, 199, 89, 0.1);
    transform: scale(1.1);
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
    min-height: 40px;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.btn-secondary {
    background: rgba(128, 128, 128, 0.08);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(128, 128, 128, 0.15);
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Hamburger Menu Icon */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
    margin-right: 12px;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.hamburger.active span:first-child {
    transform: rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    z-index: 1060;
    transition: left 0.3s ease;
    padding: calc(var(--header-h) + 20px) 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    /* Enable scrolling */
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu .nav-link {
    margin: 0;
    font-size: 1.1rem;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu .nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--bg-body);
    color: var(--text-primary);
    transform: scale(1.05);
}

.icon-btn.active {
    background: var(--bg-card);
    box-shadow: 0 0 12px rgba(0, 122, 255, 0.4);
    animation: pulse 2s infinite;
    color: var(--primary);
    border-color: var(--primary);
}

[data-theme="dark"] .icon-btn.active {
    color: #FFF;
    border-color: #FFF;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.refresh-btn svg {
    transition: transform 0.5s ease;
}

.refresh-btn.spinning svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.add-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: auto;
    padding: 0 20px;
    border-radius: 20px;
    font-weight: 600;
    height: 40px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.2);
    white-space: nowrap;
}

.add-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}


/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-card);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    height: auto;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-tabs {
    display: flex;
    padding: 0 20px;
    gap: 24px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 16px 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
}

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.chart-container {
    background: var(--bg-body);
    padding: 24px;
    border-radius: var(--radius-md);
    min-height: 450px;
    height: auto;
    display: flex;
    flex-direction: column;
}



.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Modal Animation */
.modal-overlay.active .modal {
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* Admin Item */
.admin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-body);
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.data-table th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-color);
    font-variant-numeric: tabular-nums;
}

/* === MOBILE OPTIMIZATION === */
@media (max-width: 768px) {
    .container {
        padding: 12px 16px;
    }

    /* Header */
    .header-content {
        padding: 12px 16px;
    }

    .logo-text {
        display: none;
    }

    /* Hide logo text */
    .header-actions {
        gap: 6px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .add-btn {
        height: 36px;
        padding: 0 12px;
        font-size: 0.85rem;
    }

    .hamburger {
        display: flex;
    }

    .header-actions .add-btn {
        display: none;
        /* Hide +Task button in header on small mobile if needed, or keep it */
    }

    /* Small screens tweak */
    @media (max-width: 480px) {
        .header-actions .add-btn {
            display: none;
        }
    }

    /* Main Controls */
    .main-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin: 16px 0;
    }

    .main-tabs {
        width: 100%;
        justify-content: center;
    }

    .main-tab-btn {
        flex: 1;
        text-align: center;
    }

    .search-wrapper {
        width: 100%;
    }

    .search-input {
        width: 100%;
    }

    /* Grid */
    .projects-grid {
        grid-template-columns: 1fr;
        /* Single column */
        gap: 16px;
    }

    .project-card {
        padding: 16px;
    }

    .project-card h3 {
        font-size: 1.1rem;
    }

    /* Modal: Full Screen */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    .modal-header {
        padding: 16px;
        background: var(--bg-card);
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .modal-tabs {
        padding: 0 16px;
        gap: 16px;
    }

    .tab-btn {
        padding: 12px 0;
        font-size: 0.95rem;
    }

    .modal-content {
        padding: 16px;
        padding-bottom: 80px;
    }

    /* Charts */
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-container {
        min-height: 350px;
        padding: 16px;
    }

    .chart-container canvas {
        max-height: 300px;
    }

    /* Tables */
    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .data-table th,
    .data-table td {
        font-size: 0.85rem;
        padding: 10px 8px;
    }

    /* Profile Modal */
    #profileModal .modal {
        height: auto;
        max-height: 80vh;
        border-radius: 18px 18px 0 0;
    }
}

@media (max-width: 360px) {
    .header-actions {
        gap: 4px;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .logo img {
        width: 28px;
        height: 28px;
    }

    .tab-btn {
        font-size: 0.9rem;
    }
}

/* Admin Navigation (Shared) */
.admin-nav,
.tabs-nav {
    display: flex;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-right: auto;
    /* Push to left if in flex container */
    margin-left: 24px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-body);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

@media (max-width: 768px) {

    .admin-nav,
    .tabs-nav {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
        margin-left: 0;
        scrollbar-width: none;
    }

    .admin-nav::-webkit-scrollbar,
    .tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        flex-shrink: 0;
    }

    .tabs-nav {
        display: none !important;
        /* Hide the original scrollable nav by default on mobile */
    }
}

/* Criteria Cards (Grid) */
.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.criteria-card {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}

.criteria-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.criteria-card .score {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.criteria-card .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* === EMPLOYEE DASHBOARD STYLES === */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.app-nav {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.nav-item {
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-body);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
}

.kpi-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    min-height: 350px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Tasks */
.task-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.task-card-emp {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.task-card-emp:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

.task-card-emp.priority-high {
    border-left: 4px solid var(--danger);
}

.task-card-emp.priority-medium {
    border-left: 4px solid var(--warning);
}

.task-card-emp.priority-low {
    border-left: 4px solid var(--primary);
}

.task-status-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

/* Task Filters */
.task-filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9rem;
    white-space: nowrap;
}

.task-filter-btn:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.task-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.2);
}

/* Task Filter Buttons */
.task-filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.task-filter-btn:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.task-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Task Cards */
.task-card {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid var(--border-color);
    transition: transform 0.2s;
}

.task-card:hover {
    transform: translateX(4px);
    border-color: var(--primary);
}

.task-card.status-pending {
    border-left-color: var(--primary);
}

.task-card.status-done {
    border-left-color: var(--success);
}

.task-card.status-late {
    border-left-color: var(--warning);
}

.task-card.status-failed {
    border-left-color: var(--danger);
}

.task-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.task-status-badge.pending {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.task-status-badge.done {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.task-status-badge.late {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.task-status-badge.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    :root {
        --header-h: 64px;
    }

    .container {
        padding: 12px;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px;
    }

    .mobile-hidden {
        display: none !important;
    }

    .hamburger {
        display: flex;
    }

    /* Modals */
    .modal {
        width: 95%;
        margin: 10px;
        max-height: 90vh;
        border-radius: 16px;
    }

    .modal-content {
        padding: 16px;
    }

    .modal-header {
        padding: 16px;
    }

    /* Grids */
    .employees-grid {
        grid-template-columns: 1fr;
        /* Full width cards on mobile */
        gap: 16px;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    /* Buttons in cards */
    .action-btn-row {
        grid-template-columns: 1fr;
        /* Stack buttons vertically */
    }

    /* Make tables scrollable */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Adjust charts height */
    .chart-container {
        padding: 12px;
    }

    canvas {
        max-height: 250px;
    }

    /* Rating Inputs */
    .rating-group {
        flex-wrap: wrap;
    }

    .rating-group label {
        flex: 1 0 18%;
        /* 5 items row -> wrap if small */
        padding: 8px;
    }
}

/* Employee Task Accordion Styles */
.project-accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    background: var(--bg-card);
}

.project-accordion-header {
    padding: 12px 16px;
    background: var(--bg-body);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.project-accordion-header:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .project-accordion-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.project-accordion-header.active {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.accordion-arrow {
    transition: transform 0.2s ease;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    font-size: 0.8rem;
}

.project-accordion-header.active .accordion-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.project-accordion-content {
    display: none;
    padding: 16px;
    background: var(--bg-card);
    flex-direction: column;
    gap: 12px;
}

.project-accordion-content.active {
    display: flex;
}

/* Employee Task Card Styles */
.ep-tasks-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ep-task-card {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ep-task-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ep-task-source {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.ep-task-status {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: capitalize;
}

.ep-task-status.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.ep-task-status.done {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.ep-task-status.late {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.ep-task-status.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.ep-task-desc {
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
    white-space: pre-wrap;
}

.ep-task-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}