:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-kanban: #ebedf0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    transition: width 0.3s;
}

/* Hide mobile-header as we are using persistent sidebar */
.mobile-header {
    display: none !important;
}

.sidebar-overlay {
    display: none !important;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-title {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 10px;
    transition: 0.2s;
    font-weight: 500;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.nav-item.active {
    background: #eef2ff;
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    height: 20px;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 32px;
    width: 100%;
    min-height: 100vh;
    transition: 0.3s;
}

/* On Desktop, we might want it always open if screen > 1400px, but user asked for HIDDEN */
@media (min-width: 1400px) {
    /* Optional: Show sidebar by default on very large screens */
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    gap: 16px;
    flex-wrap: wrap;
    /* Allow wrapping if content is too wide */
}

@media (max-width: 600px) {
    .top-bar {
        margin-bottom: 24px;
        gap: 12px;
    }

    .top-bar h2 {
        font-size: 1.25rem;
    }

    .btn-primary {
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* Modals */
.modal {
    display: none;
    /* Important to keep hidden */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex !important;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    position: relative;
}

#task-modal .modal-content {
    max-width: 900px;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block !important;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
    }

    .sidebar .logo-title,
    .sidebar .nav-item span {
        display: none;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .sidebar .logo {
        justify-content: center;
        margin-bottom: 30px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: row;
        /* Keep it side by side even on mobile */
    }

    .main-content {
        padding: 16px;
    }

    .sidebar {
        width: 70px;
        /* Very thin on mobile */
        padding: 15px 5px;
    }

    /* On mobile, if top-bar h2 is redundant with logo, we can hide it or shrink it */
    .top-bar h2 {
        display: flex;
        align-items: center;
    }
}

.menu-toggle {
    display: none !important;
    /* Remove toggles as menu is always visible */
}

/* Utils */
.hide-mobile {
    @media (max-width: 768px) {
        display: none !important;
    }
}

.btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.badge-income {
    background: #ecfdf5;
    color: #10b981;
}

.badge-expense {
    background: #fef2f2;
    color: #ef4444;
}

/* Kanban Board & Dynamic Columns */
.kanban-board {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: calc(100vh - 200px);
}

.kanban-column {
    background: var(--bg-kanban);
    border-radius: 12px;
    min-width: 300px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
}

.column-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
}

.column-header:hover .column-actions {
    opacity: 1;
}

.column-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.column-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: 0.2s;
}

.column-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
}

.column-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.add-column-area {
    min-width: 250px;
    background: rgba(0, 0, 0, 0.03);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Attachments */
.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
}

.attachment-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.attachment-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.attachment-delete {
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
}

.task-card-attachments {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}


/* Kanban Board Styles */
.kanban-board {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 20px;
    min-height: calc(100vh - 200px);
}

.kanban-column {
    background: var(--bg-kanban);
    border-radius: 12px;
    min-width: 300px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.column-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.column-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-count {
    background: #dfe1e6;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.task-list {
    padding: 8px;
    flex-grow: 1;
    min-height: 50px;
}

.task-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: 0.2s;
    border-left: 4px solid transparent;
}

.task-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.task-card:active {
    cursor: grabbing;
}

.task-card.priority-high {
    border-left-color: var(--danger);
}

.task-card.priority-medium {
    border-left-color: var(--warning);
}

.task-card.priority-low {
    border-left-color: var(--success);
}

.task-card-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.task-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.add-card-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-radius: 0 0 12px 12px;
    font-weight: 500;
}

.add-card-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

/* Drag & Drop Feedback */
.task-list.drag-over {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}