:root {
    --bg-body: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-surface-secondary: #f8f9fa;
    --bg-surface-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #343a40; /* Darkened for better contrast */
    --text-muted: #5a6268; /* Darkened for better contrast */
    --border-color: #dee2e6;
    --border-color-subtle: #e5e7eb;
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --danger-color: #dc3545;
    --code-bg: #f3f4f6;
    --code-color: #d63384;
    --pre-bg: #212529;
    --pre-color: #f8f9fa;
    --semantic-green: #059669;
    --semantic-orange: #d97706;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --bg-header: var(--bg-body);
}

[data-theme="dark"] {
    --bg-body: #121212;
    --bg-surface: #1e1e1e;
    --bg-surface-secondary: #2d2d2d;
    --bg-surface-tertiary: #383838;
    --text-primary: #f8f9fa; /* Brightened */
    --text-secondary: #e9ecef; /* Brightened */
    --text-muted: #adb5bd; /* Brightened */
    --border-color: #404040;
    --border-color-subtle: #333333;
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --danger-color: #e74c3c;
    --code-bg: #2d2d2d;
    --code-color: #e06c75;
    --pre-bg: #2d2d2d;
    --pre-color: #e0e0e0;
    --semantic-green: #34d399;
    --semantic-orange: #fbbf24;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --bg-header: #000000;
}

/* Theme Utility Classes */
.bg-theme-surface { background-color: var(--bg-surface) !important; }

/* Important Checkbox Styling */
#importantCheckbox {
    /* Hide the default checkbox outline/border */
    outline: none !important;
    box-shadow: none !important;
}

#importantCheckbox:checked + label {
    color: #ffc107 !important; /* Yellow when checked */
    border-color: transparent !important; /* Remove border */
    background-color: transparent !important; /* Remove background */
}

#importantCheckbox:not(:checked) + label {
    color: #6c757d !important; /* Grey when unchecked */
}

#importantCheckbox:disabled + label {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

[data-theme="dark"] #importantCheckbox:not(:checked) + label {
    color: #9ca3af !important; /* Lighter grey for dark theme */
}
.bg-theme-surface-secondary { background-color: var(--bg-surface-secondary) !important; }
.bg-theme-surface-tertiary { background-color: var(--bg-surface-tertiary) !important; }
.text-theme-primary { color: var(--text-primary) !important; }
.text-theme-secondary { color: var(--text-secondary) !important; }
.border-theme { border-color: var(--border-color) !important; }

/* Bootstrap Overrides for Theming */
.text-body {
    color: var(--text-primary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.bg-light {
    background-color: var(--bg-surface-secondary) !important;
}

.bg-white {
    background-color: var(--bg-surface) !important;
}

.border {
    border-color: var(--border-color) !important;
}

/* Bootstrap Overrides for Dark Mode */
[data-theme="dark"] .list-group-item {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .list-group-item-action:hover,
[data-theme="dark"] .list-group-item-action:focus {
    background-color: var(--bg-surface-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .list-group-item.disabled,
[data-theme="dark"] .list-group-item:disabled {
    background-color: var(--bg-surface-tertiary);
    color: var(--text-muted);
}

[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .bg-white {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary);
}

[data-theme="dark"] .card {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-content {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ============================================
   WORKSPACES DRAWER (Off-canvas)
   ============================================ */
#workspaces-drawer {
    width: 340px !important;
    max-width: 85vw;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color-subtle);
}

#workspaces-drawer .offcanvas-header {
    border-bottom: 1px solid var(--border-color-subtle);
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
}

#workspaces-drawer .offcanvas-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#workspaces-drawer .offcanvas-title i {
    color: var(--primary-color);
}

#workspaces-drawer .offcanvas-body {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#workspaces-drawer .workspaces-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

#workspaces-drawer .btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
}

#workspaces-drawer .btn-ghost:hover {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

/* Drawer Footer - User Info & Settings */
.drawer-footer {
    border-top: 1px solid var(--border-color-subtle);
    padding: 0.75rem 1rem;
    background: var(--bg-surface-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
}

.drawer-user-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    flex: 1;
}

.drawer-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-surface-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.drawer-user-avatar i {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.drawer-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

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

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

.drawer-settings-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.drawer-settings-link {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.drawer-settings-link:hover {
    background: var(--bg-surface-tertiary);
    color: var(--text-primary);
}

.drawer-settings-link i {
    font-size: 1rem;
}

/* Filter dropdown - always visible in drawer */
.drawer-filter-dropdown {
    display: block;
}

/* Dark mode adjustments for drawer */
[data-theme="dark"] #workspaces-drawer {
    background: var(--bg-surface);
}

[data-theme="dark"] #workspaces-drawer .offcanvas-header {
    background: var(--bg-surface);
}

/* Drawer toggle button styling */
#workspacesDrawerToggle {
    position: relative;
}

#workspacesDrawerToggle.has-active::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */

html, body {
    height: 100%;
    overflow: hidden;
    color: var(--text-primary);
    background-color: var(--bg-body);
}

/* Root Layout Container */
.workspaces-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Mobile viewport fix */
    max-height: 100dvh; /* Prevent overflow */
    width: 100vw;
    background: var(--bg-body);
    overflow: hidden;
    box-sizing: border-box;
}

/* Header Styles */
.app-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color-subtle);
    z-index: 1030;
    color: var(--text-primary);
    height: 48px;
    flex-shrink: 0;
}

.app-header nav {
    max-width: 100%;
    gap: 0 !important;
    height: 100%;
}

.app-header .app-brand {
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    gap: 0.25rem;
}

.app-header .app-brand:hover {
    color: var(--primary-color);
}

.app-header .app-brand i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.app-header .app-brand .brand-text {
    font-size: 1rem;
    margin-left: 0.25rem;
}

/* Global search container styling - wider by default */
#globalSearchContainer {
    max-width: 900px;
    min-width: 300px;
    flex: 1 1 auto;
}

/* Icon buttons in header */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.15s ease;
    font-size: 0.875rem;
}

.btn-icon:hover {
    background: var(--bg-surface-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color-subtle);
}

.btn-icon:active {
    transform: scale(0.95);
}

.btn-icon.text-danger {
    color: var(--danger-color);
}

.btn-icon.text-danger:hover {
    background: rgba(220, 53, 69, 0.12);
    border-color: rgba(220, 53, 69, 0.2);
}

/* Tablet responsive header (768px and below) */
@media (max-width: 768px) {
    .app-header .app-brand .brand-text {
        display: none; /* Hide text on tablet */
    }
    
    #globalSearchContainer {
        min-width: 150px;
    }
}

