/* SVG Icon Styles */
.icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Icon size variants */
.icon-sm {
    width: 16px;
    height: 16px;
}

.icon-md {
    width: 20px;
    height: 20px;
}

.icon-lg {
    width: 32px;
    height: 32px;
}

.icon-xl {
    width: 48px;
    height: 48px;
}

:root {
    /* Light theme (default) */
    --bg: #ffffff;
    --bg-secondary: #f9fafb;
    --card: #ffffff;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --primary-dark: #1e40af;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --muted: #6b7280;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --text: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-light: #9ca3af;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Shadows - clean and subtle */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;

    /* Calendar (iPhone-style red accent) */
    --calendar-accent: #e53935;

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-fast: all 0.15s ease;
}

/* Dark theme variants */
[data-theme="dark"] {
    --bg: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --card: #2d2d2d;
    --primary: #60a5fa;
    --primary-hover: #3b82f6;
    --primary-light: rgba(96, 165, 250, 0.15);
    --primary-dark: #2563eb;
    --calendar-accent: #ef5350;
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --muted: #9ca3af;
    --border: #404040;
    --border-light: #525252;
    --text: #f5f5f5;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --text-light: #9ca3af;

    /* Dark theme shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.6), 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
}

/* Dark Blue Theme */
[data-theme="dark-blue"] {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --card: #1e293b;
    --primary: #60a5fa;
    --primary-hover: #3b82f6;
    --primary-light: rgba(96, 165, 250, 0.15);
    --primary-dark: #2563eb;
    --calendar-accent: #ef5350;
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --muted: #94a3b8;
    --border: #334155;
    --border-light: #475569;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #94a3b8;

    /* Dark blue shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

/* Dark Purple Theme */
[data-theme="dark-purple"] {
    --bg: #1a1625;
    --bg-secondary: #2d2438;
    --card: #2d2438;
    --primary: #a78bfa;
    --primary-hover: #8b5cf6;
    --primary-light: rgba(167, 139, 250, 0.15);
    --primary-dark: #7c3aed;
    --calendar-accent: #ef5350;
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --muted: #a8a29e;
    --border: #44403c;
    --border-light: #57534e;
    --text: #f5f3ff;
    --text-secondary: #d8b4fe;
    --text-muted: #a8a29e;
    --text-light: #c4b5fd;

    /* Purple theme shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.6), 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
}

/* Dark Green Theme */
[data-theme="dark-green"] {
    --bg: #0d1b0f;
    --bg-secondary: #1c2e20;
    --card: #1c2e20;
    --primary: #34d399;
    --primary-hover: #10b981;
    --primary-light: rgba(52, 211, 153, 0.15);
    --primary-dark: #059669;
    --calendar-accent: #ef5350;
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --muted: #9ca3af;
    --border: #374151;
    --border-light: #4b5563;
    --text: #f0fdf4;
    --text-secondary: #bbf7d0;
    --text-muted: #9ca3af;
    --text-light: #86efac;

    /* Green theme shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.6), 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    min-width: 320px;
}

/* Responsive base setup - prevent horizontal scrolling */
html {
    overflow-x: hidden;
}

/* Responsive base: prevent horizontal scroll and respect viewport */
html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    min-width: 0;
}

/* Prevent mobile browser zoom on input/textarea focus (iOS Safari zooms when font-size < 16px) */
@media screen and (max-width: 768px) {

    input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="hidden"]),
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Ensure all containers respect viewport width */
.container,
.dashboard-container,
.main-content {
    width: 95%;
    max-width: 95%;
    /* overflow-x: hidden; */
    margin: 0px auto;
    padding: var(--spacing-md);
}

/* Prevent text from causing overflow */
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
div {
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* Exclude iframes from word-break rules */
iframe {
    word-wrap: normal !important;
    word-break: normal !important;
    hyphens: none !important;
}

/* Override for modal content to prevent character-by-character breaking */
.modal-content h1,
.modal-content h2,
.modal-content h3,
.modal-content h4,
.modal-content h5,
.modal-content h6,
.modal-content p,
.modal-content span,
#companyManagementContent h1,
#companyManagementContent h2,
#companyManagementContent h3,
#companyManagementContent h4,
#companyManagementContent h5,
#companyManagementContent h6,
#companyManagementContent p,
#companyManagementContent span {
    word-break: normal !important;
    word-wrap: normal !important;
    overflow-wrap: break-word;
    white-space: normal !important;
}

/* Flexbox items shouldn't overflow */
.flex,
.d-flex {
    min-width: 0;
}

.flex>*,
.d-flex>* {
    min-width: 0;
    flex-shrink: 1;
}

/* Grid items responsive */
.grid,
.dashboard-stats,
.dashboard-main {
    width: 100%;
    max-width: 100%;
}

/* Media elements scale within containers */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    /* padding: 0 var(--spacing-lg); */
}

/* Main content area for SPA navigation */
/* .main-content {
    min-height: calc(100vh - 120px);
} */

.main-content .container {
    transition: opacity 0.2s ease;
}

/* Company Brand Bar */
.brand-bar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1001;
    color: var(--text);
}

.brand-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    gap: 2rem;
    min-width: 0;
}

.company-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.company-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.company-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* Company Switcher */
.company-switcher-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    margin-left: 0.5rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.company-switcher-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.company-switcher-btn .icon {
    width: 18px;
    height: 18px;
}

.company-brand {
    position: relative;
}

.company-switcher-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.company-switcher-dropdown.show {
    display: block;
}

.company-switcher-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.company-switcher-loading {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.company-switcher-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-light);
}

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

.company-switcher-item:hover {
    background: var(--bg-secondary);
}

.company-switcher-item.current {
    background: rgba(0, 102, 255, 0.1);
    border-left: 3px solid var(--primary);
}

.company-switcher-logo {
    font-size: 32px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
    font-size: 14px;
    flex-shrink: 0;
}

.company-switcher-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.company-switcher-info {
    flex: 1;
    min-width: 0;
}

.company-switcher-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-switcher-role {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.company-switcher-current {
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Header */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border-light);
    padding: 0;
    margin-bottom: 0;
    position: sticky;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    border-top: 1px solid var(--border-light);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    gap: 2rem;
    min-width: 0;
}

.logo {
    min-width: 170px;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: opacity 0.2s;
    min-width: 0;
    gap: 0.35rem;
}

.logo-link [data-brand-name] {
    overflow-wrap: break-word;
    word-break: break-word;
}

.logo-link .icon {
    margin-right: 0;
    color: var(--primary);
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.logo-link:hover {
    opacity: 0.7;
}

.logo-link .icon {
    margin-right: var(--spacing-sm);
    color: var(--primary);
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--spacing-sm);
    color: var(--text);
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    background: var(--bg-secondary);
}

.mobile-menu-toggle .icon {
    width: 24px;
    height: 24px;
}

.nav {
    display: flex;
    gap: var(--spacing-xs);
    flex: 1;
    justify-content: center;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    position: relative;
}

.nav::-webkit-scrollbar {
    height: 4px;
}

.nav::-webkit-scrollbar-track {
    background: transparent;
}

.nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Navigation scroll fade indicator */
@media (min-width: 769px) {
    .nav::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 4px;
        width: 40px;
        background: linear-gradient(to left, var(--card), transparent);
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.2s ease;
        z-index: 1;
    }

    .nav:not(.scrolled-end)::after {
        opacity: 1;
    }
}

/* Desktop: Show navigation always */
@media (min-width: 769px) {
    .nav {
        display: flex !important;
        position: relative;
        width: auto;
        height: auto;
        background: transparent;
        box-shadow: none;
        flex-direction: row;
        gap: var(--spacing-xs);
        padding: 0;
        z-index: auto;
        transition: none;
        overflow-y: visible;
        overflow-x: auto;
        border-right: none;
        justify-content: flex-start;
        flex: 1 1 auto;
        min-width: 0;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        cursor: grab;
    }

    .nav:active {
        cursor: grabbing;
    }
}

/* Tablet: balanced header and nav so top looks good when nav wraps */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-content {
        padding: 0.75rem 1rem;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .logo {
        max-width: 200px;
        flex-shrink: 1;
    }

    .logo-link [data-brand-name] {
        white-space: normal;
        line-height: 1.25;
    }

    .nav {
        flex: 1 1 auto;
        min-width: 280px;
        justify-content: flex-start;
        gap: 0.35rem;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .nav a {
        padding: 0.35rem 0.5rem;
        font-size: 12px;
    }

    .nav a .icon {
        width: 16px;
        height: 16px;
    }

    .nav-divider {
        height: 16px;
        margin: 0 0.2rem;
    }
}

/* Narrow desktop: fit nav on one line where possible */
@media (min-width: 901px) and (max-width: 1024px) {
    .nav a {
        padding: 0.4rem 0.6rem;
        font-size: 13px;
    }

    .nav a .icon {
        width: 18px;
        height: 18px;
    }
}

.nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
    font-size: 14px;
    position: relative;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav a .icon {
    width: 20px;
    height: 20px;
}

.nav a:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.nav a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav a.active .icon {
    color: var(--primary);
}

.nav a.active::after {
    display: none;
}

.nav-link-support {
    position: relative;
}

.nav-link-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    margin-left: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    background: var(--primary);
    border-radius: 999px;
}

/* Hide sidebar-specific elements on desktop */
.sidebar-user-profile,
.sidebar-divider,
.sidebar-logout {
    display: none;
}

/* Hide mobile-only elements on desktop */
.mobile-only {
    display: none !important;
}

/* Navigation dividers for compartmentalization */
.nav-divider {
    display: none;
}

@media (min-width: 769px) {
    .nav-divider {
        display: block;
        width: 1px;
        height: auto;
        background: var(--border);
        margin: 0 var(--spacing-sm);
        flex-shrink: 0;
    }

    /* Ensure mobile-only items are completely hidden on desktop */
    .mobile-only {
        display: none !important;
    }
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.notification-badge {
    position: relative;
    text-decoration: none;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-sm);
    border-radius: 50%;
    transition: var(--transition);
}

.notification-badge:hover {
    background: var(--bg-secondary);
}

.notification-badge .icon {
    width: 22px;
    height: 22px;
}

.support-link {
    text-decoration: none;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    border-radius: 50%;
    transition: var(--transition);
}

.support-link:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.support-link .icon {
    width: 22px;
    height: 22px;
}

/* White Label – Custom Favicon block */
.wl-favicon-group .form-hint {
    color: var(--text-light);
    font-size: 0.875rem;
    display: block;
    margin-top: 0.5rem;
}

.wl-favicon-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.wl-favicon-upload {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}

.wl-favicon-upload:hover {
    border-color: var(--primary);
    background: var(--border-light);
}

.wl-favicon-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.wl-favicon-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.wl-favicon-placeholder .icon {
    width: 28px;
    height: 28px;
}

.wl-favicon-overlay {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s;
}

.wl-favicon-upload:hover .wl-favicon-overlay {
    opacity: 1;
}

.wl-favicon-overlay .icon {
    width: 20px;
    height: 20px;
}

.wl-favicon-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.wl-favicon-actions {
    display: flex;
    align-items: center;
}

.wl-favicon-remove-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.wl-favicon-remove-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}

.badge {
    width: 20px;
    height: 20px;
    position: absolute;
    top: 2px;
    right: -5px;
    background: var(--danger);
    color: white;
    border-radius: 10px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid white;
}

.user-name {
    color: var(--text);
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    font-size: 14px;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.user-name:hover {
    background: var(--bg-secondary);
}

.user-name .icon {
    width: 20px;
    height: 20px;
    margin-right: var(--spacing-xs);
    color: var(--text-light);
}

.header-user-avatar-wrap {
    flex-shrink: 0;
    margin-right: var(--spacing-sm);
}

.header-user-avatar-wrap .header-user-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
}

.header-user-avatar-wrap .header-user-avatar.has-image {
    background-color: transparent;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.user-dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0.75rem 1rem;
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item.logout-item {
    color: var(--danger);
}

.dropdown-item.logout-item:hover {
    background: var(--danger-light);
}

.dropdown-item .icon {
    width: 18px;
    height: 18px;
}

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

.dropdown-arrow {
    transition: transform 0.2s ease;
    margin-left: var(--spacing-xs);
}

.user-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* Global New dropdown (header) */
.global-new-dropdown {
    position: fixed;
    right: calc(1rem + env(safe-area-inset-right));
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 12000;
    flex-shrink: 0;
}

.global-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    font-size: 14px;
    width: 48px;
    height: 48px;
    border-radius: 50% !important;
    padding: 0 !important;
    background: var(--primary);
    color: #fff;
    border: 1px solid color-mix(in srgb, var(--primary) 72%, var(--text) 28%);
    box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--primary) 22%, transparent);
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.global-new-btn:hover {
    background: var(--primary-hover);
    color: #fff;
    border-color: color-mix(in srgb, var(--primary-hover) 70%, var(--text) 30%);
    box-shadow: var(--shadow-xl), 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent);
}

.global-new-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.global-new-btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-lg), 0 0 0 3px color-mix(in srgb, var(--primary) 32%, transparent);
}

.global-new-btn .icon:first-child {
    width: 40px;
    height: 40px;
}

.global-new-dropdown .dropdown-arrow {
    margin-left: 0.15rem;
}

.global-new-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.global-new-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 1001;
    overflow: hidden;
}

.global-new-menu.show {
    display: block;
}

.global-new-menu .dropdown-item {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 1024px) {
    .global-new-btn {
        width: 48px !important;
        height: 48px !important;
        box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--primary) 24%, transparent);
    }

    .global-new-menu {
        bottom: calc(100% + 10px);
    }
}

@media (max-width: 768px) {
    .global-new-dropdown {
        position: fixed;
        right: calc(1rem + env(safe-area-inset-right));
        bottom: calc(5.75rem + env(safe-area-inset-bottom));
        z-index: 12000;
    }

    .global-new-btn {
        width: 58px !important;
        height: 58px !important;
        border-radius: 50% !important;
        box-shadow: var(--shadow-xl), 0 8px 22px color-mix(in srgb, var(--primary) 30%, transparent);
    }

    .global-new-btn .icon:first-child {
        width: 28px;
        height: 28px;
    }

    .global-new-menu {
        min-width: 210px;
        border-radius: 12px;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0.9rem;
        right: 0.9rem;
        bottom: calc(0.7rem + env(safe-area-inset-bottom));
        z-index: 999;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
        background: color-mix(in srgb, var(--card) 88%, var(--primary) 12%);
        border: 1px solid color-mix(in srgb, var(--border) 72%, var(--primary) 28%);
        border-radius: 16px;
        padding: 0.75rem;
        box-shadow: var(--shadow-xl);
    }


    .mobile-bottom-nav-link {
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 0.95rem;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        padding: 0.45rem 0.3rem;
        border-radius: 10px;
        border: 1px solid transparent;
        transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
    }

    .mobile-bottom-nav-link:hover,
    .mobile-bottom-nav-link:focus-visible {
        color: var(--text);
        background: color-mix(in srgb, var(--primary-light) 70%, transparent);
        border-color: color-mix(in srgb, var(--primary) 32%, transparent);
        outline: none;
    }

    .mobile-bottom-nav-link span {
        white-space: nowrap;
    }

    .mobile-bottom-nav-link .icon {
        width: 18px;
        height: 18px;
    }

    .mobile-bottom-nav-link.active {
        color: #fff;
        background: var(--primary);
        border: 1px solid color-mix(in srgb, var(--primary) 76%, var(--text) 24%);
        box-shadow: 0 1px 0 color-mix(in srgb, var(--primary-dark) 44%, transparent);
    }

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

@media (max-width: 360px) {
    .global-new-dropdown {
        right: calc(0.65rem + env(safe-area-inset-right));
        bottom: calc(4.9rem + env(safe-area-inset-bottom));
    }

    .global-new-btn {
        width: 52px !important;
        height: 52px !important;
    }

    .global-new-btn .icon:first-child {
        width: 24px;
        height: 24px;
    }

    .mobile-bottom-nav {
        left: 0.55rem;
        right: 0.55rem;
        gap: 0.15rem;
        padding: 0.55rem 0.45rem;
    }

    .mobile-bottom-nav-link {
        font-size: 0.82rem;
        gap: 0.2rem;
        padding: 0.35rem 0.12rem;
    }

    .mobile-bottom-nav-link .icon {
        width: 14px;
        height: 14px;
    }

    .dashboard-redesign {
        padding: 1rem 0.72rem 6rem;
        border-radius: 14px;
    }

    .dashboard-redesign .dashboard-rd-header h1 {
        font-size: 2rem;
    }

    .dashboard-redesign .dashboard-rd-subtitle {
        font-size: 0.95rem;
    }

    .dashboard-redesign .dashboard-rd-stats-grid {
        gap: 0.62rem;
    }

    .dashboard-redesign .dashboard-rd-stat {
        min-height: 76px;
        padding: 0.62rem 0.5rem;
    }

    .dashboard-redesign .dashboard-rd-stat-value {
        font-size: 1.72rem;
    }

    .dashboard-redesign .dashboard-rd-stat-label {
        font-size: 0.7rem !important;
        gap: 0.22rem;
    }

    .dashboard-redesign .dashboard-rd-feed-top {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .dashboard-redesign .dashboard-rd-feed-item {
        padding: 0.54rem 0.52rem;
    }
}

.btn-logout {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    border: 1px solid var(--border);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-weight: 500;
    font-size: 14px;
}

.btn-logout:hover {
    background: var(--card);
    border-color: var(--border);
    color: var(--text);
}

.btn-logout .icon {
    width: 18px;
    height: 18px;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    /* padding: var(--spacing-xl); */
    background: var(--bg-secondary);
}

.auth-card {
    background: var(--card);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-light);
}

.auth-brand-logo {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.auth-brand-logo img {
    max-width: 120px;
    max-height: 64px;
    object-fit: contain;
}

.auth-card h1 {
    margin-bottom: var(--spacing-xl);
    text-align: center;
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.auth-links {
    margin-top: var(--spacing-lg);
    text-align: center;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    display: block;
    margin-top: var(--spacing-sm);
    font-size: 14px;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Auth pages – responsive */
@media (max-width: 480px) {
    .auth-container {
        /* padding: var(--spacing-md); */
        align-items: flex-start;
        padding-top: var(--spacing-xl);
    }

    .auth-card {
        padding: var(--spacing-lg);
        max-width: none;
    }

    .auth-card h1 {
        font-size: 24px;
        margin-bottom: var(--spacing-lg);
    }

    .auth-links a {
        white-space: normal;
        word-break: normal;
        hyphens: none;
    }
}

@media (max-width: 768px) {

    .auth-card {
        padding: var(--spacing-xl);
    }
}

.auth-password-row {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 480px) {
    .auth-password-row {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-password-row .btn {
        width: 100%;
    }
}

/* Forms - Kit.com style */
/* .form-group {
    margin-bottom: var(--spacing-lg);
} */

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: var(--transition);
    background: var(--card);
    color: var(--text);
    font-family: inherit;
}

.form-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\' fill=\'%23666\'%3E%3Cpath d=\'M7 10l5 5 5-5z\'/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    cursor: pointer;
}

/* Ensure invite role select always shows chevron */
#invite-role {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
    background: var(--card) url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\' fill=\'%23666\'%3E%3Cpath d=\'M7 10l5 5 5-5z\'/%3E%3C/svg%3E') no-repeat right 0.75rem center / 1.25rem;
}

[data-theme="dark"] .form-group select,
[data-theme="dark-green"] .form-group select {
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\' fill=\'%23aaa\'%3E%3Cpath d=\'M7 10l5 5 5-5z\'/%3E%3C/svg%3E');
}

[data-theme="dark"] #invite-role,
[data-theme="dark-blue"] #invite-role,
[data-theme="dark-purple"] #invite-role,
[data-theme="dark-green"] #invite-role {
    background: var(--card) url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\' fill=\'%23aaa\'%3E%3Cpath d=\'M7 10l5 5 5-5z\'/%3E%3C/svg%3E') no-repeat right 0.75rem center / 1.25rem;
}

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

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
    border-color: var(--border);
}

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

#group-color[type="hidden"],
#project-color {
    width: 60px;
    height: 50px;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 5px;
}

.group-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: 0.25rem;
}

.group-color-swatch {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.group-color-swatch:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.group-color-swatch.is-selected {
    border-color: var(--text);
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text);
}

.group-color-swatch:disabled.is-used {
    cursor: not-allowed;
    opacity: 0.5;
    position: relative;
}

.group-color-swatch:disabled.is-used::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.15) 2px,
            rgba(0, 0, 0, 0.15) 4px);
    border-radius: inherit;
}

.group-side-border-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-weight: 500;
}

.group-side-border-toggle-wrap input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
}

.form-group select[multiple] {
    min-height: 120px;
}

.form-group small {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 13px;
    color: var(--text-muted);
}

/* Create task modal inline error */
.create-task-modal-error {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--danger-light, #fef2f2);
    border: 1px solid var(--danger, #dc2626);
    border-radius: var(--radius-md, 6px);
    color: var(--danger, #b91c1c);
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Password visibility toggle */
.password-input-wrap {
    align-items: stretch;
}

.password-input-wrap input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.password-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--spacing-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.password-toggle-btn:hover {
    color: var(--text);
    background: var(--border-light);
}

.password-toggle-btn .icon {
    width: 20px;
    height: 20px;
}

/* Buttons - Kit.com style */
.btn {
    padding: var(--spacing-md) var(--spacing-xl);
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-weight: 500;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    border: none;
}

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

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.625rem 1.25rem;
    font-weight: 500;
}

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

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-danger .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
    border: none;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-warning:hover {
    background: var(--warning-dark, #d97706);
    transform: translateY(-1px);
}

.btn-warning .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-primary,
.btn-secondary {
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-1px);
}

.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 14px;
}

/* Alerts */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

[data-theme^="dark"] .alert-error {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.4);
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

[data-theme^="dark"] .alert-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
    border-color: rgba(52, 211, 153, 0.4);
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fcd34d;
}

[data-theme^="dark"] .alert-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.4);
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

[data-theme^="dark"] .alert-info {
    background: rgba(96, 165, 250, 0.15);
    color: var(--primary);
    border-color: rgba(96, 165, 250, 0.4);
}

/* Dashboard */
.dashboard {
    padding: 1rem 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.dashboard-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.02em;
}

.dashboard-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0;
}

/* Statistics Cards */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-row {
    display: contents;
}

/* Desktop: Show all stats in one row */
@media (min-width: 769px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 20px;
    }
}

.stat-card {
    background: var(--card);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: var(--primary-light);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    display: flex;
}

.stat-card-link:hover {
    color: inherit;
}

