:root {
            color-scheme: light;
            --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
            --bg: #ffffff;
            --sidebar-bg: #ffffff;
            --sidebar-footer-bg: #ffffff;
            --surface: #ffffff;
            --surface-2: #f5f5f7;
            --surface-3: #eaeaea;
            --border: #e5e5ea;
            --border-light: #f2f2f7;
            --text: #1c1c1e;
            --text-2: #48484a;
            --text-3: #8e8e93;
            --accent: #3b82f6;
            --accent-soft: #eff6ff;
            --accent-hover: #2563eb;
            --accent-2: #8b5cf6;
            --green: #10b981;
            --green-soft: #ecfdf5;
            --red: #ef4444;
            --red-soft: #fef2f2;
            --amber: #f59e0b;
            --amber-soft: #fffbeb;
            --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
            --radius: 8px;
            --radius-sm: 6px;
            --radius-xs: 4px;
            --sidebar-w: 260px;
            --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
            --calendar-filter: none;
        }

        [data-theme="dark"] {
            color-scheme: dark;
            --bg: #18181a;
            --sidebar-bg: #18181a;
            --sidebar-footer-bg: #18181a;
            --surface: #242426;
            --surface-2: #1e1e20;
            --surface-3: #2c2c2e;
            --border: #2c2c2e;
            --border-light: #242426;
            --text: #f2f2f7;
            --text-2: #eaeae0;
            --text-3: #71717a;
            --accent: #3b82f6;
            --accent-soft: rgba(59, 130, 246, 0.15);
            --accent-hover: #60a5fa;
            --accent-2: #a78bfa;
            --green: #10b981;
            --green-soft: rgba(16, 185, 129, 0.1);
            --red: #ef4444;
            --red-soft: rgba(239, 68, 68, 0.15);
            --amber: #f59e0b;
            --amber-soft: rgba(245, 158, 11, 0.15);
            --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
            --calendar-filter: invert(1);
        }

        *,
        *::before,
        *::after {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: var(--font-family);
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            display: flex;
            overflow: hidden;
            font-size: 14px;
            line-height: 1.5;
            transition: background-color var(--transition), color var(--transition);
        }

        .sidebar,
        .main,
        .toolbar,
        .filter-bar,
        .modal,
        .kanban-col,
        .kanban-card,
        .task-item,
        .search-box,
        .detail-panel {
            transition: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
        }

        select, option {
            background-color: var(--bg);
            color: var(--text);
        }

        select:focus {
            outline: none;
        }

        /* ── SIDEBAR ── */
        .sidebar {
            width: var(--sidebar-w);
            background: var(--sidebar-bg);
            border-right: 1px solid var(--border-light);
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            height: 100vh;
            overflow: hidden;
        }

        .sidebar-header {
            padding: 20px 20px 16px;
            border-bottom: 1px solid var(--border-light);
            display: flex;
            align-items: center;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 9px;
            margin-bottom: 18px;
        }

        .logo-icon {
            width: 30px;
            height: 30px;
            background: var(--text);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .logo-icon svg {
            color: #fff;
        }

        .logo-name {
            font-family: var(--font-family);
            font-weight: 600;
            font-size: 16px;
            color: var(--text);
        }

        .search-box {
            display: flex;
            align-items: center;
            gap: 8px;
            background: var(--surface-2);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 7px 11px;
            cursor: text;
            transition: border-color var(--transition);
            flex: 1;
        }

        .menu-toggle-btn {
            display: none;
            background: none;
            border: none;
            color: var(--text-2);
            cursor: pointer;
            padding: 6px;
            border-radius: var(--radius-sm);
            align-items: center;
            justify-content: center;
            margin-right: 8px;
            transition: background var(--transition);
        }

        .menu-toggle-btn:hover {
            background: var(--surface-2);
            color: var(--text);
        }

        .sidebar-close-btn {
            display: none;
            background: none;
            border: none;
            color: var(--text-2);
            cursor: pointer;
            padding: 6px;
            border-radius: var(--radius-sm);
            align-items: center;
            justify-content: center;
            margin-right: 8px;
            transition: background var(--transition);
        }

        .sidebar-close-btn:hover {
            background: var(--surface-2);
            color: var(--text);
        }

        .sidebar-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.4);
            z-index: 998;
            opacity: 0;
            pointer-events: none;
            transition: opacity var(--transition);
        }

        body.sidebar-open .sidebar-overlay {
            opacity: 1;
            pointer-events: auto;
        }

        .search-box:focus-within {
            border-color: var(--accent);
            background: var(--surface);
            box-shadow: 0 0 0 3px var(--accent-soft);
        }

        .search-box svg {
            color: var(--text-3);
            flex-shrink: 0;
        }

        .search-box input {
            border: none;
            outline: none;
            background: transparent;
            font-size: 13px;
            color: var(--text);
            width: 100%;
            font-family: inherit;
        }

        .search-box input::placeholder {
            color: var(--text-3);
        }

        .sidebar-nav {
            padding: 12px 10px;
            display: flex;
            flex-direction: column;
            gap: 1px;
            border-bottom: 1px solid var(--border-light);
        }

        .nav-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 10px;
            border-radius: var(--radius-sm);
            cursor: pointer;
            color: var(--text-2);
            font-size: 13.5px;
            font-weight: 500;
            transition: background var(--transition), color var(--transition);
            user-select: none;
        }

        .nav-item:hover {
            background: var(--surface-2);
            color: var(--text);
        }

        .nav-item.active {
            background: var(--accent-soft);
            color: var(--accent);
        }

        .nav-item .nav-count {
            margin-left: auto;
            font-size: 11px;
            font-weight: 600;
            background: var(--surface-3);
            color: var(--text-3);
            border-radius: 20px;
            padding: 1px 7px;
            min-width: 20px;
            text-align: center;
        }

        .nav-item.active .nav-count {
            background: #dbeafe;
            color: var(--accent);
        }

        .sidebar-section {
            padding: 12px 10px;
            flex: 1;
            overflow-y: auto;
        }

        .section-label {
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-3);
            padding: 0 10px;
            margin-bottom: 6px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .add-list-btn {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-3);
            display: flex;
            align-items: center;
            padding: 2px;
            border-radius: 4px;
            transition: color var(--transition);
        }

        .add-list-btn:hover {
            color: var(--accent);
        }

        .list-item {
            display: flex;
            align-items: center;
            gap: 9px;
            padding: 7px 10px;
            border-radius: var(--radius-sm);
            cursor: pointer;
            color: var(--text-2);
            font-size: 13.5px;
            transition: background var(--transition), color var(--transition);
            user-select: none;
            position: relative;
        }

        .list-item:hover {
            background: var(--surface-2);
            color: var(--text);
        }

        .list-item.active {
            background: var(--accent-soft);
            color: var(--accent);
        }

        .list-dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .list-item-count {
            margin-left: auto;
            font-size: 11px;
            color: var(--text-3);
        }

        .list-actions {
            display: none;
            gap: 4px;
            margin-left: auto;
        }

        .list-item:hover .list-actions {
            display: flex;
        }

        .list-item:hover .list-item-count {
            display: none;
        }

        .list-action-btn {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-3);
            padding: 2px;
            border-radius: 3px;
            transition: color var(--transition);
            line-height: 1;
        }

        .list-action-btn:hover {
            color: var(--red);
        }

        /* ── MAIN ── */
        .main {
            flex: 1;
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
        }

        /* ── TOOLBAR ── */
        .toolbar {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 24px 28px 12px;
            background: transparent;
            border-bottom: none;
            flex-shrink: 0;
        }

        .toolbar-title {
            font-family: var(--font-family);
            font-weight: 600;
            font-size: 22px;
            flex: 1;
        }

        .view-switcher {
            display: flex;
            background: var(--surface-2);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 3px;
            gap: 2px;
        }

        .view-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 5px 12px;
            border-radius: 6px;
            border: none;
            background: none;
            cursor: pointer;
            font-size: 12.5px;
            font-weight: 500;
            color: var(--text-2);
            font-family: inherit;
            transition: all var(--transition);
        }

        .view-btn.active {
            background: var(--surface);
            color: var(--text);
            box-shadow: var(--shadow-sm);
        }

        .toolbar-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 7px 14px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--surface);
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            color: var(--text-2);
            font-family: inherit;
            transition: all var(--transition);
        }

        .toolbar-btn:hover {
            background: var(--surface-2);
            color: var(--text);
        }

        .toolbar-btn.icon-only {
            padding: 7px;
            aspect-ratio: 1;
            justify-content: center;
        }

        .toolbar-btn.primary {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent);
        }

        .toolbar-btn.primary:hover {
            background: var(--accent-hover);
            border-color: var(--accent-hover);
        }

        /* ── LIST VIEW ── */
        #list-view {
            flex: 1;
            overflow-y: auto;
            padding: 24px 28px;
            display: flex;
            flex-direction: column;
            gap: 0;
        }

        .add-task-bar {
            display: flex;
            align-items: center;
            gap: 10px;
            background: var(--surface);
            border: 1.5px dashed var(--border);
            border-radius: var(--radius);
            padding: 12px 16px;
            margin-bottom: 20px;
            cursor: text;
            transition: border-color var(--transition), box-shadow var(--transition);
        }

        .add-task-bar:focus-within {
            border-color: var(--accent);
            border-style: solid;
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
        }

        .add-task-input {
            flex: 1;
            border: none;
            outline: none;
            font-family: inherit;
            font-size: 14px;
            color: var(--text);
            background: transparent;
        }

        .add-task-input::placeholder {
            color: var(--text-3);
        }

        .task-group {
            margin-bottom: 8px;
        }

        .group-header {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 4px;
            cursor: pointer;
            user-select: none;
        }

        .group-header:hover .group-title {
            color: var(--text);
        }

        .group-chevron {
            color: var(--text-3);
            transition: transform var(--transition);
            flex-shrink: 0;
        }

        .group-chevron.collapsed {
            transform: rotate(-90deg);
        }

        .group-title {
            font-family: var(--font-family);
            font-weight: 600;
            font-size: 13px;
            color: var(--text-2);
            transition: color var(--transition);
        }

        .group-count {
            font-size: 11px;
            color: var(--text-3);
            background: var(--surface-2);
            border-radius: 20px;
            padding: 1px 7px;
        }

        .task-list {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .task-item {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 11px 12px;
            border-radius: var(--radius-sm);
            background: transparent;
            border-bottom: 1px solid var(--border-light);
            cursor: pointer;
            transition: all var(--transition);
            animation: taskIn 0.2s ease;
            position: relative;
        }

        @keyframes taskIn {
            from {
                opacity: 0;
                transform: translateY(-4px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .task-item:hover {
            background: var(--surface-3);
            border-bottom-color: transparent;
        }

        .task-item.done {
            opacity: 0.55;
        }

        .task-check {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            border: 2px solid var(--border);
            flex-shrink: 0;
            cursor: pointer;
            transition: all var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-top: 1.5px;
            position: relative;
        }

        /* TickTick checkbox priority borders and hovers */
        .task-item.priority-high .task-check {
            border-color: var(--red);
        }

        .task-item.priority-high .task-check:hover {
            background: var(--red-soft);
        }

        .task-item.priority-high.done .task-check {
            background: var(--red);
            border-color: var(--red);
        }

        .task-item.priority-medium .task-check {
            border-color: var(--amber);
        }

        .task-item.priority-medium .task-check:hover {
            background: var(--amber-soft);
        }

        .task-item.priority-medium.done .task-check {
            background: var(--amber);
            border-color: var(--amber);
        }

        .task-item.priority-low .task-check {
            border-color: var(--accent);
        }

        .task-item.priority-low .task-check:hover {
            background: var(--accent-soft);
        }

        .task-item.priority-low.done .task-check {
            background: var(--accent);
            border-color: var(--accent);
        }

        .task-item.priority-none .task-check {
            border-color: var(--text-3);
        }

        .task-item.priority-none .task-check:hover {
            background: var(--surface-2);
        }

        .task-item.priority-none.done .task-check {
            background: var(--text-3);
            border-color: var(--text-3);
        }

        .task-item.done .task-check::after {
            content: '';
            display: block;
            width: 5px;
            height: 8px;
            border: 2px solid #fff;
            border-top: none;
            border-left: none;
            transform: rotate(42deg) translateY(-1px);
        }

        .task-content {
            flex: 1;
            min-width: 0;
        }

        .task-title {
            font-size: 14px;
            font-weight: 400;
            color: var(--text);
            word-break: break-word;
            line-height: 1.45;
        }

        .task-item.done .task-title {
            text-decoration: line-through;
            color: var(--text-3);
        }

        .task-meta {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 4px;
            flex-wrap: wrap;
        }

        .task-tag {
            font-size: 11px;
            font-weight: 500;
            padding: 2px 8px;
            border-radius: 20px;
            background: var(--surface-2);
            color: var(--text-2);
        }

        .task-date {
            font-size: 11px;
            color: var(--text-3);
            display: flex;
            align-items: center;
            gap: 3px;
        }

        .task-date.overdue {
            color: var(--red);
        }

        .task-date.today {
            color: var(--amber);
        }

        .priority-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
        }

        .task-actions {
            display: none;
            gap: 4px;
            flex-shrink: 0;
        }

        .task-item:hover .task-actions {
            display: flex;
        }

        .task-action {
            background: none;
            border: none;
            cursor: pointer;
            padding: 3px;
            border-radius: 4px;
            color: var(--text-3);
            transition: color var(--transition);
            line-height: 1;
        }

        .task-action:hover {
            color: var(--red);
        }

        .task-action.edit:hover {
            color: var(--accent);
        }

        .task-action.priority-btn:hover {
            color: inherit !important;
            background: var(--surface-2);
        }

        /* ── KANBAN VIEW ── */
        #kanban-view {
            flex: 1;
            overflow-x: auto;
            overflow-y: hidden;
            padding: 24px 28px;
            display: none;
        }

        .kanban-board {
            display: flex;
            gap: 16px;
            height: 100%;
            min-width: max-content;
            align-items: flex-start;
        }

        .kanban-col {
            width: 300px;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            max-height: calc(100vh - 120px);
            background: var(--surface-2);
            border-radius: var(--radius);
            border: 1px solid var(--border);
            overflow: hidden;
        }

        .kanban-col-header {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 14px 16px 12px;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
            background: var(--surface);
        }

        .col-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .col-title {
            font-family: var(--font-family);
            font-weight: 600;
            font-size: 14px;
            flex: 1;
        }

        .col-count {
            font-size: 11px;
            font-weight: 600;
            background: var(--surface-2);
            color: var(--text-3);
            border-radius: 20px;
            padding: 2px 8px;
        }

        .kanban-cards {
            flex: 1;
            overflow-y: auto;
            padding: 10px 12px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .kanban-card {
            background: var(--surface);
            border: 1px solid var(--border-light);
            border-radius: var(--radius-sm);
            padding: 12px 14px;
            cursor: grab;
            transition: all var(--transition);
            animation: taskIn 0.2s ease;
            border-left: 3.5px solid transparent;
        }

        .kanban-card:hover {
            box-shadow: var(--shadow);
            border-color: var(--border);
        }

        .kanban-card.priority-high {
            border-left-color: var(--red);
        }

        .kanban-card.priority-medium {
            border-left-color: var(--amber);
        }

        .kanban-card.priority-low {
            border-left-color: var(--accent);
        }

        .kanban-card.priority-none {
            border-left-color: transparent;
        }

        .kanban-card.dragging {
            opacity: 0.4;
            cursor: grabbing;
        }

        .kanban-card.drag-over {
            border: 2px dashed var(--accent);
            background: var(--accent-soft);
        }

        .kanban-card-title {
            font-size: 13.5px;
            font-weight: 400;
            color: var(--text);
            margin-bottom: 8px;
            line-height: 1.45;
            word-break: break-word;
        }

        .kanban-card.done .kanban-card-title {
            text-decoration: line-through;
            color: var(--text-3);
        }

        .kanban-card-footer {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .kanban-card-actions {
            display: none;
            margin-left: auto;
            gap: 4px;
        }

        .kanban-card:hover .kanban-card-actions {
            display: flex;
        }

        .task-actions.confirm-delete-mode,
        .kanban-card-actions.confirm-delete-mode {
            display: flex !important;
        }

        .add-card-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 8px 14px;
            background: none;
            border: none;
            color: var(--text-3);
            cursor: pointer;
            font-size: 13px;
            font-family: inherit;
            border-top: 1px solid var(--border-light);
            width: 100%;
            text-align: left;
            transition: color var(--transition), background var(--transition);
            flex-shrink: 0;
        }

        .add-card-btn:hover {
            color: var(--accent);
            background: var(--accent-soft);
        }


        /* ── MODALS ── */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(8px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            animation: fadeIn 0.25s ease;
            padding: 20px;
        }

        .form-input[type="date"]::-webkit-calendar-picker-indicator {
            filter: var(--calendar-filter);
            cursor: pointer;
        }

        /* ── SIDEBAR FOOTER ── */
        .sidebar-footer {
            padding: 14px 16px;
            border-top: 1px solid var(--border-light);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            background: var(--sidebar-footer-bg);
            flex-shrink: 0;
            margin-top: auto;
        }

        /* ── DETAIL PANEL ── */
        .detail-panel {
            width: 360px;
            background: var(--bg);
            border-left: 1px solid var(--border-light);
            display: flex;
            flex-direction: column;
            height: 100vh;
            flex-shrink: 0;
            margin-right: -360px;
            transition: margin-right var(--transition), transform var(--transition);
            overflow: hidden;
            z-index: 100;
        }

        .detail-panel.open {
            margin-right: 0;
        }

        .detail-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 18px 20px 10px;
            border-bottom: none;
            flex-shrink: 0;
        }

        .detail-check-wrapper {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .detail-header-title {
            font-family: var(--font-family);
            font-weight: 600;
            font-size: 15px;
            color: var(--text);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .detail-header-actions {
            display: flex;
            align-items: center;
            gap: 6px;
            position: relative;
        }

        .detail-action-btn {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-3);
            padding: 6px;
            border-radius: var(--radius-sm);
            transition: all var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .detail-action-btn:hover {
            background: var(--surface-3);
            color: var(--text);
        }

        .detail-action-btn.delete:hover {
            color: var(--red);
            background: var(--red-soft);
        }

        .detail-body {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        /* Borderless fields in TickTick style */
        .detail-title-input {
            font-family: var(--font-family);
            font-size: 18px;
            font-weight: 600;
            border: none;
            outline: none;
            width: 100%;
            background: transparent;
            color: var(--text);
            padding: 0 0 10px 0;
            border-bottom: 1px solid var(--border-light);
            margin-bottom: 4px;
        }

        .detail-notes-textarea {
            font-family: var(--font-family);
            font-size: 13.5px;
            border: none;
            outline: none;
            width: 100%;
            background: transparent;
            color: var(--text-2);
            resize: none;
            flex: 1;
            min-height: 120px;
            line-height: 1.6;
        }

        .detail-metadata {
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding-top: 16px;
            border-top: 1px solid var(--border-light);
            margin-top: auto;
        }

        .metadata-row {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 13px;
            color: var(--text-2);
        }

        .meta-icon {
            color: var(--text-3);
            flex-shrink: 0;
        }

        .meta-label {
            width: 80px;
            color: var(--text-3);
            flex-shrink: 0;
        }

        .meta-input,
        .meta-select {
            border: none;
            background: transparent;
            color: var(--text);
            outline: none;
            font-family: inherit;
            font-size: 13px;
            padding: 4px 0;
            cursor: pointer;
            width: 100%;
        }

        /* Priority dropdown */
        .priority-dropdown {
            position: absolute;
            top: 36px;
            right: 50px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            box-shadow: var(--shadow-lg);
            z-index: 1000;
            display: flex;
            flex-direction: column;
            padding: 4px 0;
            min-width: 145px;
        }

        .priority-dropdown-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            cursor: pointer;
            font-size: 13px;
            color: var(--text);
            transition: background var(--transition);
            white-space: nowrap;
        }

        .priority-dropdown-item:hover {
            background: var(--surface-3);
        }

        .prio-flag-dot {
            font-size: 14px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .detail-footer {
            padding: 14px 20px;
            border-top: 1px solid var(--border-light);
            display: flex;
            justify-content: flex-end;
            gap: 8px;
            flex-shrink: 0;
        }



        .user-profile {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .user-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: var(--accent);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            font-size: 13px;
            flex-shrink: 0;
        }

        .user-info {
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .user-name {
            font-weight: 600;
            font-size: 13px;
            color: var(--text);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .user-email {
            font-size: 11px;
            color: var(--text-3);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .theme-toggle-btn {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-2);
            padding: 8px;
            border-radius: var(--radius-sm);
            transition: all var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .theme-toggle-btn:hover {
            background: var(--surface-3);
            color: var(--text);
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
            }

            to {
                opacity: 1;
            }
        }

        .modal {
            background: var(--surface);
            border-radius: 16px;
            box-shadow: var(--shadow-lg);
            width: 100%;
            max-width: 480px;
            animation: slideUp 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
            overflow: hidden;
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(16px) scale(0.98);
            }

            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 20px 22px 16px;
            border-bottom: 1px solid var(--border-light);
        }

        .modal-title {
            font-family: var(--font-family);
            font-weight: 600;
            font-size: 16px;
        }

        .modal-close {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-3);
            padding: 4px;
            border-radius: 6px;
            transition: color var(--transition), background var(--transition);
            line-height: 1;
        }

        .modal-close:hover {
            color: var(--text);
            background: var(--surface-2);
        }

        .modal-body {
            padding: 20px 22px;
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .modal-footer {
            padding: 14px 22px;
            border-top: 1px solid var(--border-light);
            display: flex;
            justify-content: flex-end;
            gap: 8px;
        }

        .form-group {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .form-label {
            font-size: 12px;
            font-weight: 600;
            color: var(--text-2);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .form-input,
        .form-select,
        .form-textarea {
            width: 100%;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 9px 12px;
            font-family: inherit;
            font-size: 14px;
            color: var(--text);
            background: var(--surface);
            outline: none;
            transition: border-color var(--transition), box-shadow var(--transition);
            resize: none;
        }

        .form-input:focus,
        .form-select:focus,
        .form-textarea:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
        }

        .form-textarea {
            min-height: 80px;
        }

        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .btn {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 8px 16px;
            border-radius: var(--radius-sm);
            border: none;
            cursor: pointer;
            font-family: inherit;
            font-size: 13.5px;
            font-weight: 500;
            transition: all var(--transition);
        }

        .btn-ghost {
            background: var(--surface-2);
            color: var(--text-2);
            border: 1px solid var(--border);
        }

        .btn-ghost:hover {
            background: var(--surface-3);
            color: var(--text);
        }

        .btn-primary {
            background: var(--accent);
            color: #fff;
        }

        .btn-primary:hover {
            background: var(--accent-hover);
        }

        .btn-danger {
            background: var(--red-soft);
            color: var(--red);
            border: 1px solid #fecaca;
        }

        .btn-danger:hover {
            background: #fee2e2;
        }

        /* priority colors */
        .p-high {
            background: #fef2f2;
            color: #dc2626;
        }

        .p-medium {
            background: #fffbeb;
            color: #d97706;
        }

        .p-low {
            background: var(--accent-soft);
            color: var(--accent);
        }

        .p-none {
            background: var(--surface-2);
            color: var(--text-3);
        }

        .dot-high {
            background: #dc2626;
        }

        .dot-medium {
            background: #d97706;
        }

        .dot-low {
            background: var(--accent);
        }

        .dot-none {
            background: var(--text-3);
        }

        /* drag drop indicator */
        .drop-indicator {
            height: 3px;
            border-radius: 2px;
            background: var(--accent);
            margin: 2px 0;
            display: none;
        }

        .drop-indicator.visible {
            display: block;
        }

        /* ── EMPTY STATE ── */
        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
            padding: 60px 20px;
            color: var(--text-3);
            text-align: center;
        }

        .empty-state svg {
            opacity: 0.35;
        }

        .empty-state h3 {
            font-size: 16px;
            font-weight: 600;
            color: var(--text-2);
        }

        .empty-state p {
            font-size: 13.5px;
            max-width: 260px;
        }

        /* ── TOAST ── */
        .toast-container {
            position: fixed;
            bottom: 24px;
            right: 24px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            z-index: 2000;
        }

        .toast {
            background: var(--accent);
            color: #fff;
            padding: 10px 16px;
            border-radius: 10px;
            font-size: 13.5px;
            font-weight: 500;
            box-shadow: var(--shadow-lg);
            animation: toastIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        @keyframes toastIn {
            from {
                opacity: 0;
                transform: translateY(12px) scale(0.95);
            }

            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        .toast.success {
            background: var(--accent);
        }

        .toast.error {
            background: var(--red);
        }

        /* scrollbars */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        ::-webkit-scrollbar-track {
            background: transparent;
        }

        ::-webkit-scrollbar-thumb {
            background: var(--border);
            border-radius: 3px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--text-3);
        }

        /* Inline add in kanban */
        .kanban-add-form {
            background: var(--surface);
            border: 1px solid var(--accent);
            border-radius: var(--radius-sm);
            padding: 10px 12px;
            display: none;
            flex-direction: column;
            gap: 8px;
        }

        .kanban-add-form.visible {
            display: flex;
        }

        .kanban-add-form input {
            border: none;
            outline: none;
            font-family: inherit;
            font-size: 13.5px;
            color: var(--text);
            width: 100%;
        }

        .kanban-add-form-actions {
            display: flex;
            gap: 6px;
        }

        /* Filter bar */
        .filter-bar {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 4px 28px 16px;
            background: transparent;
            border-bottom: none;
            flex-shrink: 0;
            flex-wrap: wrap;
        }

        .filter-chip {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 4px 11px;
            border-radius: 20px;
            border: 1px solid var(--border);
            background: transparent;
            cursor: pointer;
            font-size: 12.5px;
            font-weight: 500;
            color: var(--text-2);
            transition: all var(--transition);
            user-select: none;
        }

        .filter-chip:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .filter-chip.active {
            background: var(--accent-soft);
            border-color: var(--accent);
            color: var(--accent);
        }

        .sort-dropdown-menu {
            position: absolute;
            top: calc(100% + 6px);
            right: 0;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            box-shadow: var(--shadow-lg);
            z-index: 1010;
            padding: 4px 0;
            min-width: 170px;
        }

        .sort-dropdown-item {
            display: flex;
            align-items: center;
            padding: 8px 16px;
            cursor: pointer;
            font-size: 13px;
            color: var(--text-2);
            transition: background var(--transition), color var(--transition);
            white-space: nowrap;
        }

        .sort-dropdown-item:hover {
            background: var(--surface-3);
            color: var(--text);
        }

        .sort-dropdown-item.active {
            background: var(--accent-soft);
            color: var(--accent);
            font-weight: 500;
        }

        .progress-bar-wrap {
            height: 3px;
            background: var(--border);
            border-radius: 2px;
            overflow: hidden;
            margin-top: 6px;
        }

        .progress-bar-fill {
            height: 100%;
            background: var(--green);
            border-radius: 2px;
            transition: width 0.4s ease;
        }

        @media (max-width: 768px) {
            .menu-toggle-btn {
                display: flex;
            }

            .sidebar-close-btn {
                display: flex;
            }

            .sidebar {
                position: fixed;
                top: 0;
                left: 0;
                bottom: 0;
                z-index: 999;
                transform: translateX(-100%);
                width: 260px !important;
                box-shadow: var(--shadow-lg);
            }

            body.sidebar-open .sidebar {
                transform: translateX(0);
            }

            #list-view,
            #kanban-view {
                padding: 16px;
            }

            .toolbar {
                padding: 12px 16px;
            }

            .filter-bar {
                padding: 10px 16px;
            }

            .detail-panel {
                position: fixed;
                top: 0;
                right: 0;
                bottom: 0;
                z-index: 1000;
                margin-right: 0;
                transform: translateX(100%);
                width: 100% !important;
                max-width: 100% !important;
                box-shadow: none;
            }

            .detail-panel.open {
                transform: translateX(0);
            }
        }

        @media (max-width: 580px) {
            .view-btn span,
            .toolbar-btn.primary span {
                display: none;
            }

            .view-btn,
            .toolbar-btn.primary {
                padding: 8px;
                aspect-ratio: 1;
                justify-content: center;
            }

            .sort-select {
                display: none;
            }

            .task-content > div {
                flex-direction: column !important;
                align-items: flex-start !important;
                gap: 4px !important;
            }

            .task-meta {
                margin-top: 2px;
                flex-wrap: wrap !important;
            }
        }

        .task-item.drag-over-top,
        .kanban-card.drag-over-top {
            border-top: 2px solid var(--accent);
        }

        .task-item.drag-over-bottom,
        .kanban-card.drag-over-bottom {
            border-bottom: 2px solid var(--accent);
        }

        .list-item.drag-over-list {
            background: var(--accent-soft) !important;
            color: var(--accent) !important;
        }

        .task-item.dragging,
        .kanban-card.dragging {
            opacity: 0.4;
        }

        body.dragging-active .list-item *,
        body.dragging-active .task-item *,
        body.dragging-active .kanban-card * {
            pointer-events: none !important;
        }