/* Mobile responsive header (576px and below) */
@media (max-width: 576px) {
    .app-header {
        height: 48px;
        padding: 0 0.5rem;
    }
    
    .app-header nav {
        gap: 0.375rem !important;
    }
    
    .app-header .app-brand {
        font-size: 0.875rem;
    }
    
    .app-header .app-brand i {
        font-size: 1.375rem;
    }
    
    /* Full width search on mobile, but don't push audio out */
    #globalSearchContainer {
        max-width: none;
        min-width: 0;
        flex: 1 1 100px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .header-toolbar {
        gap: 0.25rem !important;
    }
}

/* Content Area */
.workspaces-layout-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Panels Base Styles */
.workspaces-sidebar-left,
.workspaces-center-panel,
.workspaces-sidebar-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-surface);
}

.workspaces-center-panel {
    background: var(--bg-body);
}

/* Panel Headers */
.panel-header {
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color-subtle);
    margin: 0; /* Ensure no margin */
}

/* Panel Header Controls */
.panel-header .btn {
    height: 28px !important;
    min-height: 28px !important;
    min-width: 28px !important;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.panel-header .btn-group {
    align-items: center;
}

.panel-header .btn-group .btn {
    border-radius: 0;
}

.panel-header .btn-group .btn:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.panel-header .btn-group .btn:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Fix for label buttons (like the star icon) */
.panel-header label.btn {
    margin-bottom: 0;
}

/* Panel Content Containers */
.workspaces-list-container,
.workspace-editor-container,
.assets-panel-container {
    flex: 1;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    margin: 0; /* Ensure no margin */
    padding: 0.5rem 0.5rem 0 0.5rem; /* Add padding for separation */
}

/* Mobile Bottom Navigation */
.workspaces-bottom-nav {
    height: 60px;
    flex-shrink: 0; /* Prevent shrinking */
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color-subtle);
    display: flex;
    justify-content: space-around;
    padding: 0;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.workspaces-bottom-nav-item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.15s;
    padding: 0.25rem;
    background: none;
    border: none;
}

.workspaces-bottom-nav-item i {
    font-size: 1.25rem;
    line-height: 1;
}

.workspaces-bottom-nav-item:hover,
.workspaces-bottom-nav-item.active {
    color: var(--primary-color);
}

.workspaces-bottom-nav-item .badge {
    position: absolute;
    top: 0.25rem;
    right: 50%;
    transform: translateX(10px);
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
}

/* Floating Action Button (Mobile) */
.workspaces-fab {
    position: fixed;
    bottom: 80px;
    right: 1rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
}

.workspaces-fab:hover {
    background: #0052a3;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    transform: scale(1.1);
}

.workspaces-fab:active {
    transform: scale(0.95);
}

/* Sidebar Panels (Hidden on Mobile) */
.workspaces-sidebar-left {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color-subtle);
    overflow-y: hidden;
    padding: 0;
}

.workspaces-sidebar-right {
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color-subtle);
    padding: 0;
    overflow: hidden; /* Let child handle scrolling */
}

/* Panel Toggle Buttons */
.panel-toggle-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-color-subtle);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.panel-toggle-btn:hover {
    background: #f3f4f6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.panel-toggle-left {
    left: -16px;
}

.panel-toggle-right {
    right: -16px;
}

/* Workspaces List in Sidebar */
.workspaces-list-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.workspaces-list-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color-subtle);
}

.workspaces-search-bar {
    position: relative;
    margin-bottom: 1rem;
}

.workspaces-search-bar input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.workspaces-search-bar .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.workspaces-search-bar .filters-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.workspaces-search-bar .filters-toggle:hover {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.workspaces-search-bar .filters-toggle.active {
    background: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
}

/* Workspaces List Items */
.workspaces-list-items {
    flex: 1;
    overflow-y: auto;
}

.workspace-list-item {
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid var(--border-color-subtle);
    background: var(--bg-surface);
}

.workspace-list-item:hover {
    background: var(--bg-surface-secondary);
    box-shadow: var(--shadow-md);
}

.workspace-list-item.active {
    background: rgba(13, 110, 253, 0.15);
    border-left-color: var(--primary-color);
}

/* Active state takes precedence over important state */
.workspace-list-item.important.active {
    background: rgba(13, 110, 253, 0.15);
    border-left-color: var(--primary-color);
}

.workspace-list-item.important {
    border-left-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.workspace-list-item.important:hover {
    background: rgba(220, 53, 69, 0.15);
}

.workspace-list-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.workspace-list-item-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.workspace-list-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.workspace-list-item-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.workspace-list-item-badges {
    display: flex;
    gap: 0.25rem;
}

.workspace-list-item-badge {
    background: var(--bg-surface-tertiary);
    color: var(--text-secondary);
    padding: 0.1rem 0.35rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
}

/* Skeleton Loading States */
.skeleton-workspace-item {
    pointer-events: none;
    opacity: 1;
    background: var(--bg-surface-secondary) !important;
}

.skeleton-workspace-item .skeleton-workspace-title,
.skeleton-workspace-item .skeleton-workspace-preview,
.skeleton-workspace-item .skeleton-workspace-date,
.skeleton-workspace-item .skeleton-workspace-badge {
    background: linear-gradient(90deg, var(--border-color-subtle) 25%, var(--border-color) 50%, var(--border-color-subtle) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-workspace-item .skeleton-workspace-title {
    height: 20px;
    width: 70%;
    margin-bottom: 8px;
}

.skeleton-workspace-item .skeleton-workspace-preview {
    height: 16px;
    width: 90%;
    margin-bottom: 8px;
}

.skeleton-workspace-item .skeleton-workspace-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-workspace-item .skeleton-workspace-date {
    height: 14px;
    width: 80px;
}

.skeleton-workspace-item .skeleton-workspace-badge {
    height: 18px;
    width: 40px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Center Panel - Note Editor */
.workspace-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* max-width: 900px; Removed for full width */
    margin: 0 auto;
    width: 100%; /* Ensure it takes full width */
}

.workspace-editor-header {
    background: var(--bg-surface);
    padding: 1rem;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid var(--border-color-subtle);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    margin-top: 0; /* Remove any top margin */
}

.workspace-editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.workspace-editor-body {
    flex: 1;
    overflow-y: auto;
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
}

#artifactsContainer {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Right Sidebar - Assets Panel */
.assets-panel-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Allow flex item to shrink below content size */
}

.assets-panel-header {
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color-subtle);
}

.assets-panel-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.assets-panel-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.assets-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#associatedAssets {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#associatedAssets .list-group-item {
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color-subtle) !important;
    border-radius: 8px !important;
    background: var(--bg-surface);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    position: relative;
}

/* Focused asset in relations sidebar (bidirectional sync with graph) */
#associatedAssets .list-group-item.asset-focused {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.05);
}