.stat-icon {
    font-size: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon-success {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon-info {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.stat-icon-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-icon .icon {
    width: 24px;
    height: 24px;
    font-weight: 500;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.375rem;
    font-feature-settings: 'tnum';
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.stat-subtext {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-top: 0.25rem;
    line-height: 1.2;
}

/* Special styling for important stats */
.stat-card.stat-highlight {
    background: var(--card);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.stat-card.stat-highlight .stat-value {
    color: var(--primary);
}

.stat-card.stat-urgent {
    background: var(--card);
    border-color: var(--danger);
    animation: pulse-urgent 2s infinite;
}

@keyframes pulse-urgent {

    0%,
    100% {
        box-shadow: var(--shadow-sm);
    }

    50% {
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1), var(--shadow-md);
    }
}

/* Main Dashboard Grid */
.dashboard-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-main-left,
.dashboard-main-right {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    width: 100%;
}

.tasks-by-status,
.recent-tasks-list {
    min-width: 0;
    width: 100%;
}

.dashboard-card {
    min-width: 0;
    width: 100%;
    height: stretch;

    box-sizing: border-box;
    background: var(--card);
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.dashboard-card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.card-link {
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

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

[data-theme="dark"] .card-link,
[data-theme="dark-gray"] .card-link,
[data-theme="dark-blue"] .card-link,
[data-theme="dark-purple"] .card-link,
[data-theme="dark-green"] .card-link {
    color: #93c5fd !important;
}

[data-theme="dark"] .card-link:hover,
[data-theme="dark-gray"] .card-link:hover,
[data-theme="dark-blue"] .card-link:hover,
[data-theme="dark-purple"] .card-link:hover,
[data-theme="dark-green"] .card-link:hover {
    color: #bfdbfe !important;
}

[data-theme="dark"] .dashboard-card .empty-state .btn,
[data-theme="dark-gray"] .dashboard-card .empty-state .btn,
[data-theme="dark-blue"] .dashboard-card .empty-state .btn,
[data-theme="dark-purple"] .dashboard-card .empty-state .btn,
[data-theme="dark-green"] .dashboard-card .empty-state .btn {
    color: #fff !important;
}

/* Tasks by Status */
.tasks-by-status {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Dashboard "Tasks by Status" – keep name and count on one line */
.tasks-by-status .status-item {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: var(--transition);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    gap: 0.75rem;
}

.tasks-by-status .status-item:hover {
    background: var(--border-light);
}

.tasks-by-status .status-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex-shrink: 1;
}

.tasks-by-status .status-color {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: var(--text-muted, #64748b);
}

.tasks-by-status .status-name {
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.tasks-by-status .status-count {
    font-weight: 700;
    color: var(--text);
    font-size: 18px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Recent Tasks */
.recent-tasks-list {
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recent-task-item {
    min-height: 180px;
    position: relative;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: var(--transition);
    overflow: hidden;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.recent-task-item:hover {
    background: var(--border-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}


.task-priority-indicator {
    display: none;
}

.task-priority-indicator.priority-high {
    background: var(--danger);
}

.task-priority-indicator.priority-medium {
    background: var(--warning);
}

.task-priority-indicator.priority-low {
    background: var(--success);
}

.task-item-content {
    margin-left: 0;
}

.task-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.75rem;
    min-width: 0;
}

.task-title {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    transition: var(--transition);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-title:hover {
    color: var(--primary);
}

.task-status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.task-description {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
    margin: 0 0 0.75rem 0;
}

.task-description .rich-text-content {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.task-description .rich-text-content p {
    margin: 0;
    display: inline;
}

.task-description .rich-text-content p:after {
    content: ' ';
}

.task-description .rich-text-content img,
.task-description .rich-text-content video,
.task-description .rich-text-content iframe {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0.25rem 0;
}

/* Dark themes: highlighted text (background-color) must use dark text so it's readable on light highlight */
[data-theme="dark"] .rich-text-content span[style*="background-color"],
[data-theme="dark-gray"] .rich-text-content span[style*="background-color"],
[data-theme="dark-blue"] .rich-text-content span[style*="background-color"],
[data-theme="dark-purple"] .rich-text-content span[style*="background-color"],
[data-theme="dark-green"] .rich-text-content span[style*="background-color"],
[data-theme="dark"] .task-description-rich-editor span[style*="background-color"],
[data-theme="dark-gray"] .task-description-rich-editor span[style*="background-color"],
[data-theme="dark-blue"] .task-description-rich-editor span[style*="background-color"],
[data-theme="dark-purple"] .task-description-rich-editor span[style*="background-color"],
[data-theme="dark-green"] .task-description-rich-editor span[style*="background-color"] {
    color: #111827;
}

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

.task-meta-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.task-project,
.task-due,
.task-priority-text {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.task-project .icon,
.task-due .icon,
.task-priority-text .icon {
    width: 14px;
    height: 14px;
}

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

.task-priority-text.priority-high {
    color: var(--danger);
}

.task-priority-text.priority-medium {
    color: var(--warning);
}

.task-priority-text.priority-low {
    color: var(--success);
}

.task-assignees {
    flex-shrink: 0;
}

.assignees-list {
    display: flex;
    align-items: center;
    gap: -0.25rem;
}

.assignee-avatar {
    width: 30px;
    height: 30px;
    font-size: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    border: 2px solid var(--bg);
    margin-left: -0.25rem;
    position: relative;
    z-index: 1;
}

.assignee-avatar:first-child {
    margin-left: 0;
}

.assignee-avatar.extra-count {
    background: var(--muted);
    font-size: 9px;
}

.no-assignees {
    color: var(--text-muted);
    font-style: italic;
    font-size: 11px;
}

/* .priority-low {
    background: var(--success-light);
    color: var(--success);
}

.priority-medium {
    background: var(--warning-light);
    color: var(--warning);
} */

/* .priority-high {
    background: var(--danger-light);
    color: var(--danger);
} */

/* Notifications */
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.notification-item.unread {
    background: rgba(0, 102, 255, 0.05);
    border-left: 3px solid var(--primary);
}

.notification-item:hover {
    background: var(--border-light);
    transform: translateX(2px);
}

.notification-icon {
    width: 32px;
    height: 32px;
    font-size: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.notification-mention {
    background: var(--warning-light);
    color: var(--warning);
}

.notification-icon.notification-task_assigned {
    background: var(--success-light);
    color: var(--success);
}

.notification-icon.notification-ticket_reply {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.notification-icon .icon {
    width: 18px;
    height: 18px;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.notification-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.notification-task-link {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.notification-task-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.notification-task-link strong {
    font-weight: 600;
    color: inherit;
}

.dashboard-card .notifications-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-card .notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.dashboard-card .notification-item.unread {
    background: rgba(0, 102, 255, 0.05);
    border-left: 3px solid var(--primary);
}

.dashboard-card .notification-item:hover {
    background: var(--border-light);
    transform: translateX(2px);
}

.dashboard-card .notification-icon {
    font-size: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dashboard-card .notification-icon.notification-mention {
    background: var(--warning-light);
    color: var(--warning);
}

.dashboard-card .notification-icon.notification-task_assigned {
    background: var(--success-light);
}

.dashboard-card .notification-icon.notification-ticket_reply {
    background: rgba(99, 102, 241, 0.15);
    color: var(--success);
}

.dashboard-card .notification-icon .icon {
    width: 18px;
    height: 18px;
}

.dashboard-card .notification-content {
    flex: 1;
    min-width: 0;
}

.dashboard-card .notification-text {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.dashboard-card .notification-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.dashboard-card .notification-task-link {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.dashboard-card .notification-task-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.dashboard-card .notification-task-link strong {
    font-weight: 600;
    color: inherit;
}

/* New notifications indicator */
.new-notifications-indicator {
    padding: 0.5rem;
    background: rgba(0, 102, 255, 0.1);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    text-align: center;
}

.new-notifications-indicator a {
    text-decoration: none;
}

.new-notifications-indicator a:hover {
    text-decoration: underline;
}

/* Company Management Modal Content */
#companyManagementContent {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: normal;
    word-break: normal;
    overflow-wrap: break-word;
}

#companyManagementContent * {
    word-wrap: normal;
    word-break: normal;
    overflow-wrap: break-word;
    white-space: normal;
}

#companyManagementContent h1,
#companyManagementContent h2,
#companyManagementContent h3,
#companyManagementContent h4,
#companyManagementContent h5,
#companyManagementContent h6,
#companyManagementContent p,
#companyManagementContent span {
    word-break: normal;
    word-wrap: normal;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Company Management Styles */
.company-management-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.company-management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.management-card {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.management-card-header {
    margin-bottom: 1.5rem;
}

.management-card-header h2 {
    margin: 0 0 0.5rem 0;
    color: var(--text);
    font-size: 20px;
    font-weight: 600;
}

.management-card-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.company-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: var(--transition);
}

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

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Current Companies Section */
.current-companies {
    margin-top: 3rem;
}

.current-companies h2 {
    margin-bottom: 1.5rem;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.company-card {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.company-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.company-card.current {
    border-color: var(--primary);
    background: rgba(0, 102, 255, 0.05);
}

.company-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.company-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
    flex-shrink: 0;
}

.company-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.company-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin {
    background: var(--danger-light);
    color: var(--danger);
}

.role-editor {
    background: var(--warning-light);
    color: var(--warning);
}

.role-user {
    background: var(--success-light);
    color: var(--success);
}

.role-guest {
    background: var(--text-light);
    color: var(--text-secondary);
}

.company-card-actions {
    margin-bottom: 1rem;
}

.current-indicator {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
}

.company-details {
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
    font-size: 0.85rem;
}

.company-details p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
}

.company-details code {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.8rem;
}

/* Button Styles */
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Modal Styles for Company Management */
/* Modal styles moved to line ~4148 for better organization */

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

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

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

.modal-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

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

.invite-result {
    margin-top: 1rem;
}

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
}

.quick-action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.quick-action-btn .icon {
    width: 24px;
    height: 24px;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    margin-bottom: 1rem;
}

.empty-state-icon .icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.empty-state-text {
    font-size: 16px;
    margin: 0;
    color: var(--text-secondary);
}

/* Notification Actions */
.notification-actions {
    margin-top: 0.5rem;
    display: flex;
    justify-content: flex-end;
}

.mark-read-btn {
    padding: 0.25rem 0.75rem;
    font-size: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.mark-read-btn:hover {
    background: var(--primary-dark);
}

.mark-read-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* User Cards */
.user-cards {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 1rem;
}

.task-list-mini,
.notification-list-mini {
    list-style: none;
}

.task-list-mini li,
.notification-list-mini li {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.task-list-mini li:last-child,
.notification-list-mini li:last-child {
    border-bottom: none;
}

.quick-actions {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

/* Tasks Page */
.tasks-page {
    padding: var(--spacing-lg) 0;
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    gap: var(--spacing-lg);
    flex-wrap: wrap;
    width: 100%;
    min-width: 0;
}

.tasks-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    margin: 0;
    flex: 0 0 auto;
    min-width: 0;
}

.tasks-header-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.tasks-header-actions .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.tasks-header-primary {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.tasks-header-secondary {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.tasks-header-more {
    display: none;
    position: relative;
}

.tasks-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.125rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tasks-more-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.tasks-more-btn:active {
    transform: translateY(0);
}

.tasks-more-btn .icon {
    transition: transform 0.2s ease;
    width: 18px;
    height: 18px;
}

.tasks-header-more.is-open .tasks-more-btn .icon {
    transform: rotate(180deg);
}

/* Board/Calendar – segmented control */
.tasks-view-toggle {
    display: inline-flex;
    gap: 0;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tasks-view-toggle .tasks-view-btn {
    border-radius: var(--radius-sm);
    margin: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tasks-view-toggle .tasks-view-btn:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--text) 8%, transparent);
}

.tasks-view-toggle .tasks-view-btn.is-active {
    background: var(--card);
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tasks-view-toggle .tasks-view-btn .icon {
    width: 18px;
    height: 18px;
    margin-right: 0.4rem;
}

.tasks-view-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: auto;
}

.tasks-view-toggle-scroll {
    overflow: visible;
}

.tasks-view-scroll-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    flex: 0 0 auto;
}

.tasks-view-scroll-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

@media (max-width: 768px) {
    .tasks-header-primary {
        width: 100%;
    }

    .tasks-view-toggle-wrap {
        width: 100%;
        min-width: 0;
    }

    .tasks-view-scroll-btn {
        display: inline-flex;
    }

    .tasks-view-toggle-scroll {
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tasks-view-toggle-scroll::-webkit-scrollbar {
        display: none;
    }

    .tasks-view-toggle {
        width: max-content;
        min-width: max-content;
        flex-wrap: nowrap;
    }

    .tasks-view-toggle .tasks-view-btn {
        flex: 0 0 auto !important;
        white-space: nowrap;
        min-width: 96px;
    }
}

/* New Task Button */
.tasks-new-task-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tasks-new-task-btn:hover {
    background: var(--primary-hover);
}

.tasks-new-task-btn:active {
    background: var(--primary-dark);
}

.tasks-new-task-btn .icon {
    width: 18px;
    height: 18px;
}

.tasks-view-content {
    margin-top: 0;
}

#tasks-board-view {
    min-height: 320px;
}

/* Tasks Gantt view */
.tasks-gantt-view {
    min-height: 320px;
}

.tasks-gantt-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.tasks-gantt-scale {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.tasks-gantt-scale-btn {
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
}

.tasks-gantt-scale-btn.is-active {
    background: var(--card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tasks-gantt-wrap {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--card);
    overflow: hidden;
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-muted) 10%, transparent);
}

.tasks-gantt-scroll {
    position: relative;
    overflow: auto;
    max-width: 100%;
}

.tasks-gantt-grid {
    display: grid;
    align-items: stretch;
}

.tasks-gantt-corner {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 3;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    padding: 0.55rem 0.75rem;
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    height: 38px;
    box-sizing: border-box;
}

.tasks-gantt-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.tasks-gantt-header-cell {
    flex: 0 0 auto;
    height: 38px;
    border-right: 1px solid var(--border-light);
    padding: 0.6rem 0.2rem 0 0.2rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    line-height: 1;
}

.tasks-gantt-header-cell-month {
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.01em;
    color: var(--text);
    padding-top: 0.54rem;
}

.tasks-gantt-task-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    padding: 0.4rem 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 42px;
    box-sizing: border-box;
}

.tasks-gantt-task-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.tasks-gantt-task-link {
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.tasks-gantt-row {
    position: relative;
    border-bottom: 1px solid var(--border-light);
    background-image: linear-gradient(to right, color-mix(in srgb, var(--text-muted) 16%, transparent) 1px, transparent 1px);
    background-size: 26px 100%;
}

.tasks-gantt-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 70%;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--primary) 14%, var(--card));
    color: var(--text);
    padding: 0 0.35rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
    overflow: hidden;
    cursor: ew-resize;
    justify-content: center;
    border-radius: 5px;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -ms-border-radius: 5px;
    -o-border-radius: 5px;
}

.tasks-gantt-bar.is-dragging {
    opacity: 0.9;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent);
}

.tasks-gantt-drag-indicator {
    position: fixed;
    z-index: 9999;
    display: none;
    pointer-events: none;
    background: color-mix(in srgb, var(--card) 88%, #0f172a);
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border));
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
}

.tasks-gantt-bar-label {
    display: block;
    width: 100%;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.tasks-gantt-bar-avatar {
    position: absolute;
    right: 16px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background: var(--card);
    border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
    pointer-events: auto;
    cursor: help;
}

.tasks-gantt-bar-avatar.has-image {
    color: transparent;
}

.tasks-gantt-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 14px;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.tasks-gantt-handle::before {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: color-mix(in srgb, var(--text-muted) 65%, transparent);
    border-radius: 999px;
}

.tasks-gantt-handle-start {
    left: 1px;
    cursor: w-resize;
}

.tasks-gantt-handle-start::before {
    left: 5px;
}

.tasks-gantt-handle-end {
    right: 1px;
    cursor: e-resize;
}

.tasks-gantt-handle-end::before {
    right: 5px;
}

.tasks-gantt-bar:hover .tasks-gantt-handle,
.tasks-gantt-bar.is-dragging .tasks-gantt-handle {
    opacity: 0.75;
}

.tasks-gantt-bar.priority-high {
    background: color-mix(in srgb, #ef4444 12%, var(--card));
}

.tasks-gantt-bar.priority-medium {
    background: color-mix(in srgb, #f59e0b 11%, var(--card));
}

.tasks-gantt-bar.priority-low {
    background: color-mix(in srgb, #10b981 11%, var(--card));
}

.tasks-gantt-deps {
    position: absolute;
    top: 0;
    pointer-events: none;
    overflow: visible;
}

.tasks-gantt-deps path {
    fill: none;
    stroke: color-mix(in srgb, var(--text-muted) 70%, transparent);
    stroke-width: 1.2;
}

.tasks-gantt-unscheduled {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--bg-secondary) 85%, transparent);
}

.tasks-gantt-unscheduled h3 {
    margin: 0 0 0.45rem;
    font-size: 0.86rem;
}

.tasks-gantt-unscheduled-list {
    margin: 0;
    padding-left: 1.1rem;
}

.tasks-gantt-unscheduled-list li {
    margin: 0.2rem 0;
}

.tasks-gantt-scroll-month .tasks-gantt-header-cell {
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    padding-top: 0.55rem;
}

.tasks-gantt-scroll-month .tasks-gantt-row {
    background-image: linear-gradient(to right, color-mix(in srgb, var(--text-muted) 22%, transparent) 1px, transparent 1px);
}

.tasks-gantt-scroll-week .tasks-gantt-header-cell {
    text-align: center;
    padding-left: 0.1rem;
    padding-right: 0.1rem;
    font-size: 0.66rem;
}

@media (max-width: 768px) {
    .tasks-gantt-task-link {
        max-width: 180px;
        font-size: 0.76rem;
    }

    .tasks-gantt-corner,
    .tasks-gantt-task-cell {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Tasks list view – table layout */
.tasks-list-view .tasks-list-scroll {
    max-height: calc(100vh - 280px);
    min-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.tasks-list-view .tasks-list-table-wrap {
    padding: var(--spacing-sm) 0;
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.tasks-list-view .tasks-list-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.tasks-list-view .tasks-list-table th,
.tasks-list-view .tasks-list-table td {
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.tasks-list-view .tasks-list-table th:first-child,
.tasks-list-view .tasks-list-table td:first-child {
    min-width: 240px;
    width: 28%;
}

.tasks-list-view .tasks-list-table th:nth-child(2),
.tasks-list-view .tasks-list-table td:nth-child(2),
.tasks-list-view .tasks-list-table th:nth-child(3),
.tasks-list-view .tasks-list-table td:nth-child(3) {
    min-width: 140px;
}

.tasks-list-view .tasks-list-table th:nth-child(4),
.tasks-list-view .tasks-list-table td:nth-child(4) {
    min-width: 180px;
}

.tasks-list-view .tasks-list-table th:nth-child(5),
.tasks-list-view .tasks-list-table td:nth-child(5) {
    min-width: 120px;
}

.tasks-list-view .tasks-list-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

.tasks-list-view .tasks-list-table tbody tr:hover {
    background: var(--bg-secondary);
}

.tasks-list-view .tasks-list-table tbody tr:last-child td {
    border-bottom: none;
}

.tasks-list-task-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 340px;
}

.tasks-list-task-desc {
    margin-top: 0.25rem;
    max-width: 360px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: normal;
}

.tasks-list-muted {
    color: var(--text-muted);
}

.tasks-list-assignees {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.tasks-list-assignees-more {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tasks-list-col-actions {
    text-align: right !important;
    width: 1%;
}

.tasks-list-view .tasks-list-table .btn-task-view {
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-md);
}

.tasks-list-view .tasks-list-table .custom-dropdown-trigger,
.tasks-list-view .tasks-list-table .task-inline-select {
    min-height: 32px;
    font-size: 0.8125rem;
    padding: 0.3rem 0.5rem;
    max-width: 100%;
}

.tasks-list-project-cell-title {
    font-weight: 600;
    color: var(--text);
}

/* .tasks-list-view .tasks-projects-table {
    min-width: 640px;
} */

@media (max-width: 1024px) {
    .tasks-list-view .tasks-list-scroll {
        max-height: none;
        min-height: 0;
    }

    .tasks-list-view .tasks-list-table-wrap {
        margin: 0;
        padding: var(--spacing-sm) 0;
    }

    .tasks-list-view .tasks-list-table {
        min-width: 820px;
    }

    .tasks-list-view .tasks-list-table th,
    .tasks-list-view .tasks-list-table td {
        padding: 0.65rem 0.65rem;
        font-size: 0.82rem;
    }

    .tasks-list-task-title {
        font-size: 0.9rem;
    }

    .tasks-list-task-desc {
        max-width: 260px;
        font-size: 0.78rem;
    }
}

@media (max-width: 768px) {
    .tasks-list-view .tasks-list-table {
        min-width: 980px;
    }

    .tasks-list-view .tasks-list-table th:first-child,
    .tasks-list-view .tasks-list-table td:first-child {
        min-width: 220px;
        width: auto;
    }

    .tasks-list-view .tasks-list-table .custom-dropdown-trigger,
    .tasks-list-view .tasks-list-table .task-inline-select {
        min-height: 30px;
        font-size: 0.75rem;
        padding: 0.24rem 0.42rem;
    }

    .tasks-list-view .tasks-list-table .btn-task-view {
        padding: 0.28rem 0.5rem;
        font-size: 0.75rem;
    }

    .tasks-list-task-desc {
        max-width: 240px;
    }

    .tasks-list-view .tasks-projects-table {
        min-width: 560px;
    }
}

@media (max-width: 480px) {


    .tasks-list-view .tasks-list-table th,
    .tasks-list-view .tasks-list-table td {
        padding: 0.55rem 0.5rem;
        font-size: 0.75rem;
    }

    .tasks-list-task-title {
        font-size: 0.84rem;
        max-width: 220px;
    }

    .tasks-list-task-desc {
        display: none;
    }
}

/* Tasks calendar view – iPhone-style */
.tasks-calendar-header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.tasks-calendar-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0.5rem 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.calendar-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--calendar-accent);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.calendar-nav-btn:hover {
    background: color-mix(in srgb, var(--calendar-accent) 12%, var(--card));
    border-color: var(--calendar-accent);
}

.calendar-nav-btn:active {
    transform: scale(0.96);
}

.calendar-nav-btn .icon {
    width: 24px;
    height: 24px;
}

.tasks-calendar-title-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.tasks-calendar-timezone {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
}

.tasks-calendar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--calendar-accent);
    margin: 0;
    letter-spacing: -0.02em;
    flex: 1;
    text-align: center;
}

.tasks-calendar-view-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    border: 1px solid var(--border-light);
}

.calendar-view-mode-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.calendar-view-mode-btn:hover {
    color: var(--text);
}

.calendar-view-mode-btn.is-active {
    background: var(--card);
    color: var(--calendar-accent, #e53935);
    box-shadow: var(--shadow-sm);
}

.tasks-calendar-view-wrap {
    margin-bottom: var(--spacing-xl);
}

.tasks-calendar-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    background: var(--card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
    min-height: 320px;
}

.tasks-calendar-week-day {
    min-width: 0;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    background: var(--card);
}

.tasks-calendar-week-day:last-child {
    border-right: none;
}

.tasks-calendar-week-day-header {
    padding: 0.5rem 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.tasks-calendar-day-today-cell .tasks-calendar-week-day-header {
    background: color-mix(in srgb, var(--calendar-accent, #e53935) 12%, transparent);
    color: var(--calendar-accent, #e53935);
}

.tasks-calendar-week-day-tasks {
    padding: 0.35rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* Week view with time axis */
.tasks-calendar-week-time-grid {
    display: flex;
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    min-height: 400px;
}

.tasks-calendar-week-time-axis {
    flex-shrink: 0;
    width: 52px;
    border-right: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.tasks-calendar-week-time-corner {
    height: 40px;
    min-height: 40px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
}

.tasks-calendar-week-time-slot-label {
    padding: 0 0.35rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.tasks-calendar-week-days-with-time {
    display: flex;
    flex: 1;
    min-width: 0;
}

.tasks-calendar-week-day-col {
    flex: 1;
    min-width: 0;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: relative;
}

.tasks-calendar-week-day-col:last-child {
    border-right: none;
}

.tasks-calendar-week-day-col .tasks-calendar-week-day-header {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    padding: 0 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.tasks-calendar-week-day-allday {
    min-height: 40px;
    padding: 0.25rem;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    align-content: flex-start;
    overflow-y: auto;
    flex-shrink: 0;
}

.tasks-calendar-week-time-allday-label {
    min-height: 40px;
}

.tasks-calendar-week-day-hour-slot {
    min-height: 28px;
    border-bottom: 1px solid var(--border-light);
    padding: 2px 0.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    justify-content: flex-start;
    align-items: stretch;
    flex-shrink: 0;
    box-sizing: border-box;
    overflow-y: auto;
}

.tasks-calendar-task-allday,
.tasks-calendar-task-timed {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    flex-shrink: 0;
    line-height: 1.3;
}

.tasks-calendar-task-timed {
    align-self: flex-start;
}

.tasks-calendar-task-time {
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.25rem;
    font-size: 0.6875rem;
}

/* Live current-time indicator (Week & Day views) */
.tasks-calendar-now-line-container {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
}

.tasks-calendar-now-line {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.tasks-calendar-now-line-badge {
    flex-shrink: 0;
    padding: 0.15rem 0.4rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #fff;
    background: var(--calendar-accent, var(--danger, #e53935));
    border-radius: var(--radius-sm);
    margin-right: 0.35rem;
    line-height: 1.2;
}

.tasks-calendar-now-line-bar {
    flex: 1;
    height: 0;
    border-top: 2px solid var(--calendar-accent, var(--danger, #e53935));
}

/* Day view with time axis */
.tasks-calendar-day-time-grid {
    display: flex;
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    min-height: 400px;
}

.tasks-calendar-day-time-axis {
    flex-shrink: 0;
    width: 56px;
    border-right: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.tasks-calendar-day-time-row {
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}

.tasks-calendar-day-time-allday-label {
    min-height: 44px;
    box-sizing: border-box;
}

.tasks-calendar-day-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.tasks-calendar-day-allday-cell {
    min-height: 44px;
    padding: 0.35rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-content: flex-start;
    overflow-y: auto;
    box-sizing: border-box;
}

.tasks-calendar-day-hour-cell {
    border-bottom: 1px solid var(--border-light);
    padding: 2px 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    justify-content: flex-start;
    min-height: 28px;
    overflow-y: auto;
    box-sizing: border-box;
}

.tasks-calendar-day-time-row.tasks-calendar-day-hour-label {
    box-sizing: border-box;
}

.tasks-calendar-day-task-timed .tasks-calendar-task-time {
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.35rem;
    font-size: 0.8125rem;
}

.tasks-calendar-day-list {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.tasks-calendar-day-task {
    width: 100%;
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-size: 0.9375rem;
}

.tasks-calendar-day-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
    padding: var(--spacing-xl) var(--spacing-lg);
    text-align: center;
    line-height: 1.5;
}

.tasks-calendar-grid {
    background: var(--card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--spacing-xl);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tasks-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    text-align: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.tasks-calendar-weekdays span:first-child,
.tasks-calendar-weekdays span:last-child {
    color: var(--text-muted);
}

.tasks-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 360px;
}

.tasks-calendar-day {
    min-height: 72px;
    padding: 0.35rem;
    background: var(--card);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border: none;
}

.tasks-calendar-day-other {
    background: var(--card);
}

.tasks-calendar-day-other .tasks-calendar-day-num {
    color: var(--text-muted);
}

.tasks-calendar-day-weekend:not(.tasks-calendar-day-other) .tasks-calendar-day-num {
    color: var(--text-muted);
}

.tasks-calendar-day-today .tasks-calendar-day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--calendar-accent, #e53935);
    color: #fff;
    font-weight: 600;
    margin: 0 auto;
}

.tasks-calendar-day-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    margin-bottom: 0.25rem;
    min-height: 2.25rem;
    flex-shrink: 0;
}

.tasks-calendar-day-num {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.2;
}

.tasks-calendar-day-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.tasks-calendar-day-today .tasks-calendar-day-dot {
    background: rgba(255, 255, 255, 0.8);
}

.tasks-calendar-task {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 0.7rem;
    padding: 0.2rem 0.3rem;
    margin-bottom: 0.15rem;
    border-radius: var(--radius-sm);
    border: none;
    border-left: 3px solid var(--primary);
    background: var(--bg-secondary);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tasks-calendar-task:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.tasks-calendar-task.priority-low {
    border-left-color: var(--success);
    background: var(--success-light, rgba(16, 185, 129, 0.08));
}

.tasks-calendar-task.priority-low:hover {
    background: var(--success-light);
    color: var(--success);
}

.tasks-calendar-task.priority-medium {
    border-left-color: var(--warning);
    background: var(--warning-light, rgba(245, 158, 11, 0.08));
}

.tasks-calendar-task.priority-medium:hover {
    background: var(--warning-light);
    color: var(--warning);
}

.tasks-calendar-task.priority-high {
    border-left-color: var(--danger);
    background: var(--danger-light, rgba(239, 68, 68, 0.08));
}

.tasks-calendar-task.priority-high:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.tasks-calendar-no-date {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.tasks-calendar-no-date h3 {
    font-size: 1rem;
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text);
}

.tasks-calendar-no-date-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tasks-calendar-no-date-list li {
    margin-bottom: 0.35rem;
}

.tasks-calendar-task-inline {
    background: none;
    border: none;
    font-size: 0.875rem;
    color: var(--primary);
    cursor: pointer;
    padding: 0.2rem 0;
    text-align: left;
    width: 100%;
}

.tasks-calendar-task-inline:hover {
    text-decoration: underline;
}

/* Filters Container */
.filters-container {
    margin-bottom: var(--spacing-lg);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
}

.filter-chip-active {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.filter-chip-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.filter-chip-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
}

.filter-chip-clear {
    display: inline-flex;
    color: inherit;
    opacity: 0.85;
    padding: 0.125rem;
    border-radius: var(--radius-sm);
}

.filter-chip-clear:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
}

/* Active filters: pills next to Filters title (remove with x, navigates) */
.filters-active-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--card);
    border: 1px solid var(--border-light);
    border-top: none;
    min-height: 0;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-light, #DBEAFE);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.filter-pill:hover {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.filter-pill-x {
    opacity: 0.9;
}

.filter-pill:hover .filter-pill-x {
    opacity: 1;
}

.filter-pill-danger {
    color: var(--danger);
    background: var(--danger-light);
    border-color: var(--danger);
}

.filter-pill-danger:hover {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.filter-pill-warning {
    color: var(--warning);
    background: var(--warning-light);
    border-color: var(--warning);
}

.filter-pill-warning:hover {
    background: color-mix(in srgb, var(--warning) 12%, transparent);
}

.filter-pill-clear {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.6rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    margin-left: var(--spacing-xs);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.filter-pill-clear:hover {
    color: var(--text);
    border-color: var(--text-muted);
    background: var(--bg-secondary);
}

/* Accordion: clickable header (trigger) */
.filters-accordion-trigger.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.filters-accordion-trigger:hover {
    background: var(--bg-secondary);
}

/* .filters-accordion-trigger:focus {
    outline: 2px solid var(--border);
    outline-offset: 2px;
} */

.filters-accordion-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.filters-accordion-title .icon {
    width: 20px;
    height: 20px;
}

.filters-accordion-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.filters-accordion-chevron {
    display: inline-flex;
    align-items: center;
}

.filters-chevron {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

/* Accordion panel: collapsed by default, expanded when .expanded */
.filters-accordion-panel.filters {
    display: none;
    gap: var(--spacing-md);
    margin-bottom: 0;
    flex-wrap: wrap;
    padding: var(--spacing-lg);
    background: var(--card);
    border: 1px solid var(--border-light);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    transition: all 0.3s ease;
    align-items: center;
    overflow: visible;
}

.filters-accordion-panel.filters.expanded {
    display: flex;
}

/* Desktop: accordion panel layout when expanded */
@media (min-width: 769px) {
    .filters-accordion-panel.filters.expanded {
        flex-direction: row;
        align-items: center;
    }

    /* .filters-container {
        margin-bottom: var(--spacing-2xl);
    } */

    .filters-accordion-panel .filter-input,
    .filters-accordion-panel .filter-select {
        width: auto;
        margin-bottom: 0;
    }

    .filters-accordion-panel .btn {
        width: auto;
        margin-top: 0;
        min-height: 42px;
        box-sizing: border-box;
    }
}

.filters-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.filters-actions .btn-clear-filters {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-input,
.filter-select {
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: var(--transition);
    background: var(--card);
    color: var(--text);
    font-family: inherit;
    min-width: 120px;
}

/* Cross-browser consistent select: no native dropdown skin, custom arrow (same look in Chrome, Firefox, Safari, Edge) */
.filter-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    padding-right: 2.25rem;
    min-height: 42px;
    background-color: var(--card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 1.125rem;
}

.filter-select::-ms-expand {
    display: none;
}

/* Disabled state for filter select */
.filter-select:disabled {
    opacity: 0.6;
    background-color: var(--bg);
    color: var(--text-light);
    cursor: not-allowed;
}

/* Dark themes: arrow uses muted text color */
[data-theme="dark"] .filter-select,
[data-theme="dark-blue"] .filter-select,
[data-theme="dark-purple"] .filter-select,
[data-theme="dark-green"] .filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* ========== App-wide: selects and date inputs (consistent across all browsers) ========== */
select:not([multiple]) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    min-height: 38px;
    font-size: 14px;
    color: var(--text);
    background-color: var(--card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
    box-sizing: border-box;
}

/* Dark themes: ensure select chevron is visible */
[data-theme="dark"] select:not([multiple]),
[data-theme="dark-blue"] select:not([multiple]),
[data-theme="dark-purple"] select:not([multiple]),
[data-theme="dark-green"] select:not([multiple]) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

select:not([multiple]):focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

select::-ms-expand {
    display: none;
}

/* Date inputs: same look in all browsers (custom icon, consistent field) */
input[type="date"] {
    width: 100%;
    position: relative;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background-color: var(--card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 1.125rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    min-height: 38px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* Hide native calendar icon but keep area clickable (Chrome, Safari, Edge) */
input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    right: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    margin: 0;
}

/* Dark themes: lighter calendar icon */
[data-theme="dark"] input[type="date"],
[data-theme="dark-blue"] input[type="date"],
[data-theme="dark-purple"] input[type="date"],
[data-theme="dark-green"] input[type="date"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
}

/* Date/time display chips (Due date, Created, etc.) – consistent across app */
.due-date,
.created-date {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.4rem;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.due-date .icon,
.created-date .icon {
    width: 16px;
    height: 16px;
    opacity: 0.85;
}

.task-due-date {
    font-size: 13px;
    color: var(--text-muted);
}

.comment-time,
.pending-invite-date-value {
    font-size: 12px;
    color: var(--text-muted);
}

.filter-input {
    flex: 1;
    min-width: 200px;
    min-height: 42px;
    box-sizing: border-box;
}

.date-range-filter {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.date-range-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.date-range-inputs {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.filter-input-date {
    min-height: 42px;
    width: 140px;
}

.filter-input-date:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.date-range-separator {
    color: var(--text-muted);
    font-size: 14px;
    user-select: none;
}

.btn-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 var(--spacing-md);
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-sizing: border-box;
}

.btn-filter-toggle .icon {
    flex-shrink: 0;
}

.btn-filter-toggle:hover {
    background: var(--bg);
    border-color: var(--primary);
}

.btn-filter-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.btn-filter-toggle.active:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

.btn-filter-toggle .toggle-icon {
    transition: transform 0.2s ease;
}

.date-filters-container {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    width: 100%;
    align-items: flex-end;
}

.date-filters-quick-select {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    width: 100%;
}

.date-filters-quick-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-right: 0.25rem;
}

.btn-date-quick {
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-date-quick:hover {
    background: var(--primary-light, #DBEAFE);
    border-color: var(--primary);
}

.btn-date-quick.active {
    background: var(--primary-light, #DBEAFE);
    border-color: var(--primary);
    color: var(--primary);
}

/* Task Attachments */
.task-links-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--border);
}

.task-links-section .task-links-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.task-links-section .attachment-name a {
    color: var(--primary);
    text-decoration: none;
}

.task-links-section .attachment-name a:hover {
    text-decoration: underline;
}

.task-links-form-inline {
    margin-top: var(--spacing-md);
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    align-items: flex-start;
}

.task-links-form-inline input {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: var(--transition);
    background: var(--card);
    color: var(--text);
    font-family: inherit;
}

.task-links-form-inline input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.task-links-form-inline input::placeholder {
    color: var(--text-muted);
}

.task-links-form-inline .btn {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .task-links-form-inline {
        flex-direction: column;
    }

    .task-links-form-inline input {
        width: 100%;
    }

    .task-links-form-inline .btn {
        width: 100%;
    }
}

.task-attachments-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--border);
}

.task-attachments-section h3 {
    margin-bottom: var(--spacing-md);
    color: var(--text);
    font-size: 18px;
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.attachments-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
    text-align: center;
}

.attachments-empty .icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

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

.attachment-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary-light, #DBEAFE);
    border-radius: var(--radius-md);
    color: var(--primary);
}

.attachment-icon .icon {
    font-size: 24px;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.attachment-meta {
    font-size: 12px;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.attachment-actions {
    display: flex;
    gap: var(--spacing-xs);
    flex-shrink: 0;
}

.attachment-viewer-header {
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.attachment-viewer-actions {
    flex-wrap: wrap;
}

.attachment-viewer-actions .btn {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .attachment-item {
        align-items: flex-start;
    }

    .attachment-actions {
        margin-left: auto;
    }
}

@media (max-width: 640px) {
    .attachment-item {
        flex-wrap: wrap;
    }

    .attachment-icon {
        width: 36px;
        height: 36px;
    }

    .attachment-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .attachment-viewer-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.file-upload-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.attachment-dropzone {
    width: 100%;
    min-height: 96px;
    justify-content: center;
    gap: var(--spacing-md);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(248, 250, 252, 0.9));
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.03);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.attachment-dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(148, 163, 184, 0.25) 1px, transparent 1px);
    background-size: 12px 12px;
    opacity: 0.35;
    pointer-events: none;
}

.attachment-dropzone.is-dragging {
    border-color: var(--primary);
    background: linear-gradient(180deg, rgba(219, 234, 254, 0.8), rgba(219, 234, 254, 0.4));
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
    transform: translateY(-1px);
}

.attachment-dropzone-hint {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.attachment-dropzone .btn {
    position: relative;
    z-index: 1;
}

.attachment-dropzone #selectedFileName {
    position: relative;
    z-index: 1;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.04);
    color: var(--text);
    max-width: 100%;
    word-break: break-all;
}

#selectedFileName {
    font-size: 14px;
    color: var(--text);
}

#uploadButton {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* Dark mode improvements for attachment upload section */
[data-theme="dark"] .attachment-dropzone,
[data-theme="dark-blue"] .attachment-dropzone,
[data-theme="dark-purple"] .attachment-dropzone,
[data-theme="dark-green"] .attachment-dropzone {
    background: linear-gradient(180deg, rgba(45, 45, 45, 0.4), rgba(30, 30, 30, 0.6));
    border-color: var(--border-light);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme="dark-blue"] .attachment-dropzone {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.7));
}

[data-theme="dark-purple"] .attachment-dropzone {
    background: linear-gradient(180deg, rgba(45, 36, 56, 0.5), rgba(26, 22, 37, 0.7));
}

[data-theme="dark-green"] .attachment-dropzone {
    background: linear-gradient(180deg, rgba(28, 46, 32, 0.5), rgba(13, 27, 15, 0.7));
}

[data-theme="dark"] .attachment-dropzone::before,
[data-theme="dark-blue"] .attachment-dropzone::before,
[data-theme="dark-purple"] .attachment-dropzone::before,
[data-theme="dark-green"] .attachment-dropzone::before {
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    opacity: 0.3;
}

[data-theme="dark"] .attachment-dropzone.is-dragging,
[data-theme="dark-blue"] .attachment-dropzone.is-dragging,
[data-theme="dark-purple"] .attachment-dropzone.is-dragging,
[data-theme="dark-green"] .attachment-dropzone.is-dragging {
    border-color: var(--primary);
    background: linear-gradient(180deg, rgba(96, 165, 250, 0.2), rgba(59, 130, 246, 0.15));
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25), inset 0 0 0 1px rgba(96, 165, 250, 0.3);
}

[data-theme="dark-purple"] .attachment-dropzone.is-dragging {
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.2), rgba(139, 92, 246, 0.15));
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.25), inset 0 0 0 1px rgba(167, 139, 250, 0.3);
}

[data-theme="dark"] .attachment-dropzone #selectedFileName,
[data-theme="dark-blue"] .attachment-dropzone #selectedFileName,
[data-theme="dark-purple"] .attachment-dropzone #selectedFileName,
[data-theme="dark-green"] .attachment-dropzone #selectedFileName {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dark mode improvements for attachment items */
[data-theme="dark"] .attachment-item,
[data-theme="dark-blue"] .attachment-item,
[data-theme="dark-purple"] .attachment-item,
[data-theme="dark-green"] .attachment-item {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

[data-theme="dark"] .attachment-item:hover,
[data-theme="dark-blue"] .attachment-item:hover,
[data-theme="dark-purple"] .attachment-item:hover,
[data-theme="dark-green"] .attachment-item:hover {
    border-color: var(--primary);
    background: rgba(96, 165, 250, 0.08);
}

[data-theme="dark-purple"] .attachment-item:hover {
    background: rgba(167, 139, 250, 0.08);
}

[data-theme="dark"] .attachment-icon,
[data-theme="dark-blue"] .attachment-icon,
[data-theme="dark-green"] .attachment-icon {
    background: rgba(96, 165, 250, 0.2);
}

[data-theme="dark-purple"] .attachment-icon {
    background: rgba(167, 139, 250, 0.2);
}

/* Dark mode for attachment upload section hint text */
[data-theme="dark"] .attachment-dropzone-hint,
[data-theme="dark-blue"] .attachment-dropzone-hint,
[data-theme="dark-purple"] .attachment-dropzone-hint,
[data-theme="dark-green"] .attachment-dropzone-hint {
    color: var(--text-muted);
    opacity: 0.9;
}

.filter-select {
    min-width: 150px;
}

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

.filter-input {
    flex: 1;
    min-width: 200px;
}

.filter-select {
    min-width: 150px;
}

.tasks-board {
    display: flex;
    align-items: stretch;
    gap: var(--spacing-lg);
    overflow-x: auto;
    padding-bottom: var(--spacing-md);
    cursor: grab;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    scrollbar-width: thin;
}

.tasks-board:active {
    cursor: grabbing;
}

/* Project Filter Checkbox - Custom Styling */
.project-filter-checkbox {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.project-filter-checkbox:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.project-filter-checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.project-filter-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.project-filter-checkbox:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

.project-filter-checkbox:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.task-column {
    display: flex;
    flex-direction: column;
    min-width: 300px;
    min-height: 420px;
    max-height: 750px;
    flex: 1 1 300px;
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    border: 1px solid var(--border-light);
    border-left-width: 4px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.task-column:hover {
    box-shadow: var(--shadow-md);
    /* Avoid layout shift on hover */
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-light);
    flex-shrink: 0;
}

.column-header-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.column-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.task-count {
    background: var(--bg-secondary);
    color: var(--text-light);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.task-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs);
    position: relative;
}

.task-list.drag-over {
    background: var(--primary-light);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.task-list.drag-over::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border-radius: var(--radius-md);
    pointer-events: none;
    z-index: 1;
}

.task-column-footer {
    flex-shrink: 0;
    padding: var(--spacing-sm) var(--spacing-xs) var(--spacing-md);
    border-top: 1px solid var(--border);
}

/* Task Archive Section */
.task-column-archive-section {
    flex-shrink: 0;
    border-top: 2px solid var(--border-light);
    padding: var(--spacing-sm) var(--spacing-xs);
}

.btn-archive-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.625rem var(--spacing-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    gap: var(--spacing-sm);
}

.btn-archive-toggle:hover {
    color: var(--text);
    background: var(--card);
    border-color: var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-archive-toggle[aria-expanded="true"] {
    background: var(--card);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-archive-toggle[aria-expanded="true"] .archive-chevron {
    transform: rotate(180deg);
}

.btn-archive-toggle .archive-chevron {
    transition: transform 0.2s ease;
    margin-left: auto;
}

.archive-task-list {
    margin-top: var(--spacing-sm);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--spacing-xs);
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.archive-task-list:empty::before {
    content: 'No archived tasks';
    display: block;
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.archive-task-card {
    opacity: 0.8;
    margin-bottom: var(--spacing-sm);
}

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

.btn-unarchive {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-unarchive:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.btn-column-add-task {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.5rem var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn-column-add-task:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.task-card {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    padding-left: calc(var(--spacing-md) + 1.25rem);
    /* margin-bottom: var(--spacing-md); */
    cursor: grab;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.task-card:active {
    cursor: grabbing;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    /* Avoid layout shift on hover */
}

.task-card[data-completed="1"] {
    border-left-color: var(--text-muted) !important;
}

.task-card[data-completed="1"]:hover {
    border-color: var(--border-light);
    border-left-color: var(--text-muted) !important;
}

.task-card[data-completed="1"] .task-priority {
    background: var(--text-muted) !important;
}

/* Priority-based visual enhancements */
/* .task-card.priority-high {
    background: linear-gradient(to right, rgba(239, 68, 68, 0.05) 0%, var(--card) 20px);
} */

.task-card.priority-high:hover {
    box-shadow: 0 4px 12px color-mix(in srgb, var(--danger) 30%, transparent);
}

.task-card.priority-medium {
    background: linear-gradient(to right, color-mix(in srgb, var(--warning) 12%, transparent) 0%, var(--card) 20px);
}

.task-card.priority-medium:hover {
    box-shadow: 0 4px 12px color-mix(in srgb, var(--warning) 25%, transparent);
}

.task-card.priority-low {
    background: linear-gradient(to right, color-mix(in srgb, var(--success) 12%, transparent) 0%, var(--card) 20px);
}

.task-card.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
    cursor: grabbing;
}

.task-card-drag-handle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    z-index: 10;
    pointer-events: auto;
}

.task-card-drag-handle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.task-card-drag-handle:active {
    cursor: grabbing;
}

.task-card:hover .task-card-drag-handle {
    opacity: 1;
}

.task-card-drag-handle .icon {
    width: 18px;
    height: 18px;
}

.task-header {
    display: flex;
    align-items: start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.task-priority {
    width: 4px;
    height: 100%;
    border-radius: 2px;
    flex-shrink: 0;
}

.task-card h4 {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    flex: 1;
    line-height: 1.4;
}

.task-description {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
    line-height: 1.5;
}

.task-card-status {
    margin-bottom: var(--spacing-sm);
}

.task-quick-edit-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
    margin-bottom: var(--spacing-sm);
}

.task-inline-select {
    width: 100%;
    min-width: 0;
}

.task-quick-edit-row .custom-dropdown-enhanced .custom-dropdown-trigger {
    min-height: 30px;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 6px;
    padding: 0.28rem 0.5rem;
}

.task-quick-edit-row .custom-dropdown-enhanced .custom-dropdown-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-quick-edit-row .custom-dropdown-enhanced .custom-dropdown-menu {
    z-index: 1200;
}

.task-status-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    text-transform: capitalize;
}

.task-due-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.overdue {
    color: var(--danger);
    font-weight: 500;
}

.task-assignees {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-sm);
}

.assignee-avatar {
    font-size: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.group-badge {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
}

.task-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-light);
}

.btn-task-view {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}

.btn-task-view:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-task-view:active {
    transform: translateY(0);
}

.btn-task-view .icon {
    width: 16px;
    height: 16px;
}

/* Task Context Menu */
.task-context-menu {
    position: fixed;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    min-width: 180px;
    padding: var(--spacing-xs) 0;
    display: none;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.context-menu-item:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.context-menu-item-danger {
    color: var(--danger, #ef4444) !important;
}

.context-menu-item-danger:hover {
    background: var(--danger-light, rgba(239, 68, 68, 0.1)) !important;
    color: var(--danger, #ef4444) !important;
}

.context-menu-item .icon {
    width: 18px;
    height: 18px;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-details {
    padding: var(--spacing-xl);
    background: var(--card);
}

.task-details h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.02em;
}

/* Task header with title and actions */
.task-details-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: var(--spacing-lg);
    margin-top: 50px;
}

.task-details-header h2 {
    margin: 0;
    flex: 1;
    min-width: 0;
    word-wrap: normal;
    word-break: normal;
    overflow-wrap: break-word;
    white-space: normal;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.task-detail-title-wrap {
    flex: 1;
    min-width: 0;
}

.task-detail-title-editable {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    /* margin: calc(-1 * var(--spacing-xs)) calc(-1 * var(--spacing-sm)); */
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.task-detail-title-editable:hover {
    border-color: var(--border);
    background-color: var(--hover-bg, rgba(0, 0, 0, 0.03));
}

.task-detail-title-view {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    margin: 0;
    transition: color 0.15s ease;
}

.task-detail-title-editable:hover .task-detail-title-view {
    color: rgb(95, 95, 95);
}

.task-detail-title-edit-icon {
    flex-shrink: 0;
    opacity: 0;
    color: var(--text-muted);
    transition: opacity 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
}

.task-detail-title-editable:hover .task-detail-title-edit-icon {
    opacity: 1;
    color: rgb(67, 67, 67);
}

/* Wrapper for title edit input + hint so tooltip doesn't overlap */
.task-detail-title-edit-wrap {
    width: 100%;
    min-width: 0;
}

.task-detail-title-edit-hint {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Modern minimal title edit input – borderless with subtle focus */
.task-detail-title-edit,
.task-details .task-detail-title-edit,
.task-details-header .task-detail-title-edit,
#taskDetailsContent .task-detail-title-edit {
    width: 100%;
    margin: 0;
    padding: var(--spacing-sm) 0;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: -0.02em !important;
    color: var(--text);
    font-family: inherit;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    box-sizing: border-box;
    min-height: 1.25em;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease, border-width 0.2s ease;
}

.task-detail-title-edit:hover {
    border-bottom-color: var(--text-muted);
}

/* Avoid browser autofill/orange highlight on edit */
.task-detail-title-edit:-webkit-autofill,
.task-detail-title-edit:-webkit-autofill:hover,
.task-detail-title-edit:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 100px var(--card) inset;
    box-shadow: 0 0 0 100px var(--card) inset;
    border-bottom-color: var(--border);
}

.task-detail-title-edit::placeholder,
.task-details-header .task-detail-title-edit::placeholder {
    color: var(--text-muted);
    font-size: 1.25rem !important;
    font-weight: 600;
}

/* Subtle focus: primary underline only, no heavy outline */
.task-detail-title-edit:focus,
.task-details .task-detail-title-edit:focus,
.task-details-header .task-detail-title-edit:focus {
    outline: none;
    border-bottom-color: var(--primary);
    border-bottom-width: 2px;
}

/* Clean selection color in title edit (no orange/beige) */
.task-detail-title-edit::selection {
    background: var(--primary);
    color: #fff;
}

.task-detail-title-edit::-moz-selection {
    background: var(--primary);
    color: #fff;
}

.btn-delete-task {
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem !important;
}

.btn-delete-task .icon {
    width: 18px;
    height: 18px;
    line-height: 1;
}

.task-meta {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.task-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-lg);
    align-items: start;
    width: 100%;
    min-width: 0;
}

/* Task modal/page: ensure meta container and grid use full width so 1fr column is actually 100% */
#taskDetailsContent .task-meta,
.task-details .task-meta,
#taskDetailsContent .task-meta-grid,
.task-details .task-meta-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

@media (min-width: 1025px) {
    .task-meta-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Tablet (iPad) and mobile: meta items full width so Status/Priority/Project/Due Date aren’t “half width” */
@media (max-width: 1024px) {
    .task-meta-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .task-meta {
        padding: var(--spacing-sm);
    }

    .meta-item {
        min-width: 0;
    }

    .meta-item .custom-dropdown {
        display: block;
        width: 100%;
    }

    .meta-item .custom-dropdown-trigger,
    .meta-item .task-detail-due-date-input,
    .meta-item .project-badge,
    .meta-item .due-date,
    .meta-item .status-badge,
    .meta-item .priority-badge {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
}

/* Task details: responsive header and padding */
@media (max-width: 768px) {
    .task-details {
        padding: var(--spacing-md);
    }

    .task-details-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
        padding-bottom: var(--spacing-md);
        margin-bottom: var(--spacing-md);
        margin-top: var(--spacing-md);
    }

    .task-details-header .btn-delete-task {
        align-self: flex-start;
        width: auto;
    }
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

#taskDetailsContent .task-meta .meta-item,
.task-details .task-meta .meta-item {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

/* Task details (modal or page): meta items always full width */
#taskDetailsContent .task-meta .meta-item .custom-dropdown,
.task-details .task-meta .meta-item .custom-dropdown,
#taskDetailsContent .task-meta .meta-item .custom-dropdown-status,
#taskDetailsContent .task-meta .meta-item .custom-dropdown-priority,
#taskDetailsContent .task-meta .meta-item .custom-dropdown-custom-field,
.task-details .task-meta .meta-item .custom-dropdown-status,
.task-details .task-meta .meta-item .custom-dropdown-priority,
.task-details .task-meta .meta-item .custom-dropdown-custom-field {
    display: block !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#taskDetailsContent .task-meta .meta-item .custom-dropdown-trigger,
#taskDetailsContent .task-meta .meta-item .task-detail-due-date-input,
#taskDetailsContent .task-meta .meta-item .project-badge,
#taskDetailsContent .task-meta .meta-item .due-date,
#taskDetailsContent .task-meta .meta-item .created-date,
#taskDetailsContent .task-meta .meta-item .status-badge,
#taskDetailsContent .task-meta .meta-item .priority-badge,
.task-details .task-meta .meta-item .custom-dropdown-trigger,
.task-details .task-meta .meta-item .task-detail-due-date-input,
.task-details .task-meta .meta-item .project-badge,
.task-details .task-meta .meta-item .due-date,
.task-details .task-meta .meta-item .created-date,
.task-details .task-meta .meta-item .status-badge,
.task-details .task-meta .meta-item .priority-badge {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    box-sizing: border-box;
}

/* Status/Priority triggers: full width in task details (override any min-width) */
#taskDetailsContent .task-meta .custom-dropdown-status .custom-dropdown-trigger,
#taskDetailsContent .task-meta .custom-dropdown-priority .custom-dropdown-trigger,
#taskDetailsContent .task-meta .custom-dropdown-custom-field .custom-dropdown-trigger,
.task-details .task-meta .custom-dropdown-status .custom-dropdown-trigger,
.task-details .task-meta .custom-dropdown-priority .custom-dropdown-trigger,
.task-details .task-meta .custom-dropdown-custom-field .custom-dropdown-trigger {
    width: 100% !important;
    min-width: 0 !important;
}

.meta-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.meta-label-with-help,
.label-with-help {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.field-help-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: help;
    position: relative;
    flex-shrink: 0;
}

.field-help-tooltip .icon {
    width: 11px;
    height: 11px;
}

.field-help-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    min-width: 260px;
    max-width: 360px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.45;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1200;
}

.field-help-tooltip::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--card);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1201;
}

.field-help-tooltip:hover::after,
.field-help-tooltip:hover::before,
.field-help-tooltip:focus-visible::after,
.field-help-tooltip:focus-visible::before {
    opacity: 1;
    visibility: visible;
}

.field-help-tooltip:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .field-help-tooltip::after {
        left: 0;
        transform: none;
        min-width: 220px;
        max-width: min(280px, calc(100vw - 56px));
    }

    .field-help-tooltip::before {
        left: 8px;
        transform: none;
    }
}

/* Custom dropdown (task detail Status & Priority) – clean floating menu */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.custom-dropdown-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100% !important;
    min-width: 120px;
    min-height: 38px;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}

.custom-dropdown-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.custom-dropdown-chevron {
    flex-shrink: 0;
    opacity: 0.9;
    transition: transform 0.2s ease;
}

.custom-dropdown.is-open .custom-dropdown-chevron {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 100;
    min-width: 100%;
    max-height: 280px;
    overflow-y: auto;
    padding: 0.25rem 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.custom-dropdown.is-open .custom-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Task card inline selects: menu is position:fixed via JS (escapes overflow:hidden on columns/lists) */
.custom-dropdown-menu.custom-dropdown-menu--task-card-fixed {
    transform: none !important;
}

.custom-dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: background-color 0.1s ease;
    white-space: nowrap;
}

.custom-dropdown-option:hover {
    background: var(--bg-secondary);
}

.custom-dropdown-option.is-selected {
    background: var(--primary-light, #DBEAFE);
    color: var(--primary);
    font-weight: 600;
}

.custom-dropdown-option.is-selected::before {
    content: '';
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.custom-dropdown-priority .custom-dropdown-option.is-selected::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
}

.custom-dropdown-trigger.priority-low {
    background-color: var(--success);
    color: #fff;
}

.custom-dropdown-trigger.priority-medium {
    background-color: var(--warning);
    color: #fff;
}

.custom-dropdown-trigger.priority-high {
    background-color: var(--danger);
    color: #fff;
}

/* Custom field dropdowns in task meta: same pill/menu as Priority/Status, neutral colors only */
.custom-dropdown-custom-field .custom-dropdown-trigger {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.custom-dropdown-custom-field .custom-dropdown-trigger:hover {
    border-color: var(--primary);
    background: var(--card);
}

.custom-dropdown-custom-field .custom-dropdown-option.is-selected {
    background: var(--primary-light, rgba(59, 130, 246, 0.15));
    color: var(--text-primary);
}

.custom-dropdown-custom-field .custom-dropdown-option.is-selected::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="dark"] .custom-dropdown-custom-field .custom-dropdown-option.is-selected::before,
[data-theme="dark-blue"] .custom-dropdown-custom-field .custom-dropdown-option.is-selected::before,
[data-theme="dark-purple"] .custom-dropdown-custom-field .custom-dropdown-option.is-selected::before,
[data-theme="dark-green"] .custom-dropdown-custom-field .custom-dropdown-option.is-selected::before,
[data-theme="dark-gray"] .custom-dropdown-custom-field .custom-dropdown-option.is-selected::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2393c5fd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Enhanced selects (filters, forms, settings): same menu style, neutral trigger */
.custom-dropdown-enhanced .custom-dropdown-trigger {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.custom-dropdown-enhanced .custom-dropdown-trigger:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.form-group .custom-dropdown-enhanced,
.filters .custom-dropdown-enhanced,
.date-range-filter .custom-dropdown-enhanced {
    display: block;
    width: 100%;
}

/* Filter dropdowns: higher z-index so menu appears above Filters header and panel */
.filters .custom-dropdown-menu,
.filters-accordion-panel .custom-dropdown-menu {
    z-index: 1000;
}

/* Bulk actions bar: dropdown opens upward so options are visible (bar is fixed at bottom) */
.bulk-actions-bar .custom-dropdown {
    position: relative;
}

.bulk-actions-bar .custom-dropdown-menu {
    top: auto;
    bottom: calc(100% + 4px);
    transform: translateY(4px);
}

.bulk-actions-bar .custom-dropdown.is-open .custom-dropdown-menu {
    transform: translateY(0);
}

.task-detail-status-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 1.75rem;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\' fill=\'white\'%3E%3Cpath d=\'M7 10l5 5 5-5z\'/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
    border: none;
    border-radius: var(--radius-md);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    padding-left: 0.75rem;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    min-width: 120px;
    min-height: 38px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.task-detail-status-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.task-detail-status-select:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

/* Priority dropdown – same shape as status, colored bg, white chevron */
.task-detail-priority-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 1.75rem 0.5rem 0.75rem;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    min-width: 120px;
    min-height: 38px;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 24 24\' fill=\'white\'%3E%3Cpath d=\'M7 10l5 5 5-5z\'/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.task-detail-priority-select.priority-low {
    background-color: var(--success);
}

.task-detail-priority-select.priority-medium {
    background-color: var(--warning);
}

.task-detail-priority-select.priority-high {
    background-color: var(--danger);
}

.task-detail-priority-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.task-detail-priority-select:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

.status-badge {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: fit-content;
}

.project-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) !important;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    background: var(--card);
    color: var(--text);
    padding-left: var(--spacing-md);
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.project-badge .icon {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

.due-date .icon {
    width: 18px;
    height: 18px;
    opacity: 0.85;
}

.task-detail-due-date-input {
    min-width: 220px;
    /* enough for "MM/DD/YYYY, HH:MM AM" */
    width: 100%;
    min-height: 38px;
    padding: 0.5rem 0.75rem;
    padding-right: 2.25rem;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    overflow: visible;
}

.task-detail-due-date-input:hover {
    border-color: var(--border);
}

.task-detail-due-date-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.task-detail-due-date-input:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

/* datetime-local: WebKit internal styling only on fine-pointer desktop — iOS Safari breaks pickers if these are too aggressive */
@media (hover: hover) and (pointer: fine) {
    .task-detail-due-date-input::-webkit-calendar-picker-indicator {
        opacity: 0.6;
        cursor: pointer;
        margin-left: 0;
    }

    .task-detail-due-date-input::-webkit-datetime-edit {
        padding: 0;
    }

    .task-detail-due-date-input::-webkit-datetime-edit-fields-wrapper {
        padding: 0;
    }

    .task-detail-due-date-input::-webkit-datetime-edit-text {
        color: var(--text-muted);
        padding: 0 2px;
    }
}

@media (hover: none),
(pointer: coarse) {
    .task-detail-due-date-input::-webkit-calendar-picker-indicator {
        opacity: 1;
        cursor: pointer;
    }
}

/* iOS Safari: flex row when JS adds explicit showPicker button beside datetime-local */
#taskDetailsContent .datetime-local-input-wrap,
#createTaskModal .datetime-local-input-wrap {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#taskDetailsContent .datetime-local-input-wrap .task-detail-due-date-input,
#createTaskModal .datetime-local-input-wrap input[type="datetime-local"] {
    flex: 1;
    min-width: 0;
}

.btn-datetime-local-picker {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn-datetime-local-picker:hover,
.btn-datetime-local-picker:focus-visible {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-secondary);
    outline: none;
}

.btn-datetime-local-picker .icon {
    width: 22px;
    height: 22px;
}

/* Ensure Due Date & Time column doesn't shrink so date and time are both visible */
#taskDetailsContent .task-meta .meta-item:has(.task-detail-due-date-input),
.task-details .task-meta .meta-item:has(.task-detail-due-date-input) {
    min-width: 220px;
}

#taskDetailsContent .task-meta .meta-item .task-detail-due-date-input,
.task-details .task-meta .meta-item .task-detail-due-date-input {
    min-width: 220px !important;
    padding: 10px;
}

.due-date-empty {
    color: var(--text-muted);
}

.priority-badge {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    min-width: fit-content;
}

/* .priority-low {
    background: #e0f2fe;
    color: #0369a1;
}

.priority-medium {
    background: #fef3c7;
    color: #92400e;
} */

/* .priority-high {
    background: #fee2e2;
    color: #991b1b;
} */

.task-description-section {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.task-description-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    gap: var(--spacing-md);
}

.task-description-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    min-width: 0;
}

/* Tablet and mobile: stack Description title and Edit button so Edit never covers text */
@media (max-width: 1024px) {
    .task-description-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
    }

    .task-description-header h3 {
        width: 100%;
    }

    .task-description-header #editDescriptionBtn {
        align-self: flex-end;
    }
}

/* Description Edit: subtle link-style so it doesn’t compete with the heading */
.task-description-header #editDescriptionBtn {
    flex-shrink: 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.8125rem;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.task-description-header #editDescriptionBtn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.task-description-header #editDescriptionBtn .icon {
    width: 16px;
    height: 16px;
    margin-right: 0.3rem;
}

.task-description-full {
    margin-bottom: var(--spacing-xl);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
}

.task-description-full ul,
.task-description-full ol {
    display: block;
    margin: 0.5em 0;
    padding-left: 2em;
    list-style-position: outside;
}

.task-description-full li {
    display: list-item;
    margin-bottom: 0.25em;
    padding-left: 0.25em;
}

.task-description-edit {
    margin-bottom: var(--spacing-xl);
}

/* Wrapper with scroll arrows around the toolbar */
.task-description-toolbar-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: var(--spacing-sm);
    min-width: 0;
}

.task-description-toolbar-scroll {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.task-description-toolbar-scroll::-webkit-scrollbar {
    height: 4px;
}

.task-description-toolbar-arrow {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    padding: 0;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.task-description-toolbar-arrow:hover:not(:disabled) {
    background: var(--border-light);
    color: var(--text);
}

.task-description-toolbar-arrow:disabled {
    opacity: 0.4;
    cursor: default;
}

.task-description-toolbar-arrow .icon {
    width: 20px;
    height: 20px;
}

/* Force SVG arrow icon to use text color (fixes dark mode / <use> inheritance) */
.task-description-toolbar-arrow .icon,
.task-description-toolbar-arrow svg {
    fill: currentColor;
}

/* Dark themes: ensure arrows are always visible (background + icon) */
[data-theme="dark"] .task-description-toolbar-wrap .task-description-toolbar-arrow,
[data-theme="dark-gray"] .task-description-toolbar-wrap .task-description-toolbar-arrow,
[data-theme="dark-blue"] .task-description-toolbar-wrap .task-description-toolbar-arrow,
[data-theme="dark-purple"] .task-description-toolbar-wrap .task-description-toolbar-arrow,
[data-theme="dark-green"] .task-description-toolbar-wrap .task-description-toolbar-arrow {
    background: #525252;
    color: #e5e5e5;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .task-description-toolbar-wrap .task-description-toolbar-arrow:hover:not(:disabled),
[data-theme="dark-gray"] .task-description-toolbar-wrap .task-description-toolbar-arrow:hover:not(:disabled),
[data-theme="dark-blue"] .task-description-toolbar-wrap .task-description-toolbar-arrow:hover:not(:disabled),
[data-theme="dark-purple"] .task-description-toolbar-wrap .task-description-toolbar-arrow:hover:not(:disabled),
[data-theme="dark-green"] .task-description-toolbar-wrap .task-description-toolbar-arrow:hover:not(:disabled) {
    background: #616161;
    color: #f5f5f5;
}

[data-theme="dark"] .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled,
[data-theme="dark-gray"] .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled,
[data-theme="dark-blue"] .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled,
[data-theme="dark-purple"] .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled,
[data-theme="dark-green"] .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled {
    background: #404040;
    color: #737373;
    border-color: rgba(255, 255, 255, 0.05);
}

/* Ensure arrows are never hidden and have size (fallback for any context) */
#taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow {
    min-width: 36px;
    min-height: 32px;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Dark themes when theme is on html: ensure arrows visible in task modal */
html[data-theme="dark"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow,
html[data-theme="dark-gray"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow,
html[data-theme="dark-blue"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow,
html[data-theme="dark-purple"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow,
html[data-theme="dark-green"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow {
    background: #525252;
    color: #e5e5e5;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled,
html[data-theme="dark-gray"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled,
html[data-theme="dark-blue"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled,
html[data-theme="dark-purple"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled,
html[data-theme="dark-green"] #taskDetailsContent .task-description-toolbar-wrap .task-description-toolbar-arrow:disabled {
    background: #404040;
    color: #737373;
    opacity: 0.9;
}

.task-description-rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) 0;
    margin-bottom: 0;
    border-bottom: none;
}

/* Narrow viewports: single scrollable row; arrows always visible */
@media screen and (max-width: 768px) {
    .task-description-rich-toolbar {
        flex-wrap: nowrap;
        padding: var(--spacing-sm) var(--spacing-xs);
    }

    .task-description-rich-toolbar .btn,
    .task-description-rich-toolbar .custom-dropdown-toolbar .custom-dropdown-trigger {
        width: fit-content !important;
        flex-shrink: 0;
        padding: 0.35rem 0.6rem;
    }
}

/* Toolbar custom dropdowns (Format, Text color, Highlight) – same style as Status/Priority */
.task-description-rich-toolbar .custom-dropdown-toolbar {
    margin-left: var(--spacing-xs);
}

.task-description-rich-toolbar .custom-dropdown-toolbar .custom-dropdown-trigger {
    min-width: 0;
    padding: 0.35rem 0.6rem;
    font-size: 13px;
    font-weight: 600;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.task-description-rich-toolbar .custom-dropdown-toolbar .custom-dropdown-trigger:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.task-description-rich-toolbar .custom-dropdown-toolbar .custom-dropdown-trigger.is-active {
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    border-color: color-mix(in srgb, var(--primary) 45%, transparent);
    color: var(--primary);
}

.task-description-rich-toolbar .custom-dropdown-toolbar .custom-dropdown-menu {
    min-width: max-content;
}

.task-description-rich-toolbar button.is-active {
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    border-color: color-mix(in srgb, var(--primary) 45%, transparent);
    color: var(--primary);
}

.task-description-rich-editor {
    min-height: 120px;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    outline: none;
}

.task-description-rich-editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.task-description-rich-editor p {
    margin: 0 0 0.5em 0;
}

.task-description-rich-editor p:last-child {
    margin-bottom: 0;
}

.task-description-rich-editor ul,
.task-description-rich-editor ol {
    margin: 0.5em 0;
    padding-left: 2em;
    list-style-position: outside;
}

.task-description-rich-editor li {
    display: list-item;
    margin-bottom: 0.25em;
    padding-left: 0.25em;
}

.task-description-edit textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 150px;
    background: var(--card);
    color: var(--text);
}

.description-edit-actions {
    margin-top: var(--spacing-md);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

/* Task detail sections: consistent card layout */
.task-detail-section {
    margin-bottom: var(--spacing-xl);
    /* padding: var(--spacing-lg); */
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.task-detail-section-title {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.task-detail-section-title .task-detail-section-icon {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.task-detail-section-title .task-detail-section-icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* Task detail accordions (Assignment, Resources, Attachments) - closed by default */
.task-detail-accordion {
    margin-bottom: var(--spacing-xl);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    padding: 0 !important;
}

.task-detail-accordion summary.task-detail-accordion-trigger {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    user-select: none;
    transition: background-color 0.15s ease;
}

.task-detail-accordion summary.task-detail-accordion-trigger::-webkit-details-marker {
    display: none;
}

.task-detail-accordion summary.task-detail-accordion-trigger:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.task-detail-accordion summary .task-detail-section-title {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.task-detail-accordion summary .task-detail-section-title .task-detail-section-icon,
.task-detail-accordion summary .task-detail-section-title .icon.task-detail-section-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--text-secondary, #6b7280);
    width: 1.125rem;
    height: 1.125rem;
}

.task-detail-accordion summary .task-detail-section-title .task-detail-section-icon svg,
.task-detail-accordion summary .task-detail-section-title .icon.task-detail-section-icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* Dependencies section – clear title and intro */
.task-dependencies-section .task-detail-accordion-trigger .task-detail-section-title {
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text);
}

.task-dependencies-section .task-detail-accordion-panel .task-detail-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Circular count badge in accordion headers – stays inline */
.task-detail-accordion .task-detail-section-title .assignment-count,
.task-detail-accordion .task-detail-section-title .link-count,
.task-detail-accordion .task-detail-section-title .attachment-count,
.task-detail-accordion .task-detail-section-title .blocker-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.25rem;
    border-radius: 50%;
    background: var(--text, #111);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    vertical-align: middle;
}

/* Dark themes: badge must stay dark bg + light text (--text is light in dark mode) */
[data-theme="dark"] .task-detail-accordion .task-detail-section-title .assignment-count,
[data-theme="dark"] .task-detail-accordion .task-detail-section-title .link-count,
[data-theme="dark"] .task-detail-accordion .task-detail-section-title .attachment-count,
[data-theme="dark"] .task-detail-accordion .task-detail-section-title .blocker-count,
[data-theme="dark-gray"] .task-detail-accordion .task-detail-section-title .assignment-count,
[data-theme="dark-gray"] .task-detail-accordion .task-detail-section-title .link-count,
[data-theme="dark-gray"] .task-detail-accordion .task-detail-section-title .attachment-count,
[data-theme="dark-gray"] .task-detail-accordion .task-detail-section-title .blocker-count,
[data-theme="dark-blue"] .task-detail-accordion .task-detail-section-title .assignment-count,
[data-theme="dark-blue"] .task-detail-accordion .task-detail-section-title .link-count,
[data-theme="dark-blue"] .task-detail-accordion .task-detail-section-title .attachment-count,
[data-theme="dark-blue"] .task-detail-accordion .task-detail-section-title .blocker-count,
[data-theme="dark-purple"] .task-detail-accordion .task-detail-section-title .assignment-count,
[data-theme="dark-purple"] .task-detail-accordion .task-detail-section-title .link-count,
[data-theme="dark-purple"] .task-detail-accordion .task-detail-section-title .attachment-count,
[data-theme="dark-purple"] .task-detail-accordion .task-detail-section-title .blocker-count,
[data-theme="dark-green"] .task-detail-accordion .task-detail-section-title .assignment-count,
[data-theme="dark-green"] .task-detail-accordion .task-detail-section-title .link-count,
[data-theme="dark-green"] .task-detail-accordion .task-detail-section-title .attachment-count,
[data-theme="dark-green"] .task-detail-accordion .task-detail-section-title .blocker-count {
    background: #404040;
    color: #fff;
}

.task-detail-accordion .accordion-chevron {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: var(--spacing-sm);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.task-detail-accordion[open] .accordion-chevron {
    transform: rotate(180deg);
}

.task-detail-accordion .task-detail-accordion-panel {
    padding: var(--spacing-lg) var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

/* Paid features: visible but locked for free tier with upgrade CTA */
.task-detail-paid-feature {
    position: relative;
}

.task-detail-paid-feature.is-locked {
    min-height: 200px;
}

.task-detail-paid-feature.is-locked[data-feature="history"] {
    min-height: 220px;
}

.task-detail-paid-feature.is-locked .task-detail-paid-feature-content {
    pointer-events: none;
    user-select: none;
    opacity: 0.6;
}

.task-detail-upgrade-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 2;
    background: color-mix(in srgb, var(--card) 96%, transparent);
    border-radius: var(--radius-md);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl);
    text-align: center;
}

.task-detail-paid-feature.is-locked .task-detail-upgrade-overlay {
    display: flex;
}

.task-detail-upgrade-overlay .task-detail-upgrade-icon {
    color: var(--text-muted);
    opacity: 0.9;
}

.task-detail-upgrade-overlay p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    max-width: 260px;
}

.task-detail-upgrade-overlay .btn {
    margin-top: var(--spacing-xs);
}

.task-activity-list {
    display: flex;
    max-height: 400px;
    overflow-y: auto;
    flex-direction: column;
    gap: var(--spacing-md);
}

.task-activity-item {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9375rem;
}

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

.task-activity-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 0.25rem;
}

.task-activity-user {
    font-weight: 600;
    color: var(--text);
}

.task-activity-time {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.task-activity-action {
    color: var(--text-secondary);
}

.task-activity-loading,
.task-activity-empty {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-muted);
}

/* Subtasks */
.task-subtasks-section .task-detail-accordion-panel {
    padding-top: var(--spacing-md);
}

.task-subtasks-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.task-subtasks-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.task-subtask-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.task-subtask-item[draggable="true"] {
    cursor: grab;
}

.task-subtask-item.subtask-dragging {
    opacity: 0.5;
}

.task-subtask-item:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.task-subtask-item:hover .task-subtask-delete {
    opacity: 1;
}

.task-subtask-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    margin: 0;
    font-size: 0.9375rem;
    min-width: 0;
}

.task-subtask-check {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.task-subtask-title {
    color: var(--text);
    transition: color 0.15s ease;
}

.task-subtask-title.is-completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-subtask-title-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.task-subtask-edit-input {
    width: 100%;
    max-width: 100%;
    padding: 0.25rem 0.5rem;
    font-size: inherit;
    line-height: inherit;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
}

.task-subtask-edit {
    flex-shrink: 0;
    opacity: 0.7;
}

.task-subtask-edit:hover {
    opacity: 1;
}

.task-subtask-delete {
    flex-shrink: 0;
    opacity: 0.5;
    padding: 0.35rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.task-subtask-delete:hover {
    opacity: 1;
    background: var(--danger-light, rgba(239, 68, 68, 0.1));
    color: var(--danger);
}

.task-subtask-add-form {
    display: flex;
    gap: var(--spacing-sm);
    align-items: stretch;
    flex-wrap: nowrap;
}

.task-subtask-input {
    flex: 1;
    min-width: 0;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.task-subtask-input::placeholder {
    color: var(--text-muted);
}

.task-subtask-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 59, 130, 246), 0.15);
}

.task-blockers-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.task-blocker-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
}

.task-blocker-item-id {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
}

.task-blocker-item-link {
    flex: 1;
    min-width: 0;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.task-blocker-item-link:hover {
    text-decoration: underline;
}

/* Only the X button removes; clicking the link/card opens the task */
.task-blocker-item .task-blocker-remove {
    flex-shrink: 0;
    opacity: 0.6;
    color: var(--text-muted);
    min-width: 2rem;
    min-height: 2rem;
}

.task-blocker-item .task-blocker-remove:hover {
    opacity: 1;
    color: var(--text);
}

/* Blocker search – live search + dropdown */
.task-add-blocker-hint {
    margin: 0 0 var(--spacing-sm);
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.blocker-search-wrap {
    position: relative;
    max-width: 500px;
}

.blocker-search-input-wrap {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--input-bg, var(--card));
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.blocker-search-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 59, 130, 246), 0.2);
}

.blocker-search-icon {
    flex-shrink: 0;
    color: var(--text-muted);
}

.blocker-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    font-size: 0.9375rem;
    color: var(--text);
    padding: 0;
    outline: none;
}

.blocker-search-input::placeholder {
    color: var(--text-muted);
}

.blocker-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

.blocker-search-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s ease;
}

.blocker-search-option:last-child {
    border-bottom: none;
}

.blocker-search-option:hover,
.blocker-search-option:focus {
    background: var(--hover-bg, rgba(0, 0, 0, 0.04));
    outline: none;
}

.blocker-search-option-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.blocker-search-option-id {
    flex-shrink: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.blocker-search-option-status-wrap {
    flex-shrink: 0;
}

.blocker-search-option-status {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.3;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.blocker-search-empty {
    padding: var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

/* Bulk actions bar */
.bulk-actions-bar {
    position: fixed;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    max-width: calc(100vw - 2rem);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.bulk-actions-count {
    font-size: 0.9375rem;
    color: var(--text);
    white-space: nowrap;
}

.bulk-actions-count strong {
    color: var(--text);
}

.bulk-status-select {
    min-width: 140px;
    padding: var(--spacing-sm) 2rem var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}

.bulk-actions-bar .btn {
    white-space: nowrap;
}

/* Tablet: compact spacing */
@media (max-width: 1024px) {
    .bulk-actions-bar {
        padding: var(--spacing-sm) var(--spacing-md);
        gap: var(--spacing-sm);
        bottom: var(--spacing-md);
    }

    .bulk-status-select {
        min-width: 120px;
    }
}

/* Mobile: full-width bar, compact actions */
@media (max-width: 768px) {
    .bulk-actions-bar {
        left: var(--spacing-md);
        right: var(--spacing-md);
        bottom: var(--spacing-md);
        transform: none;
        width: auto;
        max-width: none;
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .bulk-actions-count {
        flex: 0 0 100%;
        font-size: 0.875rem;
        padding-bottom: var(--spacing-sm);
        margin-bottom: 0;
        border-bottom: 1px solid var(--border-light);
    }

    .bulk-actions-bar .bulk-status-select {
        flex: 1 1 auto;
        min-width: 100px;
        font-size: 0.8125rem;
    }

    .bulk-actions-bar .btn {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 0.8125rem;
        padding: var(--spacing-sm) var(--spacing-xs);
    }
}

/* Task card checkbox */
.task-card-select-wrap {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

.task-card-select {
    margin: 0;
}

.task-subtask-add-form .btn {
    flex-shrink: 0;
}

.task-subtasks-loading,
.task-subtasks-empty {
    padding: var(--spacing-lg) var(--spacing-md);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.subtasks-progress {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    margin-left: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: 999px;
}

.task-assignment-section .task-assignment-block {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.task-assignment-section .task-assignees-section {
    margin: 0;
    padding: 0;
    border: none;
}

.task-assignment-section .task-assignees-section+.task-assignees-section {
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

.task-detail-subtitle {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.task-attachments-section.task-detail-section,
.task-comments-section.task-detail-section {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: none;
}

.task-attachments-section.task-detail-section h3,
.task-comments-section.task-detail-section h3 {
    margin: 0 0 var(--spacing-md) 0;
}

.task-assignees-section,
.task-comments-section {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border-light);
}

.task-detail-section .task-assignees-section,
.task-detail-section.task-comments-section {
    margin-top: 0;
    /* padding-top: 0; */
    border-top: none;
}

.task-assignees-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.task-assignees-section h3,
.task-assignees-section h4,
.task-comments-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.comments-list {
    margin-bottom: var(--spacing-xl);
    max-height: 400px;
    overflow-y: auto;
    /* padding-right: var(--spacing-sm); */
}

/* Global Custom Scrollbar Styles */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Webkit browsers (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
    border-radius: var(--radius-sm);
}

*::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
    background-clip: padding-box;
}

/* Dark theme scrollbar */
[data-theme="dark"] *,
[data-theme="dark-gray"] *,
[data-theme="dark-blue"] * {
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

[data-theme="dark"] *::-webkit-scrollbar-thumb,
[data-theme="dark-gray"] *::-webkit-scrollbar-thumb,
[data-theme="dark-blue"] *::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    background-clip: padding-box;
}

[data-theme="dark"] *::-webkit-scrollbar-thumb:hover,
[data-theme="dark-gray"] *::-webkit-scrollbar-thumb:hover,
[data-theme="dark-blue"] *::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
    background-clip: padding-box;
}

/* Modal-specific scrollbar styling - more subtle */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: var(--radius-sm);
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.2s ease;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
    background-clip: padding-box;
}

[data-theme="dark"] .modal-content::-webkit-scrollbar-thumb,
[data-theme="dark-gray"] .modal-content::-webkit-scrollbar-thumb,
[data-theme="dark-blue"] .modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    background-clip: padding-box;
}

[data-theme="dark"] .modal-content::-webkit-scrollbar-thumb:hover,
[data-theme="dark-gray"] .modal-content::-webkit-scrollbar-thumb:hover,
[data-theme="dark-blue"] .modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
    background-clip: padding-box;
}

.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.comments-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.comments-empty {
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    color: var(--text-secondary);
}

.comments-empty .icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    display: block;
}

.comments-empty p {
    margin: 0;
    font-size: 14px;
}

.comment-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    background: var(--card);
    border-radius: var(--radius-md);
    transition: var(--transition);
    border: 1px solid var(--border-light);
    width: 100%;
    box-sizing: border-box;
    overflow-x: visible;
}

.comment-item:hover {
    background: var(--bg-secondary);
    border-color: var(--border);
}

.comment-avatar {
    width: 40px;
    height: 40px;
    font-size: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    flex-wrap: wrap;
}

.comment-header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 1;
    min-width: 0;
}

.comment-author {
    font-weight: 600;
    color: var(--text);
}

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

.comment-actions {
    display: flex;
    gap: var(--spacing-xs);
    flex-shrink: 0;
    align-items: center;
}

.btn-icon-sm {
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 32px;
    flex-shrink: 0;
}

.btn-icon-sm .icon {
    width: 18px;
    height: 18px;
    line-height: 1;
}

.btn-icon-sm:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.comment-edit-form {
    margin-top: var(--spacing-sm);
}

.comment-edit-textarea {
    width: 100%;
    padding: var(--spacing-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    margin-bottom: var(--spacing-sm);
}

.comment-edit-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.comment-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.comment-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    word-wrap: break-word;
    margin-top: var(--spacing-xs);
    padding: var(--spacing-xs) 0;
    white-space: normal;
    min-height: 20px;
    display: block;
    visibility: visible;
    opacity: 1;
    text-align: left;
    overflow-x: visible;
}

/* Ensure rich text content in comments doesn't get constrained */
.comment-text .rich-text-content {
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
    word-wrap: break-word;
    box-sizing: border-box;
}

.comment-text .rich-text-content iframe {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    min-height: 315px !important;
    aspect-ratio: 16 / 9 !important;
    display: block !important;
    box-sizing: border-box;
}

.comment-form-wrapper {
    margin-top: var(--spacing-lg);
    /* padding-top: var(--spacing-lg); */
    border-top: 1px solid var(--border-light);
}

#commentForm {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#commentForm {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.comment-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    background: var(--card);
    padding: 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    overflow: hidden;
}

.comment-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-comment-submit:hover {
    background: var(--primary-dark);
}

.comment-textarea-container {
    position: relative;
    flex: 1;
    min-width: 0;
    background: var(--card);
    border-radius: 0;
    border: none;
    overflow: visible;
}

/* Mirror overlay: shows comment text with @mentions as pills; textarea sits on top with transparent text */
.mention-display {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: var(--spacing-md);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
    /* Must sit above the textarea so pills (pointer-events: auto) are clickable */
    z-index: 3;
    color: var(--text);
    font-family: inherit;
}

.comment-textarea-container .comment-textarea {
    position: relative;
    z-index: 2;
    background: transparent;
    border: none;
    padding: var(--spacing-md);
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    width: 100%;
    color: transparent;
    caret-color: var(--primary);
    border-radius: var(--radius-md);
}

.comment-textarea-container .comment-textarea::placeholder {
    color: var(--text-muted);
}

/* Transparent text so overlay pills show through; caret stays visible */
.comment-textarea-container #commentTextarea {
    color: transparent !important;
    caret-color: var(--primary);
}

/* Pill style for @mention in comment input overlay - chip appearance without affecting text flow */
.mention-display .mention-pill-inline {
    display: inline-flex;
    align-items: center;
    position: relative;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    padding: 0;
    margin: 0;
    line-height: inherit;
    vertical-align: baseline;
    white-space: nowrap;
    pointer-events: auto;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;
}

/* Visual chip background that doesn't affect layout */
.mention-display .mention-pill-inline::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: transparent;
    border-radius: var(--radius-sm);
    z-index: -1;
    pointer-events: none;
    transition: all 0.15s ease;
}

.mention-display .mention-pill-inline:hover::before {
    box-shadow:
        0 0 0 4px var(--bg-hover, #f3f4f6),
        inset 0 0 0 1px var(--border-hover, #d1d5db);
}

.mention-display .mention-pill-text {
    position: relative;
    z-index: 1;
    padding: 0;
    margin: 0;
    color: var(--primary);
}

.mention-pill-inline .mention-pill-remove {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    position: relative;
    z-index: 1;
    background: #ff0000;
    border: none;
    color: #fff;
    /* font-size: 14px; */
    line-height: inherit;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    /* vertical-align: baseline; */
    transition: color 0.15s ease;
    pointer-events: auto;
    font-weight: 600;
    border: 1px solid #fff;
}

.mention-pill-inline .mention-pill-remove:hover {
    color: var(--text);
}

.comment-textarea:focus {
    outline: none;
}

.btn-comment-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    width: 100%;
    border-top: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
    transition: var(--transition);
    min-height: 44px;
    align-self: flex-end;
}

.btn-comment-submit:hover {
    background: var(--primary-hover);
}

.btn-comment-submit .icon {
    width: 18px;
    height: 18px;
}

#commentTextarea {
    width: 100%;
    padding: var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
    background: transparent;
    color: var(--text);
    line-height: 1.5;
    transition: var(--transition);
    position: relative;
    z-index: 2;
    caret-color: var(--primary);
}

#commentTextarea:focus {
    outline: none;
}

#commentTextarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Mention: blue name only (no pill) in comments and overlay */
.mention-tag,
.mention-highlight,
.mention-name-inline {
    color: var(--primary, #3B82F6);
    font-weight: 600;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    display: inline;
}

.mention-inline-wrapper {
    display: inline;
    cursor: text;
    pointer-events: auto;
}

.mention-marker-invisible {
    color: transparent;
    user-select: none;
    pointer-events: none;
    font-size: inherit;
    line-height: inherit;
}

.btn-comment-submit {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.625rem 1rem;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.2);
    transition: all 0.2s;
}

.btn-comment-submit:hover {
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.btn-comment-submit .icon {
    width: 18px;
    height: 18px;
}

/* Mention Styles */

.mention-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #3B82F6), var(--primary-dark, #1E40AF));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mention-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.mention-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-email {
    font-size: 12px;
    color: var(--text-muted, var(--text-secondary));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mention autocomplete dropdown (comment textarea) */
.mention-dropdown {
    position: relative;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 8px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 10px 20px -2px rgba(0, 0, 0, 0.25);
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    z-index: 10002;
}

.mention-dropdown.show {
    display: block !important;
}

.mention-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    border-bottom: 1px solid var(--border-light);
}

.mention-option:first-child {
    border-radius: var(--radius-lg, 8px) var(--radius-lg, 8px) 0 0;
}

.mention-option:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius-lg, 8px) var(--radius-lg, 8px);
}

.mention-option:hover {
    background: var(--primary-light, rgba(59, 130, 246, 0.1));
    transform: translateX(2px);
}

.mention-option.selected {
    background: var(--primary-light, rgba(59, 130, 246, 0.15));
    border-left: 3px solid var(--primary);
    padding-left: calc(1rem - 3px);
}

.comment-item strong {
    color: var(--text);
    font-weight: 600;
}

.comment-item small {
    color: var(--text-muted);
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 12px;
}

/* Projects Page */
.projects-page {
    padding: var(--spacing-lg) 0;
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-2xl);
}

.projects-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.02em;
}

.list-search {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.list-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-md);
}

.list-search .icon {
    color: var(--text-secondary);
}

.list-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text);
    flex: 1;
    font-family: inherit;
}

.list-search input::placeholder {
    color: var(--text-muted);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-xl);
}

.projects-grid.projects-grid--dragging .project-card {
    opacity: 0.6;
    transform: scale(0.99);
}

.projects-grid.projects-grid--dragging .project-card.is-dragging {
    opacity: 0.5;
    transform: rotate(3deg);
}

.project-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-light);
    cursor: grab;
}

.project-card.is-dragging {
    opacity: 0.5;
    transform: rotate(3deg);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
    cursor: grabbing;
    z-index: 10;
}

.project-card.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
    cursor: grabbing;
    z-index: 10;
}

.project-card.is-drop-target {
    box-shadow: 0 0 0 2px var(--primary, #3B82F6);
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--spacing-md);
}

.project-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    flex-wrap: wrap;
}

.project-card-order-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.project-card-move-btn {
    padding: 4px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.project-card-move-btn:hover:not(:disabled) {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.project-card-move-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Desktop: show drag handle, hide arrows */
@media (min-width: 769px) {
    .project-card-order-actions {
        display: none;
    }
}

.project-card-drag-handle {
    width: 20px;
    height: 20px;
    display: grid;
    grid-template-columns: repeat(3, 4px);
    grid-template-rows: repeat(2, 4px);
    gap: 3px;
    cursor: grab;
}

.project-card-drag-dot {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
}

.project-card:hover .project-card-drag-dot {
    background: var(--primary);
}

/* Mobile: hide drag handle (dots), show arrows only */
@media (max-width: 768px) {
    .project-card-drag-handle {
        display: none !important;
    }

    .project-card {
        cursor: default;
    }
}

.project-card-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    flex: 1;
}

.project-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 32px;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-icon--disabled {
    cursor: default;
    opacity: 0.5;
    color: var(--text-muted);
}

.btn-icon--disabled:hover {
    background: transparent;
    border-color: var(--border);
    color: var(--text-muted);
}

.project-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
    /* Limit to 3 lines with ellipsis for a clean, consistent card height */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.project-description .rich-text-content {
    color: var(--text-secondary);
}

.project-description .rich-text-content p {
    color: var(--text-secondary);
}

.project-stats {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-light);
}

.project-stats .btn,
.project-stats a.btn {
    color: var(--primary);
    background: transparent;
    border: 1px solid var(--primary);
}

.project-stats .btn:hover,
.project-stats a.btn:hover {
    background: var(--primary);
    color: white;
}

/* Settings Page */
/* .settings-page {
    padding: var(--spacing-lg) 0;
} */

.settings-tabs-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: var(--spacing-2xl);
    border-bottom: 2px solid var(--border-light);
}

.settings-tabs-nav {
    flex-shrink: 0;
    width: 40px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: none;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: -2px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.settings-tabs-nav:hover:not(:disabled) {
    color: var(--primary);
    background: var(--bg-secondary);
}

.settings-tabs-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.settings-tabs {
    display: flex;
    gap: var(--spacing-sm);
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
}

.settings-tabs:active {
    cursor: grabbing;
}

.settings-tabs::-webkit-scrollbar {
    display: none;
}

.tab-button {
    background: transparent;
    border: none;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    /* margin-bottom: -2px; */
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    touch-action: manipulation;
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
}

.subscription-status {
    margin-bottom: var(--spacing-lg);
}

.usage-stats {
    margin-top: var(--spacing-md);
}

.usage-item {
    margin-bottom: var(--spacing-sm);
}

.usage-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
}

.plan-features {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.tab-button:hover {
    color: var(--text);
    background: var(--bg-secondary);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.settings-tab {
    display: none;
}

.settings-tab.active {
    display: flex;
    justify-content: center;
}

.settings-section {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Responsive section padding */
@media (max-width: 1200px) {
    .settings-section {
        padding: var(--spacing-xl);
    }
}

@media (max-width: 768px) {
    .settings-section {
        padding: var(--spacing-lg);
    }
}

@media (max-width: 600px) {
    .settings-section {
        padding: var(--spacing-md);
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.section-header .member-count {
    color: var(--text-light);
    font-size: 14px;
}

.section-description {
    color: var(--text-light);
    font-size: 14px;
    margin: var(--spacing-sm) 0 0 0;
}

.section-header-stacked .section-description {
    margin-top: 0.25rem;
}

/* Analytics Tab - Usage & Adoption */
.analytics-section {
    width: 100%;
    margin: 0 auto;
}

.analytics-section .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: var(--spacing-xl);
}

.analytics-section .section-header h2 {
    margin-bottom: 0.25rem;
}

.analytics-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
    width: 100%;
    box-sizing: border-box;
}

/* Large desktop: 3 columns - default */
@media (min-width: 1400px) {
    .analytics-metrics-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-lg);
    }
}

/* Desktop: 3 columns with responsive gap */
@media (min-width: 1025px) and (max-width: 1399px) {
    .analytics-metrics-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-md);
    }
}

/* Tablet: 2 columns (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .analytics-section {
        padding: 0;
    }

    .analytics-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-xl);
        margin-bottom: var(--spacing-2xl);
    }

    .analytics-metric-card {
        padding: var(--spacing-xl);
        min-height: 160px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .analytics-metric-value {
        font-size: 2rem;
        margin-bottom: var(--spacing-sm);
    }

    .analytics-metric-label {
        font-size: 0.875rem;
        font-weight: 500;
    }
}

/* Small tablet: 2 columns with adjusted spacing */
@media (min-width: 600px) and (max-width: 768px) {
    .analytics-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
}

/* Mobile: 1 column */
@media (max-width: 599px) {
    .analytics-metrics-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

.analytics-metric-card {
    background: linear-gradient(135deg, var(--card) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.analytics-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.analytics-metric-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.analytics-metric-card:hover::before {
    opacity: 1;
}

.analytics-metric-card-success {
    border-color: var(--success-light);
}

.analytics-metric-card-success:hover {
    border-color: var(--success);
    box-shadow: 0 8px 16px rgba(34, 197, 94, 0.1);
}

.analytics-metric-card-success::before {
    background: linear-gradient(90deg, var(--success), transparent);
}

.analytics-metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.analytics-metric-value .analytics-metric-suffix {
    font-weight: 600;
    font-size: 1rem;
    margin-left: 0.25em;
}

.analytics-metric-card-success .analytics-metric-value {
    color: var(--success);
}

.analytics-metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Small tablet: 2 columns (600px - 768px) responsive adjustments */
@media (max-width: 768px) {
    .analytics-metric-card {
        padding: var(--spacing-lg);
    }

    .analytics-metric-value {
        font-size: 1.5rem;
    }

    .analytics-metric-label {
        font-size: 0.8125rem;
    }
}

/* Mobile: 1 column responsive adjustments */
@media (max-width: 600px) {
    .analytics-metric-card {
        padding: var(--spacing-md);
    }

    .analytics-metric-value {
        font-size: 1.25rem;
    }

    .analytics-metric-label {
        font-size: 0.75rem;
    }
}

.analytics-reporting-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* gap: var(--spacing-lg); */
    flex-wrap: wrap;
    padding: var(--spacing-xl) var(--spacing-lg);
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(59, 130, 246, 0.05) 100%);
    border: 1px solid var(--primary-light);
    border-radius: var(--radius-lg);
    margin-top: var(--spacing-xl);
}

.analytics-reporting-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    padding: 0.5rem 0;
}

.analytics-reporting-link:hover {
    color: var(--primary-dark, #2563eb);
    gap: 0.75rem;
}

.analytics-reporting-link .icon {
    flex-shrink: 0;
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.analytics-reporting-link:hover .icon {
    transform: translateX(2px);
}

.analytics-reporting-note {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
    flex: 1 1 100%;
}

/* Responsive CTA adjustments for tablet (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .analytics-reporting-cta {
        /* gap: var(--spacing-lg); */
        padding: var(--spacing-xl);
        align-items: center;
        justify-content: flex-start;
    }

    .analytics-reporting-link {
        font-size: 0.9375rem;
        font-weight: 600;
    }

    .analytics-reporting-note {
        font-size: 0.8125rem;
        margin-left: auto;
    }
}

/* Responsive CTA adjustments for small tablet (600px - 768px) */
@media (max-width: 768px) {
    .analytics-reporting-cta {
        flex-direction: column;
        align-items: flex-start;
        /* gap: var(--spacing-md); */
        padding: var(--spacing-lg);
    }

    .analytics-reporting-link {
        font-size: 0.875rem;
    }

    .subscription-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
}

/* Responsive CTA adjustments for mobile (<600px) */
@media (max-width: 600px) {
    .analytics-reporting-cta {
        padding: var(--spacing-md);
    }

    .analytics-reporting-link {
        font-size: 0.8125rem;
    }
}

/* Security / 2FA toggle */
.security-2fa-section {
    max-width: 480px;
}

.security-2fa-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: var(--shadow-sm);
}

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

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(22px);
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 2px var(--primary-light, rgba(59, 130, 246, 0.3));
}

/* Project Access List */
.project-access-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
}

.project-access-item:hover {
    background: var(--bg-hover);
}

.project-access-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

/* Task Custom Fields tab – responsive cards and action rows */
.custom-fields-migration-note {
    padding: var(--spacing-md);
    background: var(--warning-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.custom-fields-section-header {
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: flex-start;
}

.custom-fields-section-header-text {
    flex: 1 1 150px;
    min-width: 0;
}

.custom-fields-add-btn {
    flex-shrink: 0;
    align-self: flex-start;
}

@media (max-width: 600px) {
    .custom-fields-section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-fields-add-btn {
        width: 100%;
        justify-content: center;
    }
}

.custom-fields-list {
    padding-bottom: calc(var(--spacing-2xl) + 56px + env(safe-area-inset-bottom, 0px));
    gap: var(--spacing-md);
}

/* Accordion wrapper: card with no inner padding (trigger and panel have their own) */
.custom-field-accordion {
    margin-bottom: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    box-sizing: border-box;
}

.custom-field-accordion-details {
    display: block;
}

.custom-field-accordion-trigger {
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
    transition: background-color 0.15s ease;
    user-select: none;
}

.custom-field-accordion-trigger::-webkit-details-marker {
    display: none;
}

.custom-field-accordion-trigger:hover {
    background: var(--card);
}

.custom-field-accordion-title {
    font-weight: 600;
    font-size: 1rem;
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

.custom-field-accordion-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.custom-field-accordion-chevron {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") center/contain no-repeat;
    transition: transform 0.2s ease;
}

.custom-field-accordion-details[open] .custom-field-accordion-chevron {
    transform: rotate(180deg);
}

.custom-field-accordion-panel {
    padding: var(--spacing-lg) var(--spacing-md);
    border-top: 1px solid var(--border);
}

.custom-field-accordion-panel .custom-field-card__actions {
    margin-bottom: var(--spacing-md);
    padding-top: var(--spacing-sm);
}

.custom-field-projects-wrap {
    margin-bottom: var(--spacing-md);
}

.custom-field-projects-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.custom-field-project-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin: 20px 0;
}

.custom-field-project-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.custom-field-project-pill:hover {
    border-color: var(--primary);
    color: var(--text);
}

.custom-field-project-pill--selected {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.custom-field-project-pill--selected:hover {
    background: var(--primary-dark, #1d4ed8);
    border-color: var(--primary-dark, #1d4ed8);
    color: #fff;
}

.custom-field-projects-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

@media (max-width: 600px) {
    .custom-field-accordion-trigger {
        padding: var(--spacing-sm);
    }

    .custom-field-accordion-panel {
        padding: var(--spacing-sm) var(--spacing-sm);
    }

    .custom-field-option-drag-handle {
        display: none !important;
        /* Use arrows only on mobile; show dots on desktop */
    }

    .custom-field-option-move-buttons {
        display: inline-flex !important;
        /* Show arrows on mobile */
    }
}

.custom-field-card {
    margin-bottom: 0;
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .custom-field-card {
        padding: var(--spacing-sm);
    }
}

.custom-field-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.custom-field-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

.custom-field-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    align-items: center;
    justify-content: flex-end;
}

/* Tablet: keep field title and actions in two clear rows; actions stay in one horizontal row */
@media (max-width: 900px) and (min-width: 481px) {
    .custom-field-card__header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
    }

    .custom-field-card__title {
        flex: none;
    }

    .custom-field-card__actions {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: var(--spacing-sm);
    }

    /* .custom-field-card__actions .btn {
        flex-shrink: 0;
    } */
}

@media (max-width: 480px) {
    .custom-field-card__actions {
        width: 100%;
        justify-content: stretch;
    }

    .custom-field-card__actions .btn {
        flex: 1 1 6rem;
        min-width: 0;
        justify-content: center;
    }
}

.custom-field-options-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.custom-field-option-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.custom-field-option-row:active {
    cursor: grabbing;
}

.custom-field-option-row--dragging {
    opacity: 0.6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.custom-field-option-row--drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.custom-field-option-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: grab;
    padding: 2px;
    margin-right: var(--spacing-xs);
}

.custom-field-option-drag-handle .icon {
    width: 18px;
    height: 18px;
}

.custom-field-option-move-buttons {
    display: none;
    /* Show only on mobile; desktop uses drag handle */
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    margin-right: var(--spacing-xs);
    gap: 0;
}

.custom-field-option-move-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.custom-field-option-move-btn:hover:not(:disabled) {
    color: var(--text);
    background: var(--bg-hover);
}

.custom-field-option-move-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.custom-field-option-move-btn .icon {
    width: 18px;
    height: 18px;
}

.custom-field-option-label {
    flex: 1 1 25px;
    min-width: 0;
    word-break: break-word;
    font-size: 0.9375rem;
}

.custom-field-option-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    align-items: center;
}



@media (max-width: 480px) {
    .custom-field-option-row {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-field-option-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .custom-field-option-actions .btn {
        flex: 1 1 5rem;
        min-width: 0;
        justify-content: center;
    }
}

.custom-field-empty {
    color: var(--text-light);
    font-size: 0.875rem;
    margin: 0;
}

.custom-field-empty--center {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
}

.custom-field-empty--error {
    color: var(--danger);
    padding: var(--spacing-md);
}

/* Status Management */
.statuses-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: move;
    position: relative;
}

.status-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.status-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.status-item-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
}

.status-item-handle {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    cursor: grab;
}

.status-item-handle:active {
    cursor: grabbing;
}

.status-item-order-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.status-item-move-btn {
    padding: 4px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.status-item-move-btn:hover:not(:disabled) {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.status-item-move-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Desktop: show drag handle, hide status arrows */
@media (min-width: 769px) {
    .status-item-order-actions {
        display: none;
    }
}

/* Mobile: hide drag handle (dots), show status arrows only */
@media (max-width: 768px) {
    .status-item-handle {
        display: none !important;
    }
}

.status-item-indicator {
    font-size: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-item-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

.status-badge-completed {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--success);
    background: var(--success-light);
    border-radius: var(--radius-sm);
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
}

/* Typed custom field controls: align visual language with modern task meta controls */
.task-custom-field-input {
    width: 100%;
    min-height: 40px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.3;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    box-sizing: border-box;
}

.task-custom-field-input:hover {
    border-color: var(--primary);
    background: var(--card);
}

.task-custom-field-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    background: var(--card);
}

.task-custom-field-input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    background-color: var(--bg-secondary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 1.05rem;
    padding-right: 2.1rem;
    cursor: pointer;
    height: 40px;
    min-height: 40px;
}

.task-custom-field-input[type="date"]::-webkit-datetime-edit {
    padding: 0;
}

.task-custom-field-input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

.task-custom-field-input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    right: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

[data-theme="dark"] .task-custom-field-input[type="date"],
[data-theme="dark-blue"] .task-custom-field-input[type="date"],
[data-theme="dark-purple"] .task-custom-field-input[type="date"],
[data-theme="dark-green"] .task-custom-field-input[type="date"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
}

.task-custom-field-input--textarea {
    min-height: 72px;
    resize: vertical;
}

.task-custom-field-input--multi {
    min-height: 84px;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.task-custom-field-input--multi option {
    padding: 0.3rem 0.35rem;
    border-radius: 0.3rem;
}

.task-custom-field-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 40px;
    padding: 0.35rem 0.15rem;
}

.task-custom-field-checkbox-input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.task-custom-field-checkbox-text {
    color: var(--text-primary);
    font-weight: 500;
}

#taskDetailsContent .task-meta .meta-item .task-custom-field-input,
.task-details .task-meta .meta-item .task-custom-field-input {
    width: 100%;
    max-width: 100%;
}

#createTaskForm .custom-field-form-group .task-custom-field-input {
    width: 100%;
}

.status-item-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.status-item-actions .btn-icon {
    padding: var(--spacing-xs);
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-item-actions .btn-icon:hover {
    background: var(--bg-secondary);
}

/* Team Members */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.team-member-card {
    width: fit-content;
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    transition: var(--transition);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.team-member-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

/* User avatar image (when profile photo is set) - used with .member-avatar, .comment-avatar, .assignee-avatar, etc. */
.user-avatar {
    flex-shrink: 0;
}

.user-avatar.has-image {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.assignee-chip-avatar,
.assignee-chip-avatar-wrap .user-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary);
    color: white;
}

.assignee-chip-avatar-wrap .user-avatar.has-image {
    background-color: transparent;
}

.member-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.member-info h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 var(--spacing-xs) 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-info p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

.member-info .member-email {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-meta {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--spacing-xs);
}

.role-badge {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-admin {
    background: #fef3c7;
    color: #92400e;
}

.role-editor {
    background: #dbeafe;
    color: #1e40af;
}

.role-user {
    background: #d1fae5;
    color: #065f46;
}

.role-guest {
    background: var(--bg-secondary);
    color: var(--text-light);
}

.badge-current {
    background: var(--primary);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.badge-inactive {
    background: var(--muted);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.member-actions {
    display: flex;
    gap: var(--spacing-xs);
    flex-shrink: 0;
    align-items: center;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.invite-form-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.invites-list-section {
    margin-top: var(--spacing-2xl);
}

.invites-list-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.invites-list-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.invites-count-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
}

.invites-empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
}

.invites-empty-state .empty-state-icon {
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
}

.invites-empty-state .empty-state-hint {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: var(--spacing-sm);
}

/* Pending invites card grid */
.pending-invites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-lg);
}

.pending-invite-card {
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: box-shadow var(--transition), border-color var(--transition);
}

.pending-invite-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.pending-invite-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.pending-invite-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 600;
    flex-shrink: 0;
}

.pending-invite-main {
    flex: 1;
    min-width: 0;
}

.pending-invite-email {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9375rem;
    margin-bottom: var(--spacing-xs);
    word-break: break-all;
}

.pending-invite-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
}

.pending-invite-meta .role-badge {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
    letter-spacing: 0.03em;
}

.pending-invite-meta .status-badge.status-pending {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
}

.pending-invite-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: var(--spacing-md);
}

.pending-invite-date-row {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.pending-invite-date-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pending-invite-date-value {
    font-size: 0.8125rem;
    color: var(--text);
    font-weight: 500;
}

.pending-invite-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.pending-invite-actions .btn {
    flex: 1;
    min-width: 120px;
}

.pending-invite-actions .btn .icon {
    width: 14px;
    height: 14px;
    margin-right: 0.25rem;
}

@media (max-width: 480px) {
    .pending-invites-grid {
        grid-template-columns: 1fr;
    }

    .pending-invite-actions .btn {
        min-width: 100%;
    }
}

[data-theme="dark"] .pending-invite-meta .status-badge.status-pending,
[data-theme="dark-blue"] .pending-invite-meta .status-badge.status-pending,
[data-theme="dark-purple"] .pending-invite-meta .status-badge.status-pending,
[data-theme="dark-green"] .pending-invite-meta .status-badge.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
}

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

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 0;
    font-family: inherit;
}

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

/* Invite Button in Header */
.btn-invite-header {
    background: var(--primary) !important;
    color: white !important;
    padding: var(--spacing-md) var(--spacing-lg) !important;
    border-radius: var(--radius-md) !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: var(--spacing-sm) !important;
    transition: var(--transition) !important;
    box-shadow: var(--shadow-sm) !important;
}

.btn-invite-header .icon {
    width: 18px;
    height: 18px;
}

.btn-invite-header:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md) !important;
}

/* Admin page (Platform Admin) */
.admin-page {
    padding: 0;
}

.admin-page .page-header {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
}

.admin-page .page-header h1 {
    margin: 0;
}

.admin-page .page-header .btn {
    flex-shrink: 0;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.admin-stats-grid .stat-card {
    min-width: 0;
}

.admin-section {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    border: 1px solid var(--border);
    margin-bottom: var(--spacing-xl);
}

.admin-section:last-child {
    margin-bottom: 0;
}

.admin-section h3 {
    margin: 0 0 var(--spacing-lg) 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
}

.admin-section .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-section table {
    min-width: 1080px;
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.admin-section thead tr {
    border-bottom: 2px solid var(--border);
    background: var(--bg-secondary);
}

.admin-section tbody tr {
    border-bottom: 1px solid var(--border-light);
}

.admin-section tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .admin-section tbody tr:hover,
[data-theme="dark-blue"] .admin-section tbody tr:hover,
[data-theme="dark-purple"] .admin-section tbody tr:hover,
[data-theme="dark-green"] .admin-section tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.admin-section th,
.admin-section td {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    white-space: nowrap;
    vertical-align: middle;
}

.admin-section th {
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    font-size: 0.8125rem;
}

/* Allow specific columns to wrap if needed */
.admin-section td:has(.admin-actions),
.admin-section td.col-actions {
    white-space: normal;
}

/* Action buttons in table cells */
.admin-section .admin-actions {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    flex-wrap: wrap;
}

.admin-section .admin-actions .btn {
    white-space: nowrap;
}

/* Company name column can be slightly flexible */
.admin-section td:first-child {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-plan-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.admin-plan-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

/* Admin platform settings */
.admin-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--spacing-lg);
}

.admin-setting-card {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

.admin-setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.admin-setting-title {
    font-weight: 600;
    color: var(--text);
}

.admin-setting-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
}

.admin-ticket-project-form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.admin-ticket-project-form .form-control {
    min-width: 200px;
}

.admin-setting-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
    margin-bottom: 0;
}

.admin-setting-pill {
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.admin-setting-pill--on {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.admin-setting-pill--off {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

/* Admin Tickets button: bell + badge when there are unopened tickets */
.admin-tickets-btn .admin-tickets-btn-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.admin-tickets-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.15rem;
}

.admin-tickets-bell {
    width: 1rem;
    height: 1rem;
    opacity: 0.95;
    color: var(--primary);
}

.admin-tickets-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    background: var(--primary);
    border-radius: 999px;
}

/* Admin plan dropdown (position: fixed to escape table overflow clipping) */
.admin-plan-dropdown {
    position: relative;
}

.admin-plan-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 125px;
}

.admin-plan-menu {
    position: fixed;
    min-width: 120px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10001;
    padding: var(--spacing-xs);
}

.admin-plan-option {
    display: block;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
}

.admin-plan-option:hover {
    background: var(--bg-secondary);
}

/* Admin company status: scheduled for deletion */
.admin-company-status-scheduled {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--danger);
    background: var(--danger-light);
    color: var(--danger);
    flex-shrink: 0;
}

/* Admin company status: inactive badge (outline style, distinct from action buttons) */
.admin-company-status-inactive {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Admin companies: card layout for mobile */
.admin-companies-cards {
    display: none;
}

@media (max-width: 768px) {
    .admin-page {
        padding: 0;
    }

    .admin-page .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }

    .admin-page .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }

    .admin-stats-grid .stat-card {
        padding: var(--spacing-md) !important;
    }

    .admin-stats-grid .stat-card>div:first-child {
        font-size: 1.5rem !important;
    }

    .admin-section {
        padding: var(--spacing-lg);
        margin-bottom: var(--spacing-lg);
    }

    .admin-section h3 {
        margin-bottom: var(--spacing-md);
        font-size: 1rem;
    }

    /* Show card layout, hide table on mobile */
    .admin-section .table-responsive {
        display: none;
    }

    .admin-companies-cards {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .custom-field-option-actions .btn {
        margin-bottom: 5px;
    }

    .custom-field-card__title {
        text-align: center;
        background: var(--border);
        border-radius: 5px;
        padding: 5px;
        font-weight: 700;
    }

    .custom-field-option-label {
        text-align: center;
        background: var(--border);
        border-radius: 5px;
        padding: 5px;
        font-weight: 700;
    }
}

@media (max-width: 480px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-plan-badges {
        flex-direction: column;
    }
}

@media (min-width: 769px) {
    .admin-companies-cards {
        display: none !important;
    }
}

/* Tablet: 2x2 stats grid, table scrolls */
@media (min-width: 769px) and (max-width: 1024px) {
    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-page .page-header {
        flex-wrap: nowrap;
    }
}

/* Desktop: 4-column stats */
@media (min-width: 1025px) {
    .admin-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Enhanced page headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-2xl);
}

.page-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.02em;
}

/* Better button styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

/* Improved card styling */
.dashboard-card,
.invite-form-card {
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.dashboard-card:hover,
.invite-form-card:hover {
    box-shadow: var(--shadow-md);
}

/* Profile form card */
.profile-form-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.profile-form-card h3 {
    margin-bottom: var(--spacing-lg);
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.settings-table {
    width: 100%;
    border-collapse: collapse;
}

.settings-table th,
.settings-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.settings-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.settings-table code {
    font-size: 0.8125rem;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

/* API tab: responsive tables with horizontal scroll on small screens */
.table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin-bottom: 0;
    border-radius: var(--radius-md);
}

/* Table responsive wrapper - universal solution */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin-bottom: var(--spacing-md);
    border-radius: var(--radius-md);
    position: relative;
}

/* Fade effect on table edges to indicate scrollability */
@media (max-width: 900px) {

    .table-scroll-wrap,
    .table-responsive {
        position: relative;
    }

    .table-scroll-wrap::after,
    .table-responsive::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to left, var(--card), transparent);
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .table-scroll-wrap:not(.scrolled-end)::after,
    .table-responsive:not(.scrolled-end)::after {
        opacity: 1;
    }

    /* Dark mode fade effect */
    [data-theme="dark"] .table-scroll-wrap::after,
    [data-theme="dark"] .table-responsive::after {
        background: linear-gradient(to left, var(--card), transparent);
    }

    [data-theme="dark-blue"] .table-scroll-wrap::after,
    [data-theme="dark-blue"] .table-responsive::after {
        background: linear-gradient(to left, #1e293b, transparent);
    }

    [data-theme="dark-purple"] .table-scroll-wrap::after,
    [data-theme="dark-purple"] .table-responsive::after {
        background: linear-gradient(to left, #2d2438, transparent);
    }

    [data-theme="dark-green"] .table-scroll-wrap::after,
    [data-theme="dark-green"] .table-responsive::after {
        background: linear-gradient(to left, #1c2e20, transparent);
    }
}

/* Custom scrollbar styling for table wrappers */
.table-responsive::-webkit-scrollbar,
.table-scroll-wrap::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track,
.table-scroll-wrap::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb,
.table-scroll-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.table-responsive::-webkit-scrollbar-thumb:hover,
.table-scroll-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox scrollbar styling */
.table-responsive,
.table-scroll-wrap {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-secondary);
}

/* General data table styling */
.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.data-table th,
.data-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    white-space: nowrap;
    vertical-align: middle;
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

/* Sign-in history table (Settings > Security) */
.signin-history {
    width: 100%;
}

.signin-history-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.signin-history-table th,
.signin-history-table td {
    padding: var(--spacing-sm) var(--spacing-lg);
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.signin-history-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    background: var(--bg-secondary);
}

.signin-history-table th:nth-child(1),
.signin-history-table td:nth-child(1) {
    min-width: 180px;
    width: 32%;
}

.signin-history-table th:nth-child(2),
.signin-history-table td:nth-child(2) {
    min-width: 160px;
    width: 38%;
}

.signin-history-table th:nth-child(3),
.signin-history-table td:nth-child(3) {
    min-width: 120px;
    width: 30%;
}

.signin-history-table td {
    font-size: 0.875rem;
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .data-table tbody tr:hover,
[data-theme="dark-blue"] .data-table tbody tr:hover,
[data-theme="dark-purple"] .data-table tbody tr:hover,
[data-theme="dark-green"] .data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

#api-tab .table-scroll-wrap .settings-table {
    min-width: 480px;
}

#api-tab .profile-form-card {
    max-width: 100%;
    overflow: hidden;
}

#api-tab .profile-form-card code {
    word-break: break-all;
    /* white-space: pre-wrap; */
    max-width: 100%;
}

@media (max-width: 768px) {

    #api-tab .section-header,
    #api-tab .profile-form-card {
        min-width: 0;
    }

    #api-tab .profile-form-card ol,
    #api-tab .profile-form-card li {
        word-break: break-word;
    }
}

