:root {
    --ease-snappy: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Light Theme (Default) */
    --bg-main: #FFFFFF;
    --bg-secondary: #F8F5F0;
    --subtle-bg: #F3F4F6;
    --text-primary: #000000;
    --text-secondary: #2B303B;
    --text-muted: rgba(43, 48, 59, 0.6);
    --accent: #091C3A;
    --accent-cyan: #0284C7;
    --border-color: #E5E7EB;
    --border-subtle: #E5E7EB;
    --border-strong: #D1D5DB;
    --border: 1px solid var(--border-color);
    --input-bg: #FFFFFF;
    --hover-bg: rgba(9, 28, 58, 0.04);
    --active-bg: rgba(2, 132, 199, 0.08);
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);

    --danger: #DC2626;
    --warning: #f7b731;
    --success: #16A34A;

    /* Aliases so legacy variable names keep working everywhere they're used. */
    --subtle-border: var(--border-subtle);
    --text-color: var(--text-primary);
    --glass-bg: var(--bg-secondary);
    --scrollbar-thumb: var(--border-strong);
    --scrollbar-thumb-hover: var(--accent-cyan);
}

body.dark-theme {
    --bg-main: #0A1220;
    --bg-secondary: #2B303B;
    --subtle-bg: #121B2A;
    --bg-elevated: #243447;
    --text-primary: #FFFFFF;
    --text-secondary: rgba(248, 245, 240, 0.75);
    --text-muted: rgba(248, 245, 240, 0.45);
    --accent: #091C3A;
    --accent-cyan: #38BDF8;
    --border-color: #2D3D52;
    --border-subtle: #1F2A3C;
    --border-strong: #2D3D52;
    --border: 1px solid var(--border-color);
    --input-bg: #2B303B;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    --hover-bg: rgba(248, 245, 240, 0.04);
    --active-bg: rgba(56, 189, 248, 0.08);

    --danger: #FB7185;
    --success: #34D399;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Inter', sans-serif; 
}

h1, h2, h3, h4, .logo, .glass-btn, .view-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

/* Text selection with purple accent */
::selection {
    background: var(--accent);
    color: #FFF;
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    transition: background 0.3s, color 0.3s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Native form controls (date pickers, scrollbars, selects' option list)
       follow this hint. Dark mode below switches to dark. */
    color-scheme: light;
}

body.dark-theme {
    color-scheme: dark;
}

/* Global Utility */
.hidden { display: none !important; }

/* Swarming Banner */
.swarming-banner {
    position: relative;
    width: 100%;
    min-height: 50px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    font-weight: 500;
    padding: 12px 60px 12px 20px;
    box-shadow: 0 4px 20px rgba(255, 75, 75, 0.3);
    animation: slideDown 0.3s ease-out, bannerGlow 3s ease-in-out infinite;
    border-bottom: 2px solid transparent;
    background-clip: padding-box;
    overflow: hidden;
}
.swarming-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 75, 75, 0.1) 25%,
        rgba(255, 150, 50, 0.1) 50%,
        rgba(255, 75, 75, 0.1) 75%,
        transparent 100%);
    animation: bannerShimmer 3s linear infinite;
    pointer-events: none;
}
.swarming-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        #ff4b4b,
        #ff9f43,
        #ff4b4b,
        #ff9f43,
        #ff4b4b);
    background-size: 200% 100%;
    animation: gradientFlow 2s linear infinite;
}
.swarming-banner span {
    position: relative;
    z-index: 1;
    text-shadow: 0 0 10px rgba(255, 75, 75, 0.5);
}
.swarming-banner b {
    color: #ff6b6b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Swarming Floating Button - Right Edge */
.swarming-floating-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 55px;
    padding: 25px 12px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    border: 2px solid rgba(255, 75, 75, 0.4);
    border-right: none;
    border-radius: 16px 0 0 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 25px rgba(255, 75, 75, 0.4);
    overflow: hidden;
}
.swarming-floating-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(255, 75, 75, 0.1) 50%,
        transparent 100%);
    animation: floatingBtnPulse 2s ease-in-out infinite;
}
.swarming-floating-btn-indicator {
    width: 12px;
    height: 12px;
    background: #ff4b4b;
    border-radius: 50%;
    margin-bottom: 12px;
    animation: indicatorBlink 1.5s ease-in-out infinite;
    box-shadow: 0 0 15px #ff4b4b, 0 0 30px rgba(255, 75, 75, 0.5);
}
.swarming-floating-btn-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: #ff6b6b;
    text-shadow: 0 0 15px rgba(255, 75, 75, 0.5);
    position: relative;
    z-index: 1;
}
.swarming-floating-btn-expanded {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(20px);
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid rgba(255, 75, 75, 0.4);
    border-radius: 12px;
    padding: 20px;
    min-width: 180px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 75, 75, 0.2);
}
.swarming-floating-btn-expanded::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: rgba(255, 75, 75, 0.4);
}
.swarming-floating-btn:hover {
    width: 65px;
    padding: 30px 14px;
    box-shadow: -10px 0 40px rgba(255, 75, 75, 0.6);
}
.swarming-floating-btn:hover .swarming-floating-btn-expanded {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}
.swarming-blocked-count {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ff4b4b;
    text-shadow: 0 0 20px rgba(255, 75, 75, 0.5);
    line-height: 1;
    margin-bottom: 5px;
}
.swarming-floating-btn-expanded span {
    font-size: 0.85rem;
    color: #ff9f9f;
    display: block;
    margin-bottom: 15px;
}
.swarming-view-btn {
    background: linear-gradient(90deg, #ff4b4b, #ff6b6b);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.swarming-view-btn:hover {
    background: linear-gradient(90deg, #ff6b6b, #ff8b8b);
    transform: scale(1.05);
}

@keyframes floatingBtnPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
@keyframes indicatorBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes bannerGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(255, 75, 75, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(255, 75, 75, 0.5), 0 0 60px rgba(255, 75, 75, 0.2); }
}
@keyframes bannerShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* Glass Utility Classes */
.glass {
    background: var(--bg-main);
    border: var(--border);
}

.glass-panel {
    background: var(--bg-secondary);
    border: var(--border);
    border-radius: 8px;
    padding: 16px;
}
body.dark-theme .glass-panel {
    background: var(--subtle-bg);
}

.glass-input, .glass-select, .custom-select-trigger {
    background: var(--input-bg);
    border: var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 4px;
    outline: none;
    height: 35px; /* Fixed height for consistency */
    transition: var(--ease-snappy);
}
textarea.glass-input {
    height: auto;
}

.glass-input:focus, .glass-select:focus {
    border-color: var(--text-primary);
}

.input-invalid,
.input-invalid:focus {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 1px var(--danger);
}

/* Brief shake when a mandatory field is flashed for missing input. */
@keyframes invalidShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}
.input-invalid-shake {
    animation: invalidShake 0.35s ease-in-out;
}

/* Compact borderless icon button — used for attachment download / delete
   actions where the clickable file name is the primary affordance. */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}
.icon-btn:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 1px;
}
.icon-btn-danger:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
}

/* === Attachments view modes (Details / List / Grid) ============== */