#associatedAssets .list-group-item.asset-focused::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
    border-radius: 8px 0 0 8px;
}

/* ========================================
   UNIFIED HOVER/FOCUS HIGHLIGHTING SYSTEM
   ======================================== */

/* Artifact card highlighting */
.grid-item.item-highlighted {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25), 0 4px 12px rgba(99, 102, 241, 0.15);
    background: rgba(99, 102, 241, 0.03);
    z-index: 10;
    transform: translateY(-1px);
    transition: all 0.15s ease;
}

.grid-item.item-dimmed {
    opacity: 0.35;
    transition: opacity 0.15s ease;
}

/* Asset badge highlighting within artifact cards */
.nested-asset-badge.highlighted {
    border-color: var(--primary-color) !important;
    background: rgba(99, 102, 241, 0.1) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.nested-asset-badge.related-highlighted {
    border-color: var(--primary-hover) !important;
    background: rgba(99, 102, 241, 0.05) !important;
}

/* Tag highlighting within artifact cards */
.nested-tag.tag-highlighted {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.nested-tag.tag-dimmed {
    opacity: 0.4;
}

/* Hover state for asset items in relations sidebar */
#associatedAssets .list-group-item:hover:not(.asset-focused) {
    background: rgba(99, 102, 241, 0.03);
    border-color: var(--primary-hover);
}

.assets-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.assets-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.assets-empty-state i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

/* Mobile Specifics */
@media (max-width: 767.98px) {
    .workspaces-layout-content {
        /* Full height minus mobile header and bottom nav */
        /* Flex handles this */
    }

    .workspaces-sidebar-left,
    .workspaces-center-panel,
    .workspaces-sidebar-right {
        display: none; /* Hidden by default */
        width: 100%;
        height: 100%;
        border: none; /* No borders on mobile */
        padding: 0; /* Remove padding on mobile */
    }

    .workspaces-sidebar-left.mobile-active,
    .workspaces-center-panel.mobile-active,
    .workspaces-sidebar-right.mobile-active {
        display: flex;
    }
    
    /* Hide desktop expand buttons on mobile */
    #expandLeftBtn,
    #expandRightBtn {
        display: none !important;
    }
}

/* Desktop Specifics */
@media (min-width: 768px) {
    .workspaces-layout-content {
        display: flex;
        flex-direction: row;
        overflow: hidden;
    }

    .workspaces-center-panel {
        flex: 1;
        min-width: 0; /* Important for nested flex/grid to shrink properly */
        display: flex !important;
        flex-direction: column;
        height: 100%;
        padding: 0; /* Remove padding */
    }

    .workspaces-sidebar-right {
        width: 300px;
        flex-shrink: 0;
        border-left: 1px solid var(--border-color-subtle);
        display: flex !important;
        flex-direction: column;
        height: 100%;
        transition: width 0.3s ease, padding 0.3s ease;
    }
    
    /* Hide Bottom Nav */
    .workspaces-bottom-nav {
        display: none !important;
    }
    
    /* Collapsible Right Panel */
    .workspaces-sidebar-right.collapsed {
        width: 0;
        min-width: 0;
        padding: 0;
        overflow: hidden;
        border: none;
    }
}

/* Wide Desktop */
@media (min-width: 1440px) {
    .workspaces-sidebar-right {
        width: 350px;
    }
}

/* Touch Optimization for Mobile */
@media (max-width: 767px) {
    /* Minimum tap target sizes */
    button,
    .btn,
    .workspace-list-item,
    .artifact-item .card-header button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger spacing for touch */
    .artifact-item {
        margin-bottom: 1rem;
    }

    /* Full-width modals on mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        height: 100%;
        border-radius: 0;
    }

    /* Sticky bottom padding for FAB and bottom nav */
    .workspaces-center-panel {
        padding-bottom: 0;
    }
}

/* Smooth Transitions */
.workspaces-sidebar-left,
.workspaces-sidebar-right,
.workspaces-layout-content {
    transition: all 0.3s ease;
}

/* Loading States */
.workspaces-list-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}

.workspaces-list-loading .spinner-border {
    width: 2rem;
    height: 2rem;
    margin-right: 0.75rem;
}

/* Empty States */
.workspaces-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.workspaces-empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.workspaces-empty-state p {
    margin: 0;
    font-size: 0.95rem;
}

/* Scroll Shadows for Better UX */
.workspaces-list-items,
.workspace-editor-body,
.assets-panel-body {
    position: relative;
}

.workspaces-list-items::-webkit-scrollbar,
.workspace-editor-body::-webkit-scrollbar,
.assets-panel-body::-webkit-scrollbar,
#associatedAssets::-webkit-scrollbar {
    width: 8px;
}

.workspaces-list-items::-webkit-scrollbar-track,
.workspace-editor-body::-webkit-scrollbar-track,
.assets-panel-body::-webkit-scrollbar-track,
#associatedAssets::-webkit-scrollbar-track {
    background: var(--bg-surface-secondary);
}

.workspaces-list-items::-webkit-scrollbar-thumb,
.workspace-editor-body::-webkit-scrollbar-thumb,
.assets-panel-body::-webkit-scrollbar-thumb,
#associatedAssets::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.workspaces-list-items::-webkit-scrollbar-thumb:hover,
.workspace-editor-body::-webkit-scrollbar-thumb:hover,
.assets-panel-body::-webkit-scrollbar-thumb:hover,
#associatedAssets::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Panel States */
.panel-loading {
    opacity: 0.5;
    pointer-events: none;
}

.panel-error {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid var(--danger-color);
    padding: 1rem;
    border-radius: 8px;
    color: var(--danger-color);
}

/* Asset Quick Picker Styles */
.asset-quick-picker {
    padding: 1rem;
    background: var(--bg-surface);
    border-radius: 8px;
    border: 1px solid var(--border-color-subtle);
    margin-bottom: 1rem;
}

.asset-quick-picker-header h6 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.asset-quick-picker-header i {
    color: var(--primary-color);
}