.profile-avatar-section {
    margin-bottom: var(--spacing-xl);
}

.profile-avatar-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.profile-avatar-display {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    flex-shrink: 0;
    border: 3px solid var(--border-light);
}

.profile-avatar-display.has-image span {
    display: none;
}

.profile-avatar-display-circle,
.profile-avatar-display-square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.profile-avatar-display-circle {
    border-radius: 50%;
    overflow: hidden;
}

.profile-avatar-display-circle:not(.has-image),
.profile-avatar-display-square:not(.has-image) {
    color: var(--text-muted);
}

.profile-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.input-disabled {
    background: var(--bg-secondary) !important;
    color: var(--text-light) !important;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 9998;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    /* Use flex to center content and allow better mobile behavior */
    display: none;
    /* default hidden; toggled inline */
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    overflow: hidden;
    /* prevent double scrollbars; inner handles scroll */
    pointer-events: auto;
    cursor: default;
    /* Allow text selection inside modal (overrides parent drag-scroll) */
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Attachment view modal (overlays task details modal) */
.attachment-view-modal {
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.attachment-view-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.attachment-view-modal-content {
    position: relative;
    z-index: 10011;
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    width: min(95vw, 900px);
    height: min(90vh, 800px);
    overflow: hidden;
}

.attachment-view-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.attachment-view-filename {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9375rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-view-modal-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.attachment-view-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.attachment-view-download-btn .icon {
    width: 18px;
    height: 18px;
}

.attachment-view-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.15s, color 0.15s;
}

.attachment-view-close:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.attachment-view-close .icon {
    width: 24px;
    height: 24px;
}

.attachment-view-iframe {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: none;
    background: var(--bg-secondary);
}

.modal-content {
    background-color: var(--card);
    color: var(--text);
    margin: 2% auto;
    padding: var(--spacing-lg) !important;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl) !important;
    max-height: 90dvh !important;
    overflow-y: auto;
    width: min(96vw, 600px) !important;
    box-shadow: var(--shadow-xl) !important;
    position: relative;
    z-index: 9999;
    cursor: default;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Canonical Create Group modal: always centered and responsive across the app */
#groupModal {
    align-items: center;
    justify-content: center;
}

#groupModal[style*="display: block"] {
    display: flex !important;
}

