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

/* Remove focus outline from all elements */
*:focus {
    outline: none;
}

/* Color Palette - Theme-controlled CSS variables */
:root {
    --cream: #fafaf9;
    --tan: #ccc5b9;
    --dark-gray: #27272a;
    --almost-black: #252422;
    --accent-orange: #eb5e28;

    /* Derived colors for UI consistency */
    --white: #ffffff;
    --status-open: #3498db;
    --status-closed: #95a5a6;
    --module-accent: #3498db;
    --module-accent-hover: #2980b9;
}

/* Material Symbols - Make thinner globally */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    background: var(--cream);
}

/* Mobile Overlay - Hidden by default on desktop */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--cream);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
}

/* Show mobile overlay on screens below 768px */
@media (max-width: 767px) {
    .mobile-overlay {
        display: flex;
    }

    .app-container {
        display: none !important;
    }
}

.mobile-overlay-content {
    text-align: center;
    max-width: 400px;
    padding: 40px 20px;
}

.mobile-logo {
    margin: 0 auto 30px;
    width: 120px;
    height: 120px;
}

.mobile-logo svg {
    width: 100%;
    height: 100%;
}

.mobile-title {
    font-size: 32px;
    font-weight: 600;
    color: var(--dark-gray);
    margin: 0 0 20px 0;
    line-height: 1.2;
}

.mobile-message {
    font-size: 18px;
    color: var(--dark-gray);
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.mobile-instruction {
    font-size: 16px;
    color: var(--tan);
    margin: 0;
    line-height: 1.5;
}

/* Mode-specific element visibility */
body.lite-mode .internal-mode-only {
    display: none !important;
}

body.internal-mode .lite-mode-only {
    display: none !important;
}

/* Toolbar */
.toolbar {
    height: 60px;
    background: var(--dark-gray);
    color: var(--cream);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--tan);
    font-size: 16px;
    flex: 1; /* Allow breadcrumb to take available space */
}

.breadcrumb-item {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px 14px;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-item:hover {
    color: var(--accent-orange);
}

.breadcrumb-item.active {
    color: var(--cream);
    cursor: default;
}

.breadcrumb-shape-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    opacity: 0.8;
    flex-shrink: 0;
}

/* Material icon in breadcrumb */
.breadcrumb-shape-icon.material-symbols-outlined {
    font-size: 20px;
    width: auto;
    height: auto;
}

.breadcrumb-separator {
    color: var(--tan);
    user-select: none;
    font-size: 18px;
    opacity: 0.6;
}

.toolbar-title {
    font-size: 20px;
    font-weight: bold;
    margin-right: 20px;
}

.project-dropdown {
    background: var(--almost-black);
    border: 1px solid var(--tan);
    color: var(--cream);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.project-dropdown:focus {
    outline: none;
}

/* Add margin/padding after the dropdown options */
.project-dropdown option:last-child {
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.btn-add {
    border: 1px solid #ddd;
    padding: 3px 2px 2px 2px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    background: #f5f5f5;
    color: #666;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
    aspect-ratio: 1; /* Square buttons */
}

.btn-add:hover {
    background: #ebebeb;
    border-color: #ccc;
}

.btn-add:active {
    background: #e0e0e0;
    transform: translateY(1px);
}

/* Note button icon with custom color */
#btn-add-note .btn-icon {
    color: #D4C490;
}

#btn-add-note:hover .btn-icon {
    color: #C4B480;
}

#btn-add-note:active .btn-icon {
    color: #B4A470;
}

/* ToDo button icon with custom color */
#btn-add-task .btn-icon {
    color: #4A90E2;
}

#btn-add-task:hover .btn-icon {
    color: #3A80D2;
}

#btn-add-task:active .btn-icon {
    color: #2A70C2;
}

/* Symbol button icon with custom color */
#btn-add-symbol .btn-icon {
    color: #000000;
}