.asset-quick-picker-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.asset-quick-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color-subtle);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.asset-quick-badge:hover {
    background: var(--bg-surface-tertiary);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.asset-quick-badge.loading {
    opacity: 0.5;
    pointer-events: none;
}

.asset-quick-badge i:first-child {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.asset-quick-badge span {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.asset-quick-badge-action {
    color: var(--primary-color);
    font-size: 1.125rem;
}

.asset-quick-picker-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.asset-quick-picker-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.asset-quick-picker-toast {
    position: fixed;
    bottom: 100px;
    right: 1rem;
    background: var(--bg-surface);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 9999;
}

.asset-quick-picker-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.asset-quick-picker-toast.toast-success {
    border-left: 4px solid #10b981;
}

.asset-quick-picker-toast.toast-error {
    border-left: 4px solid #ef4444;
}

/* Mobile Gesture Styles */
.block-swipe-actions,
.workspace-swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: rgba(0,0,0,0.05);
    z-index: 10;
}

.block-swipe-actions.action-delete,
.workspace-swipe-actions.action-archive {
    background: linear-gradient(to left, rgba(239,68,68,0.1), transparent);
}

.block-swipe-actions.action-duplicate,
.workspace-swipe-actions.action-star {
    background: linear-gradient(to right, rgba(59,130,246,0.1), transparent);
}

.drag-mode {
    opacity: 0.7;
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    cursor: move;
}

.drag-instructions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(59,130,246,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 20;
    border-radius: 8px;
}

.drag-instructions-content {
    text-align: center;
}

.drag-instructions i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* ========================================
   MOVED FROM EMBEDDED STYLES IN lexicon.html
   ======================================== */

/* Workspace Composer area - Modern, sleek, minimalist */
.quick-capture-card {
    background: var(--bg-surface);
    border: 2px solid var(--primary-color); /* Was #28a745 green, but let's use primary or a specific success var if needed */
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
}

.quick-capture-card:hover {
    box-shadow: var(--shadow-md);
}

.quick-capture-card h3 {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.quick-capture-card h3 i {
    color: var(--text-secondary);
}

.capture-mode-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.capture-mode-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    cursor: pointer;
}

.capture-mode-btn:hover {
    background: var(--bg-surface-secondary);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.capture-mode-btn.active {
    background: var(--bg-surface-tertiary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.capture-mode-btn i {
    margin-right: 0.5rem;
    opacity: 0.75;
}

/* Editor styles */
.editor-container {
    background: var(--bg-surface);
    border-radius: 8px;
    overflow: hidden;
}

#textEditor {
    min-height: 200px;
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

#markdownEditor {
    min-height: 200px;
    font-family: monospace;
    background: var(--code-bg);
    color: var(--code-color);
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

#richEditor {
    min-height: 200px;
    background: var(--bg-surface);
}

.ql-editor {
    min-height: 200px;
}

/* Workspaces list */
.workspace-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border-left: 4px solid var(--text-secondary);
    margin-bottom: 1rem;
}

.workspace-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md) !important;
}

.workspace-card.important {
    border-left-color: var(--danger-color);
    background: rgba(220, 53, 69, 0.1);
}

.workspace-content-preview {
    max-height: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Asset tags - Compact badge style */
.asset-tag {
    display: inline-block;
    background: var(--bg-surface-tertiary);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    margin: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.asset-tag:hover {
    background: var(--primary-color);
    color: white;
}

.asset-tag .remove-btn {
    margin-left: 0.5rem;
    cursor: pointer;
    opacity: 0.7;
}

.asset-tag .remove-btn:hover {
    opacity: 1;
}

.asset-compact-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8rem;
    margin: 0.2rem;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    border: 1px solid var(--border-color-subtle);
}

.asset-compact-badge.root-asset {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--semantic-orange); /* Keep this orange-ish for now, or use a var */
}

.asset-compact-badge.root-asset i {
    color: #f59e0b;
}

.asset-compact-badge:hover {
    background: var(--bg-surface-tertiary);
    border-color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}

.asset-compact-badge .asset-indicators {
    display: flex;
    gap: 0.15rem;
    font-size: 0.7rem;
    opacity: 0.9;
}

.asset-expanded-card {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color-subtle);
    border-radius: 6px;
    padding: 0.75rem;
    margin: 0.5rem 0;
    box-shadow: var(--shadow-sm);
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.asset-expanded-card .asset-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color-subtle);
}

.asset-expanded-card .asset-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    flex: 1;
}

.asset-expanded-card .asset-type-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--semantic-orange);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Type-Specific Badge Colors - Modern & Vibrant Palette */
.asset-type-badge[data-type='Email'],
.badge[data-type='Email'] {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #3b82f6 !important;
}

.asset-type-badge[data-type='Text'],
.badge[data-type='Text'] {
    background: rgba(99, 102, 241, 0.15) !important;
    color: #6366f1 !important;
}

