:root {
    --primary-color: #f06a6a;
    --primary-hover: #e35555;
    --secondary-color: #6c757d;
    --success-color: #13ce66;
    --warning-color: #ffc82c;
    --danger-color: #ff4949;
    --bg-color: #fafbfc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #151b26;
    --text-secondary: #6d7683;
    --border-color: #e9ecef;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-nav {
    padding: 0 1rem 1rem 1rem;
    flex-shrink: 0;
}

.projects-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 1rem;
}

.projects-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    flex-shrink: 0;
}

.projects-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#projectsNav {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.nav-item:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-icon {
    font-size: 1.25rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0; /* Prevent footer from shrinking */
}

.filter-section {
    margin-bottom: 1rem;
}

.filter-section label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.filter-select {
    width: 100%;
    padding: 0.5rem;
    padding-right: 2.75rem; /* extra space for arrow */
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: white;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-repeat: no-repeat;
    background-position: right 0.9rem center; /* move chevron inwards */
    background-size: 10px 6px;
    /* subtle down chevron similar to custom select */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 106, 106, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.main-header {
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* align actions with title line */
    gap: 2rem;
    flex-wrap: wrap;
    flex-shrink: 0; /* Prevent header from shrinking */
}

/* Make header-left take full width so inner row can push actions right */
.header-left { flex: 1; }

.header-left h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.stats-inline {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Row that contains stats and header actions on the same line */
.stats-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: var(--bg-color);
    border-radius: 1rem;
    font-size: 0.875rem;
}

.stat-badge.completed {
    background-color: #e6f9f0;
}

.stat-badge.pending {
    background-color: #fff3e6;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-left: auto; /* push actions to the far right */
}

/* Keep project title and gear on one line */
#pageTitle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

/* Desktop avatar is clickable */
.sidebar #userAvatar { cursor: pointer; }

/* ===================================
   MOBILE LAYOUT
   =================================== */

/* Hide mobile elements on desktop by default */
.mobile-topbar,
.mobile-footer,
.mobile-create-wrap {
    display: none;
}

/* Mobile Top Bar Styles (only shown on mobile) */
.mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.625rem 0.75rem;
    padding-top: calc(0.625rem + env(safe-area-inset-top, 0px)); /* Account for notches */
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* Prevent topbar from shrinking */
}

.mobile-left,
.mobile-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1; /* allow left side to grow so select can be longer */
}

/* Project select in mobile topbar uses the custom select component */
.mobile-topbar .custom-select { flex: 1 1 auto; min-width: 0; max-width: 100%; }
.mobile-topbar .custom-select-trigger { padding: 0.5rem 2rem 0.5rem 0.75rem; font-size: 0.95rem; }

.mobile-select:hover {
    border-color: var(--primary-color);
}

.mobile-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 106, 106, 0.1);
}

.mobile-icon-btn {
    flex-shrink: 0; /* Don't shrink */
    padding: 0.5rem;
    font-size: 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    line-height: 1;
}

.mobile-icon-btn:active {
    background: var(--bg-elevated);
}

.mobile-avatar {
    flex-shrink: 0; /* Don't shrink */
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
    cursor: pointer;
}

/* Mobile Footer Styles */
.mobile-footer {
    position: sticky;
    bottom: 0;
    z-index: 90;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem;
    /* Add bottom padding to prevent native phone UI from covering footer */
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 20px));
    align-items: baseline; /* align grid items to baseline so labels align */
    gap: 1rem;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; /* Dropdowns flex with viewport */
    flex-shrink: 0; /* Prevent footer from shrinking */
}

.mobile-footer-item {
    display: flex;
    flex-direction: row;
    align-items: baseline; /* align text baselines of label and select */
    gap: 0.5rem;
}
.mobile-footer-item.archived { align-items: baseline; }
.mobile-footer-item.archived input[type="checkbox"] { position: relative; top: 2px; }

.mobile-footer-item label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0; /* let baseline alignment take effect */
    line-height: 1.25;
}

.mobile-footer-item select {
    flex: 1;
    padding: 0.75rem;
    padding-right: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: white;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 10px 6px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

/* Use custom select component in mobile footer too */
.mobile-footer .custom-select { width: 100%; min-width: 0; }
.mobile-footer .custom-select-trigger {
    padding: 0.6rem 2rem 0.6rem 0.75rem;
    font-size: 0.95rem;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-footer-item select:hover {
    border-color: var(--primary-color);
}

.mobile-footer-item select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 106, 106, 0.1);
}

/* Hide selected text when compact to keep only the arrow visible */
.mobile-footer .custom-select-trigger.compact .selected-container {
    display: none !important;
}

