/* Import Inter font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Modern SaaS Theme */
    --primary: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --secondary: #64748b;
    /* Slate 500 */

    --bg-body: #f8fafc;
    /* Slate 50 */
    --bg-surface: #ffffff;
    --bg-sidebar: #1e293b;
    /* Slate 800 */

    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-sidebar: #cbd5e1;
    /* Slate 300 */
    --text-sidebar-hover: #ffffff;

    --border-light: #e2e8f0;
    /* Slate 200 */
    --border-dark: #334155;
    /* Slate 700 */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    --radius-lg: 0.75rem;

    --header-height: 60px;
    --sidebar-width: 260px;
    /* Reduced width for compactness */
}

/* Modern Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    overflow: hidden;
    /* Prevent body scroll, handle in containers */
}

/* --- Layout Structure --- */

#main-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    #main-content {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding-top: 40px;
        box-sizing: border-box;
    }
}

/* --- Top Navigation Container --- */
.top-nav-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 60;
    background: #ffffff;
    /* White Background */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* Softer shadow */
    display: flex;
    flex-direction: column;
}

/* Row 1: Header & Actions */
.top-header-row {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    flex-wrap: nowrap;
    border-bottom: 1px solid var(--border-light);
}

.app-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #354894 0%, #5a6ba8 20%, #6b8afd 40%, #cf278d 60%, #354894 80%, #27385f 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: appTitleGradient 3s linear infinite;
    flex-shrink: 0;
}

@keyframes appTitleGradient {
    0% {
        background-position: 200% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

@media (max-width: 1300px) {
    .top-header-row {
        justify-content: space-between;
        gap: 0.5rem;
        flex-wrap: nowrap;
        /* Prevent wrapping */
    }

    .header-actions {
        justify-content: flex-end;
        flex-wrap: nowrap;
        /* Prevent wrapping */
        gap: 0.5rem;
    }

    /* Scale down buttons on smaller screens */
    .top-header-row button,
    .add-task-btn,
    .csv-btn,
    .manage-access-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    .app-title {
        font-size: 24px;
        /* Smaller title */
    }
}

/* Extra small screens adjustments for header */
@media (max-width: 900px) {
    .top-header-row {
        gap: 0.25rem;
        padding: 0.5rem 0.75rem;
    }

    .header-actions {
        gap: 0.25rem;
    }

    .app-title {
        font-size: 18px !important;
        letter-spacing: -0.01em;
    }

    .profile-picture-btn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
    }

    #manageDataSection {
        display: none !important;
    }
}

