@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    /* Corporate Color Palette with Lime/Yellow Logo Accents */
    --brand-hue: 82;
    --brand-primary: hsl(var(--brand-hue), 84%, 60%);
    --brand-primary-hover: hsl(var(--brand-hue), 84%, 50%);
    --brand-light: hsl(var(--brand-hue), 85%, 96%);
    
    /* Global Backgrounds & Neutral Shades */
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    
    /* Kanban Status Colors */
    --status-todo-bg: #eff6ff;
    --status-todo-text: #1d4ed8;
    --status-todo-border: #bfdbfe;
    
    --status-progress-bg: #fffbeb;
    --status-progress-text: #b45309;
    --status-progress-border: #fde68a;
    
    --status-done-bg: #f0fdf4;
    --status-done-text: #15803d;
    --status-done-border: #bbf7d0;

    /* Semantic Priorities */
    --priority-high-bg: #fee2e2;
    --priority-high-text: #ef4444;
    --priority-high-border: #fca5a5;
    
    --priority-medium-bg: #fef3c7;
    --priority-medium-text: #d97706;
    --priority-medium-border: #fde68a;
    
    --priority-low-bg: #f0fdf4;
    --priority-low-text: #16a34a;
    --priority-low-border: #bbf7d0;

    /* General Styles */
    --font-family: 'Sarabun', 'Inter', sans-serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 0 15px rgba(163, 230, 53, 0.3);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-app: #0b0f19;
    --bg-card: #151f32;
    --bg-sidebar: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #2e3e56;
    
    --brand-light: hsl(var(--brand-hue), 25%, 12%);
    --brand-primary: hsl(var(--brand-hue), 70%, 48%);
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    
    --status-todo-bg: rgba(29, 78, 216, 0.15);
    --status-todo-border: rgba(29, 78, 216, 0.3);
    --status-progress-bg: rgba(180, 83, 9, 0.15);
    --status-progress-border: rgba(180, 83, 9, 0.3);
    --status-done-bg: rgba(21, 128, 61, 0.15);
    --status-done-border: rgba(21, 128, 61, 0.3);

    --priority-high-bg: rgba(239, 68, 68, 0.15);
    --priority-high-border: rgba(239, 68, 68, 0.3);
    --priority-medium-bg: rgba(217, 119, 6, 0.15);
    --priority-medium-border: rgba(217, 119, 6, 0.3);
    --priority-low-bg: rgba(22, 163, 74, 0.15);
    --priority-low-border: rgba(22, 163, 74, 0.3);
}

/* Hide elements based on RBAC permissions */
body.role-member .manager-only {
    display: none !important;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: var(--transition);
}

/* Layout container */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    transition: var(--transition);
    z-index: 10;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--brand-primary), #fef08a);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    text-decoration: none;
}

.menu-item:hover {
    background-color: var(--brand-light);
    color: var(--text-primary);
}

.menu-item.active {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-light));
    color: #0f172a;
    font-weight: 600;
}