#btn-add-symbol:hover .btn-icon {
    color: #1a1a1a;
}

#btn-add-symbol:active .btn-icon {
    color: #333333;
}

/* Folder button icon with custom color (lighter gray) */
#btn-add-container .btn-icon {
    color: #BBBBBB;
}

#btn-add-container:hover .btn-icon {
    color: #AAAAAA;
}

#btn-add-container:active .btn-icon {
    color: #999999;
}

.btn-icon {
    font-size: 28px;
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 48;
}

.btn-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    line-height: 1;
    text-align: center;
}

.toolbar-info {
    margin-left: auto;
    font-size: 14px;
    color: var(--tan);
    display: flex;
    align-items: center;
    gap: 8px;
}

.font-size-control {
    display: none; /* Hidden per user request */
    align-items: center;
    gap: 6px;
}

.btn-font {
    background: var(--almost-black);
    border: 1px solid var(--tan);
    color: var(--cream);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    transition: background 0.2s;
}

.btn-font:hover {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

.btn-font:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-font:disabled:hover {
    background: var(--almost-black);
    border-color: var(--tan);
}

#font-size-label {
    font-size: 14px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

.btn-toggle {
    display: none; /* Hidden per user request */
    background: var(--almost-black);
    border: 1px solid var(--tan);
    color: var(--cream);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-toggle:hover {
    background: var(--dark-gray);
}

.btn-toggle.active {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

.toggle-icon {
    font-size: 14px;
}

/* Help Mode Button */
.btn-toggle-help {
    background: transparent;
    border: none;
    color: var(--cream);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s, opacity 0.2s;
    opacity: 0.8;
    position: relative;
}

.btn-toggle-help:hover {
    opacity: 1;
    color: var(--accent-orange);
}

.btn-toggle-help .help-icon {
    font-size: 24px;
}

/* Help Mode Toolbar Toggle */
.help-mode-toolbar-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.help-mode-toolbar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.help-mode-toolbar-input {
    display: none;
}

.help-mode-toolbar-slider {
    width: 40px;
    height: 20px;
    background: rgba(204, 197, 185, 0.3);
    border-radius: 10px;
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
}

.help-mode-toolbar-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--cream);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.help-mode-toolbar-input:checked + .help-mode-toolbar-slider {
    background: var(--accent-orange);
}

.help-mode-toolbar-input:checked + .help-mode-toolbar-slider::before {
    transform: translateX(20px);
}

.help-mode-toolbar-label {
    font-size: 13px;
    color: var(--tan);
    transition: color 0.3s;
}

.help-mode-label-on {
    display: none;
}

.help-mode-toolbar-input:checked ~ .help-mode-toolbar-label {
    color: var(--accent-orange);
}

.help-mode-toolbar-input:checked ~ .help-mode-toolbar-label .help-mode-label-off {
    display: none;
}

.help-mode-toolbar-input:checked ~ .help-mode-toolbar-label .help-mode-label-on {
    display: inline;
}

/* Toolbar Separator */
.toolbar-separator {
    color: var(--tan);
    opacity: 0.4;
    margin: 0 4px;
    user-select: none;
}

.btn-settings,
.btn-icon-only,
.btn-save-db {
    background: transparent;
    border: none;
    color: var(--cream);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s, opacity 0.2s;
    opacity: 0.8;
    position: relative;
}

.btn-settings:hover,
.btn-icon-only:hover,
.btn-save-db:not(:disabled):hover {
    opacity: 1;
    color: var(--accent-orange);
}

.btn-settings .material-symbols-outlined,
.btn-icon-only .material-symbols-outlined,
.btn-save-db .material-symbols-outlined {
    font-size: 24px;
}

/* Save button specific styles */
.btn-save-db,
#btn-save-json {
    opacity: 1; /* Override the 0.8 opacity from parent class */
}

.btn-save-db:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-save-db:disabled:hover {
    color: var(--cream);
}

/* Save button spinner animation */
.btn-save-spinner {
    position: absolute;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.btn-save-db.saving .btn-save-icon {
    display: none;
}

.btn-save-db.saving .btn-save-spinner {
    display: block !important;
}

/* Floating Fit to View Button */
.btn-fit-view-floating {
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 100;
    background: transparent;
    border: none;
    color: var(--dark-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    opacity: 0.4;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: all 0.2s ease;
}

.btn-fit-view-floating:hover {
    opacity: 1;
    color: var(--accent-orange);
}

.btn-fit-view-floating:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.btn-fit-view-floating:disabled:hover {
    opacity: 0.2;
    color: var(--dark-gray);
}

.btn-fit-view-floating .material-symbols-outlined {
    font-size: 28px;
}

/* Collapsed toggle active state */
#task-collapsed-toggle.active {
    opacity: 1;
    color: var(--accent-orange);
}

/* Exit Focus Mode Button - positioned at top-right */
#btn-exit-focus {
    top: 0;
    right: 0;
    bottom: auto;
}

/* Zoom reset button in toolbar */
.toolbar-info #btn-zoom-reset {
    position: static;
    background: transparent;
    border: none;
    color: var(--cream);
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.8;
    transition: color 0.2s, opacity 0.2s;
    margin-left: 4px;
}