#groupModal>.modal-content {
    width: min(94vw, 560px) !important;
    max-width: min(94vw, 560px) !important;
    height: auto !important;
    max-height: min(90dvh, 90vh) !important;
    margin: 0;
    border-radius: var(--radius-xl) !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    #groupModal {
        align-items: stretch;
        justify-content: stretch;
        padding: 0;
    }

    #groupModal>.modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        margin: 0;
        border-radius: 0 !important;
        padding: calc(var(--spacing-md) + env(safe-area-inset-top)) calc(var(--spacing-md) + env(safe-area-inset-right)) calc(var(--spacing-md) + env(safe-area-inset-bottom)) calc(var(--spacing-md) + env(safe-area-inset-left)) !important;
    }
}

/* System modal (alerts/confirmations) */
.system-modal {
    --system-modal-accent: var(--primary);
    --system-modal-soft: var(--primary-light);
}

.system-modal--success {
    --system-modal-accent: var(--success);
    --system-modal-soft: var(--success-light);
}

.system-modal--warning {
    --system-modal-accent: var(--warning);
    --system-modal-soft: var(--warning-light);
}

.system-modal--error {
    --system-modal-accent: var(--danger);
    --system-modal-soft: var(--danger-light);
}

.system-modal__content {
    border: 1px solid var(--border-light);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2), var(--shadow-xl);
    animation: systemModalPop 0.18s ease-out;
    margin: 0;
    align-self: center;
}