.menu-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* User Switcher */
.user-switch-box {
    margin-top: 24px;
    padding: 16px;
    background-color: var(--brand-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.user-switch-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.user-select {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
    position: relative;
}

/* Top Header */
.top-header {
    height: 70px;
    min-height: 70px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    transition: var(--transition);
}

.header-title-section h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-title-section p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Notification Area */
.notifications-wrapper {
    position: relative;
}

.notifications-bell {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

.notifications-bell:hover {
    background-color: var(--brand-light);
    color: var(--text-primary);
}

.bell-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ef4444;
    display: none;
}

.bell-badge.active {
    display: block;
}

.notifications-dropdown {
    position: absolute;
    right: 0;
    top: 45px;
    width: 320px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.notifications-dropdown.active {
    display: flex;
}

.notification-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    background-color: var(--bg-app);
}

.notification-header-clear {
    color: var(--brand-primary-hover);
    cursor: pointer;
    font-size: 0.8rem;
}

.notification-list {
    max-height: 250px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    line-height: 1.4;
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover {
    background-color: var(--brand-light);
}

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

.notification-time {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.notification-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Theme toggle button */
.theme-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.theme-btn:hover {
    background-color: var(--brand-light);
}

.theme-btn svg, .notifications-bell svg {
    width: 18px;
    height: 18px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    font-family: var(--font-family);
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--brand-primary);
    color: #0f172a;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--brand-primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.btn-danger {
    background-color: #fee2e2;
    color: #ef4444;
}

.btn-danger:hover {
    background-color: #fecaca;
}

/* View Sections */
.view-section {
    display: none;
    padding: 32px;
    animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-total .stat-icon { background-color: var(--brand-light); color: var(--text-primary); }
.stat-progress .stat-icon { background-color: var(--status-progress-bg); color: var(--status-progress-text); }
.stat-review .stat-icon { background-color: #f3e8ff; color: #a855f7; }
.stat-overdue .stat-icon { background-color: #fee2e2; color: #ef4444; }

/* Dashboard layout grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    align-items: start;
    margin-bottom: 32px;
}

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

.section-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Custom CSS Workload Charts */
.workload-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.workload-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.workload-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
}

.workload-name {
    color: var(--text-primary);
}

.workload-count {
    color: var(--text-muted);
}

.workload-bar-bg {
    height: 8px;
    background-color: var(--bg-app);
    border-radius: 4px;
    overflow: hidden;
}

.workload-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary), #fbbf24);
    border-radius: 4px;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* System-Wide Activity Feed in Dashboard */
.activity-feed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 4px;
}

.activity-feed-item {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    line-height: 1.4;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.activity-feed-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-feed-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    margin-top: 5px;
}

.activity-feed-content {
    flex: 1;
}

.activity-feed-time {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 2px;
}

/* Toolbar filters */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-family);
    outline: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--brand-primary);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.filters-group {
    display: flex;
    gap: 6px;
    overflow-x: auto;
}

.filter-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: none;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-btn.active {
    background-color: var(--brand-primary);
    color: #0f172a;
    border-color: var(--brand-primary);
}

/* Table styling */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.task-table th {
    background-color: var(--bg-app);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.task-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.task-table tr:hover td {
    background-color: var(--brand-light);
}

/* Avatar representation */
.avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    color: #0f172a;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    margin-right: 8px;
    box-shadow: var(--shadow-sm);
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    border: 1px solid transparent;
}

.badge-todo { background-color: var(--status-todo-bg); color: var(--status-todo-text); border-color: var(--status-todo-border); }
.badge-progress { background-color: var(--status-progress-bg); color: var(--status-progress-text); border-color: var(--status-progress-border); }
.badge-done { background-color: var(--status-done-bg); color: var(--status-done-text); border-color: var(--status-done-border); }

.badge-priority-high { background-color: var(--priority-high-bg); color: var(--priority-high-text); border-color: var(--priority-high-border); }
.badge-priority-medium { background-color: var(--priority-medium-bg); color: var(--priority-medium-text); border-color: var(--priority-medium-border); }
.badge-priority-low { background-color: var(--priority-low-bg); color: var(--priority-low-text); border-color: var(--priority-low-border); }

.overdue-text {
    color: #ef4444;
    font-weight: 600;
}

/* Kanban Board Section */
.kanban-board-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: start;
    height: calc(100vh - 200px);
    min-height: 450px;
}

@media (max-width: 900px) {
    .kanban-board-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.kanban-column {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid transparent;
}

.column-todo { border-bottom-color: var(--status-todo-text); }
.column-progress { border-bottom-color: var(--status-progress-text); }
.column-done { border-bottom-color: var(--status-done-text); }

.kanban-column-title {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-count-pill {
    background-color: var(--bg-app);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.kanban-cards-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 250px;
    overflow-y: auto;
    flex: 1;
    padding: 4px;
}

.kanban-cards-container.drag-over {
    background-color: var(--brand-light);
    border: 2px dashed var(--brand-primary);
    border-radius: var(--radius-md);
}

/* Kanban Card layout */
.kanban-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    user-select: none;
    position: relative;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-primary);
}

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

.kanban-card.dragging {
    opacity: 0.5;
    border: 2px dashed var(--brand-primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
    cursor: pointer;
}

.card-title:hover {
    color: var(--brand-primary-hover);
    text-decoration: underline;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.card-meta-indicators {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.card-indicator-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.card-indicator-item svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
}

.card-date {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-date svg {
    width: 14px;
    height: 14px;
}

.card-actions-menu {
    position: relative;
}

.card-dots {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
}

.card-dots:hover {
    background-color: var(--bg-app);
    color: var(--text-primary);
}

/* Dropdown action menu */
.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    display: none;
    flex-direction: column;
    z-index: 10;
    width: 120px;
}

.dropdown-menu.active {
    display: flex;
}

.dropdown-item {
    padding: 8px 12px;
    border: none;
    background: none;
    font-family: var(--font-family);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    color: var(--text-primary);
}

.dropdown-item:hover {
    background-color: var(--brand-light);
}

/* Modals Overlay Base */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 28px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Detailed Task Sidebar Modal Layout */
.detail-modal-content {
    max-width: 900px; /* Wider split layout modal */
    width: 90%;
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.detail-modal-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-app);
}

.detail-modal-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    overflow: hidden;
}

@media (max-width: 768px) {
    .detail-modal-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .detail-modal-right {
        border-left: none !important;
        border-top: 1px solid var(--border-color);
    }
}

.detail-modal-left {
    padding: 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-modal-right {
    padding: 28px;
    overflow-y: auto;
    background-color: var(--bg-app);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Detailed fields */
.detail-desc-box {
    line-height: 1.5;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 12px 16px;
    background-color: var(--bg-app);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.detail-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Checklist / Subtasks styles */
.subtasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.subtask-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-primary-hover);
    cursor: pointer;
}

.subtask-text {
    flex: 1;
}

.subtask-item.completed .subtask-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.subtask-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.7;
}

.subtask-delete:hover {
    opacity: 1;
}

.add-subtask-form {
    display: flex;
    gap: 8px;
}

/* Comment Thread Styles */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
}

.comment-item {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 0.8rem;
    line-height: 1.4;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-weight: 600;
}

.comment-time {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.comment-body {
    color: var(--text-secondary);
}

.add-comment-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Attachments Styles */
.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.attachment-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attachment-info svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.attachment-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
}

.add-attachment-btn {
    border: 1px dashed var(--border-color);
    padding: 10px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.8rem;
    cursor: pointer;
    background-color: var(--bg-card);
    color: var(--text-muted);
    transition: var(--transition);
}

.add-attachment-btn:hover {
    border-color: var(--brand-primary);
    color: var(--text-primary);
}

/* Activity Log Styles (Detailed task log) */
.activity-log-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 4px;
}

.activity-log-item {
    font-size: 0.75rem;
    line-height: 1.3;
    color: var(--text-secondary);
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border-color);
}

.activity-log-item:last-child {
    border-bottom: none;
}

.activity-log-time {
    color: var(--text-muted);
    margin-right: 4px;
}

/* Forms styling */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-family);
    outline: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--brand-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Team lists */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.member-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.member-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    color: #0f172a;
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.member-details {
    flex: 1;
}

.member-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.member-tasks {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.member-actions {
    display: flex;
    gap: 8px;
}

.member-remove-btn {
    border: none;
    background: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.member-remove-btn:hover {
    background-color: #fee2e2;
}

.add-member-card {
    background-color: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.add-member-form {
    display: flex;
    gap: 8px;
}

.backup-section {
    margin-top: 20px;
    padding: 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.backup-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.hidden-file-input {
    display: none;
}

/* --- LOGIN SCREEN OVERLAY & PROFILE WIDGET & AVATAR PICKER STYLES --- */

.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: var(--transition);
}

.login-overlay.active {
    display: flex;
}

.login-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 32px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.login-logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, #a3e635 100%);
    color: #0f172a;
    font-weight: 800;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.login-logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-secondary);
}

.login-step {
    display: none;
}

.login-step.active {
    display: block;
}

.login-nav-btns {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}

.login-nav-btns button {
    flex: 1;
}

.avatar-picker-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.avatar-tab-btn {
    border: none;
    background: none;
    font-family: var(--font-family);
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.avatar-tab-btn.active {
    color: var(--text-primary);
    font-weight: 600;
    background-color: var(--brand-light);
}

.avatar-tab-content {
    display: none;
}

.avatar-tab-content.active {
    display: block;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.avatar-item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.avatar-item.active {
    border-color: var(--brand-primary);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(163, 230, 53, 0.3);
}

.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}

.avatar-upload-preview {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: var(--bg-app);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    overflow: hidden;
}

.avatar-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.demo-help-box {
    margin-top: 24px;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.demo-help-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* User Profile Widget in Sidebar */
.user-profile-widget {
    margin-top: auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar-container {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-avatar-placeholder {
    font-size: 1.1rem;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.profile-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-email {
    font-size: 0.7rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-role {
    font-size: 0.65rem;
    color: var(--brand-primary-hover);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
}

.logout-btn {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.logout-btn:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

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

/* Mobile Sidebar Toggle Button */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    margin-right: 12px;
}

.menu-toggle:hover {
    background-color: var(--brand-light);
    color: var(--text-primary);
}

/* Overlay for Mobile Sidebar */
.sidebar-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 8;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive CSS updates */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 99;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .top-header {
        padding: 0 16px;
    }
    
    .main-content {
        width: 100vw;
    }
    
    .header-title-section h1 {
        font-size: 1.1rem;
    }
    
    .header-title-section p {
        display: none; /* Hide subtitle on small screens */
    }
    
    /* Stats cards layout on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 16px !important;
    }
    
    .stat-card {
        padding: 16px !important;
    }
    
    .stat-value {
        font-size: 1.5rem !important;
    }
    
    .stat-icon {
        width: 36px !important;
        height: 36px !important;
    }
    
    .stat-icon svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    .view-section {
        padding: 16px !important;
    }
    
    /* Toolbar filters on mobile */
    .toolbar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px !important;
    }
    
    .filters-group {
        justify-content: flex-start;
        padding-bottom: 4px;
    }
    
    /* Modals content padding on mobile */
    .modal-content {
        padding: 20px !important;
        max-width: 95% !important;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
}