.toolbar-info #btn-zoom-reset:hover {
    opacity: 1;
    color: var(--accent-orange);
}

.toolbar-info #btn-zoom-reset .material-symbols-outlined {
    font-size: 24px;
}

.toolbar-info #btn-zoom-reset:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    color: var(--cream);
}

/* Modal Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
}

/* Version Sync Overlay */
.version-sync-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    animation: fadeIn 0.3s ease-out;
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.version-sync-overlay.fade-out {
    opacity: 0;
}

.version-sync-content {
    background: var(--cream);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.version-sync-icon {
    margin-bottom: 20px;
}

.version-sync-icon .material-symbols-outlined {
    font-size: 64px;
    color: var(--accent-orange);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.version-sync-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark-gray);
    margin: 0 0 15px 0;
}

.version-sync-message {
    font-size: 15px;
    color: var(--dark-gray);
    margin: 0 0 25px 0;
    line-height: 1.6;
}

#version-sync-date {
    font-weight: 600;
    color: var(--accent-orange);
}

#version-sync-time-ago {
    font-size: 13px;
    opacity: 0.8;
}

.version-sync-spinner {
    margin-top: 20px;
}

.version-sync-spinner .material-symbols-outlined {
    font-size: 32px;
    color: var(--dark-gray);
    animation: spin 1s linear infinite;
}

.version-sync-close-btn {
    margin-top: 25px;
    padding: 12px 24px;
    background: var(--accent-orange);
    border: 1px solid var(--accent-orange);
    color: var(--cream);
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(235, 94, 40, 0.3);
}

.version-sync-close-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(235, 94, 40, 0.4);
}

.version-sync-close-btn:active {
    transform: translateY(0);
}

.version-sync-close-btn .material-symbols-outlined {
    font-size: 22px;
}

/* Settings Modal - Unified Styling */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.settings-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.settings-modal.hide {
    display: flex;
    animation: fadeOut 0.3s ease-out;
}