.system-modal__content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--system-modal-accent);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.system-modal__close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.system-modal__close:hover,
.system-modal__close:focus {
    background: var(--bg-secondary);
    color: var(--text);
}

.system-modal__header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--spacing-md);
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.system-modal__icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--system-modal-soft);
    color: var(--system-modal-accent);
}

.system-modal__titles h2 {
    margin: 0;
    font-size: 1.2rem;
}

.system-modal__message {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    white-space: pre-line;
}

.system-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

/* Prompt input inside system modal (replaces native prompt()) */
.system-modal__prompt-block {
    margin-bottom: var(--spacing-lg);
}

.system-modal__prompt-input {
    width: 100%;
    box-sizing: border-box;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.system-modal__prompt-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.system-modal__prompt-input::placeholder {
    color: var(--text-muted);
}

/* Inline option list for uiPrompt select mode (avoids modal overflow clipping) */
.system-modal__option-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    background: var(--bg-secondary);
    margin-bottom: var(--spacing-lg);
}

.system-modal__option-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-md) - 2px);
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.system-modal__option-item:hover {
    background: var(--card);
}

.system-modal__option-item.is-selected {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

@keyframes systemModalPop {
    from {
        transform: translateY(6px) scale(0.98);
        opacity: 0.6;
    }

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

.modal-large {
    width: min(96vw, 955px);
}

/* 2FA Reminder Modal – refined layout, responsive, icon */
.modal-2fa-reminder__close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
    z-index: 1;
}

.modal-2fa-reminder__close:hover,
.modal-2fa-reminder__close:focus {
    color: var(--text);
    background: var(--bg-secondary);
}

.modal-2fa-reminder .modal-2fa-reminder__content {
    text-align: center;
    width: 100%;
    max-width: min(92vw, 440px);
    padding: var(--spacing-xl) var(--spacing-xl) var(--spacing-lg);
    animation: modal2faSlideIn 0.25s ease-out;
    box-sizing: border-box;
}

.modal-2fa-reminder__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto var(--spacing-lg);
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(var(--primary-rgb, 59, 130, 246), 0.12), rgba(var(--primary-rgb, 59, 130, 246), 0.06));
    color: var(--primary);
}

.modal-2fa-reminder__icon .icon {
    width: 36px;
    height: 36px;
}

.modal-2fa-reminder__title {
    font-size: clamp(1.125rem, 2.5vw, 1.375rem);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin: 0 0 var(--spacing-md);
    color: var(--text);
}

.modal-2fa-reminder__message {
    font-size: clamp(0.9375rem, 1.5vw, 1rem);
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-xl);
}

.modal-2fa-reminder__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    justify-content: center;
    align-items: center;
}

.modal-2fa-reminder__btn-dismiss,
.modal-2fa-reminder__btn-primary {
    min-width: 120px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.modal-2fa-reminder__btn-primary {
    box-shadow: 0 2px 8px rgba(var(--primary-rgb, 59, 130, 246), 0.25);
}

.modal-2fa-reminder__btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb, 59, 130, 246), 0.3);
}

.modal-2fa-reminder__btn-dismiss:hover {
    transform: translateY(-1px);
}

@keyframes modal2faSlideIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
    }

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

/* 2FA Reminder – responsive: tablet & mobile */
@media (max-width: 640px) {
    .modal-2fa-reminder__close {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
        width: 32px;
        height: 32px;
        font-size: 1.5rem;
    }

    .modal-2fa-reminder .modal-2fa-reminder__content {
        max-width: calc(100vw - 2rem);
        margin: 1rem;
        padding: var(--spacing-lg) var(--spacing-md) var(--spacing-md);
    }

    .modal-2fa-reminder__icon {
        width: 60px;
        height: 60px;
        margin-bottom: var(--spacing-md);
    }

    .modal-2fa-reminder__icon .icon {
        width: 30px;
        height: 30px;
    }

    .modal-2fa-reminder__actions {
        flex-direction: column;
        width: 100%;
    }

    .modal-2fa-reminder__btn-dismiss,
    .modal-2fa-reminder__btn-primary {
        width: 100%;
        min-width: 0;
    }
}

/* Keyboard shortcuts overlay */
.shortcuts-overlay {
    align-items: center;
    justify-content: center;
}

.shortcuts-overlay-content {
    max-width: min(92vw, 380px);
    padding: var(--spacing-xl);
}

.shortcuts-overlay-title {
    margin: 0 0 var(--spacing-lg);
    font-size: 1.25rem;
}

.shortcuts-overlay-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.shortcut-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.9375rem;
}

.shortcut-row kbd {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.8125rem;
    font-family: inherit;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
}

/* Admin action modals (Deactivate, Delete Company) */
.admin-action-modal.modal-content {
    padding: 0;
}

.admin-action-modal .modal-header {
    padding: 1.25rem 1.5rem;
}

.admin-action-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
}

.admin-action-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.admin-action-modal-title-wrap h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.admin-action-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.admin-action-modal-icon .icon {
    width: 20px;
    height: 20px;
}

.admin-action-modal--warning.modal-content {
    border-top: 4px solid var(--warning);
}

.admin-action-modal--warning .admin-action-modal-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.admin-action-modal--danger.modal-content {
    border-top: 4px solid var(--danger);
}

.admin-action-modal--danger .admin-action-modal-icon {
    background: var(--danger-light);
    color: var(--danger);
}

.admin-action-modal--success.modal-content {
    border-top: 4px solid var(--success);
}

.admin-action-modal--success .admin-action-modal-icon {
    background: var(--success-light, #DCFCE7);
    color: var(--success);
}

.admin-action-modal .modal-body {
    padding: 1.5rem 1.5rem;
}

.admin-action-alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.admin-action-alert--warning {
    background: var(--warning-light);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.admin-action-alert--danger {
    background: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.admin-action-alert--success {
    background: var(--success-light, #DCFCE7);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.admin-action-alert-text {
    margin: 0 0 0.35rem 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text);
}

.admin-action-alert-hint {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.admin-action-label-optional {
    font-weight: 400;
    color: var(--text-secondary);
}

.admin-action-textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    resize: vertical;
    font-family: inherit;
    font-size: 0.9375rem;
}

.admin-action-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 59, 130, 246), 0.15);
}

.admin-action-checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    margin-top: var(--spacing-md);
    font-size: 0.9375rem;
    color: var(--text);
}

.admin-action-checkbox-label input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-action-checkbox-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: var(--transition);
}

.admin-action-checkbox-label input:checked+.admin-action-checkbox-box {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.admin-action-checkbox-label input:checked+.admin-action-checkbox-box::after {
    content: "✓";
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.admin-action-checkbox-label input:focus-visible+.admin-action-checkbox-box {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.admin-action-modal .modal-footer {
    padding: 1rem 1.5rem;
}

/* Task details modal: chrome row stays fixed; body scrolls */
#taskDetailsModal .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 90dvh;
    overflow: hidden;
}

#taskDetailsModal .task-details-modal-sticky-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.65rem 1rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
    border-radius: 14px 14px 0 0;
}

#taskDetailsModal .task-details-modal-chrome-start {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

#taskDetailsContent {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 1rem 1.5rem 1.35rem;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Ensure description and other text in task details modal are selectable */
#taskDetailsContent .task-description-full,
#taskDetailsContent .task-description-section,
#taskDetailsContent .rich-text-content,
#taskDetailsContent .comment-text,
#taskDetailsContent p {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.task-details {
    padding: 0;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

#taskDetailsContent .task-description-section,
#taskDetailsContent .task-description-full {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

#taskDetailsContent .task-description-full p,
#taskDetailsContent .task-description-full div,
#taskDetailsContent .rich-text-content {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Task details modal — reference layout (View/Edit task) */
#taskDetailsModal.modal {
    background-color: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
}

#taskDetailsModal .modal-content.task-details-modal-content {
    padding: 0 !important;
    border-radius: 14px;
    border: 1px solid #e2e3e7;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    width: min(550px, calc(100vw)) !important;
    max-width: min(550px, calc(100vw)) !important;
}

#taskDetailsModal .task-details-modal-close {
    position: static;
    top: auto;
    right: auto;
    width: 40px;
    height: 40px;
    margin: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    color: #1d1d1d;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    opacity: 1;
    z-index: 1;
    background: transparent;
}

#taskDetailsModal .task-details-modal-close:hover,
#taskDetailsModal .task-details-modal-close:focus {
    background: var(--bg-secondary);
    color: var(--text);
}

[data-theme="dark"] #taskDetailsModal .task-details-modal-close,
[data-theme="dark-blue"] #taskDetailsModal .task-details-modal-close,
[data-theme="dark-gray"] #taskDetailsModal .task-details-modal-close,
[data-theme="dark-purple"] #taskDetailsModal .task-details-modal-close,
[data-theme="dark-green"] #taskDetailsModal .task-details-modal-close {
    color: var(--text);
}

#taskDetailsModal .task-details-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    min-height: 0;
}

#taskDetailsModal .task-details-delete-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #dc2626;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

#taskDetailsModal .task-details-delete-icon:hover {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

#taskDetailsModal .task-details-delete-icon .icon {
    width: 22px;
    height: 22px;
}

#taskDetailsContent .task-details-header {
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
    align-items: flex-start;
}

#taskDetailsContent .task-details-kicker {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

#taskDetailsContent .task-detail-title-view,
#taskDetailsContent .task-details-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

#taskDetailsContent .task-detail-title-edit {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
}

#taskDetailsContent .task-meta {
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

#taskDetailsContent .task-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
    align-items: start;
}

#taskDetailsContent .meta-item--full {
    grid-column: 1 / -1;
}

#taskDetailsContent .meta-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

#taskDetailsContent .project-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: var(--bg-secondary);
    border-left-width: 1px;
}

#taskDetailsContent .custom-dropdown-custom-field .custom-dropdown-trigger {
    background: var(--bg-secondary) !important;
    color: var(--text) !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px;
    font-weight: 600;
}

#taskDetailsContent .custom-dropdown-status .custom-dropdown-trigger {
    border-radius: 8px;
    font-weight: 600;
}

#taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-low {
    background-color: #ecfdf5 !important;
    color: #047857 !important;
    border: 1px solid #a7f3d0 !important;
}

#taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-medium {
    background-color: #fffbeb !important;
    color: #c2410c !important;
    border: 1px solid #fde68a !important;
}

#taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-high {
    background-color: #fef2f2 !important;
    color: #b91c1c !important;
    border: 1px solid #fecaca !important;
}

[data-theme="dark"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-low,
[data-theme="dark-blue"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-low,
[data-theme="dark-gray"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-low,
[data-theme="dark-purple"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-low,
[data-theme="dark-green"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-low {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}

[data-theme="dark"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-medium,
[data-theme="dark-blue"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-medium,
[data-theme="dark-gray"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-medium,
[data-theme="dark-purple"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-medium,
[data-theme="dark-green"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-medium {
    background-color: rgba(245, 158, 11, 0.18) !important;
    color: #fcd34d !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-high,
[data-theme="dark-blue"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-high,
[data-theme="dark-gray"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-high,
[data-theme="dark-purple"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-high,
[data-theme="dark-green"] #taskDetailsContent .custom-dropdown-priority .custom-dropdown-trigger.priority-high {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
}

#taskDetailsContent .task-detail-due-date-input,
#taskDetailsContent .meta-item--full .due-date {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
}

#taskDetailsContent .task-description-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    background: var(--card);
}

#taskDetailsContent .task-description-header {
    margin-bottom: 0.65rem;
}

#taskDetailsContent .task-description-header .task-detail-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

#taskDetailsContent .task-description-full {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.75rem 0.85rem;
    background: var(--bg-secondary);
    min-height: 3rem;
}

/* Description edit: one cohesive card; toolbar arrows only when horizontal scroll is needed */
#taskDetailsContent .task-description-edit {
    min-width: 0;
    margin-bottom: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    overflow: visible;
}

#taskDetailsContent .task-description-toolbar-wrap {
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    gap: 0.35rem;
    padding: 0.4rem 0.5rem;
    align-items: center;
    border-radius: 10px 10px 0 0;
    position: relative;
    z-index: 5;
}

#taskDetailsContent .task-description-toolbar-wrap:not(.task-description-toolbar-wrap--scrollable) .task-description-toolbar-arrow {
    display: none;
}

#taskDetailsContent .task-description-toolbar-wrap--scrollable .task-description-toolbar-scroll {
    min-height: 2.75rem;
}

/* overflow-y:hidden on .task-description-toolbar-scroll clips custom-dropdown menus; modal toolbar wraps so visible is safe */
#taskDetailsContent .task-description-toolbar-scroll {
    padding: 0.1rem 0;
    overflow: visible !important;
}

#taskDetailsContent .task-description-rich-toolbar .custom-dropdown-toolbar {
    position: relative;
    z-index: 1;
}

#taskDetailsContent .task-description-rich-toolbar .custom-dropdown.is-open {
    z-index: 50;
}

#taskDetailsContent .task-description-rich-toolbar {
    padding: 0.35rem 0;
    gap: 0.35rem;
    row-gap: 0.5rem;
    align-items: center;
}

#taskDetailsContent .task-description-rich-toolbar .btn.btn-sm {
    min-width: 2.25rem;
    justify-content: center;
    padding: 0.4rem 0.55rem;
    font-weight: 600;
}

#taskDetailsContent .task-description-rich-toolbar .custom-dropdown-toolbar .custom-dropdown-trigger {
    min-height: 36px;
    min-width: 0;
    padding: 0.35rem 0.55rem;
}

#taskDetailsContent .task-description-rich-toolbar .custom-dropdown.is-open .custom-dropdown-menu {
    z-index: 60;
}

#taskDetailsContent .task-description-rich-editor {
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--border);
    min-height: clamp(6.5rem, 22vh, 13rem);
    background: var(--card);
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

#taskDetailsContent .task-description-edit .description-edit-actions {
    margin-top: 0;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 0 0 10px 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

#taskDetailsContent .task-description-edit .description-edit-actions .btn {
    min-height: 40px;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Plain textarea mode (no rich toolbar): stack like the rich editor card */
#taskDetailsContent .task-description-edit:not(:has(.task-description-toolbar-wrap)) textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
    min-height: clamp(6.5rem, 22vh, 13rem);
    margin: 0;
}

#taskDetailsContent .task-description-edit:not(:has(.task-description-toolbar-wrap)) .description-edit-actions {
    border-radius: 0 0 10px 10px;
}

@media (max-width: 1200px) {
    #taskDetailsContent .task-description-rich-toolbar {
        flex-wrap: wrap !important;
    }
}

@media (max-width: 480px) {
    #taskDetailsContent .task-description-edit .description-edit-actions {
        flex-direction: column-reverse;
    }

    #taskDetailsContent .task-description-edit .description-edit-actions .btn {
        width: 100%;
        justify-content: center;
    }

    #taskDetailsContent .task-description-rich-editor {
        min-height: 7.5rem;
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    #taskDetailsContent .task-description-toolbar-wrap {
        padding: 0.35rem 0.4rem;
    }

    #taskDetailsContent .task-description-rich-editor {
        font-size: 16px;
        min-height: 8rem;
    }

    #taskDetailsContent .task-description-edit .description-edit-actions {
        padding: 0.65rem 0.75rem;
    }
}

/* Accordion sections: card shell, white header strip, gray body (modal only) */
#taskDetailsContent .task-detail-accordion.task-detail-section {
    margin-bottom: 0.75rem;
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* Absolute dropdowns (blocker search, assignee multi-select) extend past the card; overflow:hidden clips them */
#taskDetailsContent .task-dependencies-section.task-detail-accordion.task-detail-section,
#taskDetailsContent .task-assignment-section.task-detail-accordion.task-detail-section {
    overflow: visible;
}

#taskDetailsContent .blocker-search-dropdown {
    z-index: 120;
}

#taskDetailsContent .task-assignment-section .multi-select-dropdown.show {
    z-index: 120;
}

#taskDetailsContent .task-detail-accordion>.task-detail-accordion-trigger {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    margin: 0;
    background: var(--card);
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#taskDetailsContent .task-detail-accordion[open]>.task-detail-accordion-trigger {
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid var(--border);
}

#taskDetailsContent .task-detail-accordion>.task-detail-accordion-trigger::-webkit-details-marker {
    display: none;
}

#taskDetailsContent .task-detail-accordion .task-detail-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text);
}

#taskDetailsContent .task-detail-accordion .task-detail-section-title .task-detail-section-icon,
#taskDetailsContent .task-detail-accordion .task-detail-section-title .icon.task-detail-section-icon {
    color: var(--text);
}

#taskDetailsContent .task-detail-accordion .task-detail-section-icon {
    opacity: 1;
}

#taskDetailsContent .task-detail-accordion .accordion-chevron {
    border-top-color: var(--text);
}

#taskDetailsContent .task-detail-accordion .assignment-count,
#taskDetailsContent .task-detail-accordion .blocker-count,
#taskDetailsContent .task-detail-accordion .link-count,
#taskDetailsContent .task-detail-accordion .attachment-count {
    display: inline;
    min-width: 0;
    height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent !important;
    color: inherit !important;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    vertical-align: baseline;
}

#taskDetailsContent .task-detail-accordion .subtasks-progress {
    display: inline;
    margin: 0;
    padding: 0;
    background: transparent !important;
    border-radius: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

#taskDetailsContent .task-detail-accordion .task-detail-accordion-panel {
    padding: 1rem;
    margin: 0;
    background: var(--bg-secondary);
    border: none;
    border-top: none;
}

#taskDetailsContent .task-detail-accordion-panel {
    padding: 1rem;
    background: var(--bg-secondary);
}

#taskDetailsContent .task-detail-accordion .task-detail-paid-feature-content {
    width: 100%;
}

/* Subtasks */
#taskDetailsContent .task-subtasks-section .task-detail-accordion-panel {
    padding-top: 1rem;
}

#taskDetailsContent .task-subtasks-content {
    gap: 0.85rem;
}

#taskDetailsContent .task-subtask-add-form {
    flex-wrap: wrap;
    gap: 0.5rem;
}

#taskDetailsContent .task-subtask-input {
    flex: 1 1 100%;
    min-width: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 44px;
}

#taskDetailsContent .task-subtask-add-form .btn {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-weight: 600;
}

#taskDetailsContent .task-subtask-add-form .btn:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

#taskDetailsContent .task-subtask-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

#taskDetailsContent .task-subtask-item:hover {
    background: var(--card);
    border-color: var(--text-muted);
}

/* Dependencies */
#taskDetailsContent .task-dependencies-content>.task-detail-subtitle:first-of-type {
    display: none;
}

#taskDetailsContent .task-blockers-list {
    list-style: none;
    margin: 0 0 0.85rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#taskDetailsContent .task-blocker-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 0;
}

#taskDetailsContent .task-blocker-item-id {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

#taskDetailsContent .task-blocker-item-link {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 700;
    color: var(--text);
}

#taskDetailsContent .task-blocker-kind-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
}

#taskDetailsContent .task-blocker-remove {
    margin-left: auto;
    color: #dc2626 !important;
    border: 1px solid rgba(220, 38, 38, 0.45) !important;
    border-radius: 6px;
    background: transparent !important;
}

#taskDetailsContent .task-blocker-remove:hover {
    background: rgba(220, 38, 38, 0.08) !important;
}

#taskDetailsContent .blocker-search-input-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
}

#taskDetailsContent .blocker-search-input {
    background: transparent;
}

/* Assignees: hide only the redundant "Individual Assignees" line, keep Groups heading */
#taskDetailsContent .task-assignment-section .task-assignees-section:not(.task-assignment-groups)>.task-detail-subtitle {
    display: none;
}

#taskDetailsContent .task-assignment-section .multi-select-input {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 44px;
}

#taskDetailsContent .task-assignment-section .task-assignees-section .selected-items {
    min-height: 28px;
}

#taskDetailsContent .task-assignment-groups .multi-select-input {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 44px;
}

#taskDetailsContent .task-assignment-block .selected-chip,
#taskDetailsContent .task-assignment-block .assignees-readonly>div>div {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
}

/* Resources & attachments rows */
#taskDetailsContent .attachment-item,
#taskDetailsContent .task-link-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
}

#taskDetailsContent .attachment-item:hover,
#taskDetailsContent .task-link-item:hover {
    border-color: var(--text-muted);
}

#taskDetailsContent .file-upload-area.attachment-dropzone,
#taskDetailsContent .attachment-dropzone {
    border: 1px dashed var(--border) !important;
    border-radius: 8px;
    background: var(--card);
}

/* History activity */
#taskDetailsContent .task-activity-list {
    gap: 0.5rem;
}

#taskDetailsContent .task-activity-item {
    padding: 0.75rem 0.85rem;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

#taskDetailsContent .task-activity-item:last-child {
    border-bottom: 1px solid var(--border);
}

/* Comments section (non-accordion): same card language */
#taskDetailsContent .task-comments-section {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
}

#taskDetailsContent .task-comments-section>.task-detail-section-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.65rem 1rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text);
}

#taskDetailsContent .task-comments-section>.task-detail-section-title .task-detail-section-icon {
    color: var(--text);
}

#taskDetailsContent .task-comments-section .comments-list {
    padding: 1rem;
    background: var(--bg-secondary);
}

#taskDetailsContent .task-comments-section .comment-form-wrapper {
    padding: 0 1rem 1rem;
    background: var(--bg-secondary);
}

#taskDetailsContent .comment-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.65rem;
}

#taskDetailsContent .comment-textarea {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

#taskDetailsContent .btn-comment-submit,
#taskDetailsContent .task-details-comment-submit {
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-radius: 8px;
}

#taskDetailsContent .task-details-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 34px;
    font-weight: 600;
    border-radius: 8px;
}

#taskDetailsContent .attachment-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

#taskDetailsContent .task-detail-accordion-trigger .task-section-header-extra {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.25rem;
    color: var(--text-muted);
}

#taskDetailsContent .task-detail-accordion-trigger .task-section-header-extra .icon {
    width: 16px;
    height: 16px;
}

.close {
    color: var(--text-light);
    font-size: 28px;
    font-weight: 300;
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 10001;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.close:hover,
.close:focus {
    color: var(--text);
    background: var(--bg-secondary);
}

.modal-content h2 {
    font-size: 2rem;
    font-weight: 600;
    /* margin: 0 0 var(--spacing-xl) 0; */
    color: var(--text);
    letter-spacing: -0.02em;
    padding-top: 0;
}

/* Edit User modal footer – clear hierarchy and alignment */
.edit-user-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border);
}

.edit-user-modal-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

.edit-user-modal-danger-zone {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border);
}

.edit-user-modal-danger-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.edit-user-modal-danger-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-md);
}

.edit-user-modal-danger-actions .btn-danger {
    margin-left: auto;
}

.edit-user-modal-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 40px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.edit-user-modal-form-actions .btn {
    min-width: 120px;
}

.edit-user-modal-danger-actions .btn {
    min-width: 140px;
    justify-content: center;
}

.edit-user-modal-footer .btn .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Primary emphasis – slightly stronger than default primary */
.btn-primary-emphasis {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary-emphasis:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

/* Outline warning – Transfer Ownership */
.btn-outline-warning {
    background: transparent;
    border: 1px solid var(--warning);
    color: var(--warning);
}

.btn-outline-warning:hover {
    background: var(--warning-light);
    border-color: var(--warning);
    color: var(--text);
}

/* Ensure all modal content text uses theme variables */
.modal-content label {
    color: var(--text);
}

/* Ensure proper cursors for interactive elements in modal */
.modal-content button,
.modal-content a,
.modal-content .btn,
.modal-content [onclick],
.modal-content input[type="submit"],
.modal-content input[type="button"] {
    cursor: pointer !important;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    cursor: text !important;
}

.modal-content select {
    cursor: pointer !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2rem;
}

.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content textarea,
.modal-content select {
    color: var(--text);
    background-color: var(--card);
    border-color: var(--border);
}

/* Chevron for select dropdowns - must come after background-color to override */
.modal-content select,
.modal select {
    background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 0.6rem center / 1rem !important;
}

[data-theme="dark"] .modal-content select,
[data-theme="dark-blue"] .modal-content select,
[data-theme="dark-purple"] .modal-content select,
[data-theme="dark-green"] .modal-content select,
[data-theme="dark"] .modal select,
[data-theme="dark-blue"] .modal select,
[data-theme="dark-purple"] .modal select,
[data-theme="dark-green"] .modal select {
    background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 0.6rem center / 1rem !important;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="email"]:focus,
.modal-content input[type="password"]:focus,
.modal-content textarea:focus,
.modal-content select:focus {
    border-color: var(--primary);
    outline-color: var(--primary);
}

/* Due date input in task details: show pointer (overrides modal input cursor) */
.modal-content .task-detail-due-date-input {
    cursor: pointer !important;
}

.modal-content small {
    color: var(--text-muted);
}

.modal-content .form-group label {
    color: var(--text);
}

.modal-content .form-group small {
    color: var(--text-muted);
}

/* Edit Project modal: cleaner layout */
.project-description-textarea {
    min-height: 5rem;
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
}

.project-color-group .project-color-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.project-color-input {
    width: 48px;
    height: 44px;
    padding: 2px;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.project-color-hex {
    flex: 1;
    min-width: 0;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono, monospace);
    font-size: 0.875rem;
    max-width: 8rem;
}

/* Status rows in project modal */
.status-input-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: nowrap;
    min-width: 0;
}

.status-input-row.status-input-row-dragging {
    opacity: 0.6;
    transform: rotate(1deg);
}

.status-input-row.status-input-row-drag-over {
    border-top: 2px solid var(--primary);
    margin-top: -2px;
}

.status-input-row .status-item-handle,
.status-input-row .status-item-order-actions {
    flex-shrink: 0;
}

.status-input-row .status-color-input {
    width: 40px;
    height: 40px;
    padding: 2px;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.status-input-row .status-name-input {
    flex: 1;
    min-width: 8rem;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
}

.status-input-row .btn {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .project-color-row {
        gap: var(--spacing-sm);
    }

    .project-color-hex {
        max-width: none;
    }
}

/* Modal form buttons alignment */
.modal-content form {
    display: flex;
    flex-direction: column;
}


/* CSV Import Modal Styles */
.import-modal-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.import-icon-wrapper {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--spacing-md);
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.import-icon-wrapper .icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

[data-theme="dark"] .import-icon-wrapper .icon,
[data-theme="dark-gray"] .import-icon-wrapper .icon,
[data-theme="dark-blue"] .import-icon-wrapper .icon {
    color: white;
}

.import-modal-header h2 {
    margin-bottom: var(--spacing-sm);
}

.import-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.import-template-section {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}

.template-download-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.template-download-link:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.template-download-link .icon {
    width: 20px;
    height: 20px;
}

.template-download-link .icon:last-child {
    width: 16px;
    height: 16px;
    margin-left: auto;
}

.file-upload-group {
    margin-bottom: var(--spacing-xl);
}

.file-upload-wrapper {
    position: relative;
    margin-bottom: var(--spacing-sm);
}

.file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    min-height: 140px;
}

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

.file-upload-label .icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.file-upload-text {
    font-weight: 600;
    color: var(--text);
    font-size: 16px;
    margin-bottom: var(--spacing-xs);
}

.file-upload-hint {
    font-size: 13px;
    color: var(--text-muted);
}

.file-name-display {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text);
    font-size: 14px;
}

.file-name-display .icon {
    width: 20px;
    height: 20px;
    color: var(--success);
}

.file-hint {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-muted);
    font-size: 13px;
}

.import-results {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    animation: slideIn 0.3s ease-out;
}

.import-results.success {
    background: var(--success-light);
    border-left-color: var(--success);
    color: var(--success);
}

.import-results.error {
    background: var(--danger-light);
    border-left-color: var(--danger);
    color: var(--danger);
}

.import-results.warning {
    background: var(--warning-light);
    border-left-color: var(--warning);
    color: var(--warning);
}

.import-results strong {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: 15px;
}

.import-results ul {
    margin: var(--spacing-sm) 0 0 var(--spacing-lg);
    padding: 0;
    list-style: none;
}

.import-results ul li {
    margin: var(--spacing-xs) 0;
    padding-left: var(--spacing-md);
    position: relative;
    font-size: 13px;
    line-height: 1.5;
}

.import-results ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

.modal-actions .btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    min-width: 120px;
    justify-content: center;
}

.modal-actions .btn .icon {
    width: 18px;
    height: 18px;
}

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

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl) var(--spacing-lg);
    color: var(--text-light);
}

.empty-state p {
    font-size: 16px;
    margin-bottom: var(--spacing-md);
}

.empty-state a {
    /* color: var(--primary); */
    text-decoration: none;
    font-weight: 500;
}


[data-theme="dark"] .empty-state a,
[data-theme="dark-gray"] .empty-state a,
[data-theme="dark-blue"] .empty-state a,
[data-theme="dark-purple"] .empty-state a,
[data-theme="dark-green"] .empty-state a {
    color: #60a5fa;
}

[data-theme="dark"] .empty-state a:hover,
[data-theme="dark-gray"] .empty-state a:hover,
[data-theme="dark-blue"] .empty-state a:hover,
[data-theme="dark-purple"] .empty-state a:hover,
[data-theme="dark-green"] .empty-state a:hover {
    color: #93c5fd;
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 12990;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.notifications-page {
    padding: var(--spacing-lg) 0;
}

.form-group label {
    display: flex;
    align-items: center;
    margin: 0 !important;
}

#saveProjectBtn {
    margin-bottom: var(--spacing-sm) !important;

}