.att-view-switcher {
    display: inline-flex;
    border: var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.att-view-btn {
    background: transparent;
    border: none;
    padding: 6px 10px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    border-right: 1px solid var(--border-color);
    transition: background 0.15s, color 0.15s;
}
.att-view-btn:last-child { border-right: none; }
.att-view-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
.att-view-btn.is-active { background: var(--accent); color: #fff; }

/* Group card for task / comment subsections */
.att-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}
.att-group-header {
    padding: 8px 12px;
    background: var(--subtle-bg);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.att-group-title { font-weight: 600; font-size: 0.9rem; }
.att-group-subtitle { font-size: 0.75rem; color: var(--text-secondary); }

/* --- List view: 1-line dense rows --- */
.attachments-list {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.att-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1.2fr) minmax(0, 1.8fr) auto;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
}
.att-row:last-child { border-bottom: none; }
.att-row:hover { background: var(--hover-bg); }
.att-row-emoji { font-size: 1rem; line-height: 1; }
.att-row-name {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.att-row-meta {
    color: var(--text-secondary);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.att-row-actions { display: inline-flex; gap: 2px; }

/* --- Details view: full-column table --- */
.attachments-details {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.85rem;
}
.attachments-details thead tr {
    background: var(--subtle-bg);
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}
.attachments-details th { padding: 8px 12px; font-weight: 600; }
.attachments-details td { padding: 6px 12px; border-top: 1px solid var(--border-subtle); }
.attachments-details tbody tr:hover { background: var(--hover-bg); }
.att-cell-emoji { width: 28px; font-size: 1rem; }
.att-cell-meta { color: var(--text-secondary); white-space: nowrap; }
.att-cell-actions { text-align: right; white-space: nowrap; }

/* --- Grid view: tiles with hover-to-reveal actions --- */
.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.att-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 10px 10px;
    background: var(--bg-secondary);
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
body.dark-theme .att-card { background: var(--subtle-bg); }
.att-card:hover { border-color: var(--accent-cyan); }
.att-card-emoji { font-size: 2rem; line-height: 1; margin-bottom: 4px; }
.att-card-name {
    font-size: 0.82rem;
    color: var(--text-primary);
    word-break: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    width: 100%;
    line-height: 1.25;
}
.att-card-meta { font-size: 0.7rem; color: var(--text-secondary); }
.att-card-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: inline-flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}
.att-card:hover .att-card-actions,
.att-card:focus-within .att-card-actions { opacity: 1; }

/* Discrete "(Mandatory)" hint placed next to a field label. */
.label-mandatory {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85em;
    margin-left: 4px;
    text-transform: none;
    letter-spacing: 0;
}

.custom-select-wrapper.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Date Input Styling */
.glass-btn {
    background: transparent;
    border: var(--border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--ease-snappy);
    text-transform: uppercase;
    font-size: 0.85rem;
}

.glass-btn:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

/* Primary accent button with gradient */
.glass-btn-primary {
    background: var(--accent);
    border: none;
    color: #FFFFFF;
}

.glass-btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
    background: transparent;
    border: var(--border);
    color: var(--text-primary);
    border-radius: 2px;
    cursor: pointer;
    transition: var(--ease-snappy);
}
.glass-btn-sm:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

/* Dark mode: transparent buttons read as ghosted text on dark surfaces, so
   give them a subtle solid surface and a stronger border. */
body.dark-theme .glass-btn,
body.dark-theme .glass-btn-sm,
body.dark-theme input[type="file"]::file-selector-button,
body.dark-theme input[type="file"]::-webkit-file-upload-button {
    background: var(--bg-secondary);
    border-color: var(--border-strong);
}
body.dark-theme .glass-btn:hover,
body.dark-theme .glass-btn-sm:hover,
body.dark-theme input[type="file"]::file-selector-button:hover,
body.dark-theme input[type="file"]::-webkit-file-upload-button:hover {
    background: var(--bg-elevated);
    opacity: 1;
}
body.dark-theme .glass-btn[disabled],
body.dark-theme .glass-btn-sm[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* File input — restyle native "Choose file"/"Browse" button to match the app */
input[type="file"] {
    color: var(--text-secondary);
    font-family: inherit;
}
input[type="file"]::file-selector-button {
    background: transparent;
    border: var(--border);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 2px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-family: inherit;
    transition: var(--ease-snappy);
}
input[type="file"]::file-selector-button:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}
input[type="file"]::-webkit-file-upload-button {
    background: transparent;
    border: var(--border);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 2px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-family: inherit;
    transition: var(--ease-snappy);
}
input[type="file"]::-webkit-file-upload-button:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

/* Placeholders */
::placeholder { color: var(--text-secondary) !important; opacity: 0.5; }

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.loading-logo {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
}
.loading-logo .highlight {
    color: var(--accent);
}
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-text {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Layout */
.app-container { display: flex; flex: 1; min-height: 0; }

/* Mobile Menu Toggle - Hidden by default, shown via CSS media query on mobile */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 35px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.mobile-menu-toggle:hover { background: var(--hover-bg); }

/* Sidebar Overlay - Hidden by default */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* Sidebar & Brand */
.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    background: var(--bg-secondary);
    border-right: var(--border);
    z-index: 20;
    transition: width 0.3s ease;
    overflow-y: auto;
}

.sidebar-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 32px; 
    width: 100%;
}

.sidebar-header .brand-identity {
    flex: 1;
}

.sidebar.collapsed { width: 80px; }
.sidebar.collapsed .brand-identity,
.sidebar.collapsed .app-name,
.sidebar.collapsed .nav-section h3,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-section li,
.sidebar.collapsed .custom-select-wrapper,
.sidebar.collapsed .theme-switcher { display: none !important; } /* Hide text */

.sidebar.collapsed .user-profile { display: flex; justify-content: center; padding: 5px; background: transparent; }
.sidebar.collapsed .user-actions { display: none !important; }
.sidebar.collapsed #btn-open-admin { display: none !important; }
.sidebar.collapsed .sidebar-header { justify-content: center; align-items: center; }
.sidebar.collapsed .logo { display: block; margin-bottom: 0; } /* Show logo in collapsed state */

.sidebar-header { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 30px; }

.brand-identity { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.logo { width: 40px; height: 40px; margin-bottom: 0; }
.logo-text { font-size: 1.2rem; font-weight: 900; color: var(--text-primary); font-family: 'Space Grotesk', sans-serif; }

.app-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 48px; /* Align with the text of COREIDON.AI */
}

.nav-section { margin-bottom: 20px; }
.nav-section h3 { font-size: 0.7rem; text-transform: uppercase; color: var(--text-secondary); opacity: 0.6; margin-bottom: 12px; font-weight: 700; }
.nav-section ul { list-style: none; }
.nav-section li {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--ease-snappy);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2px;
}
.nav-section li:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}
.nav-section li.active {
    background: var(--active-bg);
    color: var(--text-primary);
    font-weight: 700;
}

#project-list {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 2px;
}

#project-list li { color: var(--project-color); display: flex; justify-content: space-between; align-items: center; }

/* Blocked Project in Sidebar */
#project-list li.has-blocked,
#project-list li.has-blocked.active,
#project-list li.has-blocked:hover {
    position: relative;
    background: linear-gradient(90deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%) !important;
    color: #ff6b6b !important;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(255, 75, 75, 0.2);
    opacity: 1;
}
#project-list li.has-blocked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 75, 75, 0.08) 25%,
        rgba(255, 150, 50, 0.08) 50%,
        rgba(255, 75, 75, 0.08) 75%,
        transparent 100%);
    animation: bannerShimmer 4s linear infinite;
    pointer-events: none;
}
#project-list li.has-blocked::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        #ff4b4b,
        #ff9f43,
        #ff4b4b,
        #ff9f43,
        #ff4b4b);
    background-size: 200% 100%;
    animation: gradientFlow 2s linear infinite;
}
#project-list li.has-blocked span {
    position: relative;
    z-index: 1;
}

/* User Profile & Actions */
.user-profile {
    margin-top: auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    padding: 16px;
    border-radius: 4px;
    background: var(--bg-main);
    border: var(--border);
    align-items: center;
}
body.dark-theme .user-profile {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}
.user-info { 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
}
.user-info #current-user-name { 
    font-family: 'Space Grotesk', sans-serif; 
    font-weight: 700; 
    font-size: 0.9rem; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.user-actions { 
    grid-column: 1 / -1; 
    display: flex; 
    gap: 8px; 
    margin-top: 4px; 
}
.avatar { 
    width: 36px; 
    height: 36px; 
    background: var(--text-primary); 
    border-radius: 4px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--bg-main); 
    font-weight: 900; 
    flex-shrink: 0; 
}

/* Action Buttons (Icons) */
.icon-btn {
    background: transparent;
    border: var(--border);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--ease-snappy);
    padding: 6px;
}
.icon-btn:hover {
    background: var(--hover-bg);
}
.icon-btn svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.icon-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Theme Switcher Toggle */
.theme-switcher {
    display: flex;
    width: 100%;
    margin: 8px 0;
}

.theme-toggle-btn {
    width: 100%;
    justify-content: center;
    gap: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    height: 36px;
}
/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; min-height: 0; transition: opacity 0.2s ease, transform 0.2s ease; }
#overview-view { overflow-y: auto; }
#document-view { overflow-y: auto; }

/* --- Document View --- */
.document-content {
    padding: 40px 20px;
    display: flex;
    justify-content: center;
}
.document-paper {
    max-width: 860px;
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 48px 64px;
    line-height: 1.7;
    font-size: 1rem;
    color: var(--text-primary);
    box-shadow: var(--card-shadow);
}
.document-paper .doc-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 2.2rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--accent-cyan);
}
.document-paper h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 32px 0 14px 0;
    color: var(--text-primary);
}
.document-paper .doc-intro p {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}
.document-paper .doc-intro strong {
    color: var(--accent-cyan);
    font-weight: 700;
}
.document-paper p {
    margin: 0 0 12px 0;
}

/* Task list */
.doc-task-list {
    list-style: none;
    counter-reset: task-counter;
    padding: 0;
    margin: 0;
}
.doc-task {
    counter-increment: task-counter;
    margin: 24px 0;
    padding-left: 48px;
    position: relative;
}
.doc-task::before {
    content: counter(task-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent-cyan);
    min-width: 40px;
}
.doc-task-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text-primary);
}
.doc-task-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    font-style: italic;
}
.doc-task-desc {
    margin: 8px 0 12px 0;
    color: var(--text-primary);
}
.doc-resolved {
    color: var(--success);
    font-weight: 600;
    font-style: normal;
}

/* Subtasks */
.doc-subtask-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
}
.doc-subtask {
    margin: 14px 0;
    padding-left: 48px;
    position: relative;
}
.doc-subtask-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    position: relative;
}
.doc-subtask-num {
    position: absolute;
    left: -48px;
    top: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--accent-cyan);
    min-width: 40px;
}
.doc-subtask-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

