/* Task Manager V2 - Premium Aesthetic */

:root {
    --tm-primary: #2563eb;
    --tm-primary-light: #60a5fa;
    --tm-bg: #f8fafc;
    --tm-card-bg: #ffffff;
    --tm-text: #0f172a;
    --tm-text-light: #64748b;
    --tm-border: #e2e8f0;
    --tm-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --tm-radius: 20px;
    --tm-danger: #ef4444;
}

body.dark-mode {
    --tm-bg: #0f172a;
    --tm-card-bg: #1e293b;
    --tm-text: #f8fafc;
    --tm-text-light: #94a3b8;
    --tm-border: rgba(255, 255, 255, 0.1);
    --tm-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.task-manager-v2-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--tm-bg);
    z-index: 9999;
    display: none;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.task-manager-v2-modal.active {
    display: flex;
}

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

/* Header & Navigation */
.tm-v2-header {
    background: #ffffff;
    border-bottom: 1px solid var(--tm-border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 85px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    z-index: 10;
}

.tm-v2-tabs {
    display: flex;
    gap: 8px;
    height: 100%;
    align-items: center;
}

.tm-v2-tab {
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--tm-text-light);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 14px;
    user-select: none;
}

.tm-v2-tab:hover {
    background: #f1f5f9;
    color: var(--tm-text);
}

.tm-v2-tab.active {
    color: var(--tm-primary);
    background: rgba(37, 99, 235, 0.1);
}

.tm-v2-tab-count {
    background: #f1f5f9;
    color: var(--tm-text-light);
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 800;
}

.tm-v2-tab.active .tm-v2-tab-count {
    background: var(--tm-primary);
    color: white;
}

/* Global Controls */
.tm-v2-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tm-v2-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 14px;
    padding: 0 18px;
    width: 320px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
}

.tm-v2-search-wrapper:focus-within {
    background: white;
    border-color: var(--tm-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    width: 380px;
}

#tmV2Search {
    background: transparent;
    border: none;
    padding: 14px 0;
    width: 100%;
    font-size: 0.95rem;
    color: var(--tm-text);
    outline: none;
}

.tm-v2-close-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--tm-text-light);
    transition: all 0.3s;
    background: #f1f5f9;
    margin-left: 8px;
}

.tm-v2-close-btn:hover {
    background: #f1f5f9;
    margin-left: 8px;
}

.tm-v2-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

/* Loader Styles */
.tm-v2-main-loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 16px;
    color: var(--tm-text-light);
    font-weight: 600;
}

.tm-loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--tm-border);
    border-top: 4px solid var(--tm-primary);
    border-radius: 50%;
    animation: tm-spin 1s linear infinite;
}

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

/* Main Content Layout */
.tm-v2-content {
    flex: 1;
    overflow: hidden;
    padding: 40px;
    background: #f8fafc;
}

.tm-v2-panel {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding-right: 10px; /* Space for scrollbar */
}

.tm-v2-panel.active {
    display: block;
    animation: slideInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Cards Grid */
.tm-v2-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    height: 100%;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */
}

.tm-v2-grid::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}

/* Premium Task Card */
.tm-v2-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--tm-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    overflow: hidden;
    height: 360px; /* Fixed height for symmetry */
    min-height: 360px;
    max-height: 360px;
    box-sizing: border-box;
}

.tm-v2-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.12);
    border-color: var(--tm-primary-light);
}

.tm-v2-card.overdue {
    border-left: 5px solid var(--tm-danger);
}