.settings-modal-content {
    background: var(--cream);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    width: 700px;
    max-width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.settings-modal.show .settings-modal-content {
    animation: slideIn 0.3s ease-out;
}

.settings-modal.hide .settings-modal-content {
    animation: slideOut 0.3s ease-out;
}

.settings-modal-header {
    padding: 20px;
    background: var(--dark-gray);
    color: var(--cream);
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.settings-modal-header .modal-close {
    color: var(--cream);
}

.settings-modal-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-modal-body {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.settings-tabs {
    display: flex;
    border-bottom: 2px solid var(--tan);
    background: var(--cream);
    padding: 0 20px;
}

.settings-tab {
    background: transparent;
    border: none;
    color: var(--dark-gray);
    padding: 15px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.settings-tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

.settings-tab.active {
    color: var(--accent-orange);
    border-bottom-color: var(--accent-orange);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

.settings-tab-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark-gray);
    margin: 0 0 15px 0;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section p {
    color: var(--dark-gray);
    font-size: 14px;
    margin: 0;
}

.settings-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 8px;
}

.settings-description {
    color: var(--dark-gray);
    font-size: 13px;
    margin: 0 0 15px 0;
    opacity: 0.8;
}

.btn-setting-action {
    background: var(--accent-orange);
    border: 1px solid var(--accent-orange);
    color: var(--cream);
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    vertical-align: middle;
    line-height: 1;
}

.btn-setting-action:hover {
    background: var(--accent-orange);
    filter: brightness(0.85);
}

.btn-setting-action .material-symbols-outlined {
    font-size: 18px;
}

/* Theme Selector */
.theme-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid var(--tan);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--white);
}

.theme-option:hover {
    border-color: var(--dark-gray);
    background: rgba(0, 0, 0, 0.02);
}

.theme-option.selected {
    border-color: var(--accent-orange);
    background: rgba(235, 94, 40, 0.05);
}

.theme-option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--tan);
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.theme-option.selected .theme-option-radio {
    border-color: var(--accent-orange);
}

.theme-option.selected .theme-option-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-orange);
}

.theme-option-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.theme-option-name {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 14px;
}

.theme-colors {
    display: flex;
    gap: 6px;
    align-items: center;
}

.theme-color-sample {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.theme-color-sample .material-symbols-outlined {
    font-size: 16px;
}

/* Data Tab Styles */
.data-json-textarea {
    width: 100%;
    min-height: 400px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    padding: 12px;
    border: 1px solid var(--tan);
    border-radius: 4px;
    background: var(--white);
    color: var(--dark-gray);
    resize: vertical;
    line-height: 1.5;
    margin-bottom: 15px;
}

.data-json-textarea:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.data-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    justify-content: flex-start;
}

.data-actions .btn-setting-action {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 40px;
}

.data-actions .btn-setting-action .material-symbols-outlined {
    font-size: 18px;
    line-height: 1;
}

.btn-primary {
    background: var(--accent-orange) !important;
    border-color: var(--accent-orange) !important;
}

.btn-setting-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.data-validation-message {
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    display: none;
}

.data-validation-message:not(:empty) {
    display: block;
}

.data-validation-message.error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c00;
}

.data-validation-message.success {
    background: #efe;
    border: 1px solid #cfc;
    color: #060;
}

.data-validation-message.info {
    background: #eef;
    border: 1px solid #ccf;
    color: #006;
}

/* Data Update Confirmation Overlay */
.data-update-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.data-update-overlay.show {
    opacity: 1;
}

.data-update-content {
    background: var(--cream);
    padding: 30px;
    border-radius: 8px;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.data-update-icon {
    text-align: center;
    margin-bottom: 20px;
}

.data-update-icon .material-symbols-outlined {
    font-size: 60px;
    color: #ff9800;
}

.data-update-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--dark-gray);
    margin: 0 0 15px 0;
}

.data-update-message {
    text-align: center;
    font-size: 15px;
    color: var(--dark-gray);
    margin: 0 0 25px 0;
    line-height: 1.6;
}

.data-update-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.data-update-btn {
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    border: none;
}

.data-update-btn .material-symbols-outlined {
    font-size: 20px;
}

.data-update-btn-cancel {
    background: var(--tan);
    color: var(--dark-gray);
}

.data-update-btn-cancel:hover {
    background: #b3ada1;
}

.data-update-btn-confirm {
    background: var(--accent-orange);
    color: var(--cream);
}