.mobile-footer-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Mobile Create Task Button (only shown on mobile) */
.mobile-create-wrap {
    padding: 1.5rem 0;
    text-align: center;
    justify-content: center;
}

.mobile-create-btn {
    width: 100%;
    max-width: 200px;
    padding: 1rem 1.5rem;
    font-size: 0.9375rem;
}

/* Mobile Media Query - Tablets and below */
@media (max-width: 768px) {
    /* Show mobile UI elements */
    .mobile-topbar,
    .mobile-footer,
    .mobile-create-wrap {
        display: flex;
    }

    /* Mobile footer uses grid layout */
    .mobile-footer {
        display: grid;
    }

    /* Hide desktop elements */
    .sidebar,
    .main-header {
        display: none !important;
    }

    /* Adjust main container */
    .app-container {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        margin: 0;
        padding: 0;
        min-height: 0; /* Critical: allows proper height calculation for scrolling */
    }

    .content-area {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        align-items: center; /* Center content horizontally */
        min-height: 0; /* Critical: allows flex child to scroll properly */
    }

    /* Ensure view content div doesn't interfere */
    .view-content {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Task list - switch from grid to flex column for mobile */
    .task-list {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        align-items: center; /* Center cards horizontally */
        padding: 0;
        padding-bottom: 1.5rem; /* Extra space at bottom for better scrolling */
    }

    .task-card-compact {
        width: 340px; /* Preferred width */
        max-width: calc(100vw - 2rem); /* Shrink if viewport is smaller */
        height: auto;
        min-height: 80px;
        margin: 0 auto; /* Ensure centered in viewport */
    }

    .task-card-compact .task-title {
        font-size: 0.9375rem;
        font-weight: 600;
    }

    .task-card-compact .task-description {
        font-size: 0.8125rem;
        margin-top: 0.25rem;
        line-height: 1.4;
    }

    /* Projects grid for mobile */
    .projects-grid {
        width: 100%;
        max-width: 600px;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding-bottom: 1.5rem; /* Extra space at bottom for better scrolling */
    }

    /* Modal optimizations for mobile */
    .modal-content {
        width: calc(100% - 2rem);
        max-width: calc(100% - 2rem);
        max-height: 85vh;
        margin: 1rem;
        padding: 1.25rem;
    }

    .modal-header {
        padding: 0 0 0.75rem 0;
        margin-bottom: 0.75rem;
    }

    .modal-header h2 {
        font-size: 1.125rem;
    }

    .modal-body {
        padding: 0;
    }

    .modal-footer {
        padding: 0.75rem 0 0 0;
        margin-top: 0.75rem;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    /* Form optimizations */
    .input-group {
        margin-bottom: 0.875rem;
    }

    /* Stack form rows vertically on mobile */
    .form-row {
        grid-template-columns: 1fr !important;
    }

    .input-group label {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
    }

    .input-group input,
    .input-group select,
    .input-group textarea {
        font-size: 0.9375rem;
        padding: 0.625rem 0.75rem;
        box-sizing: border-box;
    }

    /* Task details modal compactness */
    #taskDetailsModal .modal-content {
        padding: 1rem;
    }

    #taskDetailsModal .task-detail-section {
        margin-bottom: 0.75rem;
    }

    #taskDetailsModal .task-detail-label {
        font-size: 0.75rem;
    }

    #taskDetailsModal .task-detail-value {
        font-size: 0.875rem;
    }

    /* Empty state adjustments */
    .empty-state {
        padding: 2rem 1rem;
        width: 100%;
        max-width: 400px;
    }

    .empty-state-icon {
        font-size: 2.5rem;
    }

    .empty-state h3 {
        font-size: 1.125rem;
    }

    .empty-state p {
        font-size: 0.875rem;
    }

    /* Project Settings - Add Member Section Mobile Optimization */
    .add-member-section {
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .add-member-section .form-select {
        flex: 0 1 auto;
        min-width: 140px;
        max-width: none; /* Allow expansion when dropdown is opened */
        width: auto;
        font-size: 0.875rem;
    }

    .add-member-section .btn-primary {
        flex-shrink: 0;
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }

    /* Shorten "Add Member" to "Add" on mobile */
    .add-member-section .btn-text-full {
        display: none;
    }

    #addMemberBtn {
        white-space: nowrap;
        padding: 0.625rem 0.875rem;
    }

    /* Member list items - prevent name overflow */
    .member-item {
        gap: 0.5rem;
    }

    .member-info {
        flex: 1;
        min-width: 0; /* Allow shrinking */
        overflow: hidden;
    }

    .member-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .member-actions {
        flex-shrink: 0; /* Prevent remove button from shrinking */
    }

    /* Smaller member avatar on mobile */
    .member-avatar {
        width: 20px;
        height: 20px;
    }

    /* Mobile-specific styles for member buttons (already handled in main styles) */

    /* Mobile Tab Optimizations */
    .modal-tabs {
        margin: 0 -1.25rem; /* Extend to modal edges */
        padding: 0 0.5rem;
    }

    .tab-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
        min-height: 44px; /* Touch-friendly */
        gap: 0.25rem;
    }

    .tab-icon {
        font-size: 1rem;
    }

    /* On very small screens, hide tab label and show only icon */
    @media (max-width: 360px) {
        .tab-label {
            display: none;
        }

        .tab-btn {
            flex-direction: column;
            gap: 0.125rem;
        }
    }

    /* Adjust tab footer spacing on mobile */
    .tab-footer {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
}