/* Responsive */
@media (max-width: 768px) {

    /* Full-width content on mobile – main-content was 95% which caused side margins */
    .main-content {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Container spacing for mobile – full width so dashboard sections use full width */
    .main-content .container,
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 !important;
        box-sizing: border-box;
    }

    .projects-page {
        padding: var(--spacing-md) 0;
    }

    /* Brand bar mobile adjustments */
    .brand-content {
        padding: 0.75rem var(--spacing-md);
        position: relative;
    }

    .company-brand {
        flex: 1;
        min-width: 0;
    }

    .brand-bar {
        z-index: 1000;
    }

    .company-name {
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-actions {
        position: absolute;
        right: var(--spacing-md);
        top: 50%;
        transform: translateY(-50%);
        gap: 0.5rem;
    }

    /* Header mobile adjustments */
    .header {
        padding: 0;
        top: 0;
        /* On mobile, header can be at top since brand bar is repositioned */
    }

    .header-content {
        /* Keep nav in render tree so hamburger can open mobile sidebar */
        display: flex;
        height: 0;
        padding: 0;
        overflow: visible;
        position: relative;
        justify-content: flex-start;
    }

    .logo {
        flex: 1;
        min-width: 0;
        max-width: calc(100% - 3rem);
    }

    .logo-link {
        font-size: 1rem;
    }

    .logo-link [data-brand-name] {
        white-space: normal;
        line-height: 1.25;
    }

    .mobile-menu-toggle {
        display: flex;
        right: 1rem;
        top: 50%;
        z-index: 1004;
        margin-left: 0;
    }

    /* Show user menu on mobile but hide user name, keep logout button visible */
    .user-name {
        display: none !important;
    }

    .user-dropdown {
        display: none !important;
    }

    .notification-badge {
        display: inline-flex;
    }

    /* Hide header logout on mobile to avoid overlap with burger; provide logout in sidebar */
    .btn-logout {
        display: none !important;
    }

    /* Sidebar Navigation - Override desktop styles */
    .nav {
        display: flex !important;
        position: fixed !important;
        top: 0;
        left: -280px;
        width: 280px;
        max-width: min(280px, 100vw);
        height: 100% !important;
        min-height: 100dvh;
        /* full height on iOS (avoids address bar clipping) */
        box-sizing: border-box !important;
        /* width includes padding so Safari doesn't clip right edge */
        background: var(--card) !important;
        box-shadow: var(--shadow-xl) !important;
        flex-direction: column !important;
        gap: 0.25rem !important;
        padding: 1.5rem 0 !important;
        padding-right: max(1rem, env(safe-area-inset-right));
        z-index: 13000 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        border-right: 1px solid var(--border-light) !important;
        justify-content: flex-start !important;
    }

    .mobile-menu-toggle {
        z-index: 13001;
    }

    .nav.nav-open {
        left: 0;
        justify-content: flex-start;
    }

    .nav.scrolled-end.nav-open {
        z-index: 1002 !important;
    }

    .nav a {
        width: calc(100% - 2rem);
        margin: 0 1rem;
        padding: 0.75rem 1rem;
        justify-content: flex-start;
        border-radius: var(--radius-md);
        border-left: 3px solid transparent;
        border-bottom: none;
        transition: var(--transition);
    }

    .nav a:hover {
        background: var(--bg-secondary);
        /* Keep left border subtle on hover to avoid looking active */
        border-left-color: transparent;
    }

    .nav a.active {
        background: var(--primary-light);
        color: var(--primary);
        border-left-color: var(--primary);
        font-weight: 600;
    }

    .nav a.active::after {
        display: none;
    }

    .nav a .icon {
        margin-right: var(--spacing-md);
    }

    .nav a span:last-child {
        font-size: 15px;
    }

    /* Show sidebar-specific elements on mobile */
    .sidebar-user-profile,
    .sidebar-divider {
        display: block;
    }

    .sidebar-divider {
        display: block;
        height: 1px;
        background: var(--border-light);
        margin: 0.75rem 1rem;
    }

    /* Show mobile-only navigation items */
    .mobile-only {
        display: flex !important;
    }

    /* Style mobile-only settings link like other nav items */
    .mobile-only[href*="settings"] {
        width: calc(100% - 2rem);
        margin: 0 1rem;
        padding: 0.75rem 1rem;
        justify-content: flex-start;
        border-radius: var(--radius-md);
        border-left: 3px solid transparent;
        border-bottom: none;
        transition: var(--transition);
        text-decoration: none;
        color: var(--text-secondary);
        align-items: center;
        gap: var(--spacing-md);
        font-weight: 500;
        font-size: 14px;
    }

    .mobile-only[href*="settings"]:hover {
        background: var(--bg-secondary);
        color: var(--text);
        border-left-color: transparent;
    }

    .mobile-only[href*="settings"].active {
        background: var(--primary-light);
        color: var(--primary);
        border-left-color: var(--primary);
        font-weight: 600;
    }

    .mobile-only[href*="settings"] .icon {
        margin-right: var(--spacing-md);
        width: 20px;
        height: 20px;
    }

    .mobile-only[href*="settings"] span:last-child {
        font-size: 15px;
    }

    /* Show a clear logout action inside the sidebar on mobile */
    .sidebar-logout {
        display: flex;
        align-items: center;
        gap: var(--spacing-sm);
        width: calc(100% - 2rem);
        margin: 0.5rem 1rem 0.75rem 1rem;
        padding: 0.75rem 1rem;
        border-radius: var(--radius-md);
        text-decoration: none;
        color: var(--danger);
        border: 1px solid var(--danger-light);
        background: #fff;
        font-weight: 600;
    }

    .sidebar-logout .icon {
        color: var(--danger);
    }

    .sidebar-logout:hover {
        background: var(--danger-light);
    }

    /* Sidebar User Profile */
    .sidebar-user-profile {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 1rem 1.5rem;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid var(--border-light);
    }

    .sidebar-user-avatar {
        width: 48px;
        height: 48px;
        font-size: 48px;
        border-radius: 50%;
        background: var(--primary);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        font-size: 18px;
        flex-shrink: 0;
    }

    .sidebar-user-info {
        flex: 1;
        min-width: 0;
    }

    .sidebar-user-name {
        font-weight: 600;
        font-size: 15px;
        color: var(--text);
        margin-bottom: 0.25rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar-user-email {
        font-size: 13px;
        color: var(--text-secondary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sidebar-divider {
        height: 1px;
        background: var(--border-light);
        margin: 0.75rem 1rem;
    }

    /* Navigation dividers in mobile sidebar */
    .nav-divider {
        display: block;
        height: 1px;
        background: var(--border-light);
        margin: 0.5rem 1rem;
    }

    /* User menu is already hidden above, these rules are redundant */
    .user-name span:last-child {
        display: none;
    }

    .user-name .icon+span {
        display: none;
    }

    /* Notifications mobile layout */
    .notifications-page {
        padding: var(--spacing-md) 0;
    }

    .notifications-list {
        gap: var(--spacing-sm);
    }

    .notification-item {
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
        margin: 0 var(--spacing-md);
        border-radius: var(--radius-lg);
        background: var(--card);
        border: 1px solid var(--border-light);
        box-shadow: var(--shadow-sm);
    }

    .notification-item.unread {
        border-left: 4px solid var(--primary);
        background: rgba(0, 102, 255, 0.02);
    }

    .notification-content {
        flex: 1;
        min-width: 0;
    }

    .notification-text {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: var(--spacing-xs);
    }

    .notification-time {
        font-size: 13px;
        color: var(--text-secondary);
        margin-bottom: var(--spacing-xs);
    }

    .notification-actions {
        display: flex;
        justify-content: flex-end;
        margin-top: var(--spacing-sm);
    }

    .mark-read-btn {
        padding: 0.5rem 1rem;
        font-size: 13px;
        border-radius: var(--radius-md);
        background: var(--primary);
        color: white;
        border: none;
        cursor: pointer;
        transition: var(--transition);
    }

    .mark-read-btn:hover {
        background: var(--primary-dark);
    }

    .mark-read-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

    /* Page header mobile adjustments */
    .page-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: var(--spacing-lg);
        padding: 0 var(--spacing-md);
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .page-header h1 {
        font-size: 20px;
        margin: 0;
        flex: 1;
        min-width: 0;
    }

    #markAllReadBtn {
        padding: 0.5rem 1rem;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Safari: overflow on html/body clips fixed elements; allow overflow-x when menu open */
    html.menu-open {
        overflow-x: visible !important;
    }

    body.menu-open {
        overflow-y: hidden;
        overflow-x: visible !important;
    }

    /* Keep main content behind the sidebar overlay when menu is open (fixes Projects page content showing through) */
    body.menu-open .main-content {
        position: relative;
        z-index: 0;
    }

    /* Sidebar overlay */
    .sidebar-overlay.active {
        display: block;
        pointer-events: auto;
        z-index: 1000 !important;
    }

    .tasks-page .tasks-board {
        flex-direction: row;
        /* scroll-snap-type: x proximity; */
        scroll-padding: var(--spacing-md);
    }

    .tasks-page .task-column {
        min-width: 350px;
        scroll-snap-align: start;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stats-row {
        display: contents;
    }

    .dashboard-main {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard-header .btn {
        width: 100%;
        justify-content: center;
    }

    .filters {
        flex-direction: column;
    }

    .filter-input,
    .filter-select {
        width: 100%;
    }

    .filters .btn {
        width: 100%;
        justify-content: center;
    }

    .projects-grid,
    .team-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .projects-header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: stretch;
        margin-bottom: var(--spacing-lg);
    }

    .projects-header h1 {
        font-size: clamp(24px, 6vw, 32px);
        text-align: center;
    }

    .projects-header .btn {
        width: 100%;
        justify-content: center;
    }

    .project-card {
        padding: var(--spacing-lg);
        margin: 0;
    }

    .project-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .project-actions {
        align-self: flex-end;
    }

    /* Settings page responsive */
    .settings-page {
        padding: var(--spacing-md) 0;
    }

    .settings-tabs {
        margin: 0 calc(-1 * var(--spacing-md));
        padding: 0 var(--spacing-md);
        gap: var(--spacing-xs);
        /* margin-bottom: var(--spacing-lg); */
    }

    .tab-button {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 14px;
        min-width: max-content;
    }

    .settings-section {
        padding: var(--spacing-md);
        margin: 0 calc(-1 * var(--spacing-md));
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-lg);
        padding-bottom: var(--spacing-md);
    }

    .section-header h2 {
        font-size: clamp(18px, 4vw, 20px);
    }

    .section-header>div:last-child {
        flex-direction: column;
        align-items: flex-start !important;
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-lg);
        padding-bottom: var(--spacing-md);
    }

    .profile-form-card {
        padding: var(--spacing-lg);
        margin: 0;
    }

    .form-group {
        margin-bottom: var(--spacing-md);
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: var(--spacing-xs);
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px;
        /* Prevent zoom on iOS */
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .form-group .btn {
        width: auto;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: var(--spacing-sm);
        font-size: .8rem;
    }



    .btn-invite-header {
        width: 100%;
        justify-content: center;
    }

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

    /* Filter Accordion for Mobile */
    .filters-container {
        margin-bottom: var(--spacing-lg);
    }

    .filters-accordion-trigger.filters-header {
        padding: var(--spacing-md);
    }

    .filters-accordion-title h3 {
        font-size: 16px;
    }

    .filters-accordion-panel.filters {
        display: none;
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
        border-radius: 0 0 var(--radius-md) var(--radius-md);
        flex-direction: column;
    }

    .filters-accordion-panel.filters.expanded {
        display: flex;
        animation: filtersSlideDown 0.3s ease;
    }

    .filters-accordion-panel .filter-input,
    .filters-accordion-panel .filter-select {
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }

    .filters-accordion-panel .btn {
        width: 100%;
        justify-content: center;
        margin-top: var(--spacing-sm);
    }

    @keyframes filtersSlideDown {
        from {
            opacity: 0;
            max-height: 0;
        }

        to {
            opacity: 1;
            max-height: 600px;
        }
    }

    .project-stats {
        flex-direction: column;
    }

    .task-details-header {
        flex-direction: column;
    }

    /* Tasks page: view toggle and actions wrap */
    .tasks-header-actions {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
        align-items: stretch;
    }

    .tasks-header-primary {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
        width: 100%;
    }

    .tasks-view-toggle {
        width: 100%;
    }

    .tasks-view-toggle .tasks-view-btn {
        padding: 0.5rem 0.65rem;
        font-size: 13px;
    }

    .tasks-view-toggle .tasks-view-btn .icon {
        width: 16px;
        height: 16px;
    }

    .tasks-new-task-btn {
        width: 100%;
        justify-content: center;
    }

    .tasks-header-secondary {
        display: none;
    }

    .tasks-header-more {
        display: block;
        width: 100%;
    }

    .tasks-more-btn {
        width: 100%;
        justify-content: center;
    }

    /* Tasks board: horizontal scroll with narrower columns on small screens */
    .tasks-page .tasks-board {
        padding-bottom: var(--spacing-sm);
        -webkit-overflow-scrolling: touch;
    }

    .tasks-page .task-column {
        min-width: 350px;
        min-height: 320px;
    }

    /* Tasks header: stack title above actions, actions wrap with min-widths */
    .tasks-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
    }

    .tasks-header h1 {
        flex: none;
    }

    .tasks-header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .tasks-header-actions .btn {
        min-width: 120px;
    }

    .tasks-view-toggle {
        width: 100%;
        justify-content: stretch;
    }

    .tasks-view-toggle .tasks-view-btn {
        flex: 1;
        min-width: 0;
        padding: 0.5rem 0.5rem;
        justify-content: center;
    }

    /* Tasks calendar: compact grid on mobile */
    .tasks-calendar-header {
        gap: 0.75rem;
        margin-bottom: var(--spacing-md);
    }

    .tasks-calendar-nav-row {
        padding: 0.4rem 0.5rem;
    }

    .tasks-calendar-title {
        font-size: 1.1rem;
    }

    .calendar-view-mode-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8125rem;
    }

    .calendar-nav-btn {
        min-width: 40px;
        min-height: 40px;
    }

    .calendar-nav-btn .icon {
        width: 22px;
        height: 22px;
    }

    .tasks-calendar-week-grid {
        min-height: 260px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tasks-calendar-week-day {
        min-width: 100px;
    }

    .tasks-calendar-days {
        min-height: 280px;
    }

    .tasks-calendar-day {
        min-height: 64px;
        padding: 0.25rem;
    }

    .tasks-calendar-day-num {
        font-size: 0.75rem;
    }

    .tasks-calendar-task {
        font-size: 0.7rem;
        padding: 0.2rem 0.25rem;
    }

    .tasks-calendar-weekdays span {
        font-size: 0.65rem;
    }

    /* Modals: default centered dialog; full-bleed only when .modal--sheet is on the overlay */
    .modal:not(.modal--sheet) {
        align-items: center;
        justify-content: center;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }

    .modal:not(.modal--sheet)>.modal-content {
        width: min(100vw, 600px) !important;
        max-width: min(100vw, 600px) !important;
        height: 100vh !important;
        max-height: min(100dvh, 100vh) !important;
        margin: 0;
        border-radius: var(--radius-xl) !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal:not(.modal--sheet)>.modal-content.admin-action-modal {
        width: min(100vw, 480px) !important;
        max-width: min(100vw, 480px) !important;
    }

    #adminTrialModal>.modal-content {
        width: min(100vw, 400px) !important;
        max-width: min(100vw, 400px) !important;
    }

    .modal.modal--sheet {
        padding: 0;
        align-items: stretch;
    }

    .modal.modal--sheet>.modal-content {
        margin: 0;
        max-height: 100% !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
    }

    #taskDetailsModal.modal--sheet>.modal-content {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        max-height: 100%;
    }

    #taskDetailsModal.modal--sheet .task-details-modal-sticky-chrome {
        border-radius: 0;
        padding: 0.5rem 0.75rem;
    }

    #taskDetailsContent {
        min-width: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0.75rem 1rem 1rem;
    }

    .modal.modal--sheet>.modal-content.modal-large {
        width: 100% !important;
        max-height: 100vh;
    }

    /* Sheet modals: beat page-level ID width caps (e.g. tasks redesign) so mobile stays edge-to-edge */
    #createTaskModal.modal--sheet .modal-content.tasks-create-task-modal,
    #taskDetailsModal.modal--sheet .modal-content.task-details-modal-content,
    .tasks-page-redesign #taskDetailsModal.modal--sheet .modal-content.task-details-modal-content {
        width: 100% !important;
        max-width: 100% !important;
    }

    .attachment-view-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    /* Project section spacing */
    .project-section {
        margin-bottom: var(--spacing-xl);
    }

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

    /* Project filter checkbox */
    .project-filter-checkbox {
        width: 18px;
        height: 18px;
    }

    /* Tables: horizontal scroll */
    .settings-table,
    .profile-form-card table,
    .task-detail-section table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .settings-table th,
    .settings-table td,
    .profile-form-card table th,
    .profile-form-card table td,
    .task-detail-section table th,
    .task-detail-section table td {
        white-space: nowrap;
    }

    /* API tab: table stays table layout, wrapper scrolls */
    .table-scroll-wrap .settings-table {
        display: table;
        overflow: visible;
    }

    /* All tables without explicit wrapper get scrolling */
    table:not(.settings-table):not(.tickets-table):not(.admin-tickets-table) {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Ensure wrapped tables have proper min-width */
    .table-responsive table,
    .table-scroll-wrap table {
        min-width: 600px;
    }

    /* Admin section tables */
    .admin-section table {
        min-width: 1080px;
    }

    .admin-section th,
    .admin-section td {
        white-space: nowrap;
    }

    /* Data tables */
    .data-table {
        min-width: 700px;
    }

    /* Tickets tables */
    .tickets-table {
        min-width: 800px;
    }

    .admin-tickets-table {
        min-width: 920px;
    }

    .btn-filter-toggle {
        width: 100%;
        justify-content: space-between !important;
    }

    .filters-actions {
        width: 100%;
    }

    .task-description-rich-toolbar {
        flex-wrap: nowrap !important;
    }
}

/* Tablet and below: hide secondary actions in favor of More */
@media (max-width: 1024px) {
    /* .container {
        padding: var(--spacing-md) var(--spacing-lg);
    } */

    .task-column {
        min-width: 350px;
    }

    .tasks-header-actions {
        flex-wrap: wrap;
    }

    .tasks-header-primary {
        /* flex: 1 1 360px; */
        flex-wrap: wrap;
    }

    .tasks-header-secondary {
        display: none;
    }

    .tasks-header-more {
        display: block;
        width: 100%;
    }

    .tasks-more-btn {
        width: 100%;
        justify-content: center;
    }

    .modal-large {
        width: min(92vw, 800px);
    }
}

/* Ultra-small devices: ensure full usability down to 320px */
@media (max-width: 360px) {

    html,
    body {
        width: 100%;
        overflow-x: hidden;
    }

    .container {
        padding: var(--spacing-md) var(--spacing-sm);
    }

    .header-content {
        padding: 0.5rem 2.75rem 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .logo-link {
        font-size: 0.9375rem;
    }

    .mobile-menu-toggle {
        right: 0.5rem;
    }

    /* Sidebar nav narrower on very small screens */
    .nav {
        width: 240px;
        padding: 0.5rem 0.25rem;
    }

    .nav a {
        width: calc(100% - 1rem);
        margin: 0 0.5rem;
        padding: 0.5rem 0.75rem;
    }

    /* Dashboard improvements for small screens */
    .dashboard-stats {
        gap: 0.75rem;
    }

    .dashboard-header {
        text-align: center;
        padding: 0 0.5rem;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .dashboard-subtitle {
        font-size: 0.875rem;
    }

    .dashboard-header .btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    /* Stat cards single column */
    .stat-card {
        padding: 1rem 0.75rem;
        min-height: auto;
    }

    .stat-icon {
        font-size: 32px;
    }

    .stat-icon .icon {
        width: 18px;
        height: 18px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* Dashboard main grid */
    .dashboard-main {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Dashboard cards */
    .dashboard-card {
        padding: 1rem 0.75rem;
    }

    .dashboard-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .dashboard-card-header h2 {
        font-size: 1rem;
    }

    /* Recent tasks improvements */
    .recent-task-item {
        padding: 0.75rem 0.5rem;
        min-height: 225px !important;
    }

    .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .task-title {
        font-size: 14px;
        line-height: 1.3;
    }

    .task-status-badge {
        font-size: 10px;
        padding: 0.2rem 0.4rem;
    }

    .task-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .task-meta-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .task-assignees {
        align-self: flex-end;
    }

    /* Notification improvements */
    .notification-item {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .notification-icon {
        font-size: 28px;
        flex-shrink: 0;
    }

    .notification-icon .icon {
        width: 16px;
        height: 16px;
    }

    .notification-text {
        font-size: 12px;
        line-height: 1.3;
    }

    .notification-time {
        font-size: 11px;
    }

    /* Quick actions */
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .quick-action-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }

    .quick-action-btn .icon {
        width: 20px;
        height: 20px;
    }

    /* Tasks header improvements for mobile – compact, less busy */
    .tasks-page {
        padding: var(--spacing-md) 0;
    }

    .tasks-header {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .tasks-header h1 {
        font-size: 1.5rem;
        text-align: center;
    }

    .tasks-header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
    }

    .tasks-header-primary {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
        width: 100%;
    }

    .tasks-header-secondary {
        display: none !important;
    }

    .tasks-header-more {
        display: block;
        width: 100%;
    }

    .tasks-view-toggle {
        width: 100%;
        min-width: 0;
    }

    .tasks-view-toggle .tasks-view-btn {
        font-size: 0.875rem;
        padding: 0.625rem 0.5rem;
    }

    .tasks-new-task-btn {
        width: 100%;
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
        justify-content: center;
    }

    .tasks-more-btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .tasks-more-btn .icon {
        margin-right: 0.25rem;
    }

    .tasks-more-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-top: 0.25rem;
        padding: var(--spacing-xs);
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-lg);
        z-index: 50;
    }

    .tasks-header-more.is-open .tasks-more-menu {
        display: block;
    }

    .tasks-more-item {
        display: flex;
        align-items: center;
        gap: var(--spacing-sm);
        width: 100%;
        padding: 0.5rem 0.75rem;
        border: none;
        background: none;
        font-size: 0.875rem;
        color: var(--text);
        text-align: left;
        text-decoration: none;
        cursor: pointer;
        border-radius: var(--radius-sm);
        transition: background 0.15s ease;
    }

    .tasks-more-item:hover {
        background: var(--bg-secondary);
    }

    /* Filters stack nicely */
    .filters-container {
        margin-bottom: var(--spacing-md);
    }

    .filters-header {
        padding: var(--spacing-sm);
    }

    .filters-accordion-title h3 {
        font-size: 15px;
    }

    .filters-accordion-panel.filters {
        padding: var(--spacing-sm);
    }

    .filter-input,
    .filter-select {
        width: 100%;
        min-width: 0;
    }

    .date-filters-container {
        flex-direction: column;
        align-items: stretch;
    }

    .date-filters-quick-select {
        gap: var(--spacing-xs);
    }

    .date-range-filter {
        width: 100%;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .date-range-inputs {
        width: 100%;
        flex-wrap: wrap;
    }

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

    /* Tasks board and cards */
    .tasks-board {
        gap: var(--spacing-md);
    }

    .task-column {
        min-width: 260px;
        padding: var(--spacing-md);
    }

    .task-card {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .task-card-drag-handle {
        top: 0.25rem;
        right: 0.25rem;
    }

    /* Modal: match ≤768px — centered dialogs; full-bleed only .modal--sheet */
    .modal:not(.modal--sheet)>.modal-content {
        width: min(96vw, 600px) !important;
        max-width: min(96vw, 600px) !important;
        height: auto !important;
        max-height: min(90dvh, 90vh) !important;
        margin: 0;
        border-radius: var(--radius-xl) !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal:not(.modal--sheet)>.modal-content.admin-action-modal {
        width: min(96vw, 480px) !important;
        max-width: min(96vw, 480px) !important;
    }

    #adminTrialModal>.modal-content {
        width: min(96vw, 400px) !important;
        max-width: min(96vw, 400px) !important;
    }

    .modal.modal--sheet>.modal-content {
        width: 100% !important;
        max-width: 100%;
        margin: 0;
        max-height: 100%;
        height: 100% !important;
        padding: calc(var(--spacing-md) + env(safe-area-inset-top)) calc(var(--spacing-md) + env(safe-area-inset-right)) calc(var(--spacing-md) + env(safe-area-inset-bottom)) calc(var(--spacing-md) + env(safe-area-inset-left));
        border-radius: 0;
    }

    .modal.modal--sheet>.modal-content.modal-large {
        width: 100% !important;
        max-width: 100%;
        margin: 0;
        max-height: 100%;
        height: 100% !important;
        border-radius: 0;
    }

    #createTaskModal.modal--sheet .modal-content.tasks-create-task-modal,
    #taskDetailsModal.modal--sheet .modal-content.task-details-modal-content,
    .tasks-page-redesign #taskDetailsModal.modal--sheet .modal-content.task-details-modal-content {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Company Management Modal Mobile Fixes */
    #companyManagementContent {
        padding: var(--spacing-md);
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    #companyManagementContent .coming-soon-content {
        padding: 2rem var(--spacing-md);
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    #companyManagementContent .coming-soon-content h1,
    #companyManagementContent .coming-soon-content h2,
    #companyManagementContent .coming-soon-content p,
    #companyManagementContent .coming-soon-content span {
        word-break: normal !important;
        word-wrap: normal !important;
        white-space: normal !important;
        overflow-wrap: break-word;
    }

    #companyManagementContent .feature-item span:last-child {
        word-break: normal !important;
        word-wrap: normal !important;
        white-space: normal !important;
        overflow-wrap: break-word;
    }

    #taskDetailsContent {
        padding: 0;
        overflow-y: auto;
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        -webkit-overflow-scrolling: touch;
    }

    #taskDetailsContent .task-details {
        padding: var(--spacing-md);
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    #taskDetailsContent .task-description-full,
    #taskDetailsContent .task-description-section {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* Ensure iframes in task details are not constrained */
    #taskDetailsContent .comment-text .rich-text-content iframe,
    #taskDetailsContent .rich-text-content iframe {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
        display: block !important;
    }

    .close {
        margin: var(--spacing-sm);
        font-size: 36px;
        font-size: 28px;
        top: var(--spacing-sm);
        right: var(--spacing-sm);
    }

    /* Task Details Modal Mobile Responsiveness */
    .task-details {
        padding: var(--spacing-md);
        background: var(--card);
    }

    .task-details h2 {
        font-size: 20px;
        margin-bottom: var(--spacing-sm);
        line-height: 1.4;
        color: var(--text);
        font-weight: 600;
        word-break: normal !important;
        word-wrap: normal !important;
        overflow-wrap: break-word;
        white-space: normal !important;
        width: 100%;
        max-width: 100%;
    }

    .task-details-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: var(--spacing-md) !important;
        padding-bottom: var(--spacing-md);
        border-bottom: 1px solid var(--border-light);
        margin-bottom: var(--spacing-lg);
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .task-details-header h2 {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        font-size: 20px;
        line-height: 1.4;
        word-break: normal !important;
        word-wrap: normal !important;
        overflow-wrap: break-word;
        white-space: normal !important;
        hyphens: none;
        display: block;
    }

    .btn-delete-task {
        width: 100%;
        justify-content: center;
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 14px;
        min-height: 44px;
        margin-top: var(--spacing-xs);
        order: 2;
    }

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

    .task-meta {
        flex-direction: row;
        align-items: center;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
        padding-bottom: var(--spacing-md);
        border-bottom: 1px solid var(--border-light);
        flex-wrap: wrap;
    }

    .task-meta .priority-badge,
    .task-meta .due-date {
        display: inline-flex;
        align-items: center;
        gap: var(--spacing-xs);
    }

    .task-meta {
        padding: var(--spacing-md);
    }

    .task-meta-grid {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-md);
    }

    .meta-item {
        gap: var(--spacing-xs);
    }

    .status-badge,
    .priority-badge,
    .project-badge,
    .due-date {
        width: 90% !important;
        justify-content: flex-start;
    }

    .task-description-section {
        margin-bottom: var(--spacing-lg);
        padding: var(--spacing-md);
    }

    .task-description-header {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-sm);
    }

    .task-description-header h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: var(--text);
    }

    .task-description-header #editDescriptionBtn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
        min-height: 44px;
    }

    .task-description-full {
        margin-bottom: var(--spacing-lg);
        font-size: 14px;
        line-height: 1.7;
        padding: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .task-description-edit {
        margin-bottom: var(--spacing-lg);
        min-width: 0;
    }

    .task-description-edit textarea {
        width: 100%;
        padding: var(--spacing-md);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        font-size: 16px;
        font-family: inherit;
        resize: vertical;
        min-height: 120px;
        background: var(--card);
        color: var(--text);
        box-sizing: border-box;
    }

    .task-description-rich-editor {
        min-height: 100px;
        font-size: 16px;
        padding: var(--spacing-md);
    }

    .description-edit-actions {
        margin-top: var(--spacing-md);
        display: flex;
        gap: var(--spacing-sm);
        justify-content: stretch;
        flex-wrap: nowrap;
    }

    .description-edit-actions .btn {
        flex: 1;
        min-height: 44px;
        font-size: 15px;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .task-description-full p {
        margin: 0;
        word-wrap: normal;
        word-break: normal;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .task-assignees-section,
    .task-comments-section {
        margin-top: var(--spacing-lg);
        padding-top: var(--spacing-lg);
        border-top: 1px solid var(--border-light);
    }

    .task-assignees-section:first-of-type {
        margin-top: var(--spacing-md);
        padding-top: var(--spacing-md);
        border-top: none;
    }

    .task-assignees-list,
    .comments-list {
        margin-top: var(--spacing-md);
    }

    .task-assignees-section h3,
    .task-comments-section h3 {
        font-size: 18px;
        margin-bottom: var(--spacing-md);
        color: var(--text);
        font-weight: 600;
    }

    .comments-list {
        max-height: 300px;
        margin-bottom: var(--spacing-lg);
        padding-right: var(--spacing-xs);
    }

    .comment-item {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
        gap: var(--spacing-sm);
        flex-direction: row;
    }

    .comment-avatar {
        font-size: 36px;
        font-size: 14px;
        flex-shrink: 0;
    }

    .comment-header {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: var(--spacing-sm);
        width: 100%;
    }

    .comment-header-left {
        flex: 1;
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }

    .comment-author {
        font-size: 14px;
        margin-bottom: 0;
        font-weight: 600;
        color: var(--text);
        line-height: 1.4;
    }

    .comment-time {
        font-size: 12px;
        color: var(--text-muted);
        line-height: 1.4;
    }

    .comment-actions {
        flex-shrink: 0;
        gap: var(--spacing-xs);
        align-items: center;
    }

    .comment-content {
        width: 100%;
        flex: 1;
        min-width: 0;
    }

    .btn-icon-sm {
        font-size: 36px;
        padding: 8px;
    }

    .btn-icon-sm .icon {
        width: 18px;
        height: 18px;
    }

    .comment-text {
        font-size: 14px;
        line-height: 1.6;
        margin-top: var(--spacing-xs);
        padding-top: var(--spacing-xs);
    }

    .comment-form textarea {
        min-height: 100px;
        font-size: 14px;
        padding: var(--spacing-md);
    }

    .comment-input-wrapper {
        flex-direction: column;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }

    .btn-comment-submit {
        align-self: stretch;
        justify-content: center;
        min-height: 44px;
        font-size: 14px;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    /* Multi-select mobile adjustments for task details */
    .multi-select-container {
        width: 100%;
        position: relative;
    }

    .multi-select-input {
        padding: var(--spacing-md);
        font-size: 14px;
        min-height: 48px;
        /* Touch-friendly */
        border-radius: var(--radius-md);
    }

    .dropdown-icon {
        font-size: 22px !important;
        font-size: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .multi-select-dropdown {
        max-height: 250px;
        font-size: 14px;
        width: 100%;
        left: 0;
        right: 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border-radius: var(--radius-md);
        margin-top: var(--spacing-xs);
    }

    .search-box {
        padding: var(--spacing-md);
        min-height: 44px;
    }

    .search-box input {
        font-size: 14px;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .search-box .icon {
        width: 20px;
        height: 20px;
    }

    .select-option {
        padding: var(--spacing-md);
        min-height: 48px;
        /* Touch-friendly */
        align-items: center;
        gap: var(--spacing-sm);
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    .select-option .icon {
        width: 20px;
        height: 20px;
    }

    .select-option:active {
        background: var(--bg-secondary);
    }

    .selected-items {
        flex-wrap: wrap;
        gap: var(--spacing-xs);
        padding: 0;
        min-height: 32px;
    }

    .selected-item {
        font-size: 13px;
        padding: var(--spacing-xs) var(--spacing-sm);
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        gap: var(--spacing-xs);
    }

    .selected-item .remove-item {
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        margin-left: var(--spacing-xs);
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    /* Priority badge mobile adjustments */
    .priority-badge {
        font-size: 11px;
        padding: var(--spacing-xs) var(--spacing-sm);
        font-weight: 600;
    }

    /* Due date mobile adjustments */
    .due-date {
        font-size: 13px;
        color: var(--text);
        font-weight: 500;
    }

    /* Buttons - Touch-friendly */
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-task-view {
        font-size: 14px;
        padding: var(--spacing-sm) var(--spacing-md);
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--spacing-xs);
    }

    .btn .icon {
        width: 20px;
        height: 20px;
    }

    /* Additional mobile adjustments for multi-select in forms */
    .task-assignees-section .multi-select-input,
    .task-comments-section .multi-select-input {
        padding: var(--spacing-md);
        min-height: 48px;
    }

    .selected-chip {
        padding: 0.25rem 0.5rem;
    }

    /* Settings page mobile tweaks */
    .settings-tabs-wrapper {
        align-items: center;
    }

    .settings-tabs-nav {
        min-height: 44px;
    }

    .settings-tabs {
        margin: 0 calc(-1 * var(--spacing-sm));
        padding: 0 var(--spacing-sm);
        gap: var(--spacing-xs);
    }

    .tab-button {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 13px;
    }

    .settings-section {
        padding: var(--spacing-md);
        margin: 0 calc(-1 * var(--spacing-sm));
    }

    .section-header {
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-sm);
    }

    .profile-form-card {
        padding: var(--spacing-md);
    }

    .team-member-card {
        padding: var(--spacing-md);
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-sm);
    }

    .member-info h3 {
        font-size: 18px;
    }

    .member-email {
        font-size: 13px;
    }

    .member-actions .btn {
        width: 100%;
        font-size: 13px;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    /* Comments */
    .comment-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-comment-submit {
        width: 100%;
        justify-content: center;
    }
}

/* Extra-small devices: iPhone SE and 320px width support */
@media (max-width: 320px) {

    html,
    body {
        width: 100%;
        overflow-x: hidden;
        min-width: 320px;
    }

    .container {
        padding: var(--spacing-sm) var(--spacing-xs);
        max-width: 100%;
    }

    /* Header adjustments for very small screens */
    .header-content {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .logo {
        font-size: 24px;
    }

    .logo-link {
        font-size: 0.875rem;
        white-space: nowrap;
    }

    .user-avatar {
        font-size: 28px;
        font-size: 11px;
    }



    .mobile-menu-toggle {
        right: 0.25rem;
        padding: 0.25rem;
    }

    /* Dashboard specific fixes */
    .dashboard-header {
        padding: 0.5rem 0.25rem;
    }

    .dashboard-header h1 {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
    }

    .dashboard-subtitle {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }

    .dashboard-header .btn {
        width: 100%;
        padding: 0.65rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Stats grid - single column with reduced padding */
    .dashboard-stats {
        gap: 0.5rem;
        padding: 0;
    }

    .stat-card {
        padding: 0.75rem 0.5rem;
        min-height: auto;
    }

    .stat-content {
        gap: 0.5rem;
    }

    .stat-icon {
        font-size: 28px;
    }

    .stat-icon .icon {
        width: 16px;
        height: 16px;
    }

    .stat-value {
        font-size: 1.25rem;
        margin-bottom: 0.1rem;
    }

    .stat-label {
        font-size: 11px;
        line-height: 1.2;
    }

    /* Dashboard main content */
    .dashboard-main {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .dashboard-card {
        padding: 0.75rem 0.5rem;
    }

    .dashboard-card-header {
        margin-bottom: 0.75rem;
    }

    .dashboard-card-header h2 {
        font-size: 0.95rem;
    }

    /* Recent tasks - more compact */
    .recent-task-item {
        padding: 0.5rem 0.25rem;
        gap: 0.5rem;
    }

    .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .task-title {
        font-size: 13px;
        line-height: 1.2;
        margin-bottom: 0.25rem;
    }

    .task-priority {
        font-size: 9px;
        padding: 0.15rem 0.3rem;
    }

    .task-status-badge {
        font-size: 9px;
        padding: 0.15rem 0.3rem;
    }

    .task-meta {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .task-meta-left {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }

    .task-project,
    .task-due-date {
        font-size: 11px;
    }

    .task-assignees {
        margin-top: 0.25rem;
        align-self: flex-start;
    }

    .assignee-avatar {
        font-size: 20px;
        font-size: 9px;
    }

    /* Notifications more compact */
    .notification-item {
        padding: 0.4rem 0.25rem;
        gap: 0.4rem;
    }

    .notification-icon {
        font-size: 24px;
    }

    .notification-icon .icon {
        width: 14px;
        height: 14px;
    }

    .notification-text {
        font-size: 11px;
        line-height: 1.2;
    }

    .notification-time {
        font-size: 10px;
    }

    /* Quick actions - stack 2x2 */
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    .quick-action-btn {
        padding: 0.6rem 0.4rem;
        font-size: 11px;
        text-align: center;
    }

    .quick-action-btn .icon {
        width: 18px;
        height: 18px;
        margin-bottom: 0.2rem;
    }

    /* Navigation sidebar */
    .nav {
        width: 220px;
        padding: 0.5rem 0.2rem;
    }

    .nav a {
        padding: 0.5rem 0.6rem;
        font-size: 14px;
        margin: 0 0.3rem;
    }

    .nav .icon {
        width: 18px;
        height: 18px;
        margin-right: 0.5rem;
    }

    /* Modal adjustments */
    .modal-content {
        width: calc(100vw - 1rem);
        max-width: none;
        padding: 1rem 0.75rem;
    }

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

    .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }

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

    .form-group label {
        font-size: 13px;
        margin-bottom: 0.25rem;
    }

    .form-input,
    .form-select,
    .form-textarea {
        font-size: 14px;
        padding: 0.5rem;
    }

    /* Button adjustments */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 13px;
    }

    .btn-sm {
        padding: 0.3rem 0.5rem;
        font-size: 11px;
    }

    /* Task board for 320px */
    .tasks-board {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .task-column {
        min-width: 300px;
        padding: 0.5rem;
    }

    .task-column h3 {
        font-size: 14px;
        padding: 0.5rem;
    }

    .task-card {
        padding: 1rem;
        margin-bottom: 0.5rem;
    }

    .task-card h4 {
        font-size: 13px;
        margin-bottom: 0.25rem;
    }

    .task-card p {
        font-size: 11px;
        line-height: 1.3;
    }

    /* Ensure no horizontal scrolling */
    * {
        max-width: 100%;
        box-sizing: border-box;
    }

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

    table {
        min-width: 280px;
        font-size: 12px;
        width: 100%;
    }

    th,
    td {
        padding: 0.4rem 0.2rem;
        white-space: nowrap;
        font-size: 11px;
    }

    /* Ensure dropdowns don't overflow */
    .dropdown-menu {
        width: auto;
        min-width: 120px;
        max-width: calc(100vw - 2rem);
        left: auto;
        right: 0;
    }

    /* User dropdown positioning */
    .user-dropdown .dropdown-menu {
        right: 0;
        left: auto;
        width: auto;
        min-width: 140px;
    }

    .project-header h2 {
        font-size: 1rem !important;
    }
}


/* iPhone 12 Pro and similar devices (390-480px) */
@media (max-width: 480px) {

    /* Force single column for stats on smaller screens */
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .stats-row {
        display: contents;
    }

    .stat-card {
        padding: 1rem;
        gap: 0.75rem;
    }

    .stat-icon {
        font-size: 48px;
    }

    .stat-icon .icon {
        width: 22px;
        height: 22px;
    }

    .stat-value {
        font-size: 28px;
    }

    .stat-label {
        font-size: 12px;
    }

    /* Dashboard header improvements */
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        text-align: center;
    }

    .dashboard-header h1 {
        font-size: 1.75rem;
        margin-bottom: 0.25rem;
    }

    .dashboard-subtitle {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .dashboard-header .btn {
        width: 100%;
        padding: 0.75rem;
        justify-content: center;
    }

    /* Dashboard main content single column */
    .dashboard-main {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    /* Card improvements */
    .dashboard-card {
        padding: 0.75rem;
    }

    .dashboard-card-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
    }

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

    /* Recent tasks improvements */
    .recent-task-item {
        min-height: 225px !important;
        padding: 0.625rem;
        gap: 0.5rem;
    }

    .task-title {
        font-size: 15px;
        line-height: 1.4;
        margin-bottom: 0.5rem;
    }

    .task-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .task-meta-left {
        width: 100%;
        flex-direction: column;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .task-project,
    .task-due-date {
        font-size: 13px;
    }

    .task-assignees {
        align-self: flex-start;
        margin-top: 0.5rem;
    }

    /* Dashboard Tasks by Status – keep single row, compact spacing */
    .tasks-by-status .status-item {
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-light);
    }

    .tasks-by-status .status-item:last-child {
        border-bottom: none;
    }

    .tasks-by-status .status-info {
        gap: 0.5rem;
    }

    .tasks-by-status .status-name {
        font-size: 15px;
    }

    .tasks-by-status .status-count {
        font-size: 16px;
        font-weight: 600;
    }

    /* Notification improvements */
    .notification-item {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .notification-text {
        font-size: 14px;
        line-height: 1.4;
    }

    /* Tasks header: buttons wrap with min-width (avoid vertical text from flex:1) */
    .tasks-header {
        gap: var(--spacing-sm);
        margin-bottom: var(--spacing-lg);
    }

    .tasks-header-actions .btn {
        min-width: 110px;
        justify-content: center;
    }

    .modal-content h2 {
        font-size: 1.25rem;
    }

    .tasks-header-actions .btn .icon {
        margin-right: 0.5rem;
    }

    /* Tasks board: narrower columns on phones */
    .task-column {
        min-width: 300px;
    }

    .tasks-page .task-column {
        min-width: 300px;
    }

    /* Calendar: smaller day cells on phones */
    .tasks-calendar-day {
        min-height: 56px;
    }

    .tasks-calendar-task {
        font-size: 0.65rem;
    }
}

/* iPhone 12 Pro specific optimizations */
@media (max-width: 390px) {

    /* Tighter spacing for iPhone 12 Pro */
    .dashboard-stats {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .stat-card {
        padding: 0.875rem;
        gap: 0.625rem;
    }

    .stat-icon {
        font-size: 44px;
    }

    .stat-icon .icon {
        width: 20px;
        height: 20px;
    }

    .stat-value {
        font-size: 26px;
    }

    .stat-label {
        font-size: 11px;
    }

    .dashboard-header h1 {
        font-size: 1.625rem;
    }

    .dashboard-header .btn {
        padding: 0.625rem;
        font-size: 0.9rem;
    }

    /* Compact recent tasks for iPhone 12 Pro */
    .recent-task-item {
        padding: 0.5rem;
    }

    .task-title {
        font-size: 14px;
    }

    .task-meta-left {
        gap: 0.375rem;
    }

    /* Better notification spacing */
    .notification-item {
        padding: 0.5rem;
    }

    .notification-text {
        font-size: 13px;
    }

    /* Dashboard Tasks by Status more compact */
    .tasks-by-status .status-item {
        padding: 0.5rem;
    }

    .tasks-by-status .status-name {
        font-size: 14px;
    }

    .tasks-by-status .status-count {
        font-size: 15px;
    }
}

/* Ultra-small devices */
@media (max-width: 360px) {
    /* 360px specific styles already defined above */
}

/* Multi-Select Component */
.multi-select-container {
    position: relative;
    margin-bottom: var(--spacing-sm);
}

.multi-select-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}

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

.multi-select-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
    outline: none;
}

.selected-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    flex: 1;
    align-items: center;
}

.selected-items .placeholder {
    color: var(--text-muted);
    font-size: 14px;
}

.selected-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.chip-avatar {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    font-size: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.chip-avatar.user-avatar.has-image {
    background-color: transparent;
}

.chip-color {
    font-size: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.chip-text {
    font-size: 13px;
}

.chip-remove {
    font-size: 16px !important;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: var(--spacing-xs);
    transition: var(--transition);
}

.chip-remove:hover {
    color: var(--text);
}

.dropdown-icon {
    color: var(--text-muted);
    font-size: 20px !important;
    transition: var(--transition);
    flex-shrink: 0;
}

.multi-select-input:focus-within .dropdown-icon {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 300px;
    overflow: hidden;
    flex-direction: column;
}

.multi-select-dropdown.show {
    display: flex;
}

.search-box {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.search-box .icon {
    font-size: 20px !important;
    color: var(--text-muted);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text);
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.select-options {
    overflow-y: auto;
    max-height: 250px;
    padding: var(--spacing-xs);
}

.select-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: var(--spacing-xs);
}

.select-option:hover {
    background: var(--bg-secondary);
}

.select-option.selected {
    background: rgba(0, 102, 255, 0.1);
}

.select-option.selected .check-icon {
    opacity: 1;
    color: var(--primary);
}

.option-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-color {
    font-size: 24px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.option-info {
    flex: 1;
    min-width: 0;
}

.option-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 2px;
}

.option-email {
    font-size: 12px;
    color: var(--text-muted);
}

.check-icon {
    font-size: 20px !important;
    color: var(--primary);
    opacity: 0;
    transition: var(--transition);
    flex-shrink: 0;
}

/* Task Details Multi-Select */
.task-assignees-section .multi-select-container,
.task-assignees-section .multi-select-dropdown {
    width: 100%;
}

.task-assignees-section .selected-items {
    min-height: 40px;
}

/* Rich Text Content Display */
.rich-text-content {
    line-height: 1.6;
    color: var(--text);
}

.rich-text-content p {
    margin: 0 0 var(--spacing-sm) 0;
}

.rich-text-content p:last-child {
    margin-bottom: 0;
}

.rich-text-content ul,
.rich-text-content ol {
    margin: var(--spacing-sm) 0;
    padding-left: 2em;
    list-style-position: outside;
}

.rich-text-content li {
    display: list-item;
    margin-bottom: 0.25em;
    padding-left: 0.25em;
}

.rich-text-content a {
    color: var(--primary);
    text-decoration: underline;
}

.rich-text-content a:hover {
    color: var(--primary-hover);
}

.rich-text-content h1,
.rich-text-content h2,
.rich-text-content h3 {
    margin: var(--spacing-md) 0 var(--spacing-sm) 0;
    font-weight: 600;
    color: var(--text);
}

.rich-text-content h1 {
    font-size: 1.5rem;
}

.rich-text-content h2 {
    font-size: 1.25rem;
}

.rich-text-content h3 {
    font-size: 1.1rem;
}

/* Task card description - handle HTML content */
.task-description {
    font-size: 13px;
    color: var(--text-light);
    margin: var(--spacing-sm) 0;
    line-height: 1.4;
}

.task-description .rich-text-content {
    font-size: 13px;
}

.task-description .rich-text-content p {
    margin: 0;
    display: inline;
}

.task-description .rich-text-content p:after {
    content: ' ';
}

/* Rich text content - images and videos */
.rich-text-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

.rich-text-content video {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
}

.rich-text-content iframe {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 315px;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    margin: var(--spacing-md) 0;
    border: none;
    display: block;
}

/* YouTube iframe specific styling to reduce ad-related errors */
.rich-text-content iframe[src*="youtube.com"],
.rich-text-content iframe[src*="youtu.be"],
.rich-text-content iframe[src*="youtube-nocookie.com"] {
    /* Prevent ad scripts from loading (reduces console errors) */
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 315px !important;
    aspect-ratio: 16 / 9;
    display: block;
}

/* ============================================
   Landing Page Styles
   ============================================ */

.landing-page {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

.landing-page .main-content {
    padding: 0;
}

.landing-page .container {
    max-width: 100%;
    padding: 0;
}

/* Landing Navigation */
.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

[data-theme="light"] .landing-nav {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .landing-nav,
[data-theme="dark-blue"] .landing-nav,
[data-theme="dark-purple"] .landing-nav,
[data-theme="dark-green"] .landing-nav {
    background: rgba(45, 45, 45, 0.95);
}

.landing-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.landing-logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
}

.landing-logo span {
    white-space: nowrap;
}

.landing-logo svg {
    color: var(--primary);
}

.landing-nav-actions {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.landing-nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.landing-nav-link:hover {
    color: var(--primary);
}

.landing-nav-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

.landing-nav-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
}

.landing-nav-menu-icon {
    position: relative;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.landing-nav-menu-icon::before,
.landing-nav-menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
}

.landing-nav-menu-icon::before {
    top: -7px;
}

.landing-nav-menu-icon::after {
    top: 7px;
}

@media (max-width: 768px) {
    .landing-nav-toggle:checked~.landing-nav-menu-btn .landing-nav-menu-icon {
        background: transparent;
    }

    .landing-nav-toggle:checked~.landing-nav-menu-btn .landing-nav-menu-icon::before {
        top: 0;
        transform: rotate(45deg);
    }

    .landing-nav-toggle:checked~.landing-nav-menu-btn .landing-nav-menu-icon::after {
        top: 0;
        transform: rotate(-45deg);
    }
}

/* Landing Hero Section */
.landing-hero {
    padding: 120px var(--spacing-lg) 80px;
    text-align: center;
    background: var(--bg);
}

.landing-hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.landing-hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--spacing-lg);
    color: var(--text);
    letter-spacing: -0.02em;
}

.landing-hero-subtitle {
    font-size: clamp(1.125rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.landing-hero-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--spacing-xl);
}

.btn-large {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.125rem;
    font-weight: 600;
}

.landing-hero-features {
    display: flex;
    gap: var(--spacing-lg);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--spacing-xl);
}

.landing-feature-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.landing-feature-badge svg {
    color: var(--primary);
    flex-shrink: 0;
}

/* Landing Features Section */
.landing-features {
    padding: 80px var(--spacing-lg);
    background: var(--bg);
}

.landing-container {
    max-width: 1200px;
    margin: 0 auto;
}

.landing-section-title {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--text);
}

.landing-section-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.landing-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    margin-top: var(--spacing-2xl);
}

.landing-feature-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    transition: var(--transition);
}

.landing-feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.landing-feature-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
    color: var(--primary);
}

.landing-feature-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text);
}

.landing-feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Landing CTA Section */
.landing-cta {
    padding: 80px var(--spacing-lg);
    background: var(--bg-secondary);
    text-align: center;
}

.landing-cta-content {
    max-width: 600px;
    margin: 0 auto;
}

.landing-cta-content h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text);
}