.tm-v2-card.overdue::before {
    content: 'OVERDUE';
    position: absolute;
    top: 12px;
    right: -25px;
    background: var(--tm-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 4px 30px;
    transform: rotate(45deg);
}

.tm-v2-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.tm-v2-priority {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 10px;
    letter-spacing: 0.05em;
}

.tm-v2-priority.p1 { background: #fee2e2; color: #ef4444; border: 1.5px solid #fecaca; box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1); }
.tm-v2-priority.p2 { background: #ffedd5; color: #f97316; border: 1.5px solid #fed7aa; box-shadow: 0 2px 4px rgba(249, 115, 22, 0.1); }
.tm-v2-priority.p3 { background: #dbeafe; color: #3b82f6; border: 1.5px solid #bfdbfe; box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1); }
.tm-v2-priority.p4 { background: #f1f5f9; color: #64748b; border: 1.5px solid #e2e8f0; box-shadow: 0 2px 4px rgba(100, 116, 139, 0.1); }
.tm-v2-priority.urgent { background: #ef4444; color: white; }
.tm-v2-priority.high { background: #f97316; color: white; }
.tm-v2-priority.medium { background: #3b82f6; color: white; }
.tm-v2-priority.low { background: #94a3b8; color: white; }

.tm-v2-card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--tm-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.2rem;
}

.tm-v2-card-desc {
    font-size: 0.9rem;
    color: var(--tm-text-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Strict clamping to save space for UI elements */
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
    margin-bottom: 8px;
}

.tm-v2-progress-wrapper {
    margin: 8px 0;
    flex-shrink: 0; /* Ensure progress bar is never hidden */
}

.tm-v2-progress {
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.tm-v2-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tm-primary), var(--tm-primary-light));
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.tm-v2-card-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0; /* Ensure footer/buttons are never hidden */
}

.tm-v2-meta-wrap { display: flex; flex-direction: column; gap: 6px; }
.tm-v2-meta-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--tm-text-light); font-weight: 600; }
.tm-v2-meta-item.date span { font-size: 1.1rem; }

.tm-v2-avatar-group { display: flex; align-items: center; }
.tm-v2-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    margin-left: -12px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #475569;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.tm-v2-avatar:first-child { margin-left: 0; }

/* Card Action Buttons */
.tm-v2-card-action {
    padding: 10px 18px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: capitalize;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.tm-v2-card-action.start {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.tm-v2-card-action.start:hover {
    background: #0ea5e9;
    color: white;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.4);
    border-color: #0ea5e9;
}

.tm-v2-card-action.complete {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.tm-v2-card-action.complete:hover {
    background: #22c55e;
    color: white;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.4);
    border-color: #22c55e;
}

/* "Move to Todo" button in detail modal */
.tm-v2-btn-todo {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}
.tm-v2-btn-todo:hover {
    background: #f97316;
    color: white;
    border-color: #f97316;
    box-shadow: 0 6px 14px -3px rgba(249, 115, 22, 0.4);
    transform: translateY(-2px);
}

/* Detail View Refinement */
.tm-v2-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: none;
}
.tm-v2-detail-modal.active { display: block; }
.tm-v2-detail-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
}

.tm-v2-detail-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 1000px;
    max-width: 95vw;
    height: 900px;
    max-height: 95vh;
    background: white;
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUpCenter 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* Hide scrollbar for the modal content as well if needed, or keep it subtle */
.tm-v2-detail-body {
    scrollbar-width: thin;
    scrollbar-color: var(--tm-primary) transparent;
}

@keyframes slideUpCenter { 
    from { opacity: 0; transform: translate(-50%, -40%); } 
    to { opacity: 1; transform: translate(-50%, -50%); } 
}

.tm-v2-detail-header { padding: 32px 40px; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; }
.tm-v2-detail-body { flex: 1; overflow-y: auto; display: flex; padding: 40px; gap: 40px; }
.tm-v2-detail-main { flex: 1.8; display: flex; flex-direction: column; gap: 32px; }
.tm-v2-detail-main section h3 { margin-bottom: 16px; font-size: 1.1rem; color: var(--tm-text); font-weight: 800; }

.tm-v2-comment-input-wrap { 
    background: #f8fafc; 
    padding: 20px; 
    border-radius: 16px; 
    border: 1.5px solid var(--tm-border);
    margin-top: 12px;
}
#detailV2CommentInput {
    width: 100%;
    border: none;
    background: transparent;
    resize: none;
    min-height: 80px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--tm-text);
    outline: none;
    margin-bottom: 10px;
}
.tm-v2-comment-input-wrap:focus-within {
    border-color: var(--tm-primary);
    background: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.tm-v2-detail-sidebar { flex: 1; background: #f8fafc; padding: 32px; border-radius: 24px; display: flex; flex-direction: column; gap: 24px; border: 1px solid #f1f5f9; height: fit-content; }

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .tm-v2-detail-container { 
        width: 96vw; 
        height: 96vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 24px;
    }
}

@media (max-width: 768px) {
    .tm-v2-header { 
        padding: 12px; 
        height: auto; 
        flex-direction: column; 
        gap: 12px; 
    }
    
    .tm-v2-tabs { 
        width: 100%; 
        overflow-x: auto; 
        padding-bottom: 4px;
        justify-content: flex-start;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .tm-v2-tab {
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .tm-v2-controls { 
        width: 100%; 
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
    }

    .tm-v2-search-wrapper { 
        width: 100%; 
        order: 1; /* Move search below buttons on tiny screens if needed */
    }

    .tm-v2-content { padding: 16px; }
    
    .tm-v2-grid { 
        grid-template-columns: 1fr; 
        gap: 16px; 
    }

    .tm-v2-detail-header {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .tm-v2-detail-body { 
        flex-direction: column; 
        padding: 16px;
        gap: 24px;
    }

    .tm-v2-detail-sidebar { 
        order: -1; 
        padding: 20px;
    }
    
    .tm-v2-detail-main section h3 {
        font-size: 1rem;
    }

    /* New Task Modal Mobile Refinements */
    .tm-v2-form-row {
        grid-template-columns: 1fr !important; /* Stack everything on mobile */
        gap: 16px;
    }

    .tm-v2-new-content {
        max-height: 98vh;
        border-radius: 20px;
    }

    #newTaskV2Form {
        padding: 20px;
        gap: 16px;
    }

    .tm-v2-new-header {
        padding: 16px 20px;
    }

    .tm-v2-form-actions {
        flex-direction: column; /* Stack Cancel/Create buttons */
        gap: 10px;
    }

    .tm-v2-form-actions .btn {
        width: 100%;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .tm-v2-controls .btn-lg {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .tm-v2-controls .btn-icon {
        width: 36px;
        height: 36px;
    }
}

/* New Task V2 Modal Styles */
.tm-v2-new-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 10100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tm-v2-new-modal.active {
    display: flex;
}

.tm-v2-new-content {
    background: white;
    width: 100%;
    max-width: 650px;
    border-radius: 28px;
    box-shadow: 0 30px 60px -12px rgba(15, 23, 42, 0.3);
    overflow: hidden;
    animation: slideUpCenterNew 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    max-height: 95vh;
}

.tm-v2-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Adjust row with 3 items (Priority, Start, Due) */
.tm-v2-form-row:has(input[type="date"]) {
    grid-template-columns: 1fr 1fr 1fr;
}

.tm-v2-new-header {
    padding: 24px 32px;
    background: #f8fafc;
    border-bottom: 1px solid var(--tm-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tm-v2-new-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--tm-text);
}

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

.tm-v2-multi-select {
    min-height: 100px;
    padding: 12px !important;
}


#newTaskV2Form {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}


.tm-v2-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tm-v2-form-group label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--tm-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tm-v2-form-group input, 
.tm-v2-form-group textarea, 
.tm-v2-form-group select {
    padding: 12px 16px;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    background: #f8fafc;
}

.tm-v2-form-group input:focus, 
.tm-v2-form-group textarea:focus, 
.tm-v2-form-group select:focus {
    outline: none;
    border-color: var(--tm-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.tm-v2-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.tm-v2-attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.tm-v2-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.tm-v2-form-actions .btn {
    flex: 1;
    height: 48px;
    border-radius: 12px;
    font-weight: 700;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Dark Mode for New Task Modal */
body.dark-mode .tm-v2-new-content {
    background: #1e293b;
    color: white;
}

body.dark-mode .tm-v2-new-header {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .tm-v2-new-header h3 {
    color: white;
}

body.dark-mode .tm-v2-form-group input, 
body.dark-mode .tm-v2-form-group textarea, 
body.dark-mode .tm-v2-form-group select {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
    color: white;
}

body.dark-mode .tm-v2-form-group input:focus, 
body.dark-mode .tm-v2-form-group textarea:focus, 
body.dark-mode .tm-v2-form-group select:focus {
    border-color: var(--tm-primary);
    background: #1e293b;
}

/* Assignee List on Cards */
.tm-v2-card-assignees-list {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.8rem;
    color: var(--tm-text-light);
    font-weight: 600;
}

.tm-v2-card-assignee-name {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--tm-text);
}

/* Detail Modal Assignees */
.tm-v2-detail-assignee-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.tm-v2-detail-assignee-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--tm-text);
}

/* Custom Searchable List */
.tm-v2-searchable-list-wrap {
    border: 1.5px solid var(--tm-border);
    border-radius: 16px;
    overflow: hidden;
    background: #f8fafc;
}

.tm-v2-search-box {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--tm-border);
    gap: 12px;
}

.tm-v2-search-box i {
    color: var(--tm-text-light);
    font-size: 0.9rem;
}

.tm-v2-search-box input, .tm-v2-search-box select {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    font-size: 0.9rem;
    color: var(--tm-text);
}

.tm-v2-searchable-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tm-v2-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.tm-v2-list-item:hover {
    background: #f1f5f9;
}

.tm-v2-list-item.selected {
    background: #eff6ff;
}

.tm-v2-list-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tm-v2-count-badge {
    background: var(--tm-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    margin-left: 8px;
}

/* History Timeline Styling */
.tm-v2-history-item {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    position: relative;
}

.tm-v2-history-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 17px;
    top: 36px;
    bottom: -16px;
    width: 2px;
    background: #f1f5f9;
}

.tm-v2-history-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 1;
    flex-shrink: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.tm-v2-history-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
}

.tm-v2-history-main {
    font-size: 0.95rem;
    color: var(--tm-text);
}

.tm-v2-history-main strong {
    font-weight: 700;
}

.tm-v2-history-details {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--tm-text-light);
    flex-wrap: wrap;
}

.tm-v2-history-val {
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
}

.tm-v2-history-val.old { background: #f1f5f9; color: #64748b; }
.tm-v2-history-val.new { background: #eff6ff; color: #3b82f6; }
.tm-v2-history-arrow { color: #94a3b8; font-weight: 800; }

.tm-v2-history-time {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
}

.tm-v2-empty-state.small {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px dashed #e2e8f0;
}

/* Dark Mode Adjustments for History */
body.dark-mode .tm-v2-history-icon { background: #0f172a; border-color: rgba(255,255,255,0.1); }
body.dark-mode .tm-v2-history-main { color: #f1f5f9; }
body.dark-mode .tm-v2-history-val.old { background: #1e293b; color: #94a3b8; }
body.dark-mode .tm-v2-history-item:not(:last-child)::after { background: rgba(255,255,255,0.05); }




/* Full Task Manager V2 Dark Mode Overrides */
body.dark-mode .tm-v2-header {
    background: #1e293b;
    border-bottom-color: rgba(255,255,255,0.05);
}

body.dark-mode .tm-v2-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .tm-v2-search-wrapper {
    background: #0f172a;
}

body.dark-mode .tm-v2-search-wrapper:focus-within {
    background: #0f172a;
    border-color: var(--tm-primary);
}

body.dark-mode .tm-v2-close-btn {
    background: #0f172a;
}

body.dark-mode .tm-v2-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

body.dark-mode .tm-v2-content {
    background: #0f172a;
}

body.dark-mode .tm-v2-card {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}

body.dark-mode .tm-v2-card:hover {
    border-color: var(--tm-primary);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

body.dark-mode .tm-v2-card-title {
    color: #f8fafc;
}

body.dark-mode .tm-v2-card-desc {
    color: #94a3b8;
}

body.dark-mode .tm-v2-card-footer {
    border-top-color: rgba(255,255,255,0.05);
}

body.dark-mode .tm-v2-card-assignee-name {
    background: #0f172a;
    color: #f8fafc;
}

/* Searchable List Items (Assignees/Mentors) in Dark Mode */
body.dark-mode .tm-v2-searchable-list-wrap {
    background: #1e293b;
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .tm-v2-list-item {
    color: #cbd5e1;
}

body.dark-mode .tm-v2-list-item:hover {
    background: rgba(255,255,255,0.05);
}

body.dark-mode .tm-v2-list-item.selected {
    background: rgba(59, 130, 246, 0.2); /* var(--tm-primary) with transparency */
    color: #fff;
}

body.dark-mode .tm-v2-search-box input {
    background: #0f172a;
    color: #fff;
    border-color: rgba(255,255,255,0.1);
}


body.dark-mode .tm-v2-progress {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .tm-v2-detail-container {
    background: #1e293b;
    color: #f8fafc;
}

body.dark-mode .tm-v2-detail-header {
    border-bottom-color: rgba(255,255,255,0.05);
}

body.dark-mode .tm-v2-detail-sidebar {
    background: #0f172a;
    border-color: rgba(255,255,255,0.05);
}

body.dark-mode .tm-v2-comment-input-wrap {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode #detailV2CommentInput {
    color: #f8fafc;
}

body.dark-mode .tm-v2-searchable-list-wrap {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .tm-v2-search-box {
    background: #1e293b;
    border-bottom-color: rgba(255,255,255,0.1);
}

body.dark-mode .tm-v2-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .tm-v2-empty-state.small {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .tm-v2-tab-count {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .tm-v2-avatar {
    border-color: #1e293b;
}

body.dark-mode .tm-v2-card.overdue {
    border-left-color: #ef4444;
}

/* Export Presets Styling */
.tm-v2-export-presets .btn-subtle {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.tm-v2-export-presets .btn-subtle:hover {
    background: var(--tm-primary);
    color: white;
}

body.dark-mode .tm-v2-export-presets .btn-subtle {
    background: #0f172a;
    color: #94a3b8;
}

body.dark-mode .tm-v2-export-presets .btn-subtle:hover {
    background: var(--tm-primary);
    color: white;
}

/* Additional Dark Mode Refinements for Cards */
body.dark-mode .tm-v2-card-meta {
    color: #94a3b8;
}

body.dark-mode .tm-v2-card-meta-item i {
    color: var(--tm-primary);
}

body.dark-mode .tm-v2-card-date {
    background: rgba(255, 255, 255, 0.03);
    color: #f1f5f9;
}

body.dark-mode .tm-v2-card-id {
    color: #64748b;
}

body.dark-mode .tm-v2-list-item input[type="checkbox"] {
    accent-color: var(--tm-primary);
}

/* Integrated Step Input */
.tm-v2-step-add-wrap {
    background: #f8fafc;
    padding: 16px;
    border-radius: 16px;
    border: 2px dashed var(--tm-border);
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeInDown 0.3s ease-out;
}

.tm-v2-step-add-wrap.hidden {
    display: none;
}

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

#tmV2NewStepInput {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    color: var(--tm-text);
}

#tmV2NewStepInput:focus {
    border-color: var(--tm-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tm-v2-step-add-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Dark Mode support for new elements */
body.dark-mode .tm-v2-step-add-wrap {
    background: #0f172a;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode #tmV2NewStepInput {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ── Step Item Hover Delete Button ─────────────────────────────────────── */
.tm-v2-step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    margin-bottom: 8px;
    transition: background 0.2s, box-shadow 0.2s;
    position: relative;
}

.tm-v2-step-item:hover {
    background: #f0f4ff;
    border-color: #dde8ff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06);
}

.tm-v2-step-delete-btn {
    margin-left: auto;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.15s, color 0.15s;
    pointer-events: none;
}

.tm-v2-step-item:hover .tm-v2-step-delete-btn {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.tm-v2-step-delete-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Dark mode step item */
body.dark-mode .tm-v2-step-item {
    background: #0f172a;
    border-color: rgba(255,255,255,0.06);
    color: #cbd5e1;
}

body.dark-mode .tm-v2-step-item:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

body.dark-mode .tm-v2-step-delete-btn {
    color: #64748b;
}

body.dark-mode .tm-v2-step-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}
