@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Space+Grotesk:wght@300..700&family=JetBrains+Mono:wght@100..800&display=swap');

:root {
    /* 2025 Trending Palette */
    --bg-canvas: #f0f2f5;
    --accent-indigo: #6366f1;
    --accent-indigo-glow: rgba(99, 102, 241, 0.2);
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --text-heading: #0f172a;
    --text-body: #475569;
    --text-muted: #94a3b8;

    /* Glass Effects */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);

    /* Bento Grid Config */
    --bento-gap: 20px;
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-canvas);
    color: var(--text-body);
    min-height: 100vh;
    margin: 0;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    padding: 24px;
    gap: 24px;
}

@media (max-width: 992px) {
    .app-container {
        flex-direction: column;
        padding: 12px;
    }
}

/* Sidebar - Glassmorphism */
.sidebar-glass {
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--glass-shadow);
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 24px;
    height: calc(100vh - 48px);
    z-index: 1000;
    transition: var(--transition);
}

@media (max-width: 992px) {
    .sidebar-glass {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding: 0 12px;
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-indigo), #818cf8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 16px var(--accent-indigo-glow);
}

.logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-heading);
    letter-spacing: -0.02em;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 12px;
}

.nav-link-modern {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    color: var(--text-body);
    text-decoration: none !important;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
}

.nav-link-modern:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-indigo);
    transform: translateX(4px);
}

.nav-link-modern.active {
    background: var(--accent-indigo);
    color: white !important;
    box-shadow: 0 8px 16px var(--accent-indigo-glow);
}

/* Main Content Area */
.main-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
    /* Fix flexbox shrink issues */
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
}

.main-header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0;
}

.user-profile-pill {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 6px 6px 6px 16px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--glass-shadow);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.user-profile-pill:hover {
    background: white;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--accent-indigo);
}

/* Bento Grid */
.bento-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(160px, auto);
    gap: var(--bento-gap);
}

@media (max-width: 1200px) {
    .bento-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .bento-container {
        grid-template-columns: 1fr;
    }
}

.bento-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    overflow: hidden;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.bento-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.1);
}

.bento-card.primary {
    background: linear-gradient(135deg, var(--accent-indigo), #818cf8);
    color: white;
}

.bento-card.span-2 {
    grid-column: span 2;
}

.bento-card.row-2 {
    grid-row: span 2;
}

/* Dashboard Elements */
.data-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.primary .data-label {
    color: rgba(255, 255, 255, 0.7);
}

.data-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-heading);
    letter-spacing: -0.05em;
}

.primary .data-value {
    color: white;
}

/* Modern Tables */
.table-glass {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table-glass th {
    padding: 12px 24px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
}

.table-glass tr td {
    background: rgba(255, 255, 255, 0.4);
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition);
}

.table-glass tr td:first-child {
    border-left: 1px solid var(--glass-border);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.table-glass tr td:last-child {
    border-right: 1px solid var(--glass-border);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.table-glass tr:hover td {
    background: white;
    transform: scale(1.005);
}

/* Status Chips 2025 */
.status-pill {
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-pill.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-emerald);
}

.status-pill.danger {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
}

.status-pill.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* Form Controls 2025 */
.input-glass {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.9375rem;
    transition: var(--transition);
}

.input-glass:focus {
    background: white;
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 4px var(--accent-indigo-glow);
    outline: none;
}

.btn-glass {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-glass-primary {
    background: var(--accent-indigo);
    color: white;
    box-shadow: 0 4px 12px var(--accent-indigo-glow);
}

.btn-glass-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-indigo-glow);
}

/* Legacy Compat */
.dashboard-tile {
    display: none;
    /* We are re-modeling these */
}