/* Checklist inside a task */
.doc-checklist-wrap {
    margin: 10px 0 12px 0;
    padding: 10px 14px;
    background: var(--subtle-bg);
    border-left: 3px solid var(--border-color);
    border-radius: 4px;
}
.doc-checklist-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.doc-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}
.doc-checklist li {
    padding: 3px 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.doc-checklist li.done {
    color: var(--text-secondary);
    text-decoration: line-through;
}
.doc-check {
    color: var(--accent-cyan);
    margin-right: 6px;
    font-size: 1rem;
    display: inline-block;
    width: 18px;
    cursor: pointer;
    user-select: none;
}
.doc-check:hover { opacity: 0.7; }

/* Inline editable text */
.doc-edit {
    outline: none;
    border-radius: 3px;
    padding: 0 3px;
    margin: 0 -3px;
    transition: background 0.12s;
    cursor: text;
}
.doc-edit:hover { background: var(--hover-bg); }
.doc-edit:focus {
    background: var(--active-bg);
    box-shadow: 0 0 0 1px var(--accent-cyan);
}
.doc-edit:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    font-style: italic;
}
.doc-placeholder { color: var(--text-muted); font-style: italic; }

/* Editable block-level (description) */
.doc-editable-block {
    display: block;
    min-height: 1.5em;
    padding: 6px 8px;
    margin: 0;
    border-radius: 4px;
    white-space: pre-wrap;
}
.doc-editable-block:hover { background: var(--hover-bg); }
.doc-editable-block:focus { background: var(--active-bg); box-shadow: 0 0 0 1px var(--accent-cyan); }

/* Inline select + date */
.doc-inline-select, .doc-inline-date {
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--border-strong);
    color: var(--accent-cyan);
    font-weight: 600;
    font-family: inherit;
    font-size: inherit;
    padding: 0 2px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}
.doc-inline-select:hover, .doc-inline-date:hover {
    border-bottom-color: var(--accent-cyan);
    background: var(--hover-bg);
}
.doc-inline-select:focus, .doc-inline-date:focus {
    outline: none;
    border-bottom-color: var(--accent-cyan);
    background: var(--active-bg);
}
.doc-inline-date { color-scheme: light dark; }

/* Task head with actions */
.doc-task-head, .doc-subtask-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.doc-task-head .doc-task-title,
.doc-subtask-head .doc-subtask-title { flex: 1; }

.doc-task-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0.35;
    transition: opacity 0.15s;
}
.doc-task:hover .doc-task-actions,
.doc-subtask:hover .doc-task-actions { opacity: 1; }
.doc-action-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}
.doc-action-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); background: var(--hover-bg); }
.doc-action-btn.doc-action-danger:hover { border-color: var(--danger); color: var(--danger); }

/* Add buttons */
.doc-add-wrap {
    margin: 24px 0 8px 0;
}
.doc-add-sub {
    margin: 8px 0 0 0;
    padding-left: 48px;
}
.doc-add-btn {
    background: transparent;
    border: 1px dashed var(--border-strong);
    color: var(--text-secondary);
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.15s;
}
.doc-add-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); border-style: solid; }
.doc-add-btn-sm {
    background: transparent;
    border: 1px dashed var(--border-strong);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.15s;
}
.doc-add-btn-sm:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.doc-add-btn-xs {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px 0;
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 4px;
}
.doc-add-btn-xs:hover { color: var(--accent-cyan); }

/* Checklist item edit + delete */
.doc-checklist li {
    display: flex;
    align-items: center;
    gap: 4px;
}
.doc-check-text {
    flex: 1;
    min-width: 0;
}
.doc-check-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    opacity: 0;
    transition: all 0.15s;
}
.doc-checklist li:hover .doc-check-delete { opacity: 1; }
.doc-check-delete:hover { color: var(--danger); }

/* Resolved styling */
.doc-task.is-resolved .doc-task-title,
.doc-subtask.is-resolved .doc-subtask-title { opacity: 0.7; }

.doc-block { margin: 6px 0 10px 0; }
.doc-empty { color: var(--text-muted); font-style: italic; margin: 12px 0; }

.document-paper { position: relative; }
.doc-edit-toggle {
    position: absolute;
    top: 20px;
    right: 24px;
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.15s;
    z-index: 2;
}
.doc-edit-toggle:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.doc-edit-toggle.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #fff;
}
.doc-edit-toggle.active:hover { opacity: 0.9; }

/* Extra breathing room above title so the edit button doesn't overlap */
.document-paper .doc-title { padding-right: 100px; }
.main-content.project-loading { opacity: 0; transform: translateY(5px); }
.main-content.hidden { display: none !important; }

.top-bar {
    padding: 15px 30px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    z-index: 5;
}

.top-bar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* View Switcher Tabs */
.view-switcher {
    display: flex;
    gap: 0;
    background: transparent;
    border: var(--border);
    border-radius: 4px;
    overflow-x: auto;
}
.view-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--ease-snappy);
    white-space: nowrap;
    border-right: var(--border);
}
.view-btn:last-child { border-right: none; }
.view-btn:hover { color: var(--text-primary); background: var(--hover-bg); }
.view-btn.active { background: var(--accent); color: #FFFFFF; }

.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.controls-buttons { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Stable 2-row top-bar layout:
   - Row 1 always: project title (left) + view-switcher (right).
   - Row 2 always: filter controls (left) + action buttons (right).
   Without this, .controls would only wrap when the title was long enough to
   push it, producing different headers per project. */
.top-bar > .controls {
    flex-basis: 100%;
    justify-content: flex-start;
}
.top-bar > .controls > .controls-buttons {
    margin-left: auto;
}

/* Board & Swimlanes */
.board-container {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 20px 30px;
    min-height: 0; /* Fix flex scrolling */
}

.top-bar { background: none; }
.project-info h1 { color: var(--project-color); }
.deadline-badge {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-left: 15px;
    border: var(--border);
    padding: 4px 8px;
}

.swimlane {
    background: transparent;
    margin-bottom: 20px;
    border: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.swimlane.collapsed .swimlane-content { display: none; }

.swimlane-header {
    padding: 12px 20px;
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-bottom: var(--border);
}

.swimlane-content {
    gap: 15px;
    padding: 15px;
    overflow-x: auto; /* Allow horizontal scroll if sections are wide */
    display: flex; /* Change to flex to support sections */
    align-items: stretch; /* Stretch sections to match the tallest one */
}

.workflow-section {
    background: transparent;
    border-radius: 4px;
    border: var(--border);
    margin-right: 15px;
    display: flex;
    flex-direction: column;
    min-width: 300px; /* Width when expanded */
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.workflow-section.collapsed {
    min-width: 40px;
    width: 40px;
    cursor: pointer;
    background: var(--hover-bg);
}

.workflow-section.collapsed .workflow-columns { display: none; }
.workflow-section.collapsed .workflow-header {
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 10px 0;
    gap: 10px;
    background: none;
    border: none;
}

.workflow-header {
    padding: 10px;
    background: var(--bg-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: var(--border);
}

/* Blocked Workflow Section Styling - Futuristic */

/* When COLLAPSED - entire section has blocked design */
.workflow-section.group-blocked.collapsed {
    position: relative;
    background: linear-gradient(90deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(255, 75, 75, 0.2);
    border-radius: 8px;
}
.workflow-section.group-blocked.collapsed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 75, 75, 0.1) 25%,
        rgba(255, 150, 50, 0.1) 50%,
        rgba(255, 75, 75, 0.1) 75%,
        transparent 100%);
    animation: bannerShimmer 3s linear infinite;
    pointer-events: none;
    z-index: 0;
}
.workflow-section.group-blocked.collapsed::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: linear-gradient(90deg,
        #ff4b4b,
        #ff9f43,
        #ff4b4b,
        #ff9f43,
        #ff4b4b) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    background-size: 200% 100%;
    animation: gradientFlow 2s linear infinite;
    pointer-events: none;
}
.workflow-section.group-blocked.collapsed .workflow-header {
    position: relative;
    z-index: 1;
    background: transparent;
    color: #ff6b6b;
}
.workflow-section.group-blocked.collapsed .workflow-header span {
    position: relative;
    z-index: 1;
    text-shadow: 0 0 10px rgba(255, 75, 75, 0.5);
}

/* When EXPANDED - only header has blocked design */
.workflow-section.group-blocked:not(.collapsed) .workflow-header {
    position: relative;
    background: linear-gradient(90deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    color: #ff6b6b;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(255, 75, 75, 0.2);
    border-radius: 8px 8px 0 0;
}
.workflow-section.group-blocked:not(.collapsed) .workflow-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 75, 75, 0.1) 25%,
        rgba(255, 150, 50, 0.1) 50%,
        rgba(255, 75, 75, 0.1) 75%,
        transparent 100%);
    animation: bannerShimmer 3s linear infinite;
    pointer-events: none;
}
.workflow-section.group-blocked:not(.collapsed) .workflow-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        #ff4b4b,
        #ff9f43,
        #ff4b4b,
        #ff9f43,
        #ff4b4b);
    background-size: 200% 100%;
    animation: gradientFlow 2s linear infinite;
}
.workflow-section.group-blocked:not(.collapsed) .workflow-header span {
    position: relative;
    z-index: 1;
    text-shadow: 0 0 10px rgba(255, 75, 75, 0.5);
}