.landing-cta-content p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    line-height: 1.6;
}

.landing-cta-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Landing Footer */
.landing-footer {
    padding: 80px var(--spacing-lg) var(--spacing-xl);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.landing-footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-2xl);
    margin-bottom: var(--spacing-xl);
}

.landing-footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xl);
}

.landing-footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.landing-footer-brand .landing-logo {
    margin-bottom: var(--spacing-xs);
}

.landing-footer-tagline {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    max-width: 280px;
    margin: 0;
}

.landing-footer-social {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.landing-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border-radius: var(--radius-md);
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.landing-social-link:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.landing-footer-column h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text);
    letter-spacing: -0.01em;
}

.landing-footer-column a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: var(--spacing-sm);
    font-size: 0.9375rem;
    transition: var(--transition);
    line-height: 1.5;
}

.landing-footer-column a:hover {
    color: var(--primary);
    padding-left: var(--spacing-xs);
}

.landing-footer-column a {
    white-space: nowrap;
}

@media (max-width: 992px) {
    .landing-footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .landing-footer-links {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-lg);
    }

    .landing-footer-tagline {
        max-width: 100%;
    }
}

.landing-footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .landing-nav-container {
        padding: var(--spacing-sm) var(--spacing-md);
        position: relative;
    }

    .landing-nav-menu-btn {
        display: flex;
        margin-left: auto;
    }

    .landing-nav-actions {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: var(--spacing-md);
        background: var(--card);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    }

    .landing-nav-toggle:checked~.landing-nav-actions {
        display: flex;
    }

    .landing-nav-actions .landing-nav-link,
    .landing-nav-actions .btn {
        display: block;
        width: 100%;
        padding: var(--spacing-md);
        text-align: left;
        border-radius: var(--radius-md);
        border: none;
    }

    .landing-nav-actions .landing-nav-link:hover {
        background: var(--bg-secondary, #f5f5f5);
    }

    .landing-nav-actions .btn {
        padding: var(--spacing-md);
        font-size: 0.9375rem;
        text-align: center;
    }

    .landing-nav-actions .btn.btn-outline {
        background: transparent;
    }
}

@media (min-width: 769px) {
    .landing-nav-toggle:checked~.landing-nav-actions {
        display: flex;
    }

    .header-content {
        display: flex;
    }
}

@media (max-width: 768px) {

    .landing-hero {
        padding: 100px var(--spacing-md) 60px;
    }

    .landing-hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .landing-hero-actions .btn {
        width: 100%;
    }

    .landing-hero-features {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
    }

    .landing-features {
        padding: 60px var(--spacing-md);
    }

    .landing-features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .landing-cta {
        padding: 60px var(--spacing-md);
    }

    .landing-cta-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .landing-cta-actions .btn {
        width: 100%;
    }

    .landing-footer {
        padding: 40px var(--spacing-md) var(--spacing-lg);
    }

    .landing-footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .landing-footer-links {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .landing-footer-column {
        margin-bottom: var(--spacing-md);
    }

    .landing-footer-column a {
        white-space: normal;
    }

    .landing-footer-tagline {
        max-width: 100%;
    }

    .landing-footer-social {
        justify-content: flex-start;
    }
}

/* ============================================
   Page Styles (Features, Pricing, About, etc.)
   ============================================ */

.landing-page .page-header {
    padding: 120px var(--spacing-lg) 60px;
    text-align: center;
    background: var(--bg);
}

.landing-page .page-header h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text);
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: clamp(1.125rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.page-content {
    padding: 60px var(--spacing-lg);
    background: var(--bg);
}

/* Features Page */
.features-detailed {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--spacing-xl);
}

.feature-detail-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    transition: var(--transition);
}

.feature-detail-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.feature-detail-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
    color: var(--primary);
}

.feature-detail-card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text);
}

.feature-detail-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.feature-detail-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-detail-card li {
    color: var(--text-secondary);
    padding: var(--spacing-xs) 0;
    line-height: 1.6;
}

/* Pricing Page */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    max-width: 1000px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    position: relative;
    transition: var(--transition);
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.pricing-card.pricing-featured {
    border-color: var(--primary);
    border-width: 2px;
    transform: scale(1.05);
}

.pricing-card.pricing-featured:hover {
    transform: scale(1.05) translateY(-4px);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
}

.pricing-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.pricing-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text);
}

.pricing-price {
    margin-bottom: var(--spacing-sm);
}

.price-amount {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.price-period {
    font-size: 1rem;
    color: var(--text-secondary);
}

.pricing-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--spacing-xl) 0;
}

.pricing-features li {
    padding: var(--spacing-sm) 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.btn-block {
    width: 100%;
    display: block;
    text-align: center;
}

/* About Page */
.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-section {
    margin-bottom: var(--spacing-2xl);
}

.about-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text);
}

.about-section p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--spacing-md);
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.value-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.value-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text);
}

.value-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Contact Page */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2xl);
    max-width: 1000px;
    margin: 0 auto;
}

.contact-info-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.contact-info-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
}

.contact-info-description {
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-lg);
    line-height: 1.6;
}

.contact-form-section h2,
.contact-info-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--text);
}

.contact-form {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.contact-info-item {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
}

.contact-info-icon {
    font-size: 48px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.contact-info-item h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text);
}

.contact-info-item p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Documentation Page */
.landing-page.docs-page {
    scroll-behavior: smooth;
}

.docs-container {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-2xl);
    max-width: 1100px;
    margin: 0 auto;
    align-items: flex-start;
}

.docs-nav-wrapper {
    flex-shrink: 0;
    width: 200px;
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 72px - var(--spacing-lg, 24px));
    overflow-y: auto;
}

.docs-nav {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.docs-nav-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-md);
}

.docs-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-nav-list li {
    margin-bottom: var(--spacing-xs);
}

.docs-nav-list a {
    display: block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
}

.docs-nav-list a:hover {
    background: var(--bg-secondary, #f5f5f5);
    color: var(--primary);
}

.docs-nav-list a.active {
    background: var(--primary-light, rgba(59, 130, 246, 0.15));
    color: var(--primary);
    font-weight: 600;
}

.docs-sections {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    flex: 1;
    min-width: 0;
}

.docs-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    line-height: 1.7;
    scroll-margin-top: 72px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.docs-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 var(--spacing-md);
    color: var(--text);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border);
}

.docs-section h2:first-child {
    margin-top: 0;
}

.docs-section p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.docs-section ul,
.docs-section ol {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-lg);
}

.docs-section li {
    margin-bottom: var(--spacing-xs);
}

.docs-section pre {
    margin-bottom: var(--spacing-md);
}

.docs-section a {
    color: var(--primary);
    text-decoration: none;
}

.docs-section a:hover {
    text-decoration: underline;
}

/* Legal Pages (Privacy, Terms) */
.legal-content {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl);
}

.legal-content h2 {
    font-size: 20px;
    font-weight: 600;
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
    color: var(--text);
}

.legal-content h2:first-of-type {
    margin-top: 0;
}

.legal-content p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--spacing-md);
}

.legal-content ul {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-lg);
}

.legal-content li {
    margin-bottom: var(--spacing-xs);
}

