:root {
    /* Brand & Accents */
    --primary: #7c3aed;
    --primary-strong: #5b21b6;
    --primary-hover: #6d28d9;
    --accent: #22d3ee;
    --accent-glow: rgba(124, 58, 237, 0.3);

    /* Backgrounds */
    --bg-body: #0b1220;
    --bg-subtle: #11182a;
    --bg-card: #0f172a;
    --bg-column: rgba(255, 255, 255, 0.03);
    --modal-overlay: rgba(4, 6, 15, 0.7);

    /* Text */
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-highlight: #ffffff;

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #38bdf8;

    /* Borders & Effects */
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    --radius: 14px;
    --radius-sm: 10px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgb(0 0 0 / 0.18);
    --shadow: 0 10px 30px rgb(0 0 0 / 0.25);
    --shadow-lg: 0 25px 60px rgb(0 0 0 / 0.35);
    --glow: 0 0 28px -6px var(--accent-glow);

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}


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

body {
    font-family: var(--font-sans);
    background: radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.08), transparent 30%), radial-gradient(circle at 80% 0%, rgba(34, 211, 238, 0.12), transparent 28%), var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
    height: 72px;
    /* Taller header */
    background: rgba(15, 23, 42, 0.6);
    /* Translucent */
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 40;
}

main.board-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.75rem 2.25rem 2.25rem;
    overflow-y: auto;
    overflow-x: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.board-header {
    display: grid;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(34, 211, 238, 0.05));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.header-spacer {
    height: 100%;
}

.column-header {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.column-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.column-title {
    font-weight: 700;
    letter-spacing: -0.01em;
}

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

.column-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
}

.col-actions {
    display: flex;
    gap: 0.25rem;
}

.projects-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 1rem;
    width: 100%;
}

.project-row {
    display: grid;
    gap: 1rem;
    align-items: stretch;
    width: 100%;
}

.project-info {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    position: relative;
    overflow: hidden;
}

.project-info::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), transparent 45%);
    opacity: 0.5;
    pointer-events: none;
}

.project-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.project-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.project-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-highlight);
    letter-spacing: -0.025em;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    box-shadow: 0 0 15px -3px var(--accent-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    outline: none;
    letter-spacing: 0.01em;
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-hover);
    color: var(--text-highlight);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--text-highlight);
    background: rgba(255, 255, 255, 0.08);
    align-items: start;
}

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

.project-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    align-items: center;
}

.project-title {
    font-weight: 600;
    font-size: 1rem;
}

.project-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Kanban Columns & Cards */
.kanban-column {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
    border-radius: var(--radius);
    padding: 1rem;
    min-height: 220px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border: 1px solid var(--border);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
}

.kanban-column:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.kanban-column.drag-over {
    border-color: var(--primary-hover);
    background: rgba(124, 58, 237, 0.1);
    box-shadow: inset 0 0 20px rgba(124, 58, 237, 0.12);
}

.task-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(124, 58, 237, 0.04));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.95rem 1rem;
    cursor: grab;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    isolation: isolate;
}

.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--card-color, var(--primary));
    /* Set via inline style */
    opacity: 0.8;
}

.task-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
    z-index: 5;
}

.task-card:active {
    cursor: grabbing;
    transform: scale(0.98);
}

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

.task-chips {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.pill-high { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); color: #fecdd3; }
.pill-medium { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.35); color: #fcd34d; }
.pill-low { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.35); color: #bbf7d0; }
.pill-muted { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); }
.pill-ghost { background: rgba(255, 255, 255, 0.02); color: var(--text-main); border-color: var(--border); }

.task-actions-hover {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
}

.task-card:hover .task-actions-hover {
    opacity: 1;
}

.task-title {
    font-weight: 600;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
    line-height: 1.4;
    color: var(--text-main);
}

.task-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.add-task-ghost {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    opacity: 0.7;
    background: rgba(255, 255, 255, 0.02);
}

.add-task-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
    opacity: 1;
    background: rgba(124, 58, 237, 0.08);
    box-shadow: 0 8px 16px rgba(124, 58, 237, 0.15);
}

/* Color Swatches */
.color-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.1s, border-color 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.color-swatch.selected {
    border-color: #fff !important;
    box-shadow: 0 0 0 3px var(--primary);
    transform: scale(1.1);
}

.task-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay);
    backdrop-filter: blur(8px);
    display: block;
    z-index: 50;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    z-index: 51;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Spring-ish */
}

.modal.hidden {
    transform: translate(-50%, -40%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    display: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-highlight);
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

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

/* Comments */
.comments-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.comments-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.comment-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.add-comment-box {
    display: flex;
    gap: 0.75rem;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    border: 2px solid var(--bg-body);
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-header {
        padding: 0 1rem;
    }

    .board-container {
        padding: 1rem;
    }

    /* Stack Board Header (Columns) vertically or hide them and show inside project? 
       Actually, standard Kanban on mobile usually scrolls horizontally OR stacks.
       Let's clear the grid template to allow stacking if needed, or keeping scroll.
       For this specific layout (Row per project), mobile is tricky.
       Let's stack columns within each project row.
    */
    .board-header {
        display: none;
        /* Hide global header on mobile, columns are inside projects */
    }

    .project-row {
        grid-template-columns: 1fr !important;
        /* Stack everything */
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .kanban-column {
        min-height: 100px;
    }

    /* We might want to show column title inside column on mobile since header is gone */
    .kanban-column::before {
        content: attr(data-title);
        display: block;
        font-weight: bold;
        margin-bottom: 0.5rem;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.75rem;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
}