.search-input {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    width: 250px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 106, 106, 0.1);
}

.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background-color: #5a6268;
}

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

.btn-danger:hover {
    background-color: #e63939;
}

/* Extra small button for inline actions on cards */
.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1;
}

.task-delete-btn {
    margin-left: 0.5rem;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    min-height: 0; /* Critical: allows flex child to scroll properly */
    scroll-behavior: smooth; /* Smooth scrolling */
}

/* Scrollbar styling for content area */
.content-area::-webkit-scrollbar {
    width: 10px;
}

.content-area::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.content-area::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.content-area::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.task-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, 340px);
    gap: 1rem;
    justify-content: center; /* Center grid when it doesn't fill full width */
    padding-bottom: 1rem; /* Add space at bottom for better scrolling UX */
}

/* Compact Task Card */
.task-card-compact {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    border-left-style: solid;
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    width: 340px;
    height: 110px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.task-card-compact:hover {
    box-shadow: var(--shadow);
    background-color: #fafafa;
}

.task-card-compact.completed .task-title-compact {
    text-decoration: line-through;
    opacity: 0.6;
}

.task-card-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    min-width: 20px;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Expand touch area to 44px (20px + 12px padding on each side) */
    padding: 12px;
    margin: -10px;
    margin-right: 2px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
}

@media (hover: hover) {
    .task-checkbox:hover {
        border-color: var(--primary-color);
        background-color: #fff5f5;
    }
}

.task-checkbox:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.task-checkbox.checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.task-checkbox.updating {
    opacity: 0.7;
    animation: pulse-checkbox 0.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse-checkbox {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 0.9;
    }
}