/* Blocked Swimlane Header Styling */
.swimlane.has-blocked .swimlane-header {
    position: relative;
    background: linear-gradient(90deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    color: #ff6b6b;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(255, 75, 75, 0.2);
}
.swimlane.has-blocked .swimlane-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 75, 75, 0.08) 25%,
        rgba(255, 150, 50, 0.08) 50%,
        rgba(255, 75, 75, 0.08) 75%,
        transparent 100%);
    animation: bannerShimmer 4s linear infinite;
    pointer-events: none;
}
.swimlane.has-blocked .swimlane-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        #ff4b4b,
        #ff9f43,
        #ff4b4b,
        #ff9f43,
        #ff4b4b);
    background-size: 200% 100%;
    animation: gradientFlow 2s linear infinite;
}

.workflow-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Backlog, Doing, Done */
    gap: 10px;
    padding: 10px;
    min-width: 1000px; /* Ensure columns have space */
}

.column {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 10px;
    min-height: 150px;
    min-width: 0;
}

body.dark-theme .column {
    background: transparent; /* Allow card surfaces to stand out against pure black */
}

.column-header {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    display: flex; justify-content: space-between; align-items: center;
}

/* Board Column Headers Color Coding */
.column[data-status*="backlog"] .column-header { border-left: 3px solid var(--text-muted); padding-left: 10px; }
.column[data-status*="doing"] .column-header { border-left: 3px solid var(--warning); padding-left: 10px; }
.column[data-status*="done"] .column-header { border-left: 3px solid var(--success); padding-left: 10px; }
/* Special case for shared columns */
.column[data-status="dev_done"][data-section="qa"] .column-header { border-left-color: var(--text-muted); }
.column[data-status="qa_done"][data-section="ops"] .column-header { border-left-color: var(--text-muted); }

/* Tasks */
.task-card {
    background: var(--bg-main);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: grab;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s, border-color 0.2s;
    position: relative;
    border-left: 4px solid transparent; /* For custom color */
    max-width: 300px;
}

body.dark-theme .task-card {
    background: var(--bg-secondary);
}

/* Subtask nesting */
.subtask-group {
    padding-left: 16px;
    border-left: 2px solid var(--border-color);
    margin-left: 8px;
}
.task-card.is-subtask {
    border: 1px dashed var(--border-color);
    background: var(--subtle-bg);
}
.task-card.is-subtask .task-title::before {
    content: '↳ ';
    color: var(--text-muted);
}
.task-card.is-resolved {
    opacity: 0.7;
}
.resolved-badge {
    background: var(--success);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

button.overview-action-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-color);
    background: transparent !important;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}
.overview-action-btn:hover {
    background: var(--hover-bg);
    color: var(--accent);
    border-color: var(--accent);
}
.overview-action-btn-danger:hover {
    background: rgba(255, 75, 75, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

.task-card.selected {
    border: 2px solid var(--accent);
    background: var(--active-bg);
}

.task-card:hover {
    background: var(--bg-main);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--accent);
}

body.dark-theme .task-card:hover {
    background: var(--bg-secondary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.task-card.dragging { opacity: 0.5; border: 1px dashed white; }

.task-tags { display: flex; gap: 5px; margin-bottom: 8px; }

/* Blocked Task Styling */
@keyframes pulse-blocked {
    0% { box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 75, 75, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 75, 75, 0); }
}

.task-card.blocked {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, rgba(220, 53, 69, 0.05) 100%);
    border: 2px solid var(--danger) !important;
    animation: pulse-blocked 2s infinite;
}

.task-card.blocked .task-title {
    color: var(--danger);
    font-weight: bold;
}

.blocked-badge {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 5px;
}

.block-reason-text {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 5px;
    font-style: italic;
}

.tag { font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; }
.tag.high { background: var(--danger); }
.tag.medium { background: var(--warning); color: black; }
.tag.low { background: var(--success); }
.tag.planning { background: var(--warning); color: black; }
.tag.active { background: var(--success); color: white;}
.tag.archived { background: var(--subtle-bg); color: var(--text-muted); }
body.light-theme .tag.medium, body.light-theme .tag.planning { color: #000; }

.task-group { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 4px; display: block; text-transform: uppercase; letter-spacing: 0.5px; }
.task-title {
    font-weight: 600; font-size: 0.95rem; margin-bottom: 5px;
}
.task-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; }

.task-children-preview {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--subtle-border);
    font-size: 0.75rem;
}

/* Modal (generic — used by swimlane, team, etc.) */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0); z-index: 100;
    display: flex; justify-content: center; align-items: center;
    animation: modalBackdropIn 0.25s ease-out forwards;
}
.modal.hidden { display: none !important; }
.modal-content {
    width: 1100px; max-width: 95%; height: 90vh; padding: 30px;
    position: relative; display: flex; flex-direction: column;
    animation: modalContentIn 0.3s ease-out forwards;
}

@keyframes modalBackdropIn {
    from { background: rgba(0,0,0,0); }
    to { background: rgba(0,0,0,0.6); }
}

@keyframes modalContentIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 2rem; cursor: pointer; }

/* Specific override for Team Modal to ensure it is wide enough */
#team-modal .modal-content {
    width: 900px;
    max-width: 95%;
}

.control-group { margin-bottom: 15px; display: flex; flex-direction: column; gap: 5px; }

/* ============================================
   TASK DRAWER (Asana-style split view)
   ============================================ */
.task-drawer {
    width: 0;
    min-width: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-left: 1px solid var(--subtle-border);
    overflow: hidden;
    transition: width 0.3s ease, min-width 0.3s ease;
    z-index: 10;
}
.task-drawer.open {
    width: 600px;
    min-width: 600px;
}

/* Drawer Header */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--subtle-border);
    flex-shrink: 0;
}
.drawer-close {
    font-size: 1.4rem;
    line-height: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
}
.drawer-close:hover { color: white; }
.drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* More Menu */
.more-menu-wrapper { position: relative; }
.more-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-main);
    border: 1px solid var(--subtle-border);
    border-radius: 8px;
    min-width: 180px;
    z-index: 50;
    backdrop-filter: blur(20px);
    overflow: hidden;
}
.more-menu.hidden { display: none; }
.more-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.more-menu-item:hover { background: var(--hover-bg); }
.more-menu-item.danger { color: var(--danger); }
.more-menu-item.danger:hover { background: rgba(255, 75, 75, 0.15); }

/* Drawer Body */
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Drawer Title */
.drawer-title {
    font-size: 1.4rem;
    font-weight: 600;
    outline: none;
    border-bottom: 2px solid transparent;
    padding-bottom: 6px;
    transition: border-color 0.2s;
    margin: 0;
}
.drawer-title:focus { border-bottom-color: var(--accent); }
.drawer-title:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    font-weight: 400;
}

/* Drawer Controls (inline chips) */
.drawer-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 12px;
}
.drawer-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.drawer-control input,
.drawer-control select,
.drawer-control .custom-select-wrapper {
    width: 100%;
    box-sizing: border-box;
}
.drawer-control input.glass-input {
    padding: 0 12px;
}
.drawer-control label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

/* Drawer Description */
.drawer-description { display: flex; flex-direction: column; gap: 6px; }
.drawer-section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}
.drawer-description textarea {
    width: 100%;
    min-height: 80px;
    resize: none;
    overflow: hidden;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Drawer Sections (collapsible) */
.drawer-section {
    border-top: 1px solid var(--subtle-border);
    padding-top: 12px;
}
.drawer-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding-bottom: 8px;
}
.drawer-section-header h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0;
}
.section-toggle {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.drawer-section.collapsed .section-toggle { transform: rotate(-90deg); }
.drawer-section.collapsed .drawer-section-content { display: none; }
.drawer-section-content { padding-top: 4px; }

/* Drawer Footer */
.drawer-footer {
    flex-shrink: 0;
    padding: 12px 20px;
    border-top: 1px solid var(--subtle-border);
}

/* Subtasks / Checklist */
.subtask-list { list-style: none; padding: 0; margin: 0; }
.subtask-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; background: var(--subtle-bg); padding: 8px; border-radius: 6px; }

.subtask-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.subtask-item input[type="text"] { background: transparent; border: none; color: var(--text-primary); flex: 1; outline: none; }
.subtask-item.done input[type="text"] { text-decoration: line-through; opacity: 0.6; }
.btn-delete-subtask { background: transparent; border: none; color: var(--danger); cursor: pointer; font-weight: bold; }

/* Subtask Links */
.subtask-link-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.subtask-link-item {
    background: var(--subtle-bg);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
    border-left: 3px solid var(--accent);
}
.subtask-link-item:hover { background: var(--hover-bg); }

/* Chat / Comments */
.comments-section { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow-y: auto; padding-right: 5px; }
.chat-message { background: var(--input-bg); padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; }
.chat-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; gap: 10px; }
.chat-meta { display: inline-flex; align-items: center; gap: 8px; }
.chat-ts { white-space: nowrap; }
.comment-actions { display: inline-flex; gap: 6px; }
.comment-actions .link-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 0.75rem;
}
.comment-actions .link-btn:hover { color: var(--text-color); text-decoration: underline; }
.comment-actions .link-btn.danger:hover { color: var(--danger); }
.comment-edit-input { width: 100%; box-sizing: border-box; resize: vertical; }
.chat-input-area { display: flex; gap: 10px; }
.chat-input-area input { flex: 1; }

