        /* =========================
   3) Sidebar
   ========================= */
        .sidebar {
            width: 256px;
            background: linear-gradient(to right, var(--tech-blue), var(--tech-blue-mid));
            border-right: 1px solid rgba(58, 108, 147, 0.3);
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            position: relative;
            z-index: 1;

        }

        .sidebar-header {
            padding: 24px;
        }

        .logo-container {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .app-logo {
            height: 32px;
            width: auto;
            display: block;
        }

        .logo-icon {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .logo-icon svg {
            width: 16px;
            height: 16px;
            color: white;
        }

        .logo-text {
            font-size: 20px;
            font-weight: 700;
            background: linear-gradient(to right, white, #d1d5db);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .nav-section {
            flex: 1;
            padding: 0 16px;
            overflow-y: auto;
            overflow-x: hidden;
        }


        .nav-label {
            font-size: 11px;
            font-weight: 600;
            color: #9ca3af;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            padding: 8px 12px;
        }

        .nav-item {
            display: flex;
            align-items: center;
            padding: 10px 12px;
            border-radius: 8px;
            color: #d1d5db;
            cursor: pointer;
            transition: all 0.2s;
            gap: 12px;
            text-decoration: none;
        }

        .nav-item:hover {
            background: rgba(58, 108, 147, 0.5);
            color: white;
        }

        .nav-item.active {
            background: linear-gradient(to right, rgba(253, 169, 41, 0.2), rgba(253, 169, 41, 0.1));
            border: 1px solid rgba(253, 169, 41, 0.3);
            color: var(--tech-orange);
        }

        .nav-item svg {
            width: 20px;
            height: 20px;
        }

        .nav-item span {
            font-weight: 500;
        }

        .projects-nav {
            margin-top: 18px;
        }

        .sidebar-chat-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 10px;
            border-radius: 12px;
            cursor: pointer;
            transition: all .15s ease;
            gap: 10px;
        }

        .sidebar-chat-item:hover {
            background: rgba(58, 108, 147, .22);
        }

        .sidebar-chat-item.active {
            background: linear-gradient(to right, rgba(253, 169, 41, .16), rgba(253, 169, 41, .06));
            border: 1px solid rgba(253, 169, 41, .22);
        }

        .sidebar-chat-left {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .sidebar-avatar {
            width: 28px;
            height: 28px;
            border-radius: 9999px;
            background: rgba(58, 108, 147, .35);
            border: 1px solid rgba(58, 108, 147, .35);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            font-size: 12px;
            color: #e5e7eb;
            flex: 0 0 auto;
        }

        .sidebar-chat-text {
            display: flex;
            flex-direction: column;
            min-width: 0;
            gap: 2px;
        }

        .sidebar-chat-title {
            font-size: 14px;
            font-weight: 650;
            color: #e5e7eb;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .sidebar-chat-subtitle {
            font-size: 12px;
            color: #9ca3af;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .sidebar-pill {
            font-size: 12px;
            padding: 3px 8px;
            background: rgba(58, 108, 147, .25);
            border: 1px solid rgba(58, 108, 147, .25);
            color: #e5e7eb;
            border-radius: 9999px;
        }

        /* indented "project under workspace" */
        .sidebar-child {
            margin-left: 36px;
            padding-left: 8px;
            border-left: 1px solid rgba(58, 108, 147, .18);
        }

        .sidebar-child .sidebar-avatar {
            width: 22px;
            height: 22px;
            font-size: 11px;
            background: rgba(58, 108, 147, .20);
        }






        /* =========================
           Sidebar TreeView (Workspaces > Projects)
           ========================= */
        .sidebar-tree,
        .sidebar-tree ul {
            list-style: none;
            margin: 0;
            padding: 0;
        }

        .sidebar-tree {
            padding: 0 6px;
        }

        .sidebar-tree .tree-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 10px 10px;
            border-radius: 12px;
            cursor: pointer;
            transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
        }

        .sidebar-tree .tree-row:hover {
            background: rgba(58, 108, 147, .22);
        }

        .sidebar-tree .tree-row.active,
        .sidebar-tree .project-nav-item.active {
            background: linear-gradient(to right, rgba(253, 169, 41, .16), rgba(253, 169, 41, .06));
            border: 1px solid rgba(253, 169, 41, .22);
        }

        .sidebar-tree .tree-left {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
            flex: 1;
        }

        .sidebar-tree .tree-label {
            font-size: 14px;
            font-weight: 650;
            color: #E5E7EB;

            /* Wrap to 2 lines when labels are long */
            white-space: normal;
            overflow: hidden;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            word-break: break-word;
            hyphens: auto;
            line-height: 1.15;
        }

        .sidebar-tree .tree-toggle {
            width: 26px;
            height: 26px;
            border-radius: 8px;
            border: 1px solid rgba(58, 108, 147, .35);
            background: rgba(0, 0, 0, .12);
            color: #D1D5DB;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            flex: 0 0 auto;
        }

        .sidebar-tree .tree-toggle:hover {
            background: rgba(58, 108, 147, .25);
            color: #fff;
        }

        .sidebar-tree .tree-toggle svg {
            width: 14px;
            height: 14px;
            transition: transform 0.12s ease;
        }

        .sidebar-tree .tree-node.is-expanded>.tree-row .tree-toggle svg {
            transform: rotate(90deg);
        }

        .sidebar-tree .tree-folder svg {
            width: 18px;
            height: 18px;
            color: #D1D5DB;
            opacity: .95;
        }

        .sidebar-tree .tree-node.is-expanded .folder-closed {
            display: none;
        }

        .sidebar-tree .tree-node:not(.is-expanded) .folder-open {
            display: none;
        }

        .sidebar-tree .tree-children {
            margin: 6px 0 10px 0;
            margin-left: 30px;
            padding-left: 12px;
            border-left: 1px solid rgba(58, 108, 147, .18);
        }

        .sidebar-tree .tree-children .tree-row {
            position: relative;
            padding-left: 8px;
        }

        .sidebar-tree .tree-children .tree-row::before {
            content: "";
            position: absolute;
            left: -12px;
            top: 50%;
            width: 12px;
            border-top: 1px solid rgba(58, 108, 147, .18);
            transform: translateY(-50%);
        }

        .sidebar-tree .tree-project-icon svg {
            width: 16px;
            height: 16px;
            opacity: .75;
        }

        /* Project sidebar actions (kebab menu) */
        .project-nav-right {
            display: flex;
            align-items: center;
            gap: 8px;
            position: relative;
        }

        .project-menu-btn {
            width: 28px;
            height: 28px;
            border-radius: 8px;
            border: 1px solid rgba(58, 108, 147, 0.45);
            background: rgba(0, 0, 0, 0.15);
            color: #d1d5db;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.15s ease;
            font-size: 16px;
            line-height: 1;
            flex-shrink: 0;
        }

        .project-menu-btn:hover {
            background: rgba(58, 108, 147, 0.35);
            color: #fff;
        }

        .sidebar-tree .tree-row.dragging {
            opacity: 0.55;
        }

        .sidebar-tree .tree-row.drag-over {
            box-shadow: inset 0 2px 0 0 var(--tech-orange);
        }

        .sidebar-tree .tree-row.drag-over-bottom {
            box-shadow: inset 0 -2px 0 0 var(--tech-orange);
        }

        .sidebar-tree .tree-row.valid-drop {
            outline: 1px dashed rgba(253, 169, 41, .25);
            outline-offset: -1px;
        }

        .project-menu {
            position: absolute;
            top: 34px;
            right: 0;
            min-width: 160px;
            background: linear-gradient(to bottom, var(--tech-blue), var(--tech-blue-dark));
            border: 1px solid rgba(58, 108, 147, 0.45);
            border-radius: 12px;
            box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
            padding: 6px;
            z-index: 9999;
            display: none;
        }

        .project-menu.show {
            display: block;
        }


        /* ===== Project menu ===== */
        .presence-avatars {
            display: flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
        }

        .presence-avatar {
            position: relative;
            width: 22px;
            height: 22px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid rgba(58, 108, 147, 0.35);
            color: #E5E7EB;
            font-size: 11px;
            font-weight: 800;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            user-select: none;
        }

        .presence-avatar::after {
            content: "";
            position: absolute;
            right: -2px;
            bottom: -2px;
            width: 9px;
            height: 9px;
            border-radius: 50%;
            border: 2px solid rgba(18, 44, 66, 0.95);
            background: rgba(148, 163, 184, 0.9);
            /* offline */
        }

        .presence-avatar.is-online::after {
            background: rgba(34, 197, 94, 0.95);
            /* online */
        }

        .presence-more {
            width: auto;
            padding: 0 8px;
            font-size: 11px;
            font-weight: 900;
            letter-spacing: .2px;
        }

        .project-menu-item.project-menu-delete {
            width: auto;
            padding: 8px 10px;
            border-radius: 10px;
            white-space: nowrap;
        }

        .project-menu-item {
            width: 100%;
            text-align: left;
            border: none;
            background: transparent;
            color: #e5e7eb;
            padding: 10px 10px;
            border-radius: 10px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .project-menu-item:hover {
            background: rgba(58, 108, 147, 0.25);
        }

        .project-menu-item.danger {
            color: #fecaca;
        }

        .project-menu-item.danger:hover {
            background: rgba(239, 68, 68, 0.18);
        }

        .user-profile {
            padding: 16px;
            border-top: 1px solid rgba(58, 108, 147, 0.3);
            display: flex;
            align-items: center;
            gap: 12px;
        }


        /* ===== User menu (avatar dropdown) ===== */
        .user-profile {
            cursor: pointer;
            border-radius: 12px;
            transition: background 0.15s ease, border-color 0.15s ease;
            position: relative;
            /* anchor for focus ring */
        }

        .user-profile:hover {
            background: rgba(58, 108, 147, 0.22);
        }

        .user-profile:focus-within {
            outline: none;
            box-shadow: 0 0 0 3px rgba(253, 169, 41, 0.22);
        }

        .user-menu {
            position: absolute;
            left: 12px;
            right: 12px;
            bottom: 86px;
            /* opens ABOVE the profile row */
            background: linear-gradient(to bottom, var(--tech-blue), var(--tech-blue-dark));
            border: 1px solid rgba(58, 108, 147, 0.45);
            border-radius: 12px;
            box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
            padding: 6px;
            z-index: 9999;
            display: none;
        }

        .user-menu.show {
            display: block;
        }

        .user-menu-head {
            padding: 10px 10px 8px 10px;
            border-bottom: 1px solid rgba(58, 108, 147, 0.35);
            margin-bottom: 6px;
        }

        .user-menu-name {
            font-size: 13px;
            font-weight: 700;
            color: #fff;
            line-height: 1.2;
        }

        .user-menu-role {
            font-size: 11px;
            color: #9ca3af;
            margin-top: 2px;
        }

        .user-menu-item {
            width: 100%;
            text-align: left;
            border: none;
            background: transparent;
            color: #e5e7eb;
            padding: 10px 10px;
            border-radius: 10px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .user-menu-item[disabled] {
            opacity: 0.55;
            cursor: not-allowed;
        }

        .user-menu-item:hover:not([disabled]) {
            background: rgba(58, 108, 147, 0.25);
        }

        .user-menu-item.danger {
            color: #fecaca;
        }

        .user-menu-item.danger:hover {
            background: rgba(239, 68, 68, 0.18);
        }

        .user-menu-sep {
            height: 1px;
            background: rgba(58, 108, 147, 0.35);
            margin: 6px 6px;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            background: linear-gradient(to right, var(--tech-orange), var(--tech-orange-light));
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 600;
            font-size: 14px;
        }

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

        .user-name {
            font-size: 14px;
            font-weight: 500;
            color: white;
        }

        .user-role {
            font-size: 12px;
            color: #9ca3af;
        }

        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            /* important: prevent page-level scroll */
            position: relative;
            z-index: 2;
            min-width: 0;
            min-height: 0;
            /* important: allows inner scrollers to work */
        }







        /* =========================
   4) Project View / Matrix
   ========================= */
        .project-header {
            background: linear-gradient(to right, var(--tech-blue), var(--tech-blue-mid));
            border-bottom: 1px solid rgba(58, 108, 147, 0.3);
            padding: 16px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .project-header-left h2 {
            font-size: 24px;
            font-weight: 700;
            color: white;
        }

        .project-header-meta {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-top: 4px;
        }

        .project-header-meta span {
            font-size: 13px;
            color: #d1d5db;
        }

        .status-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
        }

        .status-dot.active {
            background: #4ade80;
        }

        .status-dot.inactive {
            background: #9ca3af;
        }

        .project-header-actions {
            display: flex;
            gap: 12px;
        }

        /* Presence avatars in project header (left of Delete) */
        .presence-avatars--header {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 8px;
            border: 1px solid rgba(58, 108, 147, 0.25);
            border-radius: 12px;
            background: rgba(0, 0, 0, 0.12);
        }

        .presence-avatars--header .presence-avatar {
            width: 24px;
            height: 24px;
            font-size: 12px;
        }

        .presence-avatars--header .presence-avatar::after {
            width: 8px;
            height: 8px;
            right: -1px;
            bottom: -1px;
        }


        .table-controls {
            background: linear-gradient(to right, var(--tech-blue), var(--tech-blue-mid));
            border-bottom: 1px solid rgba(58, 108, 147, 0.3);
            padding: 12px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .table-controls-left {
            display: flex;
            gap: 8px;
        }

        .table-controls-right {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        /* Online avatars next to task counter (table controls) */
        .presence-avatars--table {
            display: none;
            /* becomes visible when it has online members */
            align-items: center;
            gap: 6px;
            padding: 6px 8px;
            border: 1px solid rgba(58, 108, 147, 0.25);
            border-radius: 12px;
            background: rgba(0, 0, 0, 0.12);
        }

        /* No green dot needed: only online users are shown */
        .presence-avatars--table .presence-avatar::after,
        .presence-avatars--table .presence-avatar.is-online::after {
            display: none;
        }

        .presence-avatars--table .presence-avatar {
            width: 24px;
            height: 24px;
            font-size: 12px;
        }


        .task-count {
            font-size: 14px;
            color: #9ca3af;
        }

        .divider {
            width: 1px;
            height: 16px;
            background: rgba(58, 108, 147, 0.5);
        }