.data-update-btn-confirm:hover {
    filter: brightness(0.85);
}

/* App Container - Full viewport with sidebar and main content */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar - Full height */
.sidebar {
    width: 280px;
    background: var(--cream);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
    position: relative;
}

/* Border on right side, but only below the toolbar */
.sidebar::after {
    content: '';
    position: absolute;
    top: 60px; /* Height of toolbar */
    right: 0;
    bottom: 0;
    width: 1px;
    background: var(--tan);
    pointer-events: none;
}

/* Main Content - Right side with toolbar and canvas/properties */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Canvas and Properties Container */
.canvas-properties-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.sidebar-header {
    padding: 12px;
    background: var(--dark-gray);
    color: var(--cream);
    display: flex;
    gap: 8px;
    align-items: center;
}

.sidebar-header .project-dropdown {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
}

/* Edit project button - matches btn-icon-only style in toolbar */
.btn-edit-project {
    flex-shrink: 0;
}

.btn-edit-project:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-edit-project:disabled:hover {
    color: var(--cream);
    opacity: 0.3;
}

.sidebar-buttons {
    padding: 10px;
    margin: 10px 0;
    background: var(--cream);
    position: relative;
}

.sidebar-buttons::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--tan), transparent);
}

.sidebar-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 4px;
}

.btn-spacer {
    /* Empty space in grid */
}

/* App Logo */
.app-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    aspect-ratio: 1;
    gap: 3px;
}

.app-logo svg {
    width: 85%;
    height: auto;
    max-width: 85%;
}

.app-logo-version {
    font-size: 9px;
    font-weight: 400;
    color: #666;
    text-align: center;
    line-height: 1;
    margin-top: 0px;
}

.sidebar-search {
    padding: 10px;
    margin: 10px 0;
    background: var(--cream);
    position: relative;
}

.sidebar-search::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--tan), transparent);
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.tree-search-input {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--tan);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    color: var(--almost-black);
    transition: border-color 0.2s;
}

.tree-search-input:focus {
    outline: none;
    border-color: var(--accent-orange);
}

.tree-search-input::placeholder {
    color: var(--tan);
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--tan);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-clear .material-symbols-outlined {
    font-size: 20px;
}

.search-clear:hover {
    color: var(--accent-orange);
}

.sidebar-filters {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

.filter-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--almost-black);
    cursor: pointer;
    user-select: none;
    padding: 8px;
    border-radius: 4px;
    background: white;
    border: 1px solid var(--tan);
    transition: all 0.2s;
    min-width: 32px;
    min-height: 32px;
}

.filter-label:hover {
    background: rgba(204, 197, 185, 0.2);
    border-color: var(--dark-gray);
}

.filter-checkbox {
    display: none; /* Hide actual checkbox */
}

/* Unpushed state (unchecked) */
.filter-checkbox:not(:checked) ~ .filter-badge,
.filter-checkbox:not(:checked) ~ .counts-toggle-icon,
.filter-checkbox:not(:checked) ~ .symbols-toggle-icon {
    opacity: 0.4;
    filter: grayscale(100%);
}

.filter-label:has(.filter-checkbox:not(:checked)) {
    filter: grayscale(80%);
    opacity: 0.7;
}

.filter-badge {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.filter-badge.status-new {
    background-color: #ffffff;
    color: #252422;
}

.filter-badge.status-open {
    background-color: #3498db;
    color: #ffffff;
}

.filter-badge.status-closed {
    background-color: #95a5a6;
    color: #ffffff;
}

/* Counts toggle icon */
.counts-toggle-icon {
    font-size: 18px;
    color: var(--almost-black);
}

/* Symbols toggle icon */
.symbols-toggle-icon {
    font-size: 18px;
    color: var(--almost-black);
}

/* Auto-expand toggle icon */
.auto-expand-toggle-icon {
    font-size: 18px;
    color: var(--almost-black);
}

/* Make auto-expand button look identical to symbols button */
.filter-checkbox:not(:checked) ~ .auto-expand-toggle-icon {
    opacity: 0.4;
    filter: grayscale(100%);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Tree Counters */
.tree-counters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin: 10px 0;
    background: var(--cream);
    position: relative;
}

.tree-counters::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--tan), transparent);
}