/* Comment composer (multi-line body + staged files + Send) */
.comment-composer {
    border: var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg-secondary);
}
body.dark-theme .comment-composer { background: var(--subtle-bg); }
.comment-composer textarea.glass-input { background: var(--input-bg); }
.comment-staged-files { display: flex; flex-wrap: wrap; gap: 6px; }
.comment-staged-files .chip { font-size: 0.78rem; }

/* Admin Team List */
.team-list-admin { margin-top: 20px; overflow-y: auto; }
.team-item { background: var(--subtle-bg); padding: 10px; border-radius: 6px; margin-bottom: 10px; }
.team-item-header { font-weight: 600; display: flex; justify-content: space-between; margin-bottom: 5px; }
.team-members { font-size: 1rem; color: var(--text-muted); padding-left: 10px; }
.team-members li { list-style: none; }

/* Admin Sections */
.admin-section {
    transition: all 0.3s ease-in-out;
}
.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 20px;
}
.admin-section-header h3 { margin: 0; }
.admin-section-header .toggle-icon { font-size: 1.5rem; transition: transform 0.3s ease-out; }
.admin-section.collapsed .toggle-icon { transform: rotate(-90deg); }
.admin-section-content {
    padding: 0 20px 20px 20px;
    opacity: 1;
    transition: opacity 0.3s ease-out, padding 0.3s ease-out;
}
.admin-section.collapsed .admin-section-content {
    display: none;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}