.legal-content a {
    color: var(--primary);
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

/* Responsive Design for Pages */
@media (max-width: 768px) {
    /* .page-header {
        padding: 100px var(--spacing-md) 40px;
    } */

    .page-content {
        padding: 40px var(--spacing-md);
    }

    .features-detailed {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .pricing-card.pricing-featured {
        transform: scale(1);
    }

    .pricing-card.pricing-featured:hover {
        transform: translateY(-4px);
    }

    .values-grid {
        grid-template-columns: 1fr;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .docs-container {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        gap: var(--spacing-md);
    }

    .docs-nav-wrapper {
        position: static;
        width: 100%;
        max-width: 100%;
        max-height: none;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-sm);
        overflow: visible;
    }

    .docs-nav {
        position: static;
        width: 100%;
    }

    .docs-nav-title {
        margin-bottom: var(--spacing-sm);
        font-size: 12px;
    }

    .docs-nav-list {
        display: flex;
        flex-wrap: nowrap;
        gap: var(--spacing-xs);
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: var(--spacing-xs);
        margin: 0 -2px 0 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .docs-nav-list li {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .docs-nav-list a {
        padding: var(--spacing-xs) var(--spacing-sm);
        white-space: nowrap;
    }

    .docs-sections {
        width: 100%;
        min-width: 0;
    }

    .docs-section {
        padding: var(--spacing-lg);
        min-width: 0;
    }

    .docs-section pre {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .landing-page .page-header {
        padding: 80px var(--spacing-md) 40px;
    }

    .landing-page .page-header h1 {
        font-size: 24px;
    }

    .page-content {
        padding: 32px var(--spacing-md);
    }

    .docs-page .page-content {
        padding: 24px var(--spacing-md);
    }

    .docs-container {
        padding: 0;
    }

    .docs-section {
        padding: var(--spacing-md);
    }

    .docs-section h2 {
        font-size: 18px;
    }
}

/* Support Tickets Page */
.tickets-page .page-header {
    margin-bottom: var(--spacing-xl);
}

.tickets-page .tickets-section {
    background: var(--card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.tickets-page .tickets-section-header {
    padding: var(--spacing-md);
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    background: linear-gradient(to bottom, var(--bg-secondary), var(--card));
}

.tickets-page .tickets-section-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.tickets-page .tickets-count {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-lg);
    font-weight: 600;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.tickets-page .tickets-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
}

.tickets-page .tickets-table th {
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: transparent;
    border-bottom: none;
}

.tickets-page .tickets-table td {
    padding: var(--spacing-lg);
    border: none;
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.tickets-page .tickets-table tbody tr {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.tickets-page .tickets-table tbody tr td:first-child {
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
}

.tickets-page .tickets-table tbody tr td:last-child {
    border-top-right-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

.tickets-page .tickets-table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tickets-page .tickets-table tbody tr:hover td {
    background: var(--card);
}

[data-theme="dark"] .tickets-page .tickets-table tbody tr:hover td,
[data-theme="dark-blue"] .tickets-page .tickets-table tbody tr:hover td,
[data-theme="dark-purple"] .tickets-page .tickets-table tbody tr:hover td,
[data-theme="dark-green"] .tickets-page .tickets-table tbody tr:hover td {
    background: var(--card);
}

.tickets-page .ticket-subject-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: color var(--transition-fast);
    display: block;
}

.tickets-page .ticket-subject-link:hover {
    color: var(--primary);
}

.tickets-page .ticket-new-reply-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #fff;
    background: var(--primary);
    border-radius: 999px;
    vertical-align: middle;
}

.tickets-page tr.ticket-has-new-reply {
    box-shadow: 0 0 0 2px var(--primary), var(--shadow-md);
}

.tickets-page tr.ticket-has-new-reply:hover {
    box-shadow: 0 0 0 3px var(--primary), var(--shadow-lg);
}

.tickets-page .ticket-card.ticket-has-new-reply {
    border-left: 3px solid var(--primary);
}

.tickets-page .ticket-card .ticket-new-reply-badge {
    margin-left: 0.5rem;
}

.tickets-page .ticket-status {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tickets-page .ticket-status-open {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.tickets-page .ticket-status-in_progress {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.tickets-page .ticket-status-resolved {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.tickets-page .ticket-status-closed {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.tickets-page .ticket-priority {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-md);
}

.tickets-page .ticket-priority .icon {
    width: 16px;
    height: 16px;
}

.tickets-page .ticket-priority.priority-high {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.tickets-page .ticket-priority.priority-medium {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.tickets-page .ticket-priority.priority-low {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.tickets-page .ticket-view-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 0.8125rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    background: var(--primary);
    color: white;
    border: none;
    font-weight: 600;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.tickets-page .ticket-view-btn:hover {
    background: var(--primary-hover);
    color: white;
    transform: translateX(2px);
}

.tickets-page .ticket-view-btn .icon {
    transition: transform var(--transition-fast);
}

.tickets-page .ticket-view-btn:hover .icon {
    transform: translateX(2px);
}

.tickets-page .ticket-meta {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.tickets-page .tickets-table-wrap {
    padding: 0 var(--spacing-sm) var(--spacing-md);
}

.tickets-page .tickets-empty {
    padding: var(--spacing-2xl);
    text-align: center;
}

.tickets-page .tickets-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--spacing-lg);
    opacity: 0.4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tickets-page .tickets-empty-icon .icon {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
}

.tickets-page .tickets-empty h4 {
    margin: 0 0 var(--spacing-sm);
    font-size: 1.125rem;
}

.tickets-page .tickets-empty p {
    margin: 0 0 var(--spacing-lg);
    color: var(--text-secondary);
}

.tickets-page .tickets-pagination {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: 2px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to top, var(--bg-secondary), var(--card));
}

\n\n

/* Ticket detail view */
.ticket-view-page .ticket-view-header {
    margin-bottom: var(--spacing-xl);
}

.ticket-view-page .ticket-view-back {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    margin-bottom: var(--spacing-md);
    transition: color var(--transition-fast);
}

.ticket-view-page .ticket-view-back:hover {
    color: var(--primary);
}

.ticket-view-page .ticket-view-back .icon {
    width: 18px;
    height: 18px;
}

.ticket-view-page .ticket-view-title-block {
    margin: 0;
}

.ticket-view-page .ticket-view-title-block h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 var(--spacing-xs);
    letter-spacing: -0.02em;
}

.ticket-view-page .ticket-view-subject {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.ticket-view-page .ticket-detail-card {
    background: var(--card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: var(--spacing-xl);
}

.ticket-view-page .ticket-detail-meta {
    padding: var(--spacing-lg) var(--spacing-xl);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: center;
}

.ticket-view-page .ticket-detail-meta .ticket-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ticket-view-page .ticket-detail-meta .ticket-status-open {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.ticket-view-page .ticket-detail-meta .ticket-status-in_progress {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.ticket-view-page .ticket-detail-meta .ticket-status-resolved {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.ticket-view-page .ticket-detail-meta .ticket-status-closed {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.ticket-view-page .ticket-priority-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
}

.ticket-view-page .ticket-priority-badge .icon {
    width: 14px;
    height: 14px;
}

.ticket-view-page .ticket-priority-badge.priority-high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.ticket-view-page .ticket-priority-badge.priority-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.ticket-view-page .ticket-priority-badge.priority-low {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.ticket-view-page .ticket-meta-item {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.ticket-view-page .ticket-meta-item .icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

.ticket-view-page .ticket-detail-message {
    padding: var(--spacing-xl);
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 0.9375rem;
}

.ticket-view-page .ticket-replies-section,
.ticket-view-page .ticket-reply-form {
    margin-bottom: var(--spacing-xl);
}

.ticket-view-page .ticket-section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: 0 0 var(--spacing-lg);
    font-size: 1rem;
    font-weight: 600;
}

.ticket-view-page .ticket-section-title .icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.ticket-view-page .ticket-reply-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    transition: box-shadow var(--transition-fast);
}

.ticket-view-page .ticket-reply-card:hover {
    box-shadow: var(--shadow-sm);
}

.ticket-view-page .ticket-reply-card.is-admin {
    border-left: 4px solid var(--primary);
    background: linear-gradient(to right, rgba(59, 130, 246, 0.04) 0%, var(--card) 12px);
}

.ticket-view-page .ticket-reply-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.ticket-view-page .ticket-reply-author {
    font-weight: 600;
    font-size: 0.875rem;
}

.ticket-view-page .ticket-reply-card.is-admin .ticket-reply-author {
    color: var(--primary);
}

.ticket-view-page .ticket-reply-date {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.ticket-view-page .ticket-reply-body {
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.ticket-view-page .ticket-reply-form {
    background: var(--card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-xl);
}

.ticket-view-page .ticket-reply-form .form-group {
    margin-bottom: var(--spacing-lg);
}

.ticket-view-page .ticket-reply-form textarea {
    min-height: 100px;
    resize: vertical;
}

.ticket-view-page .ticket-reply-form .btn .icon {
    width: 18px;
    height: 18px;
}

/* Tickets: mobile cards (hidden on desktop) */
.tickets-cards {
    display: none;
}

.ticket-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    position: relative;
}

.ticket-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.ticket-card.ticket-has-new-reply {
    box-shadow: 0 0 0 2px var(--primary), var(--shadow-md);
}

.ticket-card.ticket-has-new-reply:hover {
    box-shadow: 0 0 0 3px var(--primary), var(--shadow-lg);
}

.ticket-card-subject {
    display: block;
    font-weight: 700;
    font-size: 1.0625rem;
    color: var(--text);
    text-decoration: none;
    margin-bottom: var(--spacing-md);
    transition: color var(--transition-fast);
    line-height: 1.4;
}

.ticket-card-subject:hover {
    color: var(--primary);
}

.ticket-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.ticket-card-meta>* {
    white-space: nowrap;
}

.ticket-card-meta .ticket-status {
    font-size: 0.75rem;
}

.ticket-card-meta .ticket-priority {
    font-size: 0.8125rem;
}

.ticket-card-meta>span:last-child {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.ticket-card .ticket-view-btn {
    width: 100%;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 0.875rem;
}

.ticket-card .ticket-new-reply-badge {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    margin: 0;
}

/* Ensure table shows on desktop */
@media (min-width: 901px) {
    .tickets-table-wrap {
        display: block;
    }

    .tickets-cards {
        display: none !important;
    }
}

/* Responsive: Tickets pages */
@media (max-width: 900px) {
    .tickets-page .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tickets-page .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    .tickets-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    /* Use card layout on tablet to avoid table horizontal overflow */
    .tickets-table-wrap {
        display: none;
    }

    .tickets-cards {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-lg);
        padding: var(--spacing-lg);
    }
}

@media (max-width: 768px) {

    .tickets-page .tickets-table th,
    .tickets-page .tickets-table td {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .tickets-cards {
        gap: var(--spacing-md);
        padding: var(--spacing-md) var(--spacing-lg) var(--spacing-lg);
    }

    .ticket-card {
        padding: var(--spacing-lg);
    }

    .ticket-card-subject {
        font-size: 0.9375rem;
    }

    .ticket-card .ticket-new-reply-badge {
        position: static;
        margin-left: 0;
        margin-top: var(--spacing-sm);
        display: inline-block;
    }

    .ticket-view-page .ticket-detail-meta {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .ticket-view-page .ticket-detail-message {
        padding: var(--spacing-lg);
    }

    .ticket-view-page .ticket-reply-form {
        padding: var(--spacing-lg);
    }
}

/* Admin Tickets Page */
.admin-tickets-page .admin-tickets-back {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    margin-bottom: var(--spacing-md);
    transition: color var(--transition-fast);
}

.admin-tickets-page .admin-tickets-back:hover {
    color: var(--primary);
}

.admin-tickets-page .admin-tickets-back .icon {
    width: 18px;
    height: 18px;
}

.admin-tickets-filters {
    box-shadow: var(--shadow-sm);
}

.admin-tickets-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
    align-items: flex-end;
}

.admin-tickets-filter-form .form-group {
    margin: 0;
}

.admin-tickets-filter-form label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.admin-tickets-filter-form select,
.admin-tickets-filter-form input {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--card);
    min-width: 180px;
}

.admin-tickets-section {
    box-shadow: var(--shadow-md);
}

.admin-tickets-header {
    margin-bottom: var(--spacing-lg);
}

.admin-tickets-header h3 {
    margin: 0;
}

.admin-tickets-empty {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-secondary);
}

.admin-tickets-table {
    min-width: 920px !important;
}

.admin-tickets-table .col-id {
    width: 48px;
    min-width: 48px;
}

.admin-tickets-table .col-subject {
    width: 22%;
    min-width: 120px;
}

.admin-tickets-table .col-company {
    width: 12%;
    min-width: 90px;
}

.admin-tickets-table .col-submitter {
    width: 20%;
    min-width: 140px;
}

.admin-tickets-table .col-status {
    width: 10%;
    min-width: 90px;
}

.admin-tickets-table .col-priority {
    width: 9%;
    min-width: 90px;
}

.admin-tickets-table .col-created {
    width: 14%;
    min-width: 140px;
}

.admin-tickets-table .col-actions {
    width: 10%;
    min-width: 80px;
}

.admin-tickets-table th,
.admin-tickets-table td {
    padding: 12px 16px !important;
    font-size: 0.875rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.admin-tickets-table th {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    text-align: left;
    white-space: nowrap;
}

.admin-tickets-table th:nth-child(5),
.admin-tickets-table th:nth-child(6),
.admin-tickets-table th:nth-child(8) {
    text-align: center;
}

.admin-tickets-table td {
    transition: background var(--transition-fast);
}

.admin-tickets-table td:nth-child(5),
.admin-tickets-table td:nth-child(6),
.admin-tickets-table td:nth-child(8) {
    text-align: center;
}

.admin-tickets-table tbody tr:hover td {
    background: var(--hover-bg, rgba(0, 0, 0, 0.02));
}

[data-theme="dark"] .admin-tickets-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.admin-ticket-subject {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.admin-ticket-subject:hover {
    color: var(--primary-dark, var(--primary-hover));
    text-decoration: underline;
}

/* Unopened ticket indicator */
.admin-tickets-table tbody tr.ticket-unopened td:first-child {
    border-left: 3px solid var(--primary);
}

.admin-ticket-card.ticket-unopened {
    border-left: 3px solid var(--primary);
}

.ticket-new-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #fff;
    background: var(--primary);
    border-radius: 999px;
    vertical-align: middle;
}

.admin-tickets-table .ticket-subject-cell .ticket-new-badge {
    margin-left: 0.4rem;
}

.admin-ticket-card-header .ticket-new-badge {
    margin-left: 0.5rem;
}

.admin-tickets-table .ticket-id,
.admin-tickets-table .ticket-subject-cell,
.admin-tickets-table .ticket-company,
.admin-tickets-table .ticket-submitter,
.admin-tickets-table .ticket-status-cell,
.admin-tickets-table .ticket-priority-cell,
.admin-tickets-table .ticket-created,
.admin-tickets-table .ticket-actions-cell {
    white-space: nowrap;
}

.ticket-submitter {
    font-size: 0.875rem;
    line-height: 1.5;
}

.ticket-submitter .submitter-email {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.admin-ticket-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.admin-ticket-status.ticket-status-open {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.admin-ticket-status.ticket-status-in_progress {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.admin-ticket-status.ticket-status-resolved {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.admin-ticket-status.ticket-status-closed {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.admin-ticket-priority {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.8125rem;
}

.admin-ticket-priority .icon {
    width: 14px;
    height: 14px;
}

.admin-ticket-priority.priority-high {
    color: var(--danger);
}

.admin-ticket-priority.priority-medium {
    color: var(--warning);
}

.admin-ticket-priority.priority-low {
    color: var(--success);
}

.ticket-created {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.admin-ticket-view-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.8125rem;
    white-space: nowrap;
    border-radius: var(--radius-md);
    text-decoration: none;
    background: var(--primary);
    color: white !important;
    font-weight: 500;
    transition: var(--transition-fast);
}

.admin-ticket-view-btn:hover {
    background: var(--primary-hover);
    color: white !important;
}

.admin-ticket-view-btn .icon {
    width: 14px;
    height: 14px;
}

.admin-tickets-pagination {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: center;
}

.admin-tickets-pagination span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.admin-tickets-cards {
    display: none;
}

.admin-ticket-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    border: 1px solid var(--border);
}

.admin-ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.admin-ticket-card-subject {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.admin-ticket-card-subject:hover {
    text-decoration: underline;
}

.admin-ticket-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.admin-ticket-card .admin-ticket-view-btn {
    display: inline-flex;
}

/* Admin tickets responsive */
@media (max-width: 1024px) {
    .admin-tickets-filter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-tickets-filter-form select,
    .admin-tickets-filter-form input {
        min-width: 0;
        width: 100%;
    }

    .admin-tickets-filter-form .btn {
        width: 100%;
    }

    .admin-ticket-view-meta {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Use card layout on tablet to avoid table horizontal overflow */
    .admin-tickets-table-wrap {
        display: none !important;
    }

    .admin-tickets-cards {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .admin-tickets-section {
        padding: var(--spacing-lg);
    }
}

@media (max-width: 768px) {
    .admin-tickets-page .page-header {
        flex-direction: column;
    }

    .admin-ticket-view-meta {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .admin-ticket-view-header h1 {
        font-size: 1.5rem;
    }

    .admin-ticket-view-subject {
        font-size: 1rem;
    }

    .admin-ticket-view-message {
        padding: var(--spacing-lg);
    }

    .admin-ticket-reply-form {
        padding: var(--spacing-lg);
    }

    .admin-ticket-reply-card {
        padding: var(--spacing-md);
    }
}

/* Admin Ticket Detail View */
.admin-ticket-view-header {
    margin-bottom: var(--spacing-xl);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md);
}

.admin-ticket-view-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
}

.admin-ticket-view-actions .btn .icon {
    width: 18px;
    height: 18px;
}

.admin-ticket-archived-badge {
    display: inline-block;
    margin-left: var(--spacing-sm);
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: var(--text-muted);
    color: var(--card);
    border-radius: var(--radius-sm);
}

.admin-ticket-view-back {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    margin-bottom: var(--spacing-md);
    transition: color var(--transition-fast);
}

.admin-ticket-view-back:hover {
    color: var(--primary);
}

.admin-ticket-view-back .icon {
    width: 18px;
    height: 18px;
}

.admin-ticket-view-title-block {
    margin: 0;
}

.admin-ticket-view-title-block h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 var(--spacing-xs);
    letter-spacing: -0.02em;
}

.admin-ticket-view-subject {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.admin-ticket-view-card {
    background: var(--card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: var(--spacing-xl);
}

.admin-ticket-view-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--spacing-xl);
    padding: var(--spacing-xl);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.admin-ticket-meta-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.admin-ticket-meta-item .meta-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.admin-ticket-meta-item .meta-value {
    font-size: 0.9375rem;
    font-weight: 500;
}

.admin-ticket-meta-item .meta-email {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.admin-ticket-status-select {
    padding: 6px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    background: var(--card);
    color: var(--text);
    min-width: 120px;
}

.admin-ticket-view-message {
    padding: var(--spacing-xl);
}

.admin-ticket-view-message .message-heading {
    margin: 0 0 var(--spacing-md);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.admin-ticket-view-message .message-body {
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 0.9375rem;
}

.admin-ticket-replies-section {
    margin-bottom: var(--spacing-xl);
}

.admin-ticket-section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: 0 0 var(--spacing-lg);
    font-size: 1rem;
    font-weight: 600;
}

.admin-ticket-section-title .icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.admin-ticket-reply-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    transition: box-shadow var(--transition-fast);
}

.admin-ticket-reply-card:hover {
    box-shadow: var(--shadow-sm);
}

.admin-ticket-reply-card.is-admin {
    border-left: 4px solid var(--primary);
    background: linear-gradient(to right, rgba(59, 130, 246, 0.04) 0%, var(--card) 12px);
}

.admin-ticket-reply-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.admin-ticket-reply-card.is-admin .reply-author {
    color: var(--primary);
}

.admin-ticket-reply-header .reply-author {
    font-weight: 600;
    font-size: 0.875rem;
}

.admin-ticket-reply-header .reply-date {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.admin-ticket-reply-body {
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.admin-ticket-reply-form {
    background: var(--card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-xl);
}

.admin-ticket-reply-form .form-group {
    margin-bottom: var(--spacing-lg);
}

.tasks-page .tasks-more-menu {
    display: none;
    margin-top: 0.5rem;
    padding: 0;
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.tasks-page .tasks-header-more.is-open .tasks-more-menu {
    display: flex;
    flex-direction: column;
}

.tasks-page .tasks-more-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 0;
}

.tasks-page .tasks-more-item:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.tasks-page .tasks-more-item:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.tasks-page .tasks-more-item:only-child {
    border-radius: var(--radius-lg);
}

.tasks-page .tasks-more-item+.tasks-more-item {
    border-top: 1px solid var(--border-light);
}

.tasks-page .tasks-more-item .icon {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.tasks-page .tasks-more-item:hover {
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.tasks-page .tasks-more-item:active {
    background: color-mix(in srgb, var(--primary) 14%, transparent);
}

#board-project-color {
    width: 100%;
    height: 50px;
    padding: 5px;
    border-radius: 5px;
}

@media (max-width: 1024px) {
    .tasks-page .tasks-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }

    .tasks-page .tasks-header h1 {
        text-align: center;
        font-size: 28px;
    }

    .tasks-page .tasks-header-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
        justify-content: stretch;
    }

    .tasks-page .tasks-header-primary {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-sm);
        width: 100%;
    }

    .tasks-page .tasks-view-toggle {
        width: 100%;
        padding: 0.25rem;
    }

    .tasks-page .tasks-view-toggle .tasks-view-btn {
        flex: 1;
        min-width: 0;
        padding: 0.625rem 0.75rem;
        justify-content: center;
        font-size: 0.9375rem;
    }

    .tasks-page .tasks-new-task-btn {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: var(--radius-lg);
        box-shadow: 0 3px 10px rgba(59, 130, 246, 0.25);
        transition: all 0.2s ease;
    }

    .tasks-page .tasks-new-task-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(59, 130, 246, 0.35);
    }

    .tasks-page .tasks-new-task-btn:active {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
    }

    .tasks-page .tasks-header-secondary {
        display: none !important;
    }

    .tasks-page .tasks-header-more {
        display: none !important;
        width: 100%;
    }

    .tasks-page .tasks-more-btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
        font-weight: 500;
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-light);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .tasks-page .tasks-more-btn:hover {
        border-color: var(--primary);
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
        transform: translateY(-1px);
    }

    .tasks-page .tasks-more-btn:active {
        transform: translateY(0);
    }
}

/* Dashboard redesign (scoped) */
.dashboard-redesign {
    --rd-bg: var(--bg-secondary);
    --rd-panel: var(--card);
    --rd-text: var(--text);
    --rd-muted: var(--text-muted);
    --rd-border: var(--border);
    /* background: var(--rd-bg); */
    border-radius: 20px;
    /* padding: 1.5rem 1.25rem 6rem; */
    position: relative;
    min-height: calc(100vh - 140px);
}

.dashboard-redesign .dashboard-rd-header h1 {
    margin: 0;
    color: var(--rd-text);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dashboard-redesign .dashboard-rd-subtitle {
    margin: 0.35rem 0 0;
    color: var(--rd-muted);
    font-size: 1.08rem;
    font-weight: 600;
}

.dashboard-redesign .dashboard-rd-stats-grid {
    margin-top: 1.4rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.dashboard-redesign .dashboard-rd-stat {
    border: 1.5px solid var(--rd-border);
    border-radius: 14px;
    background: var(--rd-panel);
    min-height: 86px;
    padding: 0.9rem 0.95rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.dashboard-redesign .dashboard-rd-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.dashboard-redesign .dashboard-rd-stat-value {
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
}

.dashboard-redesign .dashboard-rd-stat-label {
    margin-top: 0.45rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-size: 0.82rem;
    font-weight: 700;
}

.dashboard-redesign .dashboard-rd-stat-blue {
    border-color: #2b87b8;
    color: #2b87b8;
}

.dashboard-redesign .dashboard-rd-stat-green {
    border-color: #54be8d;
    color: #13a55e;
}

.dashboard-redesign .dashboard-rd-stat-gold {
    border-color: #FF9800;
    color: #FF9800;
}

.dashboard-redesign .dashboard-rd-stat-red {
    border-color: #ea9da3;
    color: #db3746;
}

.dashboard-redesign .dashboard-rd-stat-gray {
    border-color: var(--rd-border);
    color: var(--rd-text);
}

.dashboard-redesign .dashboard-rd-stat-purple {
    border-color: var(--rd-border);
    color: var(--rd-text);
}

.dashboard-redesign .dashboard-rd-panel {
    margin-top: 1.8rem;
    background: var(--rd-panel);
    border: 1px solid var(--rd-border);
    border-radius: 14px;
    overflow: hidden;
}

.dashboard-redesign .dashboard-rd-main-grid {
    margin-top: 1.8rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.dashboard-redesign .dashboard-rd-main-grid .dashboard-rd-panel {
    margin-top: 0;
}

.dashboard-redesign .dashboard-rd-side {
    display: grid;
    gap: 1rem;
}

.dashboard-redesign .dashboard-rd-side-panel {
    min-height: 180px;
}

.dashboard-redesign .dashboard-rd-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--rd-border);
    padding: 0.8rem 0.95rem;
}

.dashboard-redesign .dashboard-rd-panel-header h2 {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-transform: uppercase;
    font-size: 1.03rem;
    letter-spacing: 0.01em;
}

.dashboard-redesign .dashboard-rd-count-pill {
    text-decoration: none;
    color: var(--rd-muted);
    border: 1px solid var(--rd-border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.28rem 0.65rem;
}

.dashboard-redesign .dashboard-rd-list {
    padding: 0.75rem;
    display: grid;
    gap: 0.65rem;
}

.dashboard-redesign .dashboard-rd-task-row {
    background: var(--rd-panel);
    border: 1px solid var(--rd-border);
    border-radius: 14px;
    padding: 0.8rem 0.75rem 0.85rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.7rem;
}

.dashboard-redesign .dashboard-rd-task-main h3 {
    margin: 0;
    font-size: 1.04rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.dashboard-redesign .dashboard-rd-task-main h3 a {
    color: var(--rd-text);
    text-decoration: none;
}

.dashboard-redesign .dashboard-rd-task-meta {
    margin: 0.18rem 0 0;
    color: var(--rd-muted);
    /* display: inline-flex; */
    align-items: center;
    gap: 0.28rem;
    font-size: 0.79rem;
    font-weight: 600;
}

.dashboard-redesign .dashboard-rd-task-footer {
    margin-top: 0.34rem;
    display: flex;
    align-items: center;
    gap: 0.42rem;
    flex-wrap: wrap;
}

.dashboard-redesign .dashboard-rd-assignees {
    display: inline-flex;
    align-items: center;
}

.dashboard-redesign .dashboard-rd-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--rd-panel);
    margin-left: -6px;
    background: var(--bg-secondary);
}

.dashboard-redesign .dashboard-rd-avatar:first-child {
    margin-left: 0;
}

.dashboard-redesign .dashboard-rd-empty-tag {
    background: var(--bg-secondary);
    border: 1px solid var(--rd-border);
    border-radius: 7px;
    color: var(--rd-muted);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.1rem 0.42rem;
}

.dashboard-redesign .dashboard-rd-status-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--rd-border);
    border-radius: 6px;
    color: var(--rd-muted);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.11rem 0.42rem;
    white-space: nowrap;
}

.dashboard-redesign .dashboard-rd-priority-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--rd-border);
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.11rem 0.42rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
}

.dashboard-redesign .dashboard-rd-priority-chip .icon {
    width: 12px;
    height: 12px;
}

.dashboard-redesign .dashboard-rd-project-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--rd-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.11rem 0.42rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-redesign .dashboard-rd-project-chip .icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.dashboard-redesign .dashboard-rd-feed {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem;
}

.dashboard-redesign .dashboard-rd-feed-item {
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--rd-border);
    border-radius: 10px;
    background: var(--rd-panel);
    padding: 0.62rem 0.66rem;
    display: grid;
    gap: 0.28rem;
}

.dashboard-redesign .dashboard-rd-feed-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.dashboard-redesign .dashboard-rd-feed-action {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.dashboard-redesign .dashboard-rd-feed-time {
    font-size: 0.72rem;
    color: var(--rd-muted);
    font-weight: 600;
}

.dashboard-redesign .dashboard-rd-feed-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--rd-text);
}

.dashboard-redesign .dashboard-rd-feed-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

@media (max-width: 520px) {
    .dashboard-redesign .dashboard-rd-task-row {
        padding: 0.72rem 0.68rem;
        gap: 0.55rem;
        flex-direction: column;
    }

    .dashboard-redesign .dashboard-rd-task-main {
        min-width: 0;
    }

    .dashboard-redesign .dashboard-rd-task-main h3 {
        font-size: 0.98rem;
    }

    .dashboard-redesign .dashboard-rd-task-meta {
        font-size: 0.75rem;
    }

    .dashboard-redesign .dashboard-rd-task-footer {
        gap: 0.32rem;
    }

    .dashboard-redesign .dashboard-rd-status-chip,
    .dashboard-redesign .dashboard-rd-priority-chip,
    .dashboard-redesign .dashboard-rd-project-chip {
        font-size: 0.69rem;
        padding: 0.1rem 0.36rem;
    }



    .dashboard-redesign .dashboard-rd-view-btn {
        width: 100%;
        padding: 0.48rem 0.58rem !important;
        font-size: 0.875rem;
    }
}

.dashboard-redesign .dashboard-rd-view-btn {
    background: var(--text-secondary);
    color: var(--bg) !important;
    border-radius: 10px;
    text-decoration: none;
    min-width: 84px;
    justify-content: center;
    padding: 0.55rem 0.72rem;
    font-weight: 700;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    align-self: center;
}

@media (min-width: 900px) {
    /* .dashboard-redesign {
        padding: 2.25rem 2rem 2rem;
    } */

    .dashboard-redesign .dashboard-rd-stats-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .dashboard-redesign .dashboard-rd-panel {
        max-width: 100%;
    }

    .dashboard-redesign .dashboard-rd-main-grid {
        grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
        align-items: stretch;
    }

    .dashboard-redesign .dashboard-rd-side {
        height: 100%;
        align-content: start;
    }

    .dashboard-redesign .dashboard-rd-main-grid>.dashboard-rd-panel {
        height: 100%;
    }
}

/* Tasks redesign (scoped) */
.tasks-page-redesign {
    max-width: 1360px;
    margin: 0 auto;
    padding: 1rem 0 1.75rem;
}

.tasks-page-redesign .tasks-header {
    margin-bottom: 1rem;
    gap: 0.85rem;
    align-items: center;
}

.tasks-page-redesign .tasks-header-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.tasks-page-redesign .tasks-header h1 {
    font-size: clamp(2rem, 2.8vw, 2.5rem);
    font-weight: 700;
    color: var(--text);
}

.tasks-page-redesign .tasks-filter-trigger {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    padding: 0;
}

.tasks-page-redesign .tasks-header-primary {
    order: 1;
}

.tasks-page-redesign .tasks-header-secondary {
    order: 2;
}

.tasks-page-redesign .tasks-view-toggle {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 0.25rem;
    border-radius: 12px;
    gap: 0.5rem;
}

.tasks-page-redesign .tasks-view-toggle .tasks-view-btn {
    min-height: 40px;
    border-radius: 10px;
    font-weight: 600;
}

.tasks-page-redesign .tasks-view-toggle .tasks-view-btn.is-active {
    color: var(--text);
    border: 1px solid var(--text);
    box-shadow: none;
}

.tasks-page-redesign .filters-container {
    margin-bottom: 0.75rem;
}

.tasks-page-redesign .filters-active-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tasks-filters-modal-content {
    width: min(520px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    max-height: calc(100svh - 2rem);
    border-radius: 0;
    padding: 2rem 1.7rem 1.25rem;
    border: none;
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tasks-filters-modal-content h2 {
    margin: 0 0 1.35rem 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}

.tasks-filters-modal-content .tasks-filters-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.tasks-filters-modal-content .filter-input,
.tasks-filters-modal-content .filter-select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 1rem;
    color: var(--text);
    background: var(--card);
}

/* Filters modal date inputs: keep native date rendering to avoid Chromium/WebKit glyph artifacts */
.tasks-filters-modal-content input[type="date"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    -webkit-appearance: auto;
    appearance: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    background-image: none;
    padding-right: 0.75rem;
}

@media (hover: hover) and (pointer: fine) {
    .tasks-filters-modal-content input[type="date"]::-webkit-calendar-picker-indicator {
        opacity: 1;
        position: static;
        width: 1.05rem;
        height: 1.05rem;
        margin: 0;
    }
}

.tasks-filters-modal-content input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 1 !important;
    position: static;
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
}

.tasks-filters-modal-content input[type="date"]::-webkit-datetime-edit,
.tasks-filters-modal-content input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.tasks-filters-modal-content input[type="date"]::-webkit-datetime-edit-text,
.tasks-filters-modal-content input[type="date"]::-webkit-datetime-edit-month-field,
.tasks-filters-modal-content input[type="date"]::-webkit-datetime-edit-day-field,
.tasks-filters-modal-content input[type="date"]::-webkit-datetime-edit-year-field {
    font: inherit;
    color: var(--text);
}

/* Touch/tablet: do not show native picker glyph (opacity:1) — it stacks with our
   background SVG and iOS .btn-date-filter-picker. Keep global opacity:0 + full hit area. */

.tasks-filters-modal-content .date-filter-input-wrap {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.tasks-filters-modal-content .date-filter-input-wrap input[type="date"] {
    flex: 1;
    min-width: 0;
    /* iOS: side button opens picker; keep native edit text visible */
    background-image: none;
    padding-right: 0.75rem;
}

.tasks-filters-modal-content .date-filter-input-wrap input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0 !important;
    cursor: pointer;
}

.tasks-filters-modal-content .btn-date-filter-picker {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tasks-filters-modal-content .btn-date-filter-picker:hover,
.tasks-filters-modal-content .btn-date-filter-picker:focus-visible {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-secondary);
    outline: none;
}

.tasks-filters-modal-content .btn-date-filter-picker .icon {
    width: 22px;
    height: 22px;
}

.tasks-filters-modal-content .filter-select {
    /* Keep existing custom dropdown design; ensure chevron remains visible in this modal */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 1rem;
}

[data-theme="dark"] .tasks-filters-modal-content .filter-select,
[data-theme="dark-blue"] .tasks-filters-modal-content .filter-select,
[data-theme="dark-purple"] .tasks-filters-modal-content .filter-select,
[data-theme="dark-green"] .tasks-filters-modal-content .filter-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.tasks-filters-modal-content .date-range-filter-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.tasks-filters-modal-content .date-range-filter-grid .form-group {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.tasks-filters-modal-content .date-filters-container {
    border: none;
    border-radius: 0;
    padding: 0;
    margin-top: 0.45rem;
    flex-direction: column;
    align-items: stretch;
}

.tasks-filters-modal-content .tasks-filters-modal-actions {
    margin-top: 1.5rem;
    justify-content: space-between;
    gap: 0.9rem;
}

.tasks-filters-modal-content .tasks-filters-modal-actions .btn {
    flex: 1;
    min-height: 44px;
    border-radius: 6px;
    font-weight: 600;
}

.tasks-filters-modal-content .tasks-filters-modal-actions .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.tasks-filters-modal-content .tasks-filters-modal-actions .btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.tasks-page-redesign .project-section {
    margin-bottom: 1.75rem !important;
}

.tasks-page-redesign .project-header {
    border: 1px solid var(--border) !important;
    border-radius: 12px;
    padding: 0.85rem 1rem !important;
    margin-bottom: 0.9rem !important;
    background: var(--card);
}

.tasks-page-redesign .tasks-board {
    gap: 0.9rem;
}

.tasks-page-redesign .task-column {
    border: 1px solid var(--border-light) !important;
    border-left-width: 3px !important;
    border-radius: 12px;
    overflow: hidden;
    background: var(--card);
}

.tasks-page-redesign .task-column .column-header {
    border-bottom: 1px solid var(--border-light);
    min-height: 48px;
}

.tasks-page-redesign .task-column-footer {
    border-top: 1px dashed var(--border-light);
    background: color-mix(in srgb, var(--card) 85%, var(--bg-secondary));
}

/* Board visual polish to match provided reference */
.tasks-page-redesign #tasks-board-view .project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0.85rem !important;
    border-radius: 12px;
    border: 1px solid var(--border) !important;
}

.tasks-page-redesign #tasks-board-view .project-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.tasks-page-redesign #tasks-board-view .task-count {
    border: 1px solid var(--border);
    height: fit-content;
    color: var(--text-muted);
    background: var(--bg-secondary);
    font-size: 0.73rem;
    border-radius: 5px;
    padding: 0.12rem 0.5rem;
}

.tasks-page-redesign #tasks-board-view .tasks-board {
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    /* scroll-snap-type: x proximity; */
}

.tasks-page-redesign #tasks-board-view .task-column {
    min-width: 270px;
    max-width: none;
    flex: 1 1 300px;
    min-height: 330px;
    max-height: 540px;
    border-radius: 8px;
    border: 1px solid var(--border) !important;
    border-left-width: 2px !important;
    background: color-mix(in srgb, var(--status-color, var(--border)) 10%, var(--bg-secondary));
    box-shadow: none;
    padding: 0;
    scroll-snap-align: start;
}

.tasks-page-redesign #tasks-board-view .task-column .column-header {
    min-height: 44px;
    margin: 0;
    padding: 0.5rem 0.55rem;
    border-bottom: 1px solid var(--border);
}

.tasks-page-redesign #tasks-board-view .task-column .column-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.tasks-page-redesign #tasks-board-view .task-list {
    padding: 0.5rem;
}

.tasks-page-redesign #tasks-board-view .task-card {
    margin-bottom: 0.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--card) 88%, var(--bg-secondary));
    box-shadow: none;
    padding: 0.62rem 0.62rem 0.62rem 1.25rem;
}

.tasks-page-redesign #tasks-board-view .task-card:hover {
    border-color: var(--border);
    box-shadow: none;
    transform: none;
}

.tasks-page-redesign #tasks-board-view .task-card h4 {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;
    margin-left: 5px;
}

.tasks-page-redesign #tasks-board-view .task-description {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.28;
}

.tasks-page-redesign #tasks-board-view .task-due-date {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.tasks-page-redesign #tasks-board-view .task-actions {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
}

.tasks-page-redesign #tasks-board-view .btn-task-view {
    min-height: 30px;
    font-size: 0.78rem;
}

.tasks-page-redesign #tasks-board-view .btn-column-add-task {
    /* min-height: 44px; */
    color: var(--text-muted);
    border: 1px dashed var(--border);
    /* background: #f5f5f6; */
    border-radius: 8px;
}

.tasks-page-redesign #tasks-board-view .btn-column-add-task:hover {
    color: var(--text-secondary);
    border-color: var(--border);
    background: var(--bg-secondary);
}

/* Status + priority as pill dropdowns (board, list, any tasks tab view) */
.tasks-page-redesign .task-quick-edit-row--badges {
    grid-template-columns: auto auto;
    justify-content: flex-start;
    gap: 0.35rem;
}

.tasks-page-redesign .task-quick-edit-row--badges[data-has-status="0"] {
    grid-template-columns: auto;
}

.tasks-page-redesign .task-quick-edit-row--badges .custom-dropdown-enhanced {
    width: auto;
    max-width: 100%;
}

.tasks-page-redesign .task-quick-edit-row--badges .custom-dropdown-enhanced .custom-dropdown-trigger,
.tasks-page-redesign .task-quick-edit-row--badges .task-inline-select {
    min-height: 26px;
    padding: 0.2rem 0.45rem 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    width: auto !important;
    min-width: 4.5rem !important;
    max-width: 11rem;
    border: 1px solid #d6dbe1;
    background: #f2f4f6;
    gap: 0.25rem;
}

.tasks-page-redesign .task-quick-edit-row--badges .task-inline-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 1.4rem;
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    background-size: 0.85rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.tasks-page-redesign .task-quick-edit-row--badges .task-inline-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

.tasks-page-redesign .task-quick-edit-row--badges .custom-dropdown-enhanced .custom-dropdown-chevron {
    flex-shrink: 0;
    opacity: 0.65;
}

.tasks-page-redesign .task-quick-edit-row--badges .custom-dropdown-enhanced .custom-dropdown-trigger.priority-low,
.tasks-page-redesign .task-quick-edit-row--badges .custom-dropdown-enhanced .custom-dropdown-trigger.priority-medium,
.tasks-page-redesign .task-quick-edit-row--badges .custom-dropdown-enhanced .custom-dropdown-trigger.priority-high,
.tasks-page-redesign .task-quick-edit-row--badges .task-inline-select.priority-low,
.tasks-page-redesign .task-quick-edit-row--badges .task-inline-select.priority-medium,
.tasks-page-redesign .task-quick-edit-row--badges .task-inline-select.priority-high {
    color: inherit;
}

.tasks-page-redesign .task-quick-edit-row--badges .custom-dropdown-enhanced .custom-dropdown-trigger.priority-low,
.tasks-page-redesign .task-quick-edit-row--badges .task-inline-select.priority-low {
    background: #ecfdf5;
    border-color: #86efac;
    color: #15803d;
}

.tasks-page-redesign .task-quick-edit-row--badges .custom-dropdown-enhanced .custom-dropdown-trigger.priority-medium,
.tasks-page-redesign .task-quick-edit-row--badges .task-inline-select.priority-medium {
    background: #fff7e8;
    border-color: #f0c14b;
    color: #8a5a00;
}

.tasks-page-redesign .task-quick-edit-row--badges .custom-dropdown-enhanced .custom-dropdown-trigger.priority-high,
.tasks-page-redesign .task-quick-edit-row--badges .task-inline-select.priority-high {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

/* One priority dot on the card: hide header pill when badge row exists */
.tasks-page-redesign .task-card:has(.task-quick-edit-row--badges) .task-header .task-priority {
    display: none;
}

.tasks-page-redesign .tasks-list-view .tasks-task-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

@media (max-width: 1024px) {
    .tasks-page-redesign .tasks-list-view .tasks-task-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .tasks-page-redesign .tasks-list-view .tasks-task-list {
        grid-template-columns: 1fr;
    }
}

.tasks-page-redesign .tasks-list-view .tasks-task-list .task-card {
    border-radius: 12px;
    padding: .9rem 0.9rem .9rem 2rem;
    border: 1px solid var(--border);
    box-shadow: none;
}

.tasks-page-redesign .tasks-list-view .tasks-list-project-card {
    border-radius: 12px;
}

.tasks-page-redesign .tasks-calendar-header {
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.tasks-page-redesign .tasks-calendar-nav-row {
    border-radius: 12px;
}

.tasks-page-redesign .tasks-calendar-view-mode {
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
}

.tasks-page-redesign .calendar-view-mode-btn {
    min-height: 40px;
    font-weight: 600;
}

.tasks-page-redesign .calendar-view-mode-btn.is-active {
    border: 1px solid var(--text);
    color: var(--text);
}

.tasks-page-redesign .tasks-calendar-grid,
.tasks-page-redesign .tasks-calendar-week-time-grid,
.tasks-page-redesign .tasks-calendar-day-time-grid {
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: none;
}

.tasks-page-redesign .tasks-calendar-task {
    border-radius: 8px;
}

.tasks-page-redesign #createTaskModal .modal-content,
.tasks-page-redesign #taskDetailsModal .modal-content {
    border-radius: 14px;
    border: 1px solid var(--border);
}

.tasks-page-redesign #createTaskModal .close,
.tasks-page-redesign .tasks-filters-modal-content .close {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    border: none;
    color: var(--text);
    font-size: 40px;
    font-weight: 400;
    line-height: 1;
    opacity: 1;
}

.tasks-page-redesign #taskDetailsModal .task-details-modal-close {
    position: static;
    top: auto;
    right: auto;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    color: #1d1d1d;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1;
    opacity: 1;
}

.tasks-page-redesign .tasks-filters-modal-content .close {
    top: 14px;
    right: 14px;
}

.tasks-page-redesign .tasks-filters-modal-content .form-group label,
.tasks-page-redesign .tasks-filters-modal-content .date-range-label {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.55rem;
    color: var(--text);
}

.tasks-page-redesign .tasks-filters-modal-content .btn-filter-toggle {
    margin-top: 0.6rem;
    min-height: 44px;
    border: none;
    background: transparent;
    justify-content: flex-start;
    padding-left: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

.tasks-page-redesign .tasks-filters-modal-content .btn-filter-toggle .icon {
    display: none;
}

.tasks-page-redesign .tasks-filters-modal-content .tasks-filters-section-title {
    margin-top: 0.9rem;
    margin-bottom: 0.55rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.05;
}

.tasks-page-redesign .tasks-filters-modal-content #date-filters-container {
    display: flex !important;
}

.tasks-page-redesign .tasks-filters-modal-content .date-filters-quick-select {
    margin-top: 0.55rem;
    gap: 0.45rem;
}

.tasks-page-redesign .tasks-filters-modal-content .date-filters-quick-label {
    display: none;
}

.tasks-page-redesign .tasks-filters-modal-content .btn-date-quick {
    min-height: 34px;
    padding: 0.35rem 0.68rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.95rem;
}

.tasks-page-redesign .tasks-filters-modal-content .btn-date-quick.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.tasks-page-redesign .tasks-filters-modal-content #overdue-toggle-button {
    min-height: 36px;
    border: 1px solid var(--danger);
    border-radius: 6px;
    background: var(--danger-light);
    color: var(--danger);
    font-weight: 500;
}

/* Filter modal: reliable chevron fallback for enhanced dropdowns */
.tasks-page-redesign .tasks-filters-modal-content .custom-dropdown-enhanced .custom-dropdown-trigger {
    position: relative;
    padding-right: 2.25rem;
}

.tasks-page-redesign .tasks-filters-modal-content .custom-dropdown-enhanced .custom-dropdown-chevron {
    display: none;
}

.tasks-page-redesign .tasks-filters-modal-content .custom-dropdown-enhanced .custom-dropdown-trigger::after {
    content: "";
    position: absolute;
    right: 0.85rem;
    top: 50%;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid var(--text);
    border-bottom: 2px solid var(--text);
    transform: translateY(-62%) rotate(45deg);
    pointer-events: none;
}

.tasks-page-redesign .tasks-filters-modal-content .custom-dropdown-enhanced.is-open .custom-dropdown-trigger::after {
    transform: translateY(-38%) rotate(-135deg);
}

.tasks-page-redesign #createTaskModal .modal-content {
    width: min(760px, calc(100vw - 2rem));
}

.tasks-page-redesign #createTaskModal h2 {
    font-size: 2rem;
    margin-bottom: 0.8rem;
}

/* New Task modal — reference UI (#createTaskModal: tasks page + dashboard) */
#createTaskModal.modal {
    background-color: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
}

#createTaskModal .modal-content.tasks-create-task-modal {
    width: min(550px, calc(100vw)) !important;
    max-width: min(550px, calc(100vw)) !important;
    padding: 1.35rem 1.5rem 1.5rem;
    border: 1px solid #e2e3e7;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
}

#createTaskModal .close {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    border: none;
    color: #1d1d1d;
    font-size: 40px;
    font-weight: 400;
    line-height: 1;
    opacity: 1;
    top: 14px;
    right: 14px;
}

#createTaskModal h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
}

[data-theme="dark"] #createTaskModal .close,
[data-theme="dark-blue"] #createTaskModal .close,
[data-theme="dark-gray"] #createTaskModal .close,
[data-theme="dark-purple"] #createTaskModal .close,
[data-theme="dark-green"] #createTaskModal .close {
    color: var(--text);
}

#createTaskModal #createTaskForm {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#createTaskModal #createTaskForm .form-group {
    margin-bottom: 0;
}

#createTaskModal .tasks-create-task-modal .form-group label {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.45rem;
}

#createTaskModal .tasks-create-modal-hint {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--text-muted);
}

#createTaskModal .tasks-create-task-modal input[type="text"],
#createTaskModal .tasks-create-task-modal input[type="datetime-local"] {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: var(--card);
    color: var(--text);
}

#createTaskModal .tasks-create-task-modal .custom-dropdown-enhanced .custom-dropdown-trigger {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 0.9375rem;
}

#createTaskModal .multi-select-input {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: var(--card);
    box-sizing: border-box;
}

#createTaskModal .multi-select-input:hover {
    border-color: #9ca3af;
}

#createTaskModal .multi-select-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light, rgba(59, 130, 246, 0.2));
}

#createTaskModal #create-task-description {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: var(--card);
}

#createTaskModal .create-task-status--pending .custom-dropdown-trigger {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    border-color: #e5e7eb !important;
}

#createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-low {
    background-color: #ecfdf5 !important;
    color: #047857 !important;
    border-color: #a7f3d0 !important;
}

#createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-medium {
    background-color: #fffbeb !important;
    color: #c2410c !important;
    border-color: #fde68a !important;
}

#createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-high {
    background-color: #fef2f2 !important;
    color: #b91c1c !important;
    border-color: #fecaca !important;
}

[data-theme="dark"] #createTaskModal .create-task-status--pending .custom-dropdown-trigger,
[data-theme="dark-blue"] #createTaskModal .create-task-status--pending .custom-dropdown-trigger,
[data-theme="dark-gray"] #createTaskModal .create-task-status--pending .custom-dropdown-trigger,
[data-theme="dark-purple"] #createTaskModal .create-task-status--pending .custom-dropdown-trigger,
[data-theme="dark-green"] #createTaskModal .create-task-status--pending .custom-dropdown-trigger {
    background: var(--bg-secondary) !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-low,
[data-theme="dark-blue"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-low,
[data-theme="dark-gray"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-low,
[data-theme="dark-purple"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-low,
[data-theme="dark-green"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-low {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}

[data-theme="dark"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-medium,
[data-theme="dark-blue"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-medium,
[data-theme="dark-gray"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-medium,
[data-theme="dark-purple"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-medium,
[data-theme="dark-green"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-medium {
    background-color: rgba(245, 158, 11, 0.18) !important;
    color: #fcd34d !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-high,
[data-theme="dark-blue"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-high,
[data-theme="dark-gray"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-high,
[data-theme="dark-purple"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-high,
[data-theme="dark-green"] #createTaskModal .custom-dropdown-priority .custom-dropdown-trigger.priority-high {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
}

#createTaskModal .tasks-create-modal-actions {
    margin-top: 0.85rem;
    display: flex;
    gap: 0.7rem;
    justify-content: flex-start;
}

#createTaskModal .tasks-create-modal-actions .btn {
    min-width: 130px;
    min-height: 42px;
    border-radius: 8px;
    font-weight: 600;
}

.tasks-page-redesign #taskDetailsModal .modal-content.task-details-modal-content {
    width: min(920px, calc(100vw - 2rem)) !important;
    max-width: min(920px, calc(100vw - 2rem)) !important;
}

.tasks-page-redesign .task-details {
    border-radius: 10px;
}

.tasks-page-redesign .task-details-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.75rem;
    margin-bottom: 0.8rem;
}

.tasks-page-redesign .task-detail-section {
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 0.8rem;
    margin-bottom: 0.7rem;
    background: var(--card);
}

.tasks-page-redesign .task-detail-section-title {
    font-size: 0.95rem;
    margin: 0;
}

@media (max-width: 1024px) {
    .tasks-page-redesign .tasks-header {
        align-items: flex-start;
    }

    .tasks-page-redesign .tasks-header-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .tasks-page-redesign .tasks-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tasks-page-redesign .tasks-header-title-wrap {
        justify-content: space-between;
    }

    .tasks-page-redesign .tasks-header-secondary {
        display: none;
    }

    .tasks-page-redesign .tasks-view-toggle {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tasks-page-redesign .tasks-view-toggle .tasks-view-btn {
        width: 100%;
        justify-content: center;
    }

    .tasks-page-redesign #tasks-board-view .task-column {
        min-width: 242px;
        max-width: 242px;
        flex-basis: 242px;
    }

    .tasks-filters-modal-content {
        width: calc(100vw - 0.8rem);
        max-height: calc(100vh - 0.8rem);
        max-height: calc(100svh - 0.8rem);
        padding: 1.2rem 0.95rem 1rem;
    }

    .tasks-filters-modal-content .date-range-filter-grid {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr);
    }

    .tasks-page-redesign .tasks-calendar-days {
        min-height: 300px;
    }

    .tasks-page-redesign .tasks-create-modal-actions {
        flex-direction: column;
    }

    .tasks-page-redesign .tasks-create-modal-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .tasks-page-redesign {
        padding-top: 0.5rem;
    }

    .tasks-page-redesign .tasks-header h1 {
        font-size: 1.9rem;
    }

    .tasks-page-redesign .tasks-view-toggle .tasks-view-btn {
        padding: 0.5rem 0.35rem;
        font-size: 0.9rem;
    }

    .tasks-page-redesign .tasks-view-toggle .tasks-view-btn .icon {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 360px) {
    .tasks-page-redesign .tasks-header h1 {
        font-size: 1.7rem;
    }

    .tasks-page-redesign .filter-pill,
    .tasks-page-redesign .filter-pill-clear {
        font-size: 0.75rem;
    }
}

@media (max-width: 320px) {
    .tasks-page-redesign .tasks-view-toggle .tasks-view-btn {
        font-size: 0.8rem;
    }

    .tasks-page-redesign .tasks-view-toggle .tasks-view-btn .icon {
        display: none;
    }

    .tasks-filters-modal-content {
        width: calc(100vw - 0.45rem);
        padding: 1rem 0.75rem 0.85rem;
    }
}

@supports (height: 100dvh) {
    .tasks-filters-modal-content {
        max-height: calc(100dvh - 2rem);
    }

    @media (max-width: 768px) {
        .tasks-filters-modal-content {
            max-height: calc(100dvh - 0.8rem);
        }
    }
}

/* Tasks view options: force single-row horizontal scroller on mobile */
@media (max-width: 768px) {
    .tasks-page-redesign .tasks-view-toggle-wrap {
        display: flex;
        align-items: center;
        width: 100%;
        min-width: 0;
        gap: 0.35rem;
    }

    .tasks-page-redesign .tasks-view-toggle-scroll {
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tasks-page-redesign .tasks-view-toggle-scroll::-webkit-scrollbar {
        display: none;
    }

    .tasks-page-redesign .tasks-view-scroll-btn {
        display: inline-flex;
    }

    .tasks-page-redesign .tasks-view-toggle {
        display: inline-flex !important;
        grid-template-columns: none !important;
        flex-wrap: nowrap !important;
        width: max-content !important;
        min-width: max-content !important;
        justify-content: flex-start !important;
    }

    .tasks-page-redesign .tasks-view-toggle .tasks-view-btn {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 96px !important;
        white-space: nowrap !important;
    }
}

html.modal-scroll-lock,
body.modal-scroll-lock {
    overflow: hidden;
    overscroll-behavior: contain;
}