.tree-counters .sidebar-filters {
    display: flex;
    gap: 4px;
}

.tree-counter-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.tree-counter-item:hover {
    background: rgba(204, 197, 185, 0.2);
}

.tree-counter-item.inactive {
    opacity: 0.4;
    filter: grayscale(100%);
}

.tree-counter-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.2);
    line-height: 1;
}

.tree-counter-badge.status-new {
    background-color: #ffffff;
    color: #252422;
}

.tree-counter-badge.status-open {
    background-color: #3498db;
    color: #ffffff;
}

.tree-counter-badge.status-closed {
    background-color: #95a5a6;
    color: #ffffff;
}

.tree-counter-value {
    font-size: 13px;
    font-weight: 700;
    font-family: Arial, sans-serif;
}

/* Tree View */
.tree-view {
    font-size: 14px;
}

.tree-item {
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 2px;
    margin: 2px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--almost-black);
    user-select: none;
    transition: background 0.15s;
}

.tree-item:hover {
    background: rgba(204, 197, 185, 0.3);
}

.tree-item.selected,
.tree-children .tree-item.selected,
.tree-item.highlighted,
.tree-children .tree-item.highlighted {
    background: rgba(204, 197, 185, 0.4); /* Subtle tan highlight */
    color: var(--almost-black);
}

.tree-item.highlighted,
.tree-children .tree-item.highlighted {
    border-left: 3px solid var(--tan);
    padding-left: 3px; /* Adjust for border */
}

.tree-item.selected:hover,
.tree-children .tree-item.selected:hover,
.tree-item.highlighted:hover,
.tree-children .tree-item.highlighted:hover {
    background: rgba(204, 197, 185, 0.6); /* Slightly more opaque on hover */
}

.tree-item.out-of-focus {
    opacity: 0.75; /* Dim out nodes not in current editing level - more readable */
    color: var(--tan); /* Lighter text color */
}

.tree-item.out-of-focus:hover {
    opacity: 0.85; /* More visible on hover */
}

/* Focus Shape Indicator */
.focus-shape-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 999;
    pointer-events: none; /* Don't interfere with canvas interactions */
}

.focus-shape-content {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6; /* Shape itself also at 60% */
}

.focus-shape-content svg {
    width: 100%;
    height: 100%;
}

.tree-item-icon {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.tree-item-expand {
    font-size: 10px;
    width: 12px;
    text-align: center;
    cursor: pointer;
    color: var(--tan);
}

.tree-item-expand:hover {
    color: var(--accent-orange);
}

.tree-item-status {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.tree-item-status.status-new {
    background-color: #ffffff;
    color: #252422;
}

.tree-item-status.status-open {
    background-color: #3498db;
    color: #ffffff;
}

.tree-item-status.status-closed {
    background-color: #95a5a6;
    color: #ffffff;
}

.tree-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-item-counts {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.tree-count-badge {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tree-count-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding-top: 1px; /* Optical centering - 5% of ~16px */
    line-height: 1;
}

.tree-count-badge.status-new .tree-count-circle {
    background-color: #ffffff;
    color: #252422;
}

.tree-count-badge.status-open .tree-count-circle {
    background-color: #3498db;
    color: #ffffff;
}

.tree-count-badge.status-closed .tree-count-circle {
    background-color: #95a5a6;
    color: #ffffff;
}

.tree-children {
    margin-left: 12px;
    border-left: 1px solid rgba(204, 197, 185, 0.4);
    padding-left: 1px;
}

.tree-item.collapsed + .tree-children {
    display: none;
}

.tree-item.hidden {
    display: none;
}

.tree-empty {
    padding: 20px;
    text-align: center;
    color: var(--tan);
    font-size: 14px;
}

/* Sidebar Scrollbar */
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: var(--cream);
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--tan);
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--dark-gray);
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    background: #ffffff;
    overflow: hidden;
}