.admin-section:not(.collapsed) .admin-section-content {
    animation: adminSlideDown 0.35s ease-out;
}
@keyframes adminSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-grid {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Admin Header */
.admin-header {
    padding: 20px 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
.admin-header h1 {
    font-size: 1.5rem;
    margin: 0;
}
.admin-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Calendar View */
.calendar-container { padding: 20px; height: 100%; overflow-y: auto; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(120px, auto); gap: 10px; }
.calendar-day { background: var(--subtle-bg); border-radius: 8px; padding: 10px; min-height: 120px; position: relative; border: 1px solid transparent; min-width: 0; overflow: hidden; }
.calendar-day.today { background: var(--hover-bg); border-color: var(--accent); }
.calendar-day-header { font-size: 0.8rem; font-weight: bold; margin-bottom: 8px; opacity: 0.7; text-align: right; }
.calendar-day-name { font-size: 0.7rem; text-transform: uppercase; margin-bottom: 5px; opacity: 0.5; text-align: center; }

.calendar-event { 
    font-size: 0.75rem; 
    padding: 4px 6px; 
    border-radius: 4px; 
    margin-bottom: 4px; 
    cursor: pointer; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    display: flex; 
    align-items: center; 
    gap: 5px;
    max-width: 100%;
}
.calendar-event.project-event { background: rgba(255, 159, 67, 0.3); border-left: 3px solid var(--project-color); }
.calendar-event.swimlane-event { background: rgba(0, 210, 255, 0.3); border-left: 3px solid var(--accent); }
.calendar-event.ticket-event { background: rgba(255, 71, 87, 0.2); border-left: 3px solid #ff4757; }
.calendar-event.task-event { background: rgba(32, 191, 107, 0.2); border-left: 3px solid #20bf6b; }
.calendar-event:hover { opacity: 0.8; }

.calendar-legend { display: flex; gap: 15px; font-size: 0.8rem; color: var(--text-muted); margin-left: 20px; }

/* Timeline View */
.timeline-container { padding: 20px; height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 20px; }
.timeline-chart-wrapper {
    background: var(--subtle-bg);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: var(--glass-border);
    position: relative;
}
.timeline-header-row { display: flex; border-bottom: 1px solid var(--subtle-border); background: var(--hover-bg); }
.timeline-sidebar-header { width: 200px; padding: 10px; font-weight: bold; border-right: 1px solid var(--subtle-border); flex-shrink: 0; }
.timeline-timeline-header { flex: 1; padding: 10px; font-weight: bold; text-align: center; }

.timeline-body { overflow-y: auto; flex: 1; position: relative; }
.timeline-row { display: flex; border-bottom: 1px solid var(--subtle-border); height: 40px; align-items: center; position: relative; }
.timeline-row:hover { background: var(--subtle-bg); }
.timeline-label { width: 200px; padding: 0 10px; border-right: 1px solid var(--subtle-border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; font-size: 0.85rem; }
.timeline-track { flex: 1; position: relative; height: 100%; }

.timeline-bar {
    position: absolute; top: 8px; height: 24px;
    border-radius: 2px; /* Slightly less rounded */
    font-size: 0.7rem; display: flex; align-items: center; padding: 0 8px;
    white-space: nowrap; overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: width 0.3s, left 0.3s;
}
.timeline-bar.project { background: var(--project-color); color: var(--text-primary); font-weight: bold; z-index: 2; }
.timeline-bar.swimlane { background: rgba(0, 210, 255, 0.3); border: 1px solid var(--accent); z-index: 1; }
.timeline-bar.task { background: var(--success); color: #fff; z-index: 0; height: 18px; top: 11px; font-size: 0.65rem; border: 1px solid rgba(255,255,255,0.1); }
.timeline-bar.endless { background: linear-gradient(90deg, var(--project-color) 0%, rgba(0,0,0,0) 100%); border-right: none; }
.timeline-bar.endless-swimlane { background: linear-gradient(90deg, rgba(0, 210, 255, 0.3) 0%, rgba(0,0,0,0) 100%); border-right: none; }
.timeline-bar.endless-task { background: linear-gradient(90deg, var(--success) 0%, rgba(0,0,0,0) 100%); border-right: none; }

/* Dependency Lines */
.timeline-dependency-svg {
    position: absolute;
    top: 0;
    left: 200px; /* Offset for the sidebar label width */
    width: calc(100% - 200px);
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}
.timeline-dependency-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.5;
    stroke-dasharray: 4 2;
    opacity: 0.5;
}

.timeline-today-line {
    position: absolute;
    top: 41px; /* Height of header row approx */
    bottom: 0;
    width: 2px;
    background: var(--danger);
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

/* List View */
.list-view-container { padding: 20px; height: 100%; overflow-y: auto; }
.list-project-section { margin-bottom: 20px; background: var(--subtle-bg); border-radius: 12px; overflow: hidden; border: var(--glass-border); }
.list-project-header { padding: 15px 20px; background: var(--hover-bg); display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.list-project-header h3 { margin: 0; font-size: 1.1rem; color: var(--project-color); }
.list-project-content { padding: 15px; }
.list-swimlane { margin-bottom: 15px; background: var(--subtle-bg); border-radius: 8px; overflow: hidden; }
.list-swimlane-header {
    padding: 10px 15px; background: var(--hover-bg); font-weight: 600; font-size: 0.95rem;
    color: var(--accent); display: flex; justify-content: space-between; align-items: center; cursor: pointer;
    transition: background 0.2s ease;
}
.list-swimlane-header:hover { background: var(--active-bg); }
.list-swimlane-header .toggle-icon { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: inline-block; }
.list-status-group { padding: 10px; border-bottom: 1px solid var(--subtle-border); min-height: 60px; }

.list-section-wrapper {
    border-left: 2px solid var(--subtle-border);
    margin-left: 10px;
    margin-top: 5px;
}
.list-section-wrapper.list-section-animate {
    animation: listSectionSlide 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
.list-section-header {
    padding: 5px 10px; background: var(--subtle-bg);
    font-size: 0.8rem; font-weight: bold; color: var(--text-muted); text-transform: uppercase;
    cursor: pointer; display: flex; justify-content: space-between;
    transition: background 0.2s ease;
}
.list-section-header:hover { background: var(--hover-bg); }
.list-section-header .toggle-icon { transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: inline-block; }

@keyframes listSectionSlide {
    0% {
        opacity: 0;
        transform: translateY(-15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.list-status-group.list-status-animate {
    animation: listStatusSlide 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes listStatusSlide {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.list-status-header { font-size: 0.85rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; padding-left: 10px; border-left: 3px solid var(--text-muted); font-weight: bold; }
.list-status-header[class*="backlog"] { border-color: var(--text-muted); }
.list-status-header[class*="doing"] { border-color: var(--warning); }
.list-status-header[class*="done"] { border-color: var(--success); }

.task-row {
    display: flex; align-items: center; gap: 15px;
    background: var(--bg-main);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 5px;
    cursor: grab;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-left: 4px solid transparent;
}
body.dark-theme .task-row { background: var(--bg-secondary); }
.task-row.blocked {
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid var(--danger);
    animation: pulse-blocked 2s infinite;
}
.task-row:hover { background: var(--hover-bg); }
.task-row.selected { background: var(--active-bg); border: 1px solid var(--accent); }
.task-row.dragging { opacity: 0.5; border: 1px dashed var(--text-color); }

/* Bulk Actions Bar */
.bulk-bar {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    padding: 15px 25px; z-index: 200; display: flex; gap: 20px; align-items: center;
    border-radius: 12px; width: auto; max-width: 90%;
    background: var(--bg-secondary);
    border: var(--border);
    box-shadow: var(--card-shadow);
}
.bulk-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Fix dropdowns in bulk bar opening downwards off-screen */
.bulk-bar .custom-options {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 5px;
}

/* Notifications */
.notification-container { 
    position: fixed; top: 20px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column; gap: 10px;
}
.notification-toast {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 500;
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out forwards;
    min-width: 250px;
    max-width: 400px;
    word-wrap: break-word;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Custom Selects */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    display: inline-block;
    min-width: 120px;
}
/* Force the wrapped select to fill the Add Member row inside the team modal,
   otherwise its default inline-block sizing leaves the trigger far too narrow. */
#add-member-row .custom-select-wrapper { display: block; width: 100%; min-width: 0; }
#add-member-row .custom-select-trigger { width: 100%; }
.drawer-control .custom-select-wrapper {
    display: block;
    width: 100%;
    min-width: 0;
}
.custom-select-wrapper select { display: none; } /* Hide native */
.custom-select-trigger {
    background: var(--input-bg);
    border: var(--border);
    color: var(--text-primary);
    padding: 0 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    height: 35px;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}
.custom-select-trigger:after {
    content: '▼'; font-size: 0.6rem; margin-left: 10px; opacity: 0.7;
}
.custom-options {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-main);
    border: var(--border);
    border-radius: 6px;
    z-index: 500;
    margin-top: 5px;
    max-height: 200px; overflow-y: auto;
    display: none;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}
.custom-options.open { display: block; }
.custom-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: 0.2s;
    border-bottom: 1px solid var(--subtle-border);
}
.custom-option:last-child { border-bottom: none; }
.custom-option:hover { background: var(--hover-bg); }
.custom-option.selected { background: var(--accent); color: #fff; font-weight: bold; }
.custom-option.hidden { display: none; }
.custom-select-search {
    position: sticky;
    top: 0;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-main);
    border: none;
    border-bottom: 1px solid var(--subtle-border);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    box-sizing: border-box;
    z-index: 1;
    outline: none;
}
.custom-select-search:focus { border-bottom-color: var(--accent); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* Admin Project Board */
.admin-status-zone {
    background: var(--subtle-bg);
    border: 2px dashed var(--subtle-border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    min-height: 100px;
    transition: background 0.2s, border-color 0.2s;
}
.admin-status-zone.drag-over {
    background: var(--hover-bg);
    border-color: var(--accent);
}
.admin-status-header {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.admin-project-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: grab;
    border: var(--glass-border);
}
.admin-project-card:hover { border-color: var(--text-muted); }
.admin-project-card.dragging { opacity: 0.5; border: 1px dashed white; }

/* Time Analysis Cards */
.time-card {
    background: var(--hover-bg);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: background 0.2s;
}
.time-card:hover { background: var(--hover-bg); }
.time-card-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.time-card-header h3 { margin: 0; font-size: 1rem; color: var(--project-color); }
.time-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
.time-card-grid > div {
    min-width: 0;
    overflow: hidden;
}
.task-time-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.task-time-title {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}
.task-time-hours {
    white-space: nowrap;
    flex-shrink: 0;
}
.time-card-content {
    padding: 0 20px 20px 20px;
    border-top: 1px solid var(--subtle-border);
    max-height: 50000px;
    opacity: 1;
    overflow: visible;
    transition: max-height 0.5s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
}
.time-card.collapsed .time-card-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
}
.time-card .toggle-icon { transition: transform 0.3s; display: inline-block; margin-left: 10px; font-size: 0.8rem; opacity: 0.7; }
.time-card.collapsed .toggle-icon { transform: rotate(-90deg); }

/* Dev Time Cards */
.dev-time-card {
    background: var(--hover-bg);
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
    border: 1px solid var(--subtle-border);
}
.dev-time-card-header {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}
.dev-time-card-header:hover { background: var(--hover-bg); }
.dev-time-card-content {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 50000px;
    opacity: 1;
    overflow: visible;
    transition: max-height 0.5s ease-out, opacity 0.25s ease-out, padding 0.25s ease-out;
}
.dev-time-card.collapsed .dev-time-card-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
}
.dev-time-card .toggle-icon { font-size: 0.7rem; transition: transform 0.2s; }
.dev-time-card.collapsed .toggle-icon { transform: rotate(-90deg); }

/* Team View */
.team-view-container { padding: 40px; height: 100%; overflow-y: auto; }
.team-details-header { margin-bottom: 30px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 20px; }
.team-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.detail-card { background: var(--hover-bg); border-radius: 12px; padding: 20px; }
.detail-card h3 { margin-bottom: 15px; color: var(--accent); border-bottom: 1px solid var(--subtle-border); padding-bottom: 10px; }
.member-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.member-table th { text-align: left; padding: 10px; color: var(--text-muted); border-bottom: 1px solid var(--subtle-border); }
.member-table td { padding: 10px; border-bottom: 1px solid var(--subtle-border); }
.project-list-simple { list-style: none; }
.project-list-simple li { padding: 10px; background: var(--subtle-bg); margin-bottom: 5px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }
.project-list-simple li:hover { background: var(--hover-bg); cursor: pointer; }

/* Analytics View */
.analytics-container { padding: 30px; height: 100%; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding-bottom: 100px; }
.chart-card { background: var(--glass-bg); border-radius: 12px; padding: 20px; border: var(--glass-border); display: flex; flex-direction: column; }
.chart-card.full-width { grid-column: span 2; }
.chart-header { margin-bottom: 20px; border-bottom: 1px solid var(--subtle-border); padding-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.chart-header h3 { color: var(--text-color); font-size: 1.1rem; }
.chart-body { flex: 1; min-height: 250px; position: relative; display: flex; align-items: center; justify-content: center; }

/* SVG Charts */
.cfd-chart { width: 100%; height: 100%; overflow: visible; }
.cfd-area { fill-opacity: 0.2; stroke-width: 2; }
.cfd-line { fill: none; stroke-width: 3; stroke-linecap: round; }
.cfd-axis { stroke: var(--subtle-border); stroke-width: 1; }
.cfd-label { font-size: 11px; font-weight: 500; }
.cfd-axis-label { fill: var(--text-muted); font-size: 9px; }
.cfd-axis-title { fill: var(--text-color); font-size: 11px; font-weight: 600; }
.cfd-tick { stroke: var(--subtle-border); stroke-width: 1; }
.cfd-grid { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 6, 4; opacity: 0.6; }
.cfd-tooltip { position: absolute; background: rgba(0,0,0,0.8); padding: 5px 10px; border-radius: 4px; font-size: 0.8rem; pointer-events: none; opacity: 0; transition: opacity 0.2s; border: 1px solid var(--accent); }

/* Performance Matrix */
.perf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 15px; width: 100%; }
.perf-card { background: var(--subtle-bg); border-radius: 8px; padding: 15px; display: flex; flex-direction: column; gap: 10px; border-left: 4px solid transparent; }
.perf-card.high-perf { border-left-color: var(--success); }
.perf-card.needs-help { border-left-color: var(--danger); }
.perf-card.steady { border-left-color: var(--warning); }

.perf-metric { display: flex; justify-content: space-between; font-size: 0.9rem; }
.perf-metric span:last-child { font-weight: bold; }
.perf-bar-bg { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.perf-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; }

/* Recommendation Box */
.rec-box { background: rgba(0, 210, 255, 0.1); border: 1px solid var(--accent); padding: 15px; border-radius: 8px; margin-bottom: 15px; }
.rec-title { font-weight: bold; color: var(--accent); margin-bottom: 5px; display: flex; align-items: center; gap: 10px; }
.rec-text { font-size: 0.9rem; opacity: 0.9; line-height: 1.5; }

.bottleneck-bar { display: flex; height: 30px; border-radius: 6px; overflow: hidden; margin-top: 10px; }
.bn-segment { display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: black; font-weight: bold; transition: width 0.5s; }

/* Forecast Modal */
.forecast-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.forecast-table th { text-align: left; padding: 10px; border-bottom: 1px solid var(--subtle-border); color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; }
.forecast-table td { padding: 12px 10px; border-bottom: 1px solid var(--subtle-border); }
.forecast-row:last-child td { border-bottom: none; }
.prob-badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; display: inline-block; min-width: 80px; text-align: center; }
.prob-50 { background: rgba(255, 159, 67, 0.2); color: #ff9f43; border: 1px solid #ff9f43; }
.prob-85 { background: rgba(0, 210, 255, 0.2); color: #00d2ff; border: 1px solid #00d2ff; }
.prob-95 { background: rgba(32, 191, 107, 0.2); color: #20bf6b; border: 1px solid #20bf6b; }
.forecast-summary { display: flex; gap: 20px; margin-bottom: 20px; background: var(--subtle-bg); padding: 15px; border-radius: 8px; }
.forecast-stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.forecast-stat span:first-child { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }
.forecast-stat span:last-child { font-size: 1.2rem; font-weight: bold; color: var(--text-color); }

/* ============================================
   RESPONSIVE DESIGN - Media Queries
   ============================================ */

/* Large screens and below (max-width: 1400px) */
@media (max-width: 1400px) {
    .modal-content { width: 95%; }
    .workflow-columns { min-width: 800px; }

    /* Top bar - responsive layout starts earlier */
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .project-info { width: 100%; }
    .project-info h1 { font-size: 1.4rem; }
    .controls {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    .controls .glass-input,
    .controls .glass-select,
    .controls .custom-select-wrapper {
        flex: 1 1 calc(25% - 8px);
        min-width: 140px;
    }
    .controls .glass-btn {
        flex: 0 1 auto;
    }
}

/* Tablets and smaller laptops (max-width: 1200px) */
@media (max-width: 1200px) {
    .sidebar { width: 220px; padding: 15px; }
    .top-bar { padding: 15px 20px; }
    .board-container { padding: 15px 20px; }

    .analytics-container { grid-template-columns: 1fr; }
    .chart-card.full-width { grid-column: span 1; }

    .team-details-grid { grid-template-columns: 1fr; }

    .task-drawer.open { width: 450px; min-width: 450px; }

    .admin-grid { padding: 20px; }
    .admin-header { padding: 20px; }
    .admin-header h1 { font-size: 1.4rem; }
}

/* Tablets (max-width: 992px) */
@media (max-width: 992px) {
    /* Sidebar becomes collapsible overlay from the RIGHT */
    .sidebar {
        position: fixed;
        right: 0;
        left: auto;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: -5px 0 20px rgba(0,0,0,0.3);
    }
    /* Override collapsed state when mobile-open is active */
    .sidebar.collapsed.mobile-open {
        transform: translateX(0);
    }
    .sidebar.collapsed:not(.mobile-open) { transform: translateX(100%); }

    /* Show mobile menu toggle button */
    .mobile-menu-toggle {
        display: flex !important;
    }

    /* Top bar row - full width to push menu toggle to right */
    .top-bar-row {
        width: 100%;
    }

    /* Sidebar close button - show X when sidebar is open */
    .sidebar.mobile-open #btn-toggle-sidebar {
        font-size: 0;
    }
    .sidebar.mobile-open #btn-toggle-sidebar::after {
        content: '✕';
        font-size: 1rem;
    }

    /* Reduce logo size on tablet to match mobile */
    .logo { font-size: 1.3rem; }

    /* Adjust main content */
    .main-content { margin-left: 0; }

    /* Top bar adjustments */
    .top-bar {
        padding: 15px;
    }
    .project-info h1 { font-size: 1.3rem; }
    .controls .glass-input,
    .controls .glass-select,
    .controls .custom-select-wrapper {
        flex: 1 1 calc(50% - 8px);
        min-width: 120px;
    }
    .controls .glass-btn {
        flex: 1 1 auto;
    }

    /* Calendar - 4 columns on tablet */
    .calendar-container {
        grid-template-columns: repeat(4, 1fr);
        padding: 15px;
    }

    /* Timeline adjustments */
    .timeline-sidebar-header,
    .timeline-label { width: 150px; }

    /* Workflow sections */
    .workflow-section { min-width: 250px; }
    .workflow-columns { min-width: 600px; }

    /* List view */
    .list-view-container { padding: 15px; }

    /* Team view */
    .team-view-container { padding: 20px; }

    /* Admin header */
    .admin-header { padding: 15px; margin-bottom: 20px; }
    .admin-header h1 { font-size: 1.3rem; }
}

/* Small tablets / Large phones (max-width: 768px) */
@media (max-width: 768px) {
    /* Typography adjustments */
    .logo { font-size: 1.3rem; }
    .project-info h1 { font-size: 1.2rem; }

    /* Top bar */
    .top-bar { padding: 12px; }
    .top-bar-row {
        margin-bottom: 10px;
    }
    .top-bar-row .project-info {
        flex: 1;
        min-width: 0; /* Allow text to shrink */
    }
    .top-bar-row .project-info h1 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .deadline-badge { display: none; }

    /* Controls - 2 column grid */
    .controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .controls .glass-input {
        grid-column: 1 / -1;
    }
    .controls-buttons {
        grid-column: 1 / -1;
        display: flex;
        gap: 6px;
    }
    .controls-buttons .glass-btn {
        flex: 1;
        font-size: 0.75rem;
        padding: 6px 8px;
        text-align: center;
    }

    /* Board container */
    .board-container { padding: 10px 15px; }

    /* Swimlane */
    .swimlane-header { padding: 10px 15px; font-size: 0.9rem; }
    .swimlane-content { padding: 10px; gap: 10px; }

    /* Workflow sections */
    .workflow-section { min-width: 220px; }
    .workflow-header { padding: 8px; font-size: 0.8rem; }
    .workflow-columns {
        min-width: 500px;
        gap: 8px;
        padding: 8px;
    }

    /* Task cards */
    .task-card {
        padding: 10px;
        max-width: 100%;
    }
    .task-title { font-size: 0.9rem; }
    .task-meta { font-size: 0.7rem; }

    /* Calendar - 2 columns on large phones */
    .calendar-container {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: minmax(100px, auto);
        gap: 8px;
    }
    .calendar-day { padding: 8px; min-height: 100px; }
    .calendar-day-header { font-size: 0.75rem; }
    .calendar-event { font-size: 0.7rem; padding: 3px 5px; }

    /* Timeline */
    .timeline-container { padding: 15px; }
    .timeline-sidebar-header,
    .timeline-label { width: 120px; font-size: 0.8rem; }
    .timeline-bar { font-size: 0.65rem; height: 20px; top: 10px; }

    /* List view */
    .task-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
    }
    .task-row > * { flex-shrink: 0; }

    /* Drawer — mobile full screen */
    .task-drawer.open {
        position: fixed;
        top: 0; right: 0;
        width: 100% !important;
        min-width: 100% !important;
        height: 100%;
        z-index: 100;
        border-left: none;
        border-radius: 0;
    }

    /* Bulk actions bar */
    .bulk-bar {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        max-width: 100%;
        padding: 12px 15px;
        flex-direction: column;
        gap: 10px;
    }
    .bulk-controls {
        width: 100%;
        justify-content: center;
    }

    /* Admin sections */
    .admin-section-header { padding: 15px; }
    .admin-section-content { padding: 0 15px 15px 15px; }

    /* Admin header */
    .admin-header {
        padding: 12px 15px;
        margin-bottom: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .admin-header h1 {
        font-size: 1.2rem;
        flex: 1;
        min-width: 0;
    }
    .admin-header-actions {
        gap: 8px;
    }
    .admin-header-actions .glass-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* Analytics */
    .analytics-container { padding: 15px; gap: 15px; }
    .chart-card { padding: 15px; }
    .chart-body { min-height: 200px; }

    /* Notifications */
    .notification-container {
        top: auto;
        bottom: 80px;
        left: 10px;
        right: 10px;
    }
    .notification-toast {
        min-width: auto;
        width: 100%;
    }
}

/* Mobile phones (max-width: 576px) */
@media (max-width: 576px) {
    /* Sidebar full width */
    .sidebar { width: 85%; max-width: 300px; }

    /* Top bar */
    .top-bar { padding: 10px; gap: 10px; }
    .project-info h1 { font-size: 1.1rem; word-break: break-word; }

    /* Controls - all full width */
    .controls { gap: 6px; }
    .controls .glass-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* Board */
    .board-container { padding: 8px 10px; }
    .swimlane { margin-bottom: 15px; border-radius: 8px; }
    .swimlane-header {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .swimlane-content { padding: 8px; }

    /* Workflow sections - narrower */
    .workflow-section { min-width: 180px; margin-right: 10px; }
    .workflow-columns { min-width: 400px; }
    .column { padding: 8px; min-height: 120px; }
    .column-header { font-size: 0.75rem; margin-bottom: 8px; }

    /* Task cards compact */
    .task-card { padding: 8px; margin-bottom: 8px; }
    .task-title { font-size: 0.85rem; margin-bottom: 3px; }
    .task-group { font-size: 0.65rem; }
    .task-meta { font-size: 0.65rem; margin-top: 5px; }
    .tag { font-size: 0.6rem; padding: 1px 4px; }

    /* Calendar - single column */
    .calendar-container {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }
    .calendar-day { min-height: 80px; }

    /* Timeline - hide labels, show on hover/tap */
    .timeline-sidebar-header,
    .timeline-label { width: 80px; font-size: 0.7rem; padding: 0 5px; }
    .timeline-row { height: 35px; }

    /* List view compact */
    .list-view-container { padding: 10px; }
    .list-project-header { padding: 12px 15px; }
    .list-project-header h3 { font-size: 1rem; }
    .list-swimlane-header { padding: 8px 12px; font-size: 0.9rem; }
    .list-status-group { padding: 8px; }
    .task-row { padding: 8px 10px; gap: 6px; font-size: 0.85rem; }

    /* Drawer adjustments */
    .drawer-body { padding: 15px; gap: 15px; }
    .drawer-description textarea { min-height: 150px; }
    .drawer-section-header h3 { font-size: 0.8rem; }

    /* Subtasks */
    .subtask-item { padding: 6px; gap: 8px; }

    /* Chat */
    .chat-input-area { flex-direction: column; gap: 8px; }
    .chat-input-area .glass-btn-sm { width: 100%; }

    /* Admin */
    .admin-grid { padding: 15px; gap: 15px; }
    .admin-section-header h3 { font-size: 1rem; }

    /* Admin header - stack on small screens */
    .admin-header {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px;
        gap: 10px;
    }
    .admin-header h1 {
        font-size: 1.1rem;
        text-align: center;
    }
    .admin-header-actions {
        justify-content: space-between;
        width: 100%;
    }
    .admin-header-actions .glass-btn {
        flex: 1;
        text-align: center;
    }

    /* Team view */
    .team-view-container { padding: 15px; }
    .team-details-header { margin-bottom: 20px; padding-bottom: 15px; }
    .detail-card { padding: 15px; }
    .detail-card h3 { font-size: 1rem; }
    .member-table { font-size: 0.8rem; }
    .member-table th, .member-table td { padding: 8px 5px; }

    /* Analytics */
    .analytics-container { padding: 10px; gap: 10px; padding-bottom: 80px; }
    .chart-card { padding: 12px; }
    .chart-header h3 { font-size: 1rem; }
    .chart-body { min-height: 180px; }
    .perf-grid { grid-template-columns: 1fr; }

    /* Forecast */
    .forecast-summary { flex-direction: column; gap: 10px; }
    .forecast-table { font-size: 0.8rem; }
    .forecast-table th, .forecast-table td { padding: 8px 5px; }

    /* Bulk bar */
    .bulk-bar { padding: 10px 12px; gap: 8px; }
    .bulk-controls .glass-select,
    .bulk-controls .glass-btn {
        flex: 1 1 calc(50% - 5px);
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    /* User profile in sidebar */
    .user-profile { padding: 8px; gap: 8px; }
    .avatar { width: 30px; height: 30px; font-size: 0.8rem; }

    /* Custom selects */
    .custom-select-wrapper { min-width: 100px; }
    .custom-select-trigger { padding: 0 10px; height: 32px; font-size: 0.85rem; }
    .custom-option { padding: 8px 10px; font-size: 0.85rem; }
}

/* Very small phones (max-width: 400px) */
@media (max-width: 400px) {
    .project-info h1 { font-size: 1rem; }

    .workflow-section { min-width: 160px; }
    .workflow-columns { min-width: 350px; }

    .calendar-day { padding: 6px; }

    .timeline-sidebar-header,
    .timeline-label { width: 60px; font-size: 0.65rem; }

    /* Admin header */
    .admin-header h1 { font-size: 1rem; }
    .admin-header-actions .glass-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
    }

    .bulk-controls .glass-select,
    .bulk-controls .glass-btn {
        flex: 1 1 100%;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-section li { padding: 12px; }
    .glass-btn { padding: 10px 18px; }
    .glass-btn-sm { padding: 6px 10px; }
    .task-card { padding: 14px; }
    .task-row { padding: 12px 14px; }

    /* Remove hover effects that don't work well on touch */
    .task-card:hover {
        transform: none;
        box-shadow: none;
    }
    .task-row:hover {
        background: var(--hover-bg);
    }

    /* Disable grab cursor on touch */
    .task-card, .task-row { cursor: default; }
}

/* Landscape orientation adjustments for mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .drawer-body { padding: 10px 20px; }

    .calendar-container { grid-auto-rows: minmax(80px, auto); }
}

/* Print styles */
@media print {
    .sidebar, .top-bar, .bulk-bar, .notification-container { display: none !important; }
    .main-content { margin: 0; padding: 20px; }
    .task-card { break-inside: avoid; }
}

/* SWOT Module Styles */
.swot-container {
    padding: 30px;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 100px;
}

.swot-section {
    padding: 20px;
    border-radius: 12px;
}

.swot-context-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.swot-workspace {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    min-height: 500px;
}

.swot-brainstorm {
    padding: 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.swot-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.swot-matrix {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
}

.swot-quadrant {
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.quadrant-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.swot-drop-zone {
    flex: 1;
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 10px;
    border: 1px dashed var(--subtle-border);
}

.swot-item {
    background: var(--glass-bg);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: grab;
    border: 1px solid var(--subtle-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.swot-item-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.priority-indicator {
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    user-select: none;
}
.priority-indicator.p-1 { color: var(--success); } /* Low */
.priority-indicator.p-2 { color: var(--warning); } /* Med */
.priority-indicator.p-3 { color: var(--danger); }  /* High */
.priority-indicator:hover { opacity: 0.8; transform: scale(1.1); }

.delete-swot {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
}
.delete-swot:hover { color: var(--danger); }

.swot-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.swot-ai-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--subtle-border);
    animation: slideDown 0.3s ease-out;
}

.swot-generated-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 15px;
}

.swot-gen-card {
    background: var(--glass-bg);
    border: 1px solid var(--subtle-border);
    border-radius: 8px;
    padding: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
}

.swot-gen-card.selected {
    box-shadow: 0 0 0 2px var(--accent);
    background: rgba(102, 126, 234, 0.05);
    border-color: var(--accent);
}

.swot-gen-card:not(.selected) {
    opacity: 0.6;
}

.gen-context-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--subtle-bg);
    color: var(--text-muted);
    margin-bottom: 8px;
    display: inline-block;
    text-transform: uppercase;
    font-weight: bold;
}

.swot-results-group {
    padding: 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--subtle-border);
}

.swot-results-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--subtle-border);
}

.swot-results-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.swot-results-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.gen-subtasks {
    background: var(--subtle-bg);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.gen-subtasks ul { list-style: none; padding: 0; margin: 0; }
.gen-subtasks li { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 4px; color: var(--text-muted); }
.gen-subtasks li input { margin-top: 3px; }
.gen-subtasks label { display: block; font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; font-weight: bold; }

.ai-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.ai-card {
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--accent);
    background: rgba(102, 126, 234, 0.05);
}

.ai-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* SMART Objectives */
.smart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.smart-card {
    background: var(--glass-bg);
    border: 1px solid var(--subtle-border);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}
.smart-breakdown {
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.smart-field { margin-bottom: 4px; }
.smart-field strong { color: var(--accent); display: inline-block; width: 20px; font-weight: bold; }
.smart-statement {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--subtle-border);
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* SWOT Wizard */
.swot-wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
    padding: 0 40px;
}
.swot-wizard-progress::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--subtle-border);
    z-index: 0;
}
.swot-step-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 2px solid var(--subtle-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    position: relative;
    z-index: 1;
    transition: all 0.3s;
}
.swot-step-indicator.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
    box-shadow: 0 0 10px var(--accent-glow);
}
.swot-step-indicator.completed {
    border-color: var(--success);
    background: var(--success);
    color: white;
}
.swot-step-label {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--text-muted);
}
.swot-step-indicator.active .swot-step-label { color: var(--accent); }

.ai-chat-interface { background: var(--subtle-bg); border-radius: 8px; padding: 15px; margin-top: 20px; border: 1px solid var(--subtle-border); }
.ai-message { display: flex; gap: 10px; margin-bottom: 10px; }
.ai-avatar { width: 30px; height: 30px; background: var(--accent-secondary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; flex-shrink: 0; }
.ai-bubble { background: var(--glass-bg); padding: 10px 15px; border-radius: 0 12px 12px 12px; font-size: 0.9rem; border: 1px solid var(--subtle-border); max-width: 80%; }

@media (max-width: 992px) {
    .swot-workspace {
        grid-template-columns: 1fr;
    }
    .swot-matrix {
        min-height: 600px;
    }
}

/* SWOT Wizard Project Selection (Step 5) */
.modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--subtle-border);
}

.modal-tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.modal-tab-btn:hover { color: var(--text-color); background: var(--hover-bg); border-radius: 6px 6px 0 0; }
.modal-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.grid-col-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) { .grid-col-2 { grid-template-columns: 1fr; } }

/* --- Permission UI: chips, picker, badges --- */

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 28px;
    padding: 4px 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 14px;
    background: var(--hover-bg);
    border: 1px solid var(--border-strong);
    font-size: 0.82rem;
    color: var(--text-primary);
}
body.dark-theme .chip {
    background: var(--bg-secondary);
}

.chip .chip-x {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}
.chip .chip-x:hover { color: var(--danger); }

.picker-results {
    list-style: none;
    margin: 6px 0 0 0;
    padding: 0;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.18);
}

.picker-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.picker-result:last-child { border-bottom: none; }
.picker-result:hover { background: rgba(255, 255, 255, 0.06); }
.picker-result.empty { cursor: default; opacity: 0.5; justify-content: center; }

.origin-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-left: 8px;
}
.origin-badge.synced {
    background: rgba(80, 160, 255, 0.18);
    color: #6cb1ff;
    border: 1px solid rgba(80, 160, 255, 0.35);
}
.origin-badge.manual {
    background: rgba(180, 130, 255, 0.18);
    color: #b78dff;
    border: 1px solid rgba(180, 130, 255, 0.35);
}

.pp-swimlane-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}
.pp-swimlane-table th,
.pp-swimlane-table td {
    text-align: center;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.85rem;
}
.pp-swimlane-table th {
    color: var(--text-muted);
    font-weight: 500;
}

.user-inactive { opacity: 0.6; }