.task-checkbox .checkmark {
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.task-title-compact {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.priority-triangle {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 26px 26px 0;
    z-index: 1;
    pointer-events: none;
    border-top-right-radius: 0.5rem;
}

.task-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-due {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.task-due.overdue {
    color: var(--danger-color);
    font-weight: 600;
}

.task-project-badge {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.project-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Larger variant for details views */
.project-color-dot-lg {
    width: 14px;
    height: 14px;
}

.project-abbr {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.task-footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assignee-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    flex-shrink: 0;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.task-title-section {
    flex: 1;
}

.complete-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.complete-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(240, 106, 106, 0.25);
}

.complete-btn.completed {
    background: var(--success-color);
}

.complete-btn.completed:hover {
    background: #10b956;
}

.task-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.task-project {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
}

.task-btn {
    background: none;
    border: none;
    padding: 0.375rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.125rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.task-btn:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.task-btn.delete:hover {
    background-color: #ffe6e6;
    color: var(--danger-color);
}

.task-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    cursor: pointer;
    transition: all 0.2s;
}

.task-description.expanded {
    -webkit-line-clamp: unset;
    display: block;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.task-meta-left {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.task-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.task-meta-label {
    color: var(--text-secondary);
}

.task-meta-value {
    color: var(--text-primary);
    font-weight: 600;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-status {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-status.pending {
    background-color: #ffe6e6;
    color: #c92a2a;
}

.task-status.in-progress {
    background-color: #fff3e6;
    color: #e67700;
}

.task-status.completed {
    background-color: #e6f9f0;
    color: #0f7d3f;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background-color: white;
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    /* Let dropdowns escape without scrolling the modal container */
    overflow: visible;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s;
    margin: 1rem;
    display: flex;
    flex-direction: column;
}

/* Project Settings layout refinements */
.settings-section { margin-bottom: 0.75rem; }
.settings-section h3 { margin: 0 0 0.5rem 0; font-size: 1rem; }
.info-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; }
.info-label { width: 90px; color: var(--text-secondary); font-weight: 600; font-size: 0.875rem; }
.info-value { color: var(--text-primary); font-size: 0.95rem; }
.add-member-section { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1rem; }
.add-member-section .form-select {
    flex: 0 1 auto;
    min-width: 180px;
    max-width: 300px;
    width: auto;
}
.add-member-section .btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    white-space: nowrap;
}
.add-member-section .btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}
.members-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 0.5rem; padding: 0.5rem; background: var(--card-bg); }
.member-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem; border-bottom: 1px solid var(--border-color); }
.member-item:last-child { border-bottom: none; }
.member-info { display: flex; align-items: center; gap: 0.5rem; }
.member-avatar { width: 28px; height: 28px; background: #e9ecef; border-radius: 50%; }
.member-details { display: flex; flex-direction: column; }
.member-name { font-size: 0.9375rem; font-weight: 600; }
.member-role { font-size: 0.75rem; color: var(--text-secondary); }
/* member-actions button styles moved to specific button classes */

/* Tab Navigation for Project Settings Modal */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    gap: 0;
    background: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tab-btn {
    flex: 1;
    padding: 0.875rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: -2px;
    position: relative;
}

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

.tab-btn.active {
    color: var(--primary-color);
    font-weight: 600;
    border-bottom-color: var(--primary-color);
}

.tab-icon {
    font-size: 1.125rem;
}

.tab-label {
    /* Full label shown by default */
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

.tab-panel.active {
    display: block;
}

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

/* Tab Footer for actions like Delete button */
.tab-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.tab-footer .btn {
    /* Delete button styling already handled by .btn-danger */
}

/* Remove Member Button - Circular X button */
.remove-member-btn,
.leave-project-btn {
    background: var(--danger-color, #ff4949);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 300;
}

.remove-member-btn:hover,
.leave-project-btn:hover {
    background: #e63939;
    transform: scale(1.1);
}

.modal-small {
    max-width: 400px;
}

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

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

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.close-btn:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0; /* allow flex child to shrink for scrolling */
}

#taskForm,
#projectForm {
    padding: 1.5rem;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.required {
    color: var(--danger-color);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-select {
    padding-right: 2.5rem;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 106, 106, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.color-picker-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-input {
    display: none; /* replaced by preset radio-style buttons */
}

.color-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-preset {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: var(--text-primary);
}

.color-preset.selected {
    border-color: #000; /* permanent black border for selected color */
    transform: none;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Split footer: left and right groups */
.modal-footer.split {
    justify-content: space-between;
}
.modal-footer.split .footer-right {
    display: inline-flex;
    gap: 1rem;
}

/* Custom Dropdown */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    padding: 0.75rem;
    padding-right: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: white;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-select-trigger:hover {
    border-color: var(--primary-color);
}

.custom-select-trigger:focus,
.custom-select.open .custom-select-trigger {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(240, 106, 106, 0.1);
}

.custom-select-trigger .arrow {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-secondary);
    transition: transform 0.2s;
}

.custom-select.open .custom-select-trigger .arrow {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-trigger .placeholder {
    color: var(--text-secondary);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 250px;
    overflow-y: auto;
    overscroll-behavior: contain; /* prevent scroll chaining to modal */
    z-index: 1000;
    display: none;
}

.custom-select.open .custom-select-dropdown {
    display: block;
}

/* Open upwards when there isn't enough space below */
.custom-select.open-up .custom-select-dropdown {
    top: auto;
    bottom: calc(100% + 0.25rem);
}

.custom-select-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-primary);
    font-size: 0.9375rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.custom-select-option:hover {
    background-color: #f5f5f5;
}

.custom-select-option.selected {
    background-color: var(--primary-color);
    color: white;
}

.custom-select-option.selected:hover {
    background-color: #e05555;
}

/* Scrollbar styling for custom dropdown */
.custom-select-dropdown::-webkit-scrollbar {
    width: 8px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0.5rem;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 0.5rem;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Priority indicator dot for selects */
.priority-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Inline priority triangle marker (right-pointing) */
.priority-triangle-inline {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px; /* top right bottom left */
    border-color: transparent transparent transparent; /* left border color set inline */
    display: inline-block;
}

/* Responsive Design - All mobile styles consolidated at 768px breakpoint above */

/* Loading State */
.tab-footer.danger-zone {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.tab-footer.danger-zone h3 {
    margin: 0;
    font-size: 0.8125rem;
    color: #dc2626;
    font-weight: 600;
}

.settings-section.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.settings-section.danger-zone h3 {
    margin: 0;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}