/* --- Premium Data Tables --- */
.table-premium {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-premium thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.table-premium tbody td {
    padding: 1.25rem 1.5rem;
    background: white;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
    transition: background 0.2s ease;
}

.table-premium tbody tr:hover td {
    background: #fdfdff;
}

.table-premium tbody tr:last-child td {
    border-bottom: none;
}

/* Priority Badges */
.priority-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.priority-pill.urgent {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.priority-pill.high {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.priority-pill.medium {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.priority-pill.low {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

/* Status Select Modern */
.status-select-modern {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.75rem;
    font-weight: 500;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.status-select-modern:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* User Avatar Stack */
.user-avatar-pill {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--accent-indigo);
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-transform: uppercase;
}

.recurring-indicator {
    display: inline-flex;
    color: var(--accent-indigo);
    background: rgba(99, 102, 241, 0.08);
    padding: 4px;
    border-radius: 4px;
    margin-left: 8px;
}

/* --- Kanban Board System --- */
.kanban-board-scroll {
    overflow-x: auto;
    padding-bottom: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-indigo) #f1f5f9;
}

.kanban-board-scroll::-webkit-scrollbar {
    height: 6px;
}

.kanban-board-scroll::-webkit-scrollbar-thumb {
    background: var(--accent-indigo);
    border-radius: 10px;
}

.kanban-column-modern {
    min-width: 320px;
    width: 320px;
    background: rgba(248, 250, 252, 0.4);
    border-radius: 24px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
}

.kanban-column-modern:hover {
    background: rgba(248, 250, 252, 0.8);
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.5rem;
}

.kanban-task-card {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid #eef2f6;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.kanban-task-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(99, 102, 241, 0.3);
}

.kanban-task-card .task-project-tag {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-indigo);
    background: rgba(99, 102, 241, 0.06);
    padding: 3px 10px;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    display: inline-block;
}

.kanban-task-card .task-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.kanban-task-card .task-footer {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.avatar-stack-mini {
    display: flex;
    align-items: center;
}

.avatar-mini {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-indigo);
    border: 2px solid white;
}

/* --- Detail Page & Timeline --- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
}

@media (max-width: 992px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.timeline-modern {
    position: relative;
    padding-left: 0;
}

.timeline-modern-item {
    position: relative;
    padding-bottom: 1.75rem;
    padding-left: 3.5rem;
    display: flex;
    flex-direction: column;
}

.timeline-modern-item::before {
    content: '';
    position: absolute;
    left: 1.25rem;
    top: 2.5rem;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #e2e8f0 0%, #f1f5f9 100%);
}

.timeline-modern-item:last-child::before {
    display: none;
}

.timeline-icon-box {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #e2e8f0;
    z-index: 2;
    transition: all 0.2s ease;
}

.timeline-icon-box.created {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    color: #4338ca;
}

.timeline-icon-box.assigned,
.timeline-icon-box.reassigned {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    color: #059669;
}

.timeline-icon-box.status_changed,
.timeline-icon-box.in_progress {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
    color: #2563eb;
}

.timeline-icon-box.completed {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.3);
    color: #16a34a;
}

.timeline-icon-box.on_hold {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
    color: #d97706;
}

.timeline-icon-box.commented {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.3);
    color: #9333ea;
}

.timeline-content-box {
    background: white;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.timeline-content-box:hover {
    border-color: #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.timeline-event-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.timeline-event-meta {
    font-size: 0.7rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.timeline-event-note {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-left: 3px solid var(--accent-indigo);
    border-radius: 6px;
    font-size: 0.75rem;
    color: #475569;
    font-style: italic;
    line-height: 1.5;
}

.timeline-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #64748b;
}

/* Timeline Filter Buttons */
.timeline-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeline-filter-btn:hover {
    border-color: var(--accent-indigo);
    color: var(--accent-indigo);
    background: rgba(99, 102, 241, 0.03);
}

.timeline-filter-btn.active {
    background: var(--accent-indigo);
    border-color: var(--accent-indigo);
    color: white;
}

.timeline-filter-btn.active:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}



.description-box {
    background: rgba(248, 250, 252, 0.5);
    border: 1px solid #edf2f7;
    padding: 1.5rem;
    border-radius: 12px;
    line-height: 1.6;
    color: #475569;
}

.comment-bubble {
    background: white;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.comment-bubble:hover {
    border-color: #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.comment-bubble.internal {
    background: #fffbeb;
    border-color: #fef3c7;
    border-left: 4px solid #f59e0b;
}

.role-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
}

.role-badge.admin {
    background: rgba(99, 102, 241, 0.15);
    color: #4338ca;
}

.role-badge.manager {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.comment-thread-line {
    position: absolute;
    left: 15px;
    top: 40px;
    bottom: -20px;
    width: 2px;
    background: #f1f5f9;
}

.comment-item:last-child .comment-thread-line {
    display: none;
}

/* --- File Attachment Cards --- */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.file-card-modern {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    transition: all 0.2s ease;
}

.file-card-modern:hover {
    border-color: var(--accent-indigo);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    background: #fcfdfe;
}

.file-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-indigo);
    flex-shrink: 0;
}

.file-info-main {
    flex-grow: 1;
    min-width: 0;
}

.file-name-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-meta-sub {
    font-size: 0.65rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-download-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.05);
    color: var(--accent-indigo);
    border: none;
    transition: all 0.2s;
}

.file-download-btn:hover {
    background: var(--accent-indigo);
    color: white;
}