: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);
}

/* Three-Panel Responsive Layout for Notes Page */

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);
}



/* 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;
}

/* 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);
}

.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-sidebar-left {
        width: 300px;
        flex-shrink: 0;
        border-right: 1px solid var(--border-color-subtle);
        display: flex !important; /* Override mobile hidden */
        flex-direction: column;
        height: 100%;
        transition: width 0.3s ease, padding 0.3s ease;
    }

    .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 Logic */
    .workspaces-sidebar-left.collapsed {
        width: 0;
        min-width: 0;
        padding: 0;
        overflow: hidden;
        border: none;
    }
    
    .workspaces-sidebar-right.collapsed {
        width: 0;
        min-width: 0;
        padding: 0;
        overflow: hidden;
        border: none;
    }
}

/* Wide Desktop */
@media (min-width: 1440px) {
    .workspaces-sidebar-left {
        width: 350px;
    }
    
    .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;
    /* overflow: hidden; Removed to prevent clipping of shadows/focus rings */
}

.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;
}

#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;
}


/* 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: flex-start;
    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 */
    margin-right: 1rem; /* Add some spacing */
}

.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;
    margin-top: 4px; /* Align with search box top */
}

@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;
}