/* Very small mobile screens - Wrap header */
@media (max-width: 500px) {
    .top-header-row {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        padding-bottom: 0.75rem;
    }

    .app-title {
        width: 100%;
        text-align: center;
        margin-bottom: 0.25rem;
        font-size: 20px !important;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
}



/* Add Task Button - Compact Header Version */
.add-task-btn {
    background: linear-gradient(135deg, var(--primary), #354894);
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-weight: 400;
    font-size: 0.875rem;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.add-task-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

.analytics-dashboard-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-dashboard-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, #059669, #047857);
}

.analytics-dashboard-btn svg {
    width: 16px;
    height: 16px;
}


/* User Profile Dropdown */
.user-profile-dropdown {
    position: relative;
}

.profile-picture-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    background: white;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
    /* Crucial for absolute child */
}

.profile-picture-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.profile-pic {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    position: absolute !important;
    top: 0;
    left: 0;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    z-index: 1000;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes dropdownFadeInCenter {
    from {
        opacity: 0;
        transform: translate(-50%, -10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.dropdown-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

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

.dropdown-role-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 700;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.dropdown-email {
    padding: 0 1rem 0.75rem 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0.5rem 0;
}

.dropdown-signout-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
    border-radius: 0 0 12px 12px;
}

.dropdown-signout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.dropdown-signout-btn svg {
    width: 16px;
    height: 16px;
}


/* Row 2: Filter Bar */
.filter-bar-row {
    min-height: 50px;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    gap: 0.75rem;
    flex-wrap: nowrap;
    /* Prevent wrapping if desired, or rely on scroll */
    background: #ffffff;
    /* White */
    border-bottom: 1px solid var(--border-light);
    overflow-x: auto;
    /* Allow scroll on small screens */
    white-space: nowrap;
    /* Keep items in a line */
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 140px;
}

.month-range-group {
    border-radius: var(--radius-sm);
}

.filter-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

.date-range-group {
    flex: 0 0 auto;
    /* Do not shrink or grow unexpectedly */
    min-width: max-content;
    /* Force width to fit content */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-bar-row .date-range-group .compact-date-input {
    width: 130px;
}

@media (max-width: 1300px) {
    .filter-bar-row {
        gap: 0.4rem;
        padding: 0.5rem;
    }

    .filter-group {
        flex: 0 1 auto;
        /* Allow shrinking */
        gap: 0.25rem;
    }

    .filter-bar-row .date-range-group .compact-date-input {
        width: 110px;
        /* Smaller width for dates */
        padding: 0.35rem 0.2rem;
    }

    .filter-group .compact-select {
        max-width: 140px;
        /* Smaller max width */
        min-width: 100px;
        padding-right: 1.2rem;
        /* Less padding */
    }

    .date-range-group {
        flex: 1 1 100%;
        justify-content: center;
        margin-bottom: 0.25rem;
    }
}


@media (max-width: 600px) {
    .filter-bar-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .date-range-group {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }

    .date-range-group .filter-label {
        width: 100%;
        text-align: center;
        margin-bottom: 2px;
    }

    .date-range-group .compact-date-input {
        width: 125px !important;
        flex: 0 1 auto;
    }

    .filter-divider {
        display: none;
    }

    .my-tasks-group {
        border-left: none;
        margin-left: 0;
        padding-left: 0;
        justify-content: center;
    }
}


.compact-date-input {
    appearance: none;
    background-color: transparent;
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 500;
    border: 2px solid var(--border-light);
    padding: 0.35rem 0.35rem;
    border-radius: var(--radius-sm);
    transition: 0.2s;
    font-family: inherit;
    text-align: center;
}

.compact-date-input:hover {
    background-color: #f1f5f9;
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.compact-date-input:focus {
    outline: none;
    background-color: #f1f5f9;
    border-color: rgba(99, 102, 241, 0.3);
}

.filter-group .compact-select {
    width: 160px;
    min-width: 140px;
    max-width: 180px;
}

.filter-divider {
    width: 1px;
    height: 24px;
    background: var(--border-light);
    margin: 0 0.5rem;
}

/* Compact Selects for Top Bar */
.compact-select {
    appearance: none;
    background-color: transparent;
    border: 2px solid var(--border-light);
    /* Prepare for hover border */
    color: var(--text-main);
    /* Dark text */
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.4rem 1.5rem 0.4rem 0.6rem;
    /* Add padding for hover state */
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    /* Darker arrow */
    background-position: right 0.4rem center;
    background-repeat: no-repeat;
    background-size: 1em 1em;
}

.compact-select option {
    background-color: #ffffff;
    color: var(--text-main);
    padding: 10px;
}

/* Style for disabled options */
.compact-select option:disabled {
    color: #cbd5e1;
    /* Light gray color */
    opacity: 0.5;
    /* Reduced opacity */
    text-decoration: line-through;
    /* Strikethrough for visual clarity */
    cursor: not-allowed;
}

.compact-select:hover {
    background-color: #f1f5f9;
    /* Slate 100 - Light Gray */
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.2);
}

.compact-select:focus {
    outline: none;
    background-color: #f1f5f9;
    /* Same as hover - light gray */
    border-color: rgba(99, 102, 241, 0.3);
}

/* Admin Search Styling */
.admin-search-group {
    flex: 0 1 200px !important;
    min-width: 180px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.compact-search-input {
    width: 100%;
    padding: 0.4rem 0.6rem 0.4rem 28px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    transition: all 0.2s;
    background: transparent;
}

.compact-search-input:hover {
    background-color: #f1f5f9;
    border-color: rgba(99, 102, 241, 0.2);
}

.compact-search-input:focus {
    outline: none;
    background-color: #f1f5f9;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Reset Button */
.reset-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
}

.reset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.filter-actions {
    margin-left: auto;
    /* Push to right */
}

/* --- Main Content & Calendar Grid --- */

/* Custom Select Styling - Premium Glass */
select {
    appearance: none;
    background-color: rgba(30, 41, 59, 0.4);
    /* More transparent */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    /* Top highlight */
    border-radius: var(--radius-sm);
    padding: 0.4rem 1.5rem 0.4rem 0.6rem;
    font-family: inherit;
    font-size: 0.75rem;
    color: #e2e8f0;
    /* Brighter text */
    width: 100%;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.3rem center;
    background-repeat: no-repeat;
    background-size: 1em 1em;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    /* Glass effect */
}

select:hover {
    border-color: rgba(99, 102, 241, 0.5);
    /* Indigo hint */
    background-color: rgba(30, 41, 59, 0.7);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
    background-color: rgba(30, 41, 59, 0.9);
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.8rem;
}

/* CSV Export/Import Buttons */
.csv-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, var(--primary), #354894);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

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

.csv-btn svg {
    width: 16px;
    height: 16px;
}



/* Adjust Main Content */
.calendar-app {
    height: calc(100vh - 130px);
    /* 110px header + 20px gap */
    margin-top: 130px;
    /* Space below header */
    width: 100%;
    overflow: auto;
    background-color: var(--bg-body);
    padding-top: 0;
}

.calendar-grid {
    display: grid;
    /* Columns defined in inline style by JS */
    grid-template-rows: auto;
    background-color: var(--bg-surface);
    position: relative;
    min-width: 100%;
    width: max-content;
    /* Force grid to be wide enough for sticky to work */
}

/* --- Grid Headers --- */

.header {
    background-color: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    box-sizing: border-box;
    position: sticky;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Top Sticky Headers (Month, Week) */
.header-month {
    grid-row: 1;
    top: 0;
    height: 40px;
    background: #354894;
    /* Soft indigo gradient */
    z-index: 40;
    /* Level 2: Top Headers */
    font-weight: 700;
    color: #f1f1f1;
    /* Indigo 700 */
    border-bottom: 1px solid var(--border-light);
}

.header-week {
    grid-row: 2;
    top: 40px;
    height: 30px;
    background: #354894;
    /* Lighter indigo to slate gradient */
    z-index: 39;
    /* Slightly below month */
    color: #ffffff;
    /* Slate 500 */
}

.header-day {
    display: none;
}

/* Left Sticky Headers (Class, Batch, Activity) */
.header-name {
    grid-row: 1 / span 2;
    /* Span 2 header rows */
    top: 0;
    z-index: 50 !important;
    /* Level 1: Corner Headers (Highest) */
    background: #354894;
    /* Soft blue gradient */
    color: #ffffff;
    /* Blue 800 */
    font-weight: 700;
    border-bottom: 1px solid var(--border-light);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    position: sticky !important;
}

.fixed-column-1-header {
    left: 0 !important;
    width: 100px;
}

.fixed-column-2-header {
    left: 100px !important;
    width: 100px;
}

.fixed-column-3-header {
    left: 200px !important;
    width: 100px;
}

/* --- Grid Body --- */

/* Row Labels (Sticky Left) */
.task-name-cell {
    position: sticky !important;
    z-index: 30 !important;
    /* Level 3: Left Body (Below Top Headers) */
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%) !important;
    /* Very subtle sky blue to white gradient */
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8rem;
    color: var(--text-main);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 500;
    box-sizing: border-box;
    transition: background-color 0.2s;
}

.task-name-cell:hover {
    background-color: #f8fafc !important;
}

.fixed-column-1 {
    left: 0 !important;
    width: 100px;
    z-index: 30 !important;
}

.fixed-column-2 {
    left: 100px !important;
    width: 100px;
    z-index: 29 !important;
}

.fixed-column-3 {
    left: 200px !important;
    width: 100px;
    z-index: 28 !important;
    box-shadow: 4px 0 8px -2px rgba(0, 0, 0, 0.1);
    /* Shadow to separate fixed cols */
    clip-path: inset(0 -10px 0 0);
    /* Allow shadow to show */
}

.fixed-column-3-header {
    left: 200px !important;
    width: 100px;
    box-shadow: 4px 0 8px -2px rgba(0, 0, 0, 0.1);
    clip-path: inset(0 -10px 0 0);
}

/* Task Cells */
.task {
    margin: 2px 1px;
    padding: 4px 6px;
    border-radius: 4px;
    /* Pill shape */
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    min-height: 20px;
    z-index: 5;
    position: relative;
    border: 1px solid transparent;
}

.task:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 20;
}

/* Task Colors - Modern Pastels */
.task[style*="background-color"] {
    /* This selector targets inline styles set by JS. 
       We can try to enforce a border or text color for contrast */
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Alternating row backgrounds for activities - Full grid width stripes */
/* Simplified to just 2 colors: very light cyan tones */

/* Only apply alternating colors to fixed-column-3 (Activities column) */
/* Even rows (0, 2, 4) - Very Light Cyan */
.calendar-grid .fixed-column-3[data-activity-index="0"],
.calendar-grid .fixed-column-3[data-activity-index="2"],
.calendar-grid .fixed-column-3[data-activity-index="4"] {
    background: #ffffff !important;
}

/* Odd rows (1, 3, 5) - Very Light Cyan */
.calendar-grid .fixed-column-3[data-activity-index="1"],
.calendar-grid .fixed-column-3[data-activity-index="3"],
.calendar-grid .fixed-column-3[data-activity-index="5"] {
    background: #f3f9ff !important;
}

/* Background divs for full-width row stripes */
/* Even rows - Very Light Cyan */
.activity-row-background[data-activity-row-index="0"],
.activity-row-background[data-activity-row-index="2"],
.activity-row-background[data-activity-row-index="4"] {
    background-color: #ffffff;
}

/* Odd rows - Very Light Cyan */
.activity-row-background[data-activity-row-index="1"],
.activity-row-background[data-activity-row-index="3"],
.activity-row-background[data-activity-row-index="5"] {
    background-color: #f3f9ff;
}

/* --- Auth Modal --- */

.auth-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6, #60a5fa, #8b5cf6, #ec4899);
    background-size: 400% 400%;
    animation: authModalGradient 15s ease infinite;
    align-items: center;
    justify-content: center;
}

@keyframes authModalGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.auth-container {
    display: flex;
    width: 90%;
    max-width: 1000px;
    height: 500px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

/* Left Panel - Blue Section */
.auth-left-panel {
    flex: 1;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: white;
    position: relative;
    overflow: hidden;
}

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

.auth-welcome-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    letter-spacing: 0.05em;
}

.auth-subtitle {
    font-size: 1.125rem;
    font-weight: 400;
    margin: 0 0 2rem 0;
    opacity: 0.95;
    letter-spacing: 0.02em;
}

.auth-description {
    font-size: 0.95rem;
    line-height: 1.6;
    opacity: 0.9;
    margin: 0 0 3rem 0;
    max-width: 90%;
}

.auth-footer {
    font-size: 0.85rem;
    opacity: 0.85;
    line-height: 1.6;
}

.auth-footer p {
    margin: 0.5rem 0;
}

.auth-footer a {
    color: white;
    text-decoration: underline;
}

/* Decorative Circles */
.auth-circles {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.auth-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.auth-circle-1 {
    width: 300px;
    height: 300px;
    bottom: -100px;
    left: -50px;
}

.auth-circle-2 {
    width: 250px;
    height: 250px;
    bottom: -80px;
    left: 150px;
}

.auth-circle-3 {
    width: 200px;
    height: 200px;
    bottom: -50px;
    right: 50px;
}

/* Right Panel - White Card */
.auth-right-panel {
    flex: 1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-signin-card {
    background: white;
    border-radius: 12px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.auth-logo {
    margin-bottom: 2.5rem;
}

.auth-logo img {
    max-width: 180px;
    height: auto;
}

.auth-google-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.3);
}

.auth-google-btn:hover {
    background: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
}

.auth-google-btn svg {
    flex-shrink: 0;
}

.auth-error {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 6px;
    font-size: 0.875rem;
}

.auth-help-text {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

/* --- Loading Screen --- */
/* --- Loading Screen (Redesigned) --- */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
    /* Dot pattern */
    z-index: 9999 !important;
    /* Force top */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.loading-logo img {
    max-width: 180px !important;
    /* Force size constraint */
    height: auto !important;
    margin-bottom: 2rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.loading-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.loading-progress-container {
    width: 100%;
    margin-bottom: 1rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.loading-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    width: 0%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.loading-percentage {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
}

.loading-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.loading-spinner {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}

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

/* --- Base Modal Styles --- */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    overflow: auto;
    align-items: center;
    /* Center vertically when display: flex */
    justify-content: center;
    /* Center horizontally when display: flex */
}

.modal-content {
    background-color: white;
    margin: auto;
    /* Changed from 5% auto for better centering */
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    /* Slightly increased */
    overflow: hidden;
    /* Header/Body/Footer will handle internal scrolling */
    animation: modalFadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

/* Modal Components */
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

.modal-header .close {
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.modal-header .close:hover {
    color: #475569;
    background: #f1f5f9;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body.overflow-visible {
    overflow: visible !important;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* --- Modal Form Improvements --- */
.modal-form-group {
    margin-bottom: 20px;
}

.modal-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    /* Slightly lighter weight */
    color: #344054;
    /* Slate-700 equivalent */
    font-size: 14px;
}

.modal-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    /* Specific gray */
    border-radius: 8px;
    /* Slightly squarer corners */
    font-size: 14px;
    color: #101828;
    transition: all 0.2s;
    background: #ffffff;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    /* Subtle shadow */
}

.modal-input:hover {
    border-color: #b9c0d5;
}

.modal-input:focus {
    outline: none;
    border-color: #6366f1;
    /* Primary color */
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 0 0 4px rgba(99, 102, 241, 0.1);
    /* Ring shadow */
}

.modal-input::placeholder {
    color: #667085;
    /* Slate-500 */
}

/* Color Picker Container */
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.color-input-swatch {
    width: 48px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

.color-picker-label {
    font-size: 14px;
    color: #64748b;
}

.modal-hint-text {
    margin-top: 0;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-hint-text span {
    font-weight: 600;
    color: #4f46e5;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Task Description Scrollable Box */
.task-description {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-top: 8px;
    line-height: 1.6;
}



/* --- Manage Access Button --- */
.manage-access-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), #354894);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.manage-access-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.manage-access-btn svg {
    width: 16px;
    height: 16px;
}

/* --- Manage Access Modal --- */
.manage-access-modal {
    max-height: 85vh;
    overflow-y: auto;
}

.manage-access-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.manage-access-modal .modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-main);
}

.manage-access-modal .close {
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.manage-access-modal .close:hover {
    color: var(--text-main);
}

.manage-access-modal .modal-body {
    padding: 1.5rem;
}

.access-controls h3,
.user-list-section h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.add-user-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.form-input,
.form-select {
    padding: 0.625rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
}

.form-input {
    flex: 1;
}

.form-select {
    min-width: 120px;
}

.btn-primary {
    padding: 0.625rem 1.25rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #5558e3;
    transform: translateY(-1px);
}

/* Tooltip for User Avatar */
.tooltip-container {
    position: relative;
}

.tooltip-container[data-email]:hover::after {
    content: attr(data-email);
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    margin-left: 12px;
    background: #1f2937;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}

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

/* Manage Data Dropdown */
.manage-data-dropdown {
    position: relative;
    display: inline-block;
}

.data-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    min-width: 160px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-light);
    z-index: 1000;
    padding: 8px;
    animation: dropdownFade 0.2s ease-out;
}

.data-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.data-dropdown-menu .dropdown-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.data-dropdown-menu .dropdown-item svg {
    color: var(--text-muted);
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



.external-add-section {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-light);
}

.external-management-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.external-management-controls input {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.external-management-controls input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.controls-divider {
    width: 1px;
    height: 24px;
    background: var(--border-light);
    margin: 0 4px;
}

.btn-action-primary {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.btn-action-primary:hover {
    filter: brightness(1.1);
}



.btn-bulk-import {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-bulk-import:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.csv-template-link {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.csv-template-link:hover {
    text-decoration: underline;
}

.btn-delete-small {
    padding: 6px;
    background: transparent;
    border: 1px solid #fee2e2;
    color: #ef4444;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-small:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

.section-divider {
    height: 1px;
    background: var(--border-light);
}

/* User Access Table Updates */
.user-email-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.user-dept-cell {
    font-weight: 500;
    color: var(--text-main);
}

.user-search-container {
    position: relative;
    margin-bottom: 20px;
    padding: 0 4px;
}

.user-search-container .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
}

#userSearchInput {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    background: white;
    transition: all 0.3s ease;
    outline: none;
}

#userSearchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

#userSearchInput:focus+.search-icon {
    color: var(--primary);
}

#userSearchInput::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.user-access-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 480px;
    overflow-y: auto;
    padding: 0 4px;
}

.user-access-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    transition: all 0.2s;
}

.user-access-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

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

.user-access-table th {
    font-size: 0.8rem;
    padding: 8px;
    text-align: left;
    color: var(--text-muted);
}

.user-access-table td {
    font-size: 0.85rem;
    padding: 8px;
    vertical-align: middle;
}

.user-name-cell {
    font-size: 0.85rem;
    font-weight: 500;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-main);
    font-weight: 500;
}

.access-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.badge-editor {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.badge-viewer {
    background: rgba(33, 150, 243, 0.15);
    color: #2196F3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.access-level-select {
    padding: 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
}

.btn-delete {
    padding: 0.5rem;
    background: transparent;
    border: 1px solid #ef4444;
    border-radius: 6px;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete:hover {
    background: #ef4444;
    color: white;
}

.loading-users,
.no-users,
.error-message {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.error-message {
    color: #ef4444;
}


/* Mobile Filter Toggle Button (hidden on desktop) */
.mobile-filter-toggle {
    display: none;
}

/* Mobile View (Hidden on Desktop) */
.mobile-view {
    display: none;
    background-color: var(--bg-surface);
}

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

/* Hierarchical Collapsible Sections */
.mobile-collapsible-section {
    margin-bottom: 0.5rem;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.mobile-section-header:hover {
    background: #f8fafc;
}

.class-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
}

.class-header:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.batch-header {
    background: #f0f9ff;
    color: #0369a1;
    font-weight: 600;
    font-size: 0.9rem;
    margin-left: 1rem;
}

.activity-header {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 2rem;
}

.section-icon {
    font-size: 1.1rem;
}

.section-title {
    flex: 1;
}

.section-count {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.class-header .section-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.batch-header .section-count {
    background: rgba(3, 105, 161, 0.1);
    color: #0369a1;
}

.activity-header .section-count {
    background: rgba(146, 64, 14, 0.1);
    color: #92400e;
}

.chevron-icon {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.mobile-collapsible-section.expanded>.mobile-section-header .chevron-icon {
    transform: rotate(180deg);
}

.mobile-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out;
}

.batch-section {
    margin: 0.5rem 0.5rem 0.5rem 1rem;
}

.activity-section {
    margin: 0.5rem 0.5rem 0.5rem 1rem;
}

/* Mobile Task Cards */
.mobile-task-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 0.875rem;
    margin: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-task-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(2px);
}

.mobile-task-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.mobile-task-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.mobile-task-meta span {
    background: var(--bg-body);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-light);
}


@media (max-width: 789px) {
    .sidebar {
        width: 0;
    }

    .sidebar.open {
        width: 100%;
        /* Full width on mobile */
    }

    /* Make header relative on mobile so expanding filters push content down */
    .top-nav-container {
        position: relative;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    }

    .calendar-grid {
        display: none !important;
        /* Hide complex grid on mobile */
    }

    /* Override calendar-app margin for mobile only */
    .calendar-app {
        margin-top: 10px !important;
    }

    .mobile-view {
        display: block;
        padding: 1rem;
        /* Adjusted to create exactly 50px visual gap including padding */
        background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
        min-height: calc(100vh - 130px);
    }

    /* Remove default margin from the heading to prevent extra spacing */
    .mobile-view h3 {
        margin-top: 0;
    }

    /* Show mobile filter toggle button */
    .mobile-filter-toggle {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.75rem 1.5rem;
        background: #ffffff;
        border: none;
        border-bottom: 1px solid var(--border-light);
        cursor: pointer;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--text-main);
        gap: 0.5rem;
        transition: background 0.2s;
        position: relative;
        z-index: 50;
    }

    .mobile-filter-toggle:hover {
        background: #f8fafc;
    }

    .mobile-filter-toggle .toggle-icon {
        transition: transform 0.3s ease;
    }

    .mobile-filter-toggle.active .toggle-icon {
        transform: rotate(180deg);
    }

    /* Collapsible filter container with grid layout */
    .filter-bar-row {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem 0.75rem;
        padding: 0 1rem;
        /* Start with 0 vertical padding */
        background: #ffffff;
        border-bottom: 1px solid var(--border-light);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);

        /* Collapsible properties */
        max-height: 0 !important;
        height: auto !important;
        overflow: hidden !important;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        margin-bottom: 0;
    }

    /* Expanded state */
    .filter-bar-row.expanded {
        max-height: 500px !important;
        /* Large enough to fit content */
        padding: 1rem;
        /* Restore padding */
        opacity: 1;
        visibility: visible;
        margin-bottom: 1rem;
    }

    /* Row 1: Period filters - Span both columns */
    .month-range-group {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: auto 1fr auto 1fr;
        gap: 0.35rem;
        align-items: center;
        background: #f8fafc;
        /* Light background for period group */
        padding: 0.5rem;
        border-radius: 8px;
        border: 1px solid var(--border-light);
    }

    .filter-label {
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--primary);
        /* Use primary color for label */
    }

    /* Row 2 & 3: pairs of selects */
    .filter-group {
        grid-column: auto;
        width: 100%;
    }

    .filter-group .compact-select {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    /* Force period row full width */
    .date-range-group {
        grid-column: 1 / -1;
    }

    /* Hide filter divider on mobile */
    .filter-divider {
        display: none;
    }

    /* Show reset button on mobile - span both columns */
    .filter-actions {
        display: block;
        grid-column: 1 / -1;
        /* Span both columns */
        text-align: center;
        margin-top: 0.35rem;
        justify-self: center;
        width: 100%;
    }

    .compact-select {
        width: 100%;
        min-width: 0;
        font-size: 0.85rem;
        padding: 0.6rem;
        /* Slightly larger padding */
        text-align: center;
        border: 1px solid var(--border-light);
        border-radius: 8px;
        background-color: #fff;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .compact-select:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        outline: none;
    }

    /* Mobile-specific reset button styling */
    .reset-btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        font-weight: 600;
        margin-top: 0.25rem;
    }

    .header-actions {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    /* Hide all buttons in header actions on mobile (Add Task, Manage Access, CSV) */
    .header-actions>button {
        display: none !important;
    }

    /* Ensure profile dropdown container is visible */
    .user-profile-dropdown {
        display: block;
    }

    /* Hide auth left panel on mobile */
    .auth-left-panel {
        display: none !important;
    }

    .auth-main-container {
        flex-direction: column;
        width: 90%;
        height: auto;
        min-height: 80vh;
    }

    .auth-welcome-panel {
        padding: 2rem;
    }

    .auth-form-panel {
        padding: 2rem;
    }

    /* Modal Responsiveness */
    .modal-content {
        width: 95% !important;
        max-width: 95vw !important;
        margin: 10px auto;
        padding: 15px !important;
    }

    .manage-access-modal .modal-content,
    .manage-teams-modal {
        width: 95% !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
    }

    /* Fix for "Select Team" dropdown on mobile */
    /* Fix for "Select Team" dropdown on mobile */
    #addTeamDropdown {
        max-width: 100% !important;
        width: auto !important;
        /* Allow shrinking to content */
        min-width: 150px;
        /* Ensure clickable area */
        font-size: 16px !important;
        /* Prevent iOS zoom */
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }

    /* General input sizing for mobile to prevent overflow */
    .task-modal-content input,
    .task-modal-content select {
        max-width: 100% !important;
        font-size: 16px !important;
        /* Prevent iOS zoom */
    }

    .modal-header {
        padding: 15px !important;
    }

    .modal-header h2,
    .modal-header h3 {
        font-size: 18px !important;
    }

    /* Manage Teams Mobile Layout */
    .teams-layout {
        flex-direction: column;
        min-height: auto;
        max-height: 70vh;
    }

    .teams-sidebar {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid #e5e7eb;
        padding: 15px !important;
        max-height: 200px;
    }

    .team-header,
    .modal-body.teams-layout>.team-members-panel .team-header {
        padding: 15px !important;
    }

    .team-header h3 {
        font-size: 16px !important;
    }

    .members-list {
        padding: 15px !important;
    }

    .member-row {
        padding: 12px 10px !important;
    }

    .member-avatar {
        width: 36px !important;
        height: 36px !important;
    }

    .member-name {
        font-size: 14px !important;
    }

    /* Task Edit Modal Grid */
    .task-modal-content div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .task-modal-content {
        height: 90vh !important;
    }

    /* Fix Dropdown Overflow on Mobile */
    .user-dropdown-menu,
    .notification-dropdown {
        position: fixed !important;
        top: 130px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: calc(100vw - 32px) !important;
        max-width: 350px !important;
        margin-top: 0 !important;
        z-index: 10001 !important;
    }

    .user-dropdown-menu {
        animation: dropdownFadeInCenter 0.2s ease !important;
    }

    .notification-dropdown {
        animation: fadeIn 0.1s ease-out !important;
    }
}


/* ============ MANAGE TEAMS INTERFACE - ENHANCED DESIGN ============ */

/* Manage Teams Modal */
.manage-teams-modal {
    max-width: 1400px;
    width: 95%;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
}

.manage-teams-modal .modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.manage-teams-modal .modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.manage-teams-modal .modal-header .close {
    font-size: 32px;
    font-weight: 300;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.manage-teams-modal .modal-header .close:hover {
    background: #f3f4f6;
    color: #111827;
}

.manage-teams-modal .modal-body {
    padding: 0;
    background: #f9fafb;
}

.teams-layout {
    display: flex;
    gap: 0;
    min-height: 650px;
    max-height: 75vh;
}

/* Teams Sidebar - Enhanced */
.teams-sidebar {
    width: 300px;
    background: #ffffff;
    padding: 28px 24px;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    flex-shrink: 0;
}

.add-team-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 10px;
    width: 100%;
    margin-bottom: 28px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.add-team-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}

.teams-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-item {
    display: flex;
    align-items: center;
    padding: 16px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f9fafb;
    border: 2px solid transparent;
    position: relative;
    gap: 12px;
}

.team-edit-btn {
    background: transparent;
    border: none;
    color: #4f46e5;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    margin-left: auto;
}

.team-edit-btn svg {
    width: 18px;
    height: 18px;
}

.team-item:hover .team-edit-btn {
    opacity: 1;
}

.team-edit-btn:hover {
    background: #ede9fe;
    color: #4338ca;
}

/* Delete button in modal footer */
.delete-team-btn {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.delete-team-btn:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #dc2626;
    color: #dc2626;
}

.delete-team-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.team-item:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
    transform: translateX(4px);
}

.team-item.selected {
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
    border-color: #c7d2fe;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.team-color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 14px;
    flex-shrink: 0;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.team-name {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
    color: #1f2937;
}

.team-item.selected .team-name {
    color: #4f46e5;
}

.arrow-icon {
    width: 18px;
    height: 18px;
    color: #9ca3af;
    opacity: 0;
    transition: all 0.2s;
}

.team-item:hover .arrow-icon {
    opacity: 0.5;
    transform: translateX(2px);
}

.team-item.selected .arrow-icon {
    opacity: 1;
    color: #4f46e5;
}

/* Team Members Panel - Enhanced */
.team-members-panel {
    flex: 1;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 36px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.team-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.team-header p {
    color: #6b7280;
    margin: 6px 0 0 0;
    font-size: 14px;
}

.add-teammate-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.add-teammate-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}

/* Members List - Enhanced */
.members-list {
    flex: 1;
    overflow-y: auto;
    padding: 28px 36px;
}

.no-members {
    text-align: center;
    color: #9ca3af;
    padding: 80px 20px;
    font-size: 15px;
    background: white;
    border-radius: 12px;
    border: 2px dashed #e5e7eb;
}

.members-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table-header {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 16px 20px;
    font-weight: 700;
    color: #6b7280;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid #f3f4f6;
    background: #f9fafb;
}

.member-row {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 18px 20px;
    border-bottom: 1px solid #f3f4f6;
    align-items: center;
    transition: all 0.2s;
}

.member-row:last-child {
    border-bottom: none;
}

.member-row:hover {
    background: #f9fafb;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.member-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.member-name {
    font-weight: 600;
    font-size: 15px;
    color: #111827;
}

.member-email {
    font-size: 13px;
    color: #6b7280;
}

.member-actions {
    display: flex;
    gap: 8px;
}

.delete-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

.delete-btn svg {
    width: 20px;
    height: 20px;
}

/* Autocomplete Suggestions - Enhanced */
.autocomplete-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.autocomplete-wrapper input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.2s;
    font-family: inherit;
}

.autocomplete-wrapper input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-item:first-child {
    border-radius: 12px 12px 0 0;
}

.suggestion-item:last-child {
    border-radius: 0 0 12px 12px;
}

.suggestion-item:hover {
    background: #f3f4f6;
}

.suggestion-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
}

.suggestion-details {
    flex: 1;
    min-width: 0;
}

.suggestion-name {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
    margin-bottom: 3px;
}

.suggestion-email {
    font-size: 13px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Selected Teammates List - Enhanced */
.selected-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
}

.selected-teammate-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s;
}

.selected-teammate-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.selected-teammate-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.selected-teammate-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
}

.selected-teammate-details {
    flex: 1;
    min-width: 0;
}

.selected-teammate-name {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
}

.selected-teammate-email {
    font-size: 12px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-selected-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.remove-selected-btn:hover {
    background: #fee2e2;
}

/* Color Palette - Enhanced */
/* Color Palette - Grid Layout */
.color-palette {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.color-option.selected {
    border-color: #1e293b;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.custom-color-picker {
    width: 100%;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
}

.custom-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

/* Modal Footer - Enhanced */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px 28px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.modal-footer button {
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-footer button:first-child {
    background: white;
    border: 2px solid #d1d5db;
    color: #374151;
}

.modal-footer button:first-child:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.modal-footer button:last-child {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
    font-weight: 600;
}

.modal-footer button:last-child:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}

/* Scrollbar Styling */
.teams-sidebar::-webkit-scrollbar,
.members-list::-webkit-scrollbar,
.suggestions-dropdown::-webkit-scrollbar,
.selected-list::-webkit-scrollbar {
    width: 8px;
}

.teams-sidebar::-webkit-scrollbar-track,
.members-list::-webkit-scrollbar-track,
.suggestions-dropdown::-webkit-scrollbar-track,
.selected-list::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

.teams-sidebar::-webkit-scrollbar-thumb,
.members-list::-webkit-scrollbar-thumb,
.suggestions-dropdown::-webkit-scrollbar-thumb,
.selected-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.teams-sidebar::-webkit-scrollbar-thumb:hover,
.members-list::-webkit-scrollbar-thumb:hover,
.suggestions-dropdown::-webkit-scrollbar-thumb:hover,
.selected-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ==================== MANAGE USER ACCESS MODAL REDESIGN ==================== */

.manage-access-modal .modal-content {
    max-width: 900px;
}

.manage-access-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
}

.btn-add-new-user {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.btn-add-new-user:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.user-avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
}

.user-avatar-initials {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.user-profile-cell {
    padding: 12px 16px !important;
}

.user-name-cell {
    font-weight: 500;
    color: #111827;
}

.user-role-cell .access-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}


.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    display: block;
}

/* --- Notification System --- */
.notification-wrapper {
    position: relative;
    margin-right: 1rem;
}

.notification-btn {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.notification-btn:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-light);
    z-index: 1000;
    margin-top: 8px;
    max-height: 480px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.1s ease-out;
}

.notification-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mark-read-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.notification-list {
    overflow-y: auto;
    max-height: 360px;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.2s;
    background: white;
}

.notification-item.unread {
    background: #f0f7ff;
}

.notification-item:hover {
    background: #f9fafb;
}

.notification-item:last-child {
    border-bottom: none;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.notif-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

.notif-time {
    font-size: 11px;
    color: var(--text-muted);
}

.notif-body {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-notifications {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* --- Toggle Switch for My Tasks --- */
.my-tasks-group {
    display: flex;
    align-items: center;
    padding-left: 12px;
    border-left: 1px solid var(--border-light);
    margin-left: 12px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}


.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

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

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

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

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

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

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

.slider.round {
    border-radius: 20px;
}

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



@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ GOOGLE-STYLE FLATPICKR DATEPICKER ============ */

/* Base Flatpickr Structure */
.flatpickr-calendar {
    width: 240px;
    /* Increased to 240px for better field clearance */
    font-family: 'Roboto', 'Inter', Arial, sans-serif;
    border: none;
    box-shadow: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
    border-radius: 8px;
    padding: 8px;
    /* Reduced padding from 12px */
    background: #ffffff;
    color: #202124;
    opacity: 0;
    display: none;
    text-align: center;
    visibility: hidden;
    position: absolute;
    box-sizing: border-box;
    touch-action: manipulation;
}

.flatpickr-calendar.open,
.flatpickr-calendar.inline {
    opacity: 1;
    max-height: 640px;
    visibility: visible;
}

.flatpickr-calendar.inline {
    display: block;
    position: relative;
    top: 2px;
}

.flatpickr-calendar.open {
    display: inline-block;
    z-index: 99999;
}

.flatpickr-calendar.animate.open {
    animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);
}

.flatpickr-calendar.static {
    position: absolute;
    top: calc(100% + 2px);
}

.flatpickr-calendar.static.open {
    z-index: 999;
    display: block;
}

@keyframes fpFadeInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -20px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.flatpickr-wrapper {
    position: relative;
    display: inline-block;
}


.flatpickr-months {
    display: flex;
    background: transparent;
    border-bottom: none;
    margin-bottom: 12px;
    padding-bottom: 0;
    align-items: center;
    position: relative;
    /* Needed for absolute positioning context */
}

.flatpickr-months .flatpickr-month {
    background: transparent;
    color: #202124;
    fill: #202124;
    height: 34px;
    line-height: 1;
    text-align: center;
    position: relative;
    user-select: none;
    overflow: visible;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flatpickr-current-month {
    font-size: 13px;
    font-weight: 500;
    color: #202124;
    position: relative;
    width: 100%;
    padding: 0;
    line-height: 1;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
}

.flatpickr-current-month span.cur-month {
    font-family: inherit;
    font-weight: 500;
    color: inherit;
    display: inline-block;
    margin-left: 0;
    padding: 0;
}

.flatpickr-current-month .numInputWrapper {
    width: auto;
    display: inline-block;
    margin-left: 2px;
    pointer-events: auto;
}

.flatpickr-current-month input.cur-year {
    background: transparent;
    box-sizing: border-box;
    color: inherit;
    cursor: default;
    padding: 0;
    margin: 0;
    display: inline-block;
    font-size: inherit;
    font-family: inherit;
    font-weight: 500;
    line-height: inherit;
    height: auto;
    border: 0;
    border-radius: 0;
    vertical-align: initial;
    text-align: left;
    margin-left: 4px;
    pointer-events: auto;
    /* Enable year interaction */
}

.flatpickr-current-month input.cur-year:focus {
    outline: 0;
}

.flatpickr-monthDropdown-months {
    appearance: menulist;
    background: #ffffff;
    font-size: 13px;
    padding: 0 2px;
    width: fit-content;
    color: #202124;
}

.flatpickr-prev-month,
.flatpickr-next-month {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 3;
    padding: 4px 8px;
    cursor: pointer;
    order: -1;
    color: #5f6368;
    fill: #5f6368;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.flatpickr-prev-month:hover,
.flatpickr-next-month:hover {
    background: #f1f3f4;
}

.flatpickr-next-month {
    order: 10;
}

.flatpickr-custom-year-select {
    appearance: menulist !important;
    background: transparent !important;
    border: none !important;
    font-size: 13px !important;
    font-family: inherit !important;
    font-weight: 600 !important;
    color: #3c4043 !important;
    cursor: pointer !important;
    padding: 0 1px !important;
    margin-left: 1px !important;
    outline: none !important;
    width: fit-content !important;
}

.flatpickr-custom-year-select:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    border-radius: 4px !important;
}

.flatpickr-monthDropdown-months:focus,
.flatpickr-monthDropdown-months:active {
    outline: none;
    background: #ffffff;
}

.flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background-color: #ffffff;
    color: #202124;
    padding: 0;
}


.flatpickr-prev-month svg,
.flatpickr-next-month svg {
    width: 12px;
    height: 12px;
}

.flatpickr-prev-month svg path,
.flatpickr-next-month svg path {
    transition: fill 0.1s;
    fill: inherit;
}


.flatpickr-weekdays {
    background: transparent;
    text-align: center;
    overflow: hidden;
    width: 100%;
    display: flex;
    align-items: center;
    height: 24px;
    margin-bottom: 4px;
}

.flatpickr-weekdaycontainer {
    display: flex;
    flex: 1;
}

span.flatpickr-weekday {
    cursor: default;
    font-size: 10px;
    color: #70757a;
    font-weight: 500;
    text-transform: uppercase;
    line-height: 24px;
    margin: 0;
    background: transparent;
    text-align: center;
    display: block;
    flex: 1;
}


.flatpickr-days {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    width: 204px;
    /* Matches calendar width (220) - padding (16) */
}

.flatpickr-days:focus {
    outline: 0;
}

.dayContainer {
    padding: 0;
    outline: 0;
    text-align: left;
    width: 204px;
    min-width: 204px;
    max-width: 204px;
    box-sizing: border-box;
    display: inline-block;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

.flatpickr-months {
    display: flex;
    background: transparent;
    border-bottom: none;
    margin-bottom: 8px;
    /* Reduced margin */
    padding-bottom: 0;
    align-items: center;
    position: relative;
    /* Needed for absolute positioning context */
}

.flatpickr-day {
    background: none;
    border: none;
    border-radius: 50%;
    box-sizing: border-box;
    color: #202124;
    cursor: pointer;
    font-weight: 400;
    width: 14.28%;
    /* Force 1/7th width */
    max-width: 29px;
    /* Cap width to match grid cell size roughly */
    height: 28px;
    line-height: 28px;
    margin: 0;
    display: inline-block;
    position: relative;
    justify-content: center;

    text-align: center;
    font-size: 12px;
    transition: background 0.2s ease;
}

.flatpickr-day:hover {
    background: #f1f3f4;
    color: #202124;
}

.flatpickr-day.inRange,
.flatpickr-day.prevMonthDay.inRange,
.flatpickr-day.nextMonthDay.inRange,
.flatpickr-day.today.inRange,
.flatpickr-day.prevMonthDay.today.inRange,
.flatpickr-day.nextMonthDay.today.inRange {
    cursor: pointer;
    outline: 0;
    background: #e8f0fe;
    border-color: transparent;
    color: #1a73e8;
    border-radius: 0;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
    background: #1a73e8;
    box-shadow: none;
    color: #ffffff;
    border-color: #1a73e8;
    font-weight: 500;
}

.flatpickr-day.today {
    border: 1px solid #1a73e8;
    background: transparent;
    color: #1a73e8;
    font-weight: 500;
}

.flatpickr-day.today:hover {
    background: #f1f3f4;
    color: #1a73e8;
    border-color: #1a73e8;
}

.flatpickr-day.today.selected {
    background: #1a73e8;
    color: #ffffff;
    border-color: #1a73e8;
    font-weight: 500;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: #dadce0;
    background: transparent;
    cursor: pointer;
    /* These are effectively clickable if within range */
    opacity: 1;
    /* Make fully visible */
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover,
.flatpickr-day.notAllowed,
.flatpickr-day.notAllowed.prevMonthDay,
.flatpickr-day.notAllowed.nextMonthDay {
    color: #dadce0;
    background: transparent;
    cursor: default;
    opacity: 0.38;
}

.flatpickr-day.week.selected {
    border-radius: 0;
}

.flatpickr-innerContainer {
    display: block;
    display: flex;
    box-sizing: border-box;
    overflow: hidden;
}

/* Today button removed */
.flatpickr-calendar::after {
    display: none;
}

/* --- Modal Size Presets --- */
.modal-small {
    width: 400px !important;
}

.modal-medium {
    width: 550px !important;
}

.modal-large {
    width: 750px !important;
}

.modal-xl {
    width: 900px !important;
}

/* ==================== MOBILE VIEW STYLES ==================== */

.mobile-view {
    padding: 1rem;
    background: var(--bg-body);
}

.mobile-view h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

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

/* Accordion Sections */
.mobile-collapsible-section {
    background: white;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-collapsible-section.expanded {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mobile-section-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    min-height: 56px;
    /* Ensure ample touch target */
}

.mobile-section-header:hover {
    background: #f8fafc;
}

.section-icon {
    font-size: 1.2rem;
    width: 24px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.section-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-word;
    /* Handle long titles gracefully */
    line-height: 1.4;
}

.section-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.chevron-icon {
    transition: transform 0.3s;
    color: var(--text-muted);
    flex-shrink: 0;
}

.expanded>.mobile-section-header .chevron-icon {
    transform: rotate(180deg);
}

.mobile-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fcfdfe;
}

/* Nested padding - Indent content via margin to keep background full width */
.batch-section .mobile-section-header {
    padding-left: 1rem;
}

.batch-section .mobile-section-header .section-icon {
    margin-left: 0.5rem;
}

.activity-section .mobile-section-header {
    padding-left: 1rem;
    margin: 0;
    /* Ensure no margin causes white strip */
    width: 100%;
    /* Force full width */
    box-sizing: border-box;
}

.activity-section .mobile-section-header .section-icon {
    margin-left: 1.5rem;
}

.activity-section .mobile-section-content {
    padding: 0;
}


/* Ensure container has no padding that would squeeze the header */
.mobile-collapsible-section.activity-section {
    padding: 0;
}

/* Hierarchical Colors */
/* Hierarchical Colors */
.class-header {
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.batch-header {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #f1f5f9;
}

.activity-header {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #f1f5f9;
}

/* Mobile Task Cards */
.mobile-task-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.mobile-task-card:last-child {
    margin-bottom: 0;
}

.mobile-task-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.mobile-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mobile-task-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- Analytics Dashboard Styles --- */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.analytics-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
}

.analytics-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.analytics-stat-row:last-child {
    border-bottom: none;
}

.analytics-stat-label {
    font-size: 14px;
    color: #64748b;
}

.analytics-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.analytics-chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

.analytics-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.analytics-summary-item {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.analytics-summary-label {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.analytics-summary-value {
    font-size: 24px;
    font-weight: 700;
    color: #6366f1;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.analytics-table th {
    text-align: left;
    padding: 10px;
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    border-bottom: 2px solid #f1f5f9;
}

.analytics-table td {
    padding: 10px;
    font-size: 13px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.analytics-date-filter {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f1f5f9;
    border-radius: 8px;
}

.analytics-date-filter input {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    font-size: 13px;
}

.analytics-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

.analytics-tab {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.analytics-tab.active {
    background: #6366f1;
    color: #ffffff;
}


.analytics-tab:hover:not(.active) {
    background: #f1f5f9;
    color: #1e293b;
}

/* --- Sub-Task System Styles --- */
.sub-tasks-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.sub-tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sub-tasks-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin: 0;
}

.add-sub-task-btn {
    background: #f1f5f9;
    color: #4f46e5;
    border: 1px dashed #4f46e5;
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-sub-task-btn:hover {
    background: #eef2ff;
    border-style: solid;
}

.sub-task-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 30px;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.sub-task-input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
}

.remove-sub-task-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-sub-task-btn:hover {
    color: #dc2626;
}

/* View Modal Sub-Task Styles */
.sub-tasks-display-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    font-size: 13px;
}

.sub-tasks-display-table th {
    text-align: left;
    padding: 8px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    color: #475569;
    font-weight: 600;
}

.sub-tasks-display-table td {
    padding: 8px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.sub-tasks-display-table tr:last-child td {
    border-bottom: none;
}

/* Analytics Overview List Styles */
.analytics-overview-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analytics-overview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #475569;
}

.analytics-overview-item:last-child {
    border-bottom: none;
}

/* Status Badges */
.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
}

.status-badge.status-assigned {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.status-badge.status-ongoing {
    background: #cfe2ff;
    color: #084298;
    border: 1px solid #b6d4fe;
}

.status-badge.status-completed {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.status-badge.status-unassigned {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Chart Container */
.analytics-chart-container {
    height: 300px;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
}

/* Task Modal Grid Layout */
.task-modal-grid {
    display: grid;
    grid-template-columns: 35% 1fr;
    /* 35% Left, Rest (65%) Right */
    gap: 30px;
    align-items: start;
    width: 100%;
    overflow-x: hidden;
}

@media (max-width: 992px) {
    .task-modal-grid {
        grid-template-columns: 1fr;
    }
}

.task-modal-col-right {
    border-left: 1px solid #eee;
    padding-left: 20px;
    min-width: 0;
    /* Important for grid items to shrink properly */
}

/* Status History Timeline */
.history-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-history-container {
    padding: 10px 0;
    max-height: 400px;
    overflow-y: auto;
}

.timeline {
    position: relative;
    padding-left: 30px;
    margin-top: 10px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 5px;
    width: 9px;
    height: 9px;
    background: #3b82f6;
    border-radius: 50%;
    z-index: 1;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline-status {
    font-weight: 700;
    font-size: 13px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 5px;
}

.timeline-subtask {
    font-size: 12px;
    color: #475569;
    font-style: italic;
    font-weight: 500;
}

.timeline-user {
    font-size: 11px;
    color: #64748b;
}

.timeline-time {
    font-size: 11px;
    color: #94a3b8;
}

/* Status Select Styles in Table */
.status-select-wrapper {
    position: relative;
}

.status-select {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    background: #f8fafc;
    color: #475569;
    text-transform: uppercase;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
}

.status-select option {
    background-color: #ffffff;
    color: #1e293b;
}

.status-select.Assigned {
    background-color: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.status-select.Ongoing {
    background-color: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.status-select.Completed {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

/* --- Team Member List Styles --- */
.member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.member-row:hover {
    background-color: #f8fafc;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #4338ca;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.member-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.member-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.member-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.member-email {
    font-weight: 400;
    color: #64748b;
    font-size: 13px;
}

.remove-member-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 8px;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-member-btn:hover {
    background-color: #fee2e2;
    color: #ef4444;
}

/* Analytics Drill-down Styles */
.analytics-clickable {
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    border-radius: 8px;
    padding: 8px;
}

.analytics-clickable:hover {
    background-color: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.drilldown-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.drilldown-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.drilldown-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.875rem;
}

.drilldown-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.drilldown-row:hover {
    background-color: #f1f5f9;
}

.drilldown-row:last-child td {
    border-bottom: none;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.back-btn:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

/* Task Overlay Modal - Override default modal styles for proper centering */
div[id^="taskOverlay-"].modal {
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ==================== NOTIFICATION SYSTEM ==================== */
.notification-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-btn:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    z-index: 1000;
    overflow: hidden;
    transform-origin: top right;
    animation: dropdownSlideIn 0.2s ease-out;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.notification-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8fafc;
}

.notification-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.mark-all-read-btn {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}

.mark-all-read-btn:hover {
    text-decoration: underline;
}

.notification-list {
    max-height: 350px;
    overflow-y: auto;
}

.empty-notifications {
    padding: 30px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background-color: #f8fafc;
}

.notification-item.unread {
    background-color: #f0f9ff;
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #3b82f6;
}

.notification-content {
    font-size: 13px;
    color: #334155;
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-meta {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
}

.notification-task-title {
    font-weight: 600;
    color: #0f172a;
}

/* Hyperlinks in Task Descriptions */
.task-description a,
#editor a,
#editEditor a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s;
}

.task-description a:hover,
#editor a:hover,
#editEditor a:hover {
    color: #1d4ed8;
}