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

:root {
    --sidebar-bg: #292f4c;
    --sidebar-active: #3c4270;
    --sidebar-text: #c3c6d4;
    --page-bg: #f6f7f9;
    --card-bg: #ffffff;
    --column-bg: #ffffff;
    --task-bg: #f6f7f9;
    --primary: #579bfc;
    --primary-hover: #4387e8;
    --text: #333333;
    --text-light: #888888;
    --border: #e6e9ef;
    --danger: #e2445c;
    --success: #00c875;
    --warning: #fdab3d;
    --done: #579bfc;
    --shadow: 0 1px 4px rgba(0,0,0,0.08);
    --radius: 8px;
    --radius-lg: 12px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--page-bg); color: var(--text); }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--page-bg); }
.login-card { background: var(--card-bg); padding: 2.5rem; border-radius: var(--radius-lg); box-shadow: var(--shadow); width: 100%; max-width: 380px; }
.login-card h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-size: 0.875rem; color: var(--text-light); }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; background: #fff; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 80px; }
.login-card button { width: 100%; padding: 0.7rem; background: var(--primary); color: #fff; border: none; border-radius: 6px; font-size: 1rem; cursor: pointer; margin-top: 0.5rem; }
.login-card button:hover { background: var(--primary-hover); }
.error { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.5rem; }
.hidden { display: none; }

.app-shell { display: flex; height: 100vh; }

.sidebar { width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 16px 16px 12px; }
.sidebar-header h2 { color: #fff; font-size: 1rem; font-weight: 700; }
.sidebar-section-label { padding: 4px 16px; font-size: 10px; text-transform: uppercase; color: #8b90a0; letter-spacing: 0.5px; }
.board-list { overflow-y: auto; padding: 4px 8px; }
.sidebar-views { overflow-y: auto; padding: 4px 8px; }
.sidebar-footer { margin-top: auto; }
.sidebar-view-item { padding: 6px 12px; cursor: pointer; font-size: 0.8rem; border-radius: 6px; margin-bottom: 2px; color: var(--sidebar-text); }
.sidebar-view-item:hover { background: rgba(255,255,255,0.08); }
.sidebar-view-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar-view-item[draggable="true"] { cursor: grab; }
.sidebar-view-item.dragging { opacity: 0.4; }
.sidebar-view-item.sidebar-drag-over { border-top: 2px solid var(--primary); margin-top: -2px; }
.sidebar-category-item { font-weight: 600; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px; color: var(--text-light); display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.sidebar-category-item .category-count { font-size: 0.65rem; font-weight: 400; opacity: 0.6; }
.sidebar-category-child { padding-left: 20px; }
.board-item { padding: 8px 12px; cursor: pointer; font-size: 0.85rem; border-radius: 6px; margin-bottom: 2px; color: var(--sidebar-text); }
.board-item:hover { background: rgba(255,255,255,0.08); }
.board-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.board-item.dragging { opacity: 0.4; }
.board-item.sidebar-drag-over { border-top: 2px solid var(--primary); margin-top: -2px; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-btn { width: 100%; padding: 8px; background: rgba(255,255,255,0.1); color: var(--sidebar-text); border: none; border-radius: 6px; cursor: pointer; font-size: 0.85rem; margin-bottom: 8px; }
.sidebar-btn:hover { background: rgba(255,255,255,0.15); }
.sidebar-user { font-size: 0.8rem; }
.sidebar-user-actions { display: flex; gap: 6px; margin-top: 6px; }
.sidebar-action-btn { background: none; border: none; color: var(--sidebar-text); cursor: pointer; font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; }
.sidebar-action-btn:hover { background: rgba(255,255,255,0.1); }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.top-bar { padding: 12px 20px; background: var(--card-bg); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.top-bar-title { font-size: 1.1rem; font-weight: 700; }
.view-tabs { display: flex; gap: 4px; }
.view-tab { padding: 4px 12px; font-size: 0.8rem; color: var(--text-light); cursor: pointer; border-radius: 4px; border: none; background: none; }
.view-tab:hover { background: var(--page-bg); color: var(--text); }
.view-tab.active { color: var(--primary); font-weight: 600; background: rgba(87,155,252,0.1); }
.top-bar-right { display: flex; gap: 6px; }
.top-bar-btn { padding: 6px 12px; font-size: 0.8rem; background: var(--page-bg); border: none; border-radius: 6px; cursor: pointer; color: var(--text); }
.top-bar-btn:hover { background: var(--border); }

.filter-bar { padding: 8px 20px; background: #fafbfc; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.filter-label { font-size: 10px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-select { font-size: 0.8rem; padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.filter-clear { font-size: 0.8rem; color: var(--primary); background: none; border: none; cursor: pointer; }

.top-bar-btn.active { background: var(--danger); color: #fff; }

.kanban { display: flex; flex: 1; overflow-x: auto; padding: 16px; gap: 12px; background: var(--page-bg); }
.kanban-placeholder { padding: 2rem; color: var(--text-light); }
.kanban-column { min-width: 240px; max-width: 300px; background: var(--column-bg); border-radius: var(--radius-lg); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.column-header { padding: 12px 14px; font-weight: 700; font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; }
.column-header-border { height: 2px; margin: 0 14px; border-radius: 1px; }
.task-count { border-radius: 10px; padding: 1px 8px; font-size: 0.7rem; font-weight: 600; color: #fff; }
.column-body { flex: 1; overflow-y: auto; padding: 8px; min-height: 60px; }
.drag-placeholder { height: 4px; margin: 4px 0; border-radius: 2px; background: var(--primary); transition: height 0.15s; }

.task-card { background: var(--task-bg); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px; cursor: grab; transition: box-shadow 0.15s; }
.task-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.5; }
.task-card.selected { outline: 2px solid var(--primary); outline-offset: -2px; }
.task-card.done-task { opacity: 0.7; }
.task-card.done-task .task-title { text-decoration: line-through; }
.task-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; padding: 2px 4px; }
.task-desc-preview { font-size: 0.75rem; color: #666; margin-bottom: 6px; padding: 0 4px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.task-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.task-pill { padding: 1px 8px; border-radius: 12px; font-size: 0.7rem; font-weight: 500; color: #fff; border: none; }
.pill-high { background: var(--danger); }
.pill-medium { background: var(--warning); }
.pill-low { background: var(--success); }
.pill-category { background: #6c757d; }
.pill-project { }
.task-footer { display: flex; justify-content: space-between; align-items: center; }
.task-avatar { width: 22px; height: 22px; border-radius: 50%; font-size: 9px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; object-fit: cover; }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .task-avatar { border: 2px solid var(--card-bg, #16213e); margin-left: -8px; }
.avatar-stack .task-avatar:first-child { margin-left: 0; }
.avatar-stack .avatar-overflow { font-size: 10px; color: var(--text-light); margin-left: 2px; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0; }
.avatar-grid-item { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; opacity: 0.35; transition: opacity 0.15s; }
.avatar-grid-item.selected { opacity: 1; }
.avatar-grid-item .task-avatar { border: 2px solid transparent; transition: border-color 0.15s; }
.avatar-grid-item.selected .task-avatar { border-color: var(--accent, #579bfc); }
.avatar-grid-item .avatar-name { font-size: 9px; color: var(--text-light); max-width: 48px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-grid-warn { color: #e2445c; font-size: 11px; margin-top: 4px; display: none; }
.add-task-btn { text-align: center; color: var(--text-light); font-size: 0.8rem; padding: 10px; border: 1px dashed var(--border); border-radius: var(--radius); cursor: pointer; margin: 8px; }
.add-task-btn:hover { background: var(--page-bg); border-color: var(--text-light); }
.add-column-btn-area { min-width: 180px; display: flex; align-items: flex-start; padding-top: 12px; }
.add-column-btn-area button { color: var(--text-light); font-size: 0.8rem; padding: 10px 16px; border: 1px dashed var(--border); border-radius: var(--radius-lg); cursor: pointer; background: none; }
.add-column-btn-area button:hover { border-color: var(--text-light); }
.add-column-btn { flex-shrink: 0; min-width: 240px; height: fit-content; align-self: flex-start; text-align: center; color: var(--text-light); font-size: 0.85rem; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius-lg); cursor: pointer; background: transparent; }
.add-column-btn:hover { background: var(--column-bg); border-color: var(--text-light); color: var(--text); }

.inline-dropdown { position: absolute; background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); z-index: 50; min-width: 140px; padding: 4px; }
.inline-dropdown-item { padding: 6px 10px; font-size: 0.8rem; cursor: pointer; border-radius: 4px; }
.inline-dropdown-item:hover { background: var(--page-bg); }

.btn { padding: 0.4rem 0.8rem; border-radius: 6px; border: 1px solid var(--border); background: var(--card-bg); cursor: pointer; font-size: 0.85rem; }
.btn:hover { background: var(--page-bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--card-bg); border-radius: var(--radius-lg); padding: 1.5rem; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.modal h2 { margin-bottom: 1rem; font-size: 1.2rem; }
.modal .form-group { margin-bottom: 0.75rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

.sprint-badge { padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.75rem; }
.sprint-badge.planning { background: #e8e8e8; }
.sprint-badge.active { background: #d4edda; color: #155724; }
.sprint-badge.completed { background: #d1ecf1; color: #0c5460; }

.ai-btn { background: var(--primary) !important; color: #fff !important; font-weight: 600; }
.ai-btn:hover { background: var(--primary-hover) !important; }

.ai-preview-table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; font-size: 0.8rem; }
.ai-preview-table th { text-align: left; padding: 6px 8px; border-bottom: 2px solid var(--border); font-size: 0.75rem; color: var(--text-light); text-transform: uppercase; }
.ai-preview-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ai-preview-table tr:hover { background: var(--page-bg); }
.ai-remove-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.85rem; }
.ai-remove-btn:hover { text-decoration: underline; }
.ai-loading { text-align: center; padding: 2rem; color: var(--text-light); }
.ai-modal { max-width: 640px !important; max-height: 80vh; overflow-y: auto; }

/* Edit task modal - two panel layout */
.edit-task-modal { max-width: 820px !important; max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; }
.edit-modal-layout { display: flex; gap: 1.5rem; flex: 1; min-height: 0; }
.edit-modal-left { flex: 1; min-width: 0; overflow-y: auto; }
.edit-modal-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.form-label { display: block; margin-bottom: 0.4rem; font-size: 0.875rem; color: var(--text-light); font-weight: 600; }
.comment-toggle { cursor: pointer; user-select: none; }
.comment-toggle:hover { color: var(--text); }
.comment-toggle-arrow { display: inline-block; font-size: 0.7rem; margin-right: 0.2rem; }
.desc-comment-area { background: var(--page-bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem; font-size: 0.85rem; line-height: 1.6; min-height: 80px; max-height: 160px; overflow-y: auto; cursor: text; white-space: pre-wrap; word-wrap: break-word; user-select: text; }
.desc-empty { color: var(--text-light); font-style: italic; }
.comment-highlight { background: #fff3a8; border-radius: 2px; cursor: pointer; padding: 0 1px; }
.comment-highlight:hover { background: #ffe066; }
.comment-hint { font-size: 0.75rem; color: var(--text-light); margin-top: 0.3rem; }
.comment-form { margin-top: 0.5rem; }
.comment-form-quote { font-size: 0.8rem; color: var(--text-light); font-style: italic; margin-bottom: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comment-form textarea { width: 100%; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; resize: vertical; min-height: 40px; }
.comment-form textarea:focus { outline: none; border-color: var(--primary); }
.comments-list { margin-top: 0.75rem; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.comment-item { padding: 0.5rem; background: var(--page-bg); border-radius: 6px; border-left: 3px solid var(--primary); font-size: 0.8rem; }
.comment-tabs { display: flex; gap: 0; margin-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.comment-tab { background: none; border: none; padding: 0.3rem 0.75rem; font-size: 0.8rem; cursor: pointer; color: var(--text-light); border-bottom: 2px solid transparent; }
.comment-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.comment-tab:hover { color: var(--text); }
.comment-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.2rem; }
.comment-item-header strong { font-size: 0.8rem; }
.comment-item-header small { color: var(--text-light); font-size: 0.7rem; }
.comment-item-quote { font-size: 0.75rem; color: var(--text-light); font-style: italic; margin-bottom: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comment-item-body { margin-bottom: 0.3rem; }
.comment-item-actions { display: flex; gap: 0.3rem; }
.comment-resolved-badge { font-size: 0.7rem; color: var(--success); font-weight: 600; }
.comment-image-preview { margin-top: 0.3rem; display: flex; align-items: center; gap: 0.3rem; }
.comment-image-preview img { max-height: 60px; border-radius: 4px; border: 1px solid var(--border); }
.comment-image { max-width: 100%; max-height: 120px; border-radius: 4px; margin-top: 0.3rem; cursor: pointer; display: block; }

.dropdown-wrapper { position: relative; }
.dropdown-menu { display: none; position: absolute; top: 100%; right: 0; margin-top: 4px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); z-index: 50; min-width: 160px; padding: 4px; }
.dropdown-wrapper.open .dropdown-menu { display: block; }
.dropdown-item { padding: 8px 12px; font-size: 0.85rem; cursor: pointer; border-radius: 4px; }
.dropdown-item:hover { background: var(--page-bg); }

/* Workspace page */
.workspace { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem; }
.workspace-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.workspace-header h1 { font-size: 1.5rem; }
.workspace-user { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; color: var(--text-light); }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.board-card { display: block; background: var(--card-bg); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow); text-decoration: none; color: var(--text); transition: box-shadow 0.15s, transform 0.15s; }
.board-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); transform: translateY(-2px); }
.board-card h3 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.board-card-stats { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-light); }
.context-menu { position: fixed; background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 200; min-width: 120px; padding: 4px; }
.context-menu-item { padding: 6px 12px; font-size: 0.8rem; cursor: pointer; border-radius: 4px; }
.context-menu-item:hover { background: var(--page-bg); }
.ctx-submenu-trigger { position: relative; }
.ctx-submenu { display: none; position: absolute; left: 100%; top: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 160px; padding: 4px; z-index: 201; max-height: 240px; overflow-y: auto; }
.ctx-submenu-trigger:hover > .ctx-submenu { display: block; }
.ctx-assign-user { display: flex; align-items: center; gap: 8px; }

.sidebar-view-item.sidebar-task-drop-target { background: rgba(87,155,252,0.2); outline: 1px dashed var(--primary); outline-offset: -1px; }

.desc-edit-area { word-wrap: break-word; overflow-wrap: break-word; }
.desc-edit-area a { color: #1a73e8; text-decoration: underline; }
.desc-edit-area img {
    display: block;
    margin: 0.5rem 0;
    cursor: pointer;
    max-width: 100%;
    height: auto;
}
.desc-edit-area img[data-size="small"]  { max-width: 25%; }
.desc-edit-area img[data-size="medium"] { max-width: 50%; }
.desc-edit-area img[data-size="large"]  { max-width: 100%; }

.desc-toolbar { display: flex; gap: 4px; margin-bottom: 4px; flex-wrap: wrap; }
.desc-edit-area h1 { font-size: 1.4rem; margin: 0.5rem 0 0.25rem; }
.desc-edit-area h2 { font-size: 1.15rem; margin: 0.4rem 0 0.2rem; }
.desc-edit-area h3 { font-size: 1rem; margin: 0.3rem 0 0.15rem; }
.desc-edit-area ul { margin: 0.3rem 0; padding-left: 1.5rem; }

.img-size-menu {
    display: flex;
    gap: 0.25rem;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 2000;
}
.img-size-menu button {
    border: 1px solid #ddd;
    background: #f7f7f7;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 3px;
}
.img-size-menu button.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.img-size-menu button.img-size-delete {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
    margin-left: 0.25rem;
}
.img-size-menu button.img-size-delete:hover {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    cursor: zoom-out;
}
.lightbox-overlay img {
    max-width: 95vw;
    max-height: 95vh;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
}
.task-created-by {
    font-size: 0.65rem;
    color: var(--text-light);
    font-weight: normal;
    margin-bottom: 0.2rem;
}
.task-done-date {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    font-style: italic;
}
.input-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-secondary);
}
.created-by-info { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--text-light); font-size: 13px; }
.task-modal-created { font-size: 0.82rem; color: #555; margin-bottom: 10px; font-style: italic; }
.avatar-xs { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--accent, #579bfc); color: #fff; font-size: 11px; font-weight: 600; }

/* Activity Widget */
.activity-widget { position: fixed; bottom: 24px; right: 24px; z-index: 1000; }
.activity-widget-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 12px rgba(0,0,0,0.18); position: relative; transition: background 0.15s; }
.activity-widget-btn:hover { background: var(--primary-hover); }
.activity-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.activity-panel { position: absolute; bottom: 56px; right: 0; width: 360px; height: 500px; background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: 0 4px 24px rgba(0,0,0,0.15); display: flex; flex-direction: column; overflow: hidden; }
.activity-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.activity-panel-title { font-weight: 700; font-size: 0.95rem; }
.activity-panel-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-light); padding: 0 4px; }
.activity-panel-close:hover { color: var(--text); }
.activity-filters { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.activity-filter-select, .activity-filter-date { font-size: 0.75rem; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; background: #fff; flex: 1; min-width: 0; }
.activity-feed { flex: 1; overflow-y: auto; padding: 8px 12px; }
.activity-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.activity-item:last-child { border-bottom: none; }
.activity-item .task-avatar { flex-shrink: 0; }
.activity-item-content { flex: 1; min-width: 0; }
.activity-item-text { font-size: 0.8rem; color: var(--text); line-height: 1.35; }
.activity-item-text strong { color: var(--primary); }
.activity-item-text .activity-task-link { color: var(--text); font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: var(--border); }
.activity-item-text .activity-task-link:hover { color: var(--primary); }
.activity-item-time { font-size: 0.7rem; color: var(--text-light); margin-top: 2px; }
.activity-bot-msg { background: #f0f4ff; border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-size: 0.8rem; line-height: 1.4; color: var(--text); }
.activity-bot-msg p { margin-bottom: 4px; }
.activity-chat { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
.activity-chat-input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.8rem; background: #fff; }
.activity-chat-input:focus { outline: none; border-color: var(--primary); }
.activity-chat-send { background: var(--primary); color: #fff; border: none; border-radius: 6px; padding: 0 12px; cursor: pointer; font-size: 0.9rem; }
.activity-chat-send:hover { background: var(--primary-hover); }
.activity-loading { text-align: center; padding: 20px; color: var(--text-light); font-size: 0.8rem; }
.activity-empty { text-align: center; padding: 30px 16px; color: var(--text-light); font-size: 0.8rem; }

/* Board Notes */
.sidebar-notes {
    padding: 0 8px;
    margin-bottom: 8px;
}
.sidebar-notes-toggle {
    padding: 6px 8px;
    font-size: 0.8rem;
    color: var(--text-light);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sidebar-notes-toggle:hover {
    color: var(--text);
}
.sidebar-notes-caret {
    font-size: 0.7rem;
    transition: transform 0.15s;
}
.sidebar-notes-caret.expanded {
    transform: rotate(90deg);
}
.sidebar-notes-editor {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    margin-top: 4px;
    overflow: hidden;
}
.sidebar-notes-editor .ql-toolbar {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 4px;
}
.sidebar-notes-editor .ql-toolbar .ql-formats {
    margin-right: 8px;
}
.sidebar-notes-editor .ql-container {
    border: none;
    font-size: 0.82rem;
    max-height: 200px;
    overflow-y: auto;
}
.sidebar-notes-editor .ql-editor {
    padding: 8px;
    min-height: 60px;
}
.sidebar-notes-editor .ql-editor.ql-blank::before {
    font-style: italic;
    color: var(--text-light);
}

/* Bottom Navigation - Mobile */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    z-index: 200;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.mobile-bottom-nav-inner {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: space-around;
}
.mobile-nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 0.65rem;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 8px;
}
.mobile-nav-tab.active {
    color: var(--primary);
}
.mobile-nav-tab svg {
    width: 22px;
    height: 22px;
}

/* Mobile Boards Panel */
.mobile-boards-panel {
    display: none;
    position: fixed;
    inset: 0;
    bottom: 56px;
    background: var(--page-bg);
    z-index: 150;
    overflow-y: auto;
    padding: 16px;
}
.mobile-boards-panel.active {
    display: block;
}
.mobile-boards-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}
.mobile-board-item {
    padding: 14px 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
}
.mobile-board-item.active {
    outline: 2px solid var(--primary);
    font-weight: 600;
}

/* Mobile Projects Panel */
.mobile-projects-panel {
    display: none;
    position: fixed;
    inset: 0;
    bottom: 56px;
    background: var(--page-bg);
    z-index: 150;
    overflow-y: auto;
    padding: 16px;
}
.mobile-projects-panel.active {
    display: block;
}
.mobile-projects-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}
.mobile-project-item {
    padding: 12px;
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
}
.mobile-project-item.active {
    outline: 2px solid var(--primary);
}
.mobile-project-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Mobile More Panel */
.mobile-more-panel {
    display: none;
    position: fixed;
    inset: 0;
    bottom: 56px;
    background: var(--page-bg);
    z-index: 150;
    overflow-y: auto;
    padding: 16px;
}
.mobile-more-panel.active {
    display: block;
}
.mobile-more-item {
    padding: 14px 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
}

/* Kanban column dot indicators */
.kanban-dots {
    display: none;
    justify-content: center;
    gap: 6px;
    padding: 8px 0;
    background: var(--page-bg);
}
.kanban-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.15s;
}
.kanban-dot.active {
    background: var(--primary);
}

@media (max-width: 768px) {
    /* Hide sidebar completely */
    .sidebar { display: none; }
    .sidebar-backdrop { display: none; }
    .sidebar-toggle { display: none; }

    /* Show bottom nav */
    .mobile-bottom-nav { display: block; }

    /* Hide activity widget (overlaps bottom nav) */
    .activity-widget { display: none; }

    /* Add bottom padding for bottom nav */
    .app-shell { padding-bottom: 56px; }

    /* Top bar adjustments */
    .top-bar { padding: 8px 12px; }
    .top-bar-right { gap: 4px; }
    .top-bar-btn { padding: 4px 8px; font-size: 0.75rem; }
    .top-bar-title { font-size: 0.95rem; }

    /* Filter bar wraps */
    .filter-bar { flex-wrap: wrap; padding: 6px 12px; }

    /* Kanban: horizontal scroll-snap */
    .kanban {
        scroll-snap-type: x mandatory;
        padding: 12px 0;
        gap: 0;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    .kanban::-webkit-scrollbar { display: none; }
    .kanban-column {
        min-width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        margin: 0 12px;
        scroll-snap-align: start;
        flex-shrink: 0;
    }
    .add-column-btn {
        min-width: calc(100vw - 24px);
        margin: 0 12px;
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    /* Show dot indicators */
    .kanban-dots { display: flex; }

    /* Task cards: disable drag on mobile */
    .task-card { cursor: pointer; }
    .task-card:active { cursor: pointer; }

    /* Standard modals constrained */
    .modal { max-width: calc(100vw - 2rem); }

    /* Raise overlay above bottom nav when edit modal is open */
    .modal-overlay:has(.edit-task-modal) { z-index: 201; }

    /* Edit task modal: full-screen sheet */
    .edit-task-modal {
        max-width: none !important;
        max-height: none !important;
        border-radius: 0;
        position: fixed;
        inset: 0;
    }
    .edit-task-modal .edit-modal-layout {
        flex-direction: column;
        overflow: hidden;
        flex: 1;
        position: relative;
    }
    .edit-task-modal .edit-modal-left {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding-bottom: 3rem;
    }
    .edit-task-modal .edit-modal-right {
        flex: none;
        max-height: 50vh;
        overflow-y: auto;
        border-top: 1px solid var(--border);
        padding-top: 0.5rem;
        transition: max-height 0.25s ease;
    }
    .edit-task-modal .edit-modal-right.collapsed {
        max-height: none;
        overflow: visible;
        position: fixed;
        bottom: 56px;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-top: 1px solid var(--border);
        padding: 0.5rem 1rem;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
        z-index: 202;
    }
    .edit-task-modal .modal-actions {
        position: sticky;
        top: 0;
        background: var(--card-bg);
        z-index: 2;
        padding: 8px 0;
        margin-top: 0;
        border-bottom: 1px solid var(--border);
    }
}