/* Performance: Canvas layering for optimized rendering */
.canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#canvas-static {
    z-index: 1; /* Bottom layer: grid + static nodes */
    pointer-events: none; /* Only top layer receives events */
}

#canvas-dynamic {
    z-index: 2; /* Middle layer: dragged/resized nodes */
    pointer-events: none; /* Only top layer receives events */
}

#canvas {
    z-index: 3; /* Top layer: UI (handles, cursors, previews) */
    cursor: grab;
}

#canvas.dragging {
    cursor: grabbing;
}

#canvas.dragging-node {
    cursor: move;
}

/* Resize cursors */
.nw-resize {
    cursor: nw-resize !important;
}

.n-resize {
    cursor: n-resize !important;
}

.ne-resize {
    cursor: ne-resize !important;
}

.w-resize {
    cursor: w-resize !important;
}

.e-resize {
    cursor: e-resize !important;
}

.sw-resize {
    cursor: sw-resize !important;
}

.s-resize {
    cursor: s-resize !important;
}

.se-resize {
    cursor: se-resize !important;
}

/* Button Styles */
button {
    font-family: inherit;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Debug Panel */
.debug-panel {
    margin-top: 10px;
    padding: 12px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
}

.debug-header {
    font-weight: bold;
    font-size: 12px;
    color: #856404;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.debug-message {
    font-size: 13px;
    color: #333;
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ffc107;
    min-height: 40px;
    line-height: 1.4;
    white-space: pre-wrap;
    font-family: monospace;
}

.debug-continue-btn {
    width: 100%;
    padding: 8px 12px;
    background: #ffc107;
    color: #333;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.debug-continue-btn:hover {
    background: #ffca2c;
}

.debug-continue-btn:active {
    background: #e0a800;
}

/* Focus Mode Module Content Blur Overlay */
.module-content-blur-overlay {
    position: absolute;
    background: rgba(255, 255, 255, 0); /* Start transparent */
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 1000;
    pointer-events: none;
    /* Performance: Use will-change hint for GPU acceleration */
    will-change: backdrop-filter, background;
    /* Keep blur visible longer to hide movement - 300ms */
    transition: background 0.3s ease-out, backdrop-filter 0.3s ease-out, -webkit-backdrop-filter 0.3s ease-out;
}

.module-content-blur-overlay.active {
    background: rgba(255, 255, 255, 0.85); /* Strong tint to hide movement */
    /* Increased blur to hide position adjustments during transition */
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
}

/* Fade out smoothly when removed */
.module-content-blur-overlay.fade-out {
    background: rgba(255, 255, 255, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    /* Faster fade-out for snappier feel */
    transition: background 0.18s ease-in, backdrop-filter 0.18s ease-in, -webkit-backdrop-filter 0.18s ease-in;
}

/* Focus View Full Canvas Blur Overlay - starts at SAME blur as module overlay ends */
.focus-view-blur-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85); /* Strong tint to hide movement */
    /* Increased blur to hide position adjustments during transition */
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: 1000;
    pointer-events: none;
    opacity: 1;
    /* Performance: Use will-change hint for GPU acceleration */
    will-change: backdrop-filter, background, opacity;
    /* Keep blur visible longer to fully hide movement - 400ms */
    transition: background 0.4s ease-in, backdrop-filter 0.4s ease-in, -webkit-backdrop-filter 0.4s ease-in, opacity 0.4s ease-in;
}

/* Fade out to reveal nodes */
.focus-view-blur-overlay.reveal {
    background: rgba(255, 255, 255, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    opacity: 0;
}