.asset-type-badge[data-type='Markdown'],
.badge[data-type='Markdown'] {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

.asset-type-badge[data-type='Html'],
.badge[data-type='Html'] {
    background: rgba(139, 92, 246, 0.15) !important;
    color: #8b5cf6 !important;
}

.asset-type-badge[data-type='Code'],
.badge[data-type='Code'] {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #10b981 !important;
}

.asset-type-badge[data-type='Image'],
.badge[data-type='Image'] {
    background: rgba(236, 72, 153, 0.15) !important;
    color: #ec4899 !important;
}

.asset-type-badge[data-type='Audio'],
.badge[data-type='Audio'] {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
}

.asset-type-badge[data-type='Video'],
.badge[data-type='Video'] {
    background: rgba(168, 85, 247, 0.15) !important;
    color: #a855f7 !important;
}

.asset-type-badge[data-type='File'],
.badge[data-type='File'] {
    background: rgba(249, 115, 22, 0.15) !important;
    color: #f97316 !important;
}

.asset-type-badge[data-type='Drive'],
.asset-type-badge[data-type='DriveFile'],
.badge[data-type='Drive'],
.badge[data-type='DriveFile'] {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #22c55e !important;
}

.asset-type-badge[data-type='Calendar'],
.asset-type-badge[data-type='CalendarEvent'],
.badge[data-type='Calendar'],
.badge[data-type='CalendarEvent'] {
    background: rgba(6, 182, 212, 0.15) !important;
    color: #06b6d4 !important;
}

.asset-type-badge[data-type='Pdf'],
.badge[data-type='Pdf'] {
    background: rgba(220, 38, 38, 0.15) !important;
    color: #dc2626 !important;
}

.asset-type-badge[data-type='Spreadsheet'],
.badge[data-type='Spreadsheet'] {
    background: rgba(5, 150, 105, 0.15) !important;
    color: #059669 !important;
}

.asset-type-badge[data-type='Presentation'],
.badge[data-type='Presentation'] {
    background: rgba(234, 88, 12, 0.15) !important;
    color: #ea580c !important;
}

.asset-expanded-card .asset-actions {
    display: flex;
    gap: 0.25rem;
}

.asset-expanded-card .asset-btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.asset-expanded-card .asset-btn:hover {
    background: var(--bg-surface-tertiary);
    color: var(--text-primary);
}

.asset-expanded-card .asset-btn.remove:hover {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.asset-expanded-card .asset-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.asset-expanded-card .asset-section {
    margin-top: 0.5rem;
}

.asset-expanded-card .asset-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.asset-expanded-card .asset-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.asset-expanded-card .asset-tag-item {
    background: var(--bg-surface-tertiary);
    color: var(--text-primary);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--border-color-subtle);
}

.asset-expanded-card .asset-tag-item.semantic {
    background: rgba(16, 185, 129, 0.1);
    color: var(--semantic-green);
    border-color: rgba(16, 185, 129, 0.2);
}

.asset-expanded-card .relationship-item {
    background: rgba(245, 158, 11, 0.15);
    color: var(--semantic-orange);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    margin: 0.15rem;
    display: inline-block;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.assets-view-toggle button {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.assets-view-toggle button:first-child {
    border-radius: 4px 0 0 4px;
}

.assets-view-toggle button:last-child {
    border-radius: 0 4px 4px 0;
}

.assets-view-toggle button.active {
    background: var(--bg-surface-tertiary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.assets-view-toggle button:hover:not(.active) {
    background: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.asset-count-badge {
    background: var(--bg-surface-tertiary);
    color: var(--text-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.asset-compact-badge.root-asset .asset-count-badge {
    background: #fde68a;
    color: #92400e;
}

/* Suggestions */
.suggestion-card {
    background: var(--bg-surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.suggestion-badge {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.confidence-bar {
    height: 4px;
    background: var(--border-color-subtle);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    transition: width 0.3s ease;
}

/* Audio recording */
.recording-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: #dc3545;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
    margin-right: 0.5rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Markdown preview */
.markdown-preview {
    background: var(--bg-surface);
    padding: 1rem;
    border-radius: 4px;
    min-height: 200px;
    color: var(--text-primary);
}

.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.markdown-preview code {
    background: var(--code-bg);
    color: var(--code-color);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
}

.markdown-preview pre {
    background: var(--pre-bg);
    color: var(--pre-color);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

/* Utility Classes */
.hover-shadow-sm:hover {
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075)!important;
    transform: translateY(-1px);
}
.transition-all {
    transition: all 0.2s ease-in-out;
}

/* ==========================================
   New Content Block UI (Overhaul)
   ========================================== */

.artifact-item {
    border: 1px solid var(--border-color-subtle);
    border-radius: 8px;
    background: var(--bg-surface);
    margin-bottom: 0.5rem;
    transition: box-shadow 0.2s, border-color 0.2s, opacity 0.3s;
    /* overflow: hidden; Removed to prevent clipping of shadows/focus rings */
}

/* Saving State */
.artifact-item.saving {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.artifact-item.saving::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: saving-shimmer 1.5s infinite;
}

@keyframes saving-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

[data-theme="dark"] .artifact-item.saving::after {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
}

.artifact-item:hover {
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.artifact-item.selected {
    border-color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.1);
}

/* Header */
.artifact-header {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-color-subtle);
    min-height: 32px;
    gap: 0.5rem;
    cursor: pointer; /* Clicking header toggles collapse by default? Or maybe just the chevron */
    user-select: none;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}

.artifact-item.collapsed .artifact-header {
    border-bottom: none;
}

/* Drag Handle */
.block-drag-handle {
    color: var(--text-muted);
    cursor: grab;
    padding: 0.25rem;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s;
}

.artifact-item:hover .block-drag-handle {
    opacity: 1;
}

.block-drag-handle:active {
    cursor: grabbing;
}

/* Collapse Toggle */
.block-collapse-toggle {
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.block-collapse-toggle:hover {
    background: var(--bg-surface-tertiary);
    color: var(--text-primary);
}

.block-collapse-toggle i {
    transition: transform 0.2s;
}

.artifact-item.collapsed .block-collapse-toggle i {
    transform: rotate(-90deg);
}

/* Title / Summary */
.block-title-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.block-title-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.block-type-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: var(--bg-surface-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex-shrink: 0; /* Prevent badge from shrinking */
}

.block-title-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.block-summary-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Actions (Right side) */
.block-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s;
}

.artifact-item:hover .block-actions,
.artifact-item.active .block-actions {
    opacity: 1;
}

.block-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    transition: all 0.15s;
}

.block-action-btn:hover {
    background: var(--bg-surface-tertiary);
    color: var(--text-primary);
}

.block-action-btn.btn-danger:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger-color);
}

/* Body */
.artifact-body {
    padding: 0; /* Padding handled by children */
    display: block;
}

.artifact-item.collapsed .artifact-body {
    display: none;
}

/* Viewer */
.artifact-viewer {
    padding: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    cursor: text; /* Suggests it contains text */
}

/* Editor Styles */
.editor-inputs-wrapper {
    /* Padding is handled by utility class p-3 in JS, or we can enforce it here */
}

.save-block-btn {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: white !important;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Markdown Styles in Viewer */
.artifact-viewer h1, .artifact-viewer h2, .artifact-viewer h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}
.artifact-viewer h1 { font-size: 1.5rem; border-bottom: 1px solid var(--border-color-subtle); padding-bottom: 0.3rem; }
.artifact-viewer h2 { font-size: 1.25rem; }
.artifact-viewer h3 { font-size: 1.1rem; }
.artifact-viewer p { margin-bottom: 0.75rem; }
.artifact-viewer code {
    background: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85em;
    color: var(--code-color);
}
.artifact-viewer pre {
    background: var(--pre-bg);
    color: var(--pre-color);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1rem;
}
.artifact-viewer pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 0.9em;
}
.artifact-viewer blockquote {
    border-left: 4px solid var(--border-color-subtle);
    padding-left: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Editor Container */
.artifact-editor-container {
    padding: 0;
    background: var(--bg-surface);
    border-top: none;
    border-bottom-left-radius: 7px;
    border-bottom-right-radius: 7px;
}

.artifact-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border-top: none !important;
}

/* Metadata Editor (Hidden by default) */
.metadata-editor {
    padding: 0.75rem 1rem;
    background: var(--bg-surface-secondary);
    border-bottom: 1px solid var(--border-color-subtle);
    display: none;
}

.metadata-editor.visible {
    display: block;
}

/* Dark Mode Form Select (Lighter Arrow) */
[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23f8f9fa' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* EasyMDE / Markdown Editor Dark Mode */
[data-theme="dark"] .EasyMDEContainer .editor-toolbar {
    background-color: var(--bg-surface-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .EasyMDEContainer .editor-toolbar button {
    color: var(--text-primary);
    border-color: transparent;
}

[data-theme="dark"] .EasyMDEContainer .editor-toolbar button:hover,
[data-theme="dark"] .EasyMDEContainer .editor-toolbar button.active {
    background-color: var(--bg-surface-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .EasyMDEContainer .editor-toolbar i.separator {
    border-left-color: var(--border-color);
    border-right-color: var(--border-color);
}

[data-theme="dark"] .EasyMDEContainer .CodeMirror {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .EasyMDEContainer .CodeMirror-cursor {
    border-left-color: var(--text-primary);
}

[data-theme="dark"] .EasyMDEContainer .editor-preview-side,
[data-theme="dark"] .EasyMDEContainer .editor-preview {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Adjust CodeMirror syntax highlighting for dark mode */
[data-theme="dark"] .cm-header { color: #ff79c6; }
[data-theme="dark"] .cm-quote { color: #6272a4; font-style: italic; }
[data-theme="dark"] .cm-keyword { color: #ff79c6; }
[data-theme="dark"] .cm-url { color: #8be9fd; }
[data-theme="dark"] .cm-link { color: #f1fa8c; }
[data-theme="dark"] .cm-string { color: #f1fa8c; }
[data-theme="dark"] .cm-variable-2 { color: #50fa7b; }
[data-theme="dark"] .cm-comment { color: #6272a4; }

/* Custom Scrollbar for Dark Mode */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
    border: 2px solid var(--bg-surface-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Bootstrap Dark Mode Overrides */
[data-theme="dark"] .card {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .card-header {
    background-color: var(--bg-surface-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--bg-surface-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--bg-surface-secondary);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .modal-content {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--bg-surface-secondary);
    color: var(--primary-color);
}

[data-theme="dark"] .dropdown-divider {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Quill Rich Text Editor Dark Mode */
[data-theme="dark"] .ql-toolbar.ql-snow {
    background-color: var(--bg-surface-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .ql-container.ql-snow {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .ql-editor {
    color: var(--text-primary);
}

[data-theme="dark"] .ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: italic;
}

/* Toolbar Icons & Controls */
[data-theme="dark"] .ql-snow .ql-stroke {
    stroke: var(--text-primary);
}

[data-theme="dark"] .ql-snow .ql-fill {
    fill: var(--text-primary);
}

[data-theme="dark"] .ql-snow .ql-picker {
    color: var(--text-primary);
}

[data-theme="dark"] .ql-snow .ql-picker-options {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
}

/* Hover & Active States */
[data-theme="dark"] .ql-snow .ql-picker-label:hover,
[data-theme="dark"] .ql-snow .ql-picker-label.ql-active,
[data-theme="dark"] .ql-snow .ql-picker-item:hover,
[data-theme="dark"] .ql-snow .ql-picker-item.ql-selected {
    color: var(--primary-color);
}

[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-stroke,
[data-theme="dark"] .ql-snow.ql-toolbar button.ql-active .ql-stroke,
[data-theme="dark"] .ql-snow .ql-picker-label:hover .ql-stroke,
[data-theme="dark"] .ql-snow .ql-picker-label.ql-active .ql-stroke {
    stroke: var(--primary-color);
}

[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-fill,
[data-theme="dark"] .ql-snow.ql-toolbar button.ql-active .ql-fill,
[data-theme="dark"] .ql-snow .ql-picker-label:hover .ql-fill,
[data-theme="dark"] .ql-snow .ql-picker-label.ql-active .ql-fill {
    fill: var(--primary-color);
}

/* Color Picker Fixes */
/* Ensure color picker icons inherit the correct stroke/fill from general rules */
.border-muted {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .border-muted {
    border-color: var(--text-muted) !important;
}

/* Knowledge Graph Styles */
#knowledgeGraphSvg .links line {
    transition: stroke-opacity 0.3s ease, stroke-width 0.3s ease;
}

/* Animated edge flow - shows direction via moving dashes */
@keyframes edge-flow {
    0% {
        stroke-dashoffset: 24;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

#knowledgeGraphSvg .links path.edge-animated {
    animation: edge-flow 0.8s linear infinite;
}

#knowledgeGraphSvg .nodes circle {
    transition: all 0.3s ease;
    cursor: pointer;
}

#knowledgeGraphSvg .node-group:hover circle {
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2));
    transform: scale(1.2);
}

#knowledgeGraphSvg .node-group:hover text {
    font-weight: bold;
}

/* Label text with dark halo for visibility over lines */
#knowledgeGraphSvg .node-group text {
    paint-order: stroke fill;
    stroke: rgba(0, 0, 0, 0.6);
    stroke-width: 3px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

[data-theme="dark"] #knowledgeGraphSvg .node-group text {
    stroke: rgba(0, 0, 0, 0.85);
    stroke-width: 3.5px;
}

/* ===== Focus Highlight Indicator (in toolbar) ===== */
.focus-highlight-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 6px;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    max-width: 200px;
    animation: fadeSlideIn 0.2s ease;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.focus-highlight-indicator .focus-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    flex-shrink: 0;
    background: rgba(255,255,255,0.25);
}

.focus-highlight-indicator .focus-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.focus-highlight-indicator .focus-clear {
    background: rgba(255,255,255,0.25);
    border: none;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.focus-highlight-indicator .focus-clear:hover {
    background: rgba(255,255,255,0.4);
}

/* Type-specific indicator colors */
.focus-highlight-indicator.type-asset {
    background: var(--asset-color, #198754);
}

.focus-highlight-indicator.type-tag {
    background: var(--tag-color, #0dcaf0);
}

.focus-highlight-indicator.type-artifact {
    background: var(--artifact-color, #6f42c1);
}

/* ===== Enhanced Graph Details Panel ===== */
.graph-details-panel {
    backdrop-filter: blur(10px);
    background-color: rgba(var(--bg-surface-rgb, 255, 255, 255), 0.95);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

[data-theme="dark"] .graph-details-panel {
    background-color: rgba(var(--bg-surface-rgb, 30, 30, 35), 0.95);
}

.graph-details-panel.pinned {
    box-shadow: 0 0 0 2px var(--primary-color), 0 8px 32px rgba(0,0,0,0.2);
}

.graph-details-header {
    background-color: var(--bg-surface-secondary);
}

.graph-node-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.graph-node-type-icon.type-artifact { background-color: rgba(99, 102, 241, 0.15); color: #6366f1; }
.graph-node-type-icon.type-asset { background-color: rgba(34, 197, 94, 0.15); color: #22c55e; }
.graph-node-type-icon.type-tag { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; }

.graph-stats-bar {
    gap: 0.5rem;
    flex-wrap: wrap;
}

.graph-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background-color: var(--bg-surface);
    border-radius: 8px;
    min-width: 60px;
    flex: 1;
}

.graph-stat-item .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.graph-stat-item .stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

.graph-quick-actions .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.graph-relationships-list {
    max-height: 300px;
    overflow-y: auto;
}

.graph-relationship-group {
    margin-bottom: 0.75rem;
}

.graph-relationship-group-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.graph-relationship-group-header:hover {
    color: var(--primary-color);
}

.graph-relationship-group-header .badge {
    font-size: 0.6rem;
}

.graph-relationship-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    gap: 0.5rem;
}

.graph-relationship-item:hover {
    background-color: var(--bg-surface-secondary);
}

.graph-relationship-item .rel-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.graph-relationship-item .rel-info {
    flex: 1;
    min-width: 0;
}

.graph-relationship-item .rel-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.graph-relationship-item .rel-type {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.graph-relationship-item .rel-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
}

.graph-relationship-item.first-order .rel-icon {
    background-color: rgba(13, 110, 253, 0.15);
    color: #0d6efd;
}

.graph-relationship-item.second-order .rel-icon {
    background-color: rgba(158, 197, 254, 0.15);
    color: #9ec5fe;
}

.graph-node-preview {
    border-radius: 8px;
    background-color: var(--bg-surface-secondary);
    padding: 0.75rem;
}

.graph-node-preview img {
    max-height: 150px;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
}

.graph-node-preview .preview-content {
    max-height: 100px;
    overflow-y: auto;
    font-size: 0.85rem;
    white-space: pre-wrap;
    color: var(--text-secondary);
}

.graph-metadata-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

.graph-metadata-list dt {
    color: var(--text-muted);
    font-weight: 500;
}

.graph-metadata-list dd {
    margin: 0;
    color: var(--text-primary);
}

#graphRelationshipFilter .btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* ===== Floating Graph Controls Menu ===== */
.graph-floating-menu {
    bottom: 1rem;
    left: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.graph-menu-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem;
    background-color: rgba(var(--bg-surface-rgb, 255, 255, 255), 0.95);
    backdrop-filter: blur(10px);
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .graph-menu-row {
    background-color: rgba(var(--bg-surface-rgb, 30, 30, 35), 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.graph-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 0.375rem;
    background-color: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.9rem;
}

.graph-menu-btn:hover {
    background-color: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.graph-menu-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.graph-menu-btn.active:hover {
    background-color: var(--primary-color);
    filter: brightness(1.1);
}

.graph-menu-divider {
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
    margin: 0 0.25rem;
}

.graph-settings-popup {
    background-color: rgba(var(--bg-surface-rgb, 255, 255, 255), 0.98);
    backdrop-filter: blur(10px);
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    min-width: 200px;
    max-width: 240px;
}

[data-theme="dark"] .graph-settings-popup {
    background-color: rgba(var(--bg-surface-rgb, 30, 30, 35), 0.98);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.graph-settings-group {
    margin-bottom: 0.5rem;
}

.graph-settings-group:last-of-type {
    margin-bottom: 0;
}

.graph-settings-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.graph-settings-popup .form-select-sm {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.graph-settings-stats {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
}

/* ===== Split View Layout Styles ===== */
.split-view-container {
    display: flex;
    flex-direction: column;
}

.split-view-container[data-split="horizontal"] {
    flex-direction: row;
}

.split-view-container[data-split="vertical"] {
    flex-direction: column;
}

.split-view-panel {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

/* Divider between panels */
.split-view-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--border-color);
    z-index: 10;
    flex-shrink: 0;
}

.split-view-container[data-split="vertical"] .split-view-divider {
    height: 6px;
    width: 100%;
    cursor: row-resize;
}

.split-view-container[data-split="horizontal"] .split-view-divider {
    width: 6px;
    height: 100%;
    cursor: col-resize;
}

.split-view-divider:hover,
.split-view-divider.dragging {
    background-color: var(--primary-color);
}

.divider-handle {
    width: 30px;
    height: 4px;
    background-color: var(--text-muted);
    border-radius: 2px;
    opacity: 0.5;
}

.split-view-container[data-split="horizontal"] .divider-handle {
    width: 4px;
    height: 30px;
}

.split-view-divider:hover .divider-handle,
.split-view-divider.dragging .divider-handle {
    opacity: 1;
    background-color: white;
}

/* Graph toggle button active state */
#viewModeGraphBtn.active {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.15);
}

/* Node highlight states in graph */
#knowledgeGraphSvg .node-group.highlighted circle,
#knowledgeGraphSvg .node-group.highlighted foreignObject {
    filter: drop-shadow(0 0 8px var(--primary-color));
}

#knowledgeGraphSvg .node-group.dimmed {
    opacity: 0.2;
}

/* Tag nodes in graph */
#knowledgeGraphSvg .node-group.tag-node circle {
    stroke-dasharray: 3 2;
    stroke: var(--border-color);
}


/* Minimalistic Toolbar Controls */
.btn-ghost {
    color: var(--text-secondary);
    background-color: transparent;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    color: var(--primary-color);
    background-color: var(--bg-surface-secondary);
}

.btn-ghost.active {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

.btn-ghost-danger:hover {
    color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
}

/* Toolbar Group Spacing */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    border-right: none;
}

.toolbar-group:last-child {
    border-right: none;
}

/* Remove VRs as we use border-right on groups now */
.app-toolbar .vr {
    display: none;
}

/* Audio Pill Update */
.audio-pill {
    display: flex;
    align-items: center;
    background-color: var(--bg-surface-secondary);
    border-radius: 50rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--border-color-subtle);
}

/* App Header Styles */
.app-header {
    min-height: 60px;
    height: auto;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0; /* Removed padding to let inner container handle it */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

.app-brand {
    /* min-width: 200px; Removed to fit content */
    flex-shrink: 0; /* Prevent shrinking */
}

.app-toolbar {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-grow: 1;
    justify-content: flex-start;
    padding-left: 0;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Button groups should not have gaps between buttons */
.toolbar-group.btn-group {
    gap: 0;
}

@media (min-width: 768px) {
    /* Desktop specific adjustments if needed */
}

.workspaces-layout {
    padding-top: 60px; /* Offset for fixed header on all devices */
}

.workspaces-layout-content {
    flex: 1;
    overflow: hidden;
    display: flex;
}

/* Hide old headers */
.workspaces-list-header, .workspace-editor-header, .assets-panel-header {
    display: none !important;
}

/* Adjust sidebar tops */
.workspaces-sidebar-left, .workspaces-sidebar-right, .workspaces-center-panel {
    height: 100%;
    padding-top: 0;
}

.workspaces-list-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.workspaces-list-items {
    flex: 1;
    overflow-y: auto;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    /* .app-toolbar {
        display: none; 
    } */
    
    /* Adjust layout height to account for mobile header */
    .workspaces-layout {
        height: 100dvh;
        max-height: 100dvh;
    }
    
    /* Move notification up to avoid bottom nav */
    #statusNotificationFloat {
        bottom: 80px !important;
        right: 16px !important;
        width: calc(100% - 32px) !important;
        max-width: 400px;
    }
}

/* User Menu & Avatar Fixes */
.avatar-circle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Profile Modal Styles */
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1rem;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    text-align: center;
}

.profile-email {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-surface-secondary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.info-value {
    color: var(--text-primary);
    text-align: right;
    font-weight: 500;
    font-size: 0.9rem;
}

.info-value.empty {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Focus Manager Badges ===== */
.focus-badges-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.focus-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px 3px 8px;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 500;
    color: white;
    background-color: var(--badge-color, #6f42c1);
    animation: fadeSlideIn 0.2s ease;
    cursor: pointer;
    max-width: 150px;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.focus-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.focus-badge .badge-icon {
    font-size: 0.65rem;
    opacity: 0.9;
}

.focus-badge .badge-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.focus-badge .badge-clear {
    background: rgba(255,255,255,0.25);
    border: none;
    color: white;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.focus-badge .badge-clear:hover {
    background: rgba(255,255,255,0.45);
}

/* Type-specific badge colors */
.focus-badge-artifact {
    --badge-color: #6f42c1;
}

.focus-badge-asset {
    --badge-color: #198754;
}

.focus-badge-tag {
    --badge-color: #f59e0b;
}

/* ===== Focus Highlighting States ===== */
.grid-item.focus-highlighted {
    box-shadow: 0 0 0 2px var(--primary-color), 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2;
}

.grid-item.focus-dimmed {
    opacity: 0.4;
    filter: grayscale(30%);
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.grid-item.focus-dimmed:hover {
    opacity: 0.7;
    filter: grayscale(0%);
}

.nested-asset-badge.focus-highlighted {
    background-color: rgba(25, 135, 84, 0.25) !important;
    box-shadow: 0 0 0 1px #198754;
}

.nested-tag.focus-highlighted {
    background-color: rgba(245, 158, 11, 0.35) !important;
    color: #92400e !important;
    box-shadow: 0 0 0 1px #f59e0b;
}

[data-theme="dark"] .nested-tag.focus-highlighted {
    color: #fef3c7 !important;
}

/* Relations sidebar focus highlighting */
.list-group-item.focus-highlighted,
[data-asset-id].focus-highlighted {
    background-color: rgba(25, 135, 84, 0.1) !important;
    box-shadow: inset 3px 0 0 #198754;
}

/* Hover states - local styling only, no focus */
.grid-item-header:hover {
    background-color: var(--bg-surface-hover, rgba(0,0,0,0.03));
}

.nested-asset-header:hover {
    background-color: rgba(0,0,0,0.05);
}

[data-theme="dark"] .nested-asset-header:hover {
    background-color: rgba(255,255,255,0.08);
}

.nested-tag:hover {
    background-color: rgba(245, 158, 11, 0.2) !important;
}

/* Sidebar asset hover */
.list-group-item[data-asset-id]:hover {
    background-color: var(--bg-surface-hover, rgba(0,0,0,0.03)) !important;
}

/* Sidebar tag hover */
.badge[data-node-id]:hover {
    cursor: pointer;
    transform: scale(1.05);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Pulsating ring animation for focused nodes */
@keyframes focus-ring-pulse {
    0% {
        stroke-opacity: 1;
        stroke-width: 4px;
        filter: drop-shadow(0 0 6px rgba(147, 51, 234, 0.6));
    }
    50% {
        stroke-opacity: 0.7;
        stroke-width: 6px;
        filter: drop-shadow(0 0 12px rgba(147, 51, 234, 0.8));
    }
    100% {
        stroke-opacity: 1;
        stroke-width: 4px;
        filter: drop-shadow(0 0 6px rgba(147, 51, 234, 0.6));
    }
}

/* Multi-select graph node highlighting - fat border with pulsating animation */
.node-group.focus-multi-highlight circle {
    stroke: #9333ea; /* Purple focus color */
    stroke-width: 4px;
    filter: drop-shadow(0 0 8px rgba(147, 51, 234, 0.6));
    animation: focus-ring-pulse 2s ease-in-out infinite;
}

/* Tag nodes (small circles) need extra visibility when focused */
.node-group.tag-node.focus-multi-highlight circle {
    stroke: #9333ea;
    stroke-width: 5px; /* Thicker for small tags */
    filter: drop-shadow(0 0 10px rgba(147, 51, 234, 0.8));
}

.node-group.focus-multi-highlight text {
    font-weight: 600;
    fill: #9333ea;
}

/* ===============================================
   Citation Panel Styles
   =============================================== */

.citation-badge {
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.citation-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.citations-panel {
    font-size: 0.9em;
}

.citations-toggle-btn {
    font-size: 0.85em;
}

.citations-toggle-btn:hover {
    text-decoration: none;
    color: var(--bs-primary) !important;
}

.citation-item {
    transition: background-color 0.3s;
    cursor: pointer;
}

.citation-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.citation-item:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
    background-color: rgba(var(--bs-primary-rgb), 0.08);
}

.citation-item:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

.citation-item.highlight {
    background-color: rgba(var(--bs-warning-rgb), 0.2);
    animation: highlight-fade 2s ease-out;
}

@keyframes highlight-fade {
    0% {
        background-color: rgba(var(--bs-warning-rgb), 0.4);
    }
    100% {
        background-color: transparent;
    }
}

.citation-link:hover {
    text-decoration: underline !important;
}

.citations-panel-body {
    scrollbar-width: thin;
}

.citations-panel-body::-webkit-scrollbar {
    width: 6px;
}

.citations-panel-body::-webkit-scrollbar-thumb {
    background-color: var(--bs-secondary);
    border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════════
   CONTENT LAZY LOADING PLACEHOLDER
   ═══════════════════════════════════════════════════════════════ */
.content-loading-placeholder {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.content-loading-dots {
    animation: loading-dots-pulse 1.4s infinite ease-in-out both;
}

@keyframes loading-dots-pulse {
    0%, 80%, 100% {
        opacity: 0.3;
    }
    40% {
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════
   IMAGE LAZY LOADING
   ═══════════════════════════════════════════════════════════════ */
.image-lazy-placeholder {
    width: 100%;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-loading-skeleton {
    width: 100%;
    height: 100%;
    min-height: 150px;
    background: linear-gradient(
        90deg,
        var(--bg-surface-secondary) 25%,
        var(--bg-surface-tertiary) 50%,
        var(--bg-surface-secondary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.image-loading-skeleton i {
    font-size: 2rem;
    opacity: 0.5;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.image-load-failed {
    background-color: var(--bg-surface-secondary);
    min-height: 100px;
}
