/* Enhanced CSS Variables */
            :root {
                --primary: #6366f1;
                --primary-dark: #4f46e5;
                --secondary: #64748b;
                --success: #10b981;
                --warning: #f59e0b;
                --danger: #ef4444;
                --info: #06b6d4;

                /* SQL-basierte Entity Colors */
                --basis-unterkunft-bg: #fee2e2;
                --basis-unterkunft-border: #ef4444;
                --basis-unterkunft-text: #991b1b;
                --unterkunft-hotel-bg: #fef2f2;
                --unterkunft-hotel-border: #f87171;
                --unterkunft-hotel-text: #7f1d1d;
                --unterkunft-boutique-hotel-bg: #fdf4ff;
                --unterkunft-boutique-hotel-border: #d946ef;
                --unterkunft-boutique-hotel-text: #701a75;
                --unterkunft-design-hotel-bg: #f0f9ff;
                --unterkunft-design-hotel-border: #0ea5e9;
                --unterkunft-design-hotel-text: #0c4a6e;
                --unterkunft-resort-bg: #f0fdf4;
                --unterkunft-resort-border: #22c55e;
                --unterkunft-resort-text: #15803d;
                --unterkunft-bedbreakfast-bg: #fffbeb;
                --unterkunft-bedbreakfast-border: #f59e0b;
                --unterkunft-bedbreakfast-text: #92400e;
                --unterkunft-pension-bg: #f3e8ff;
                --unterkunft-pension-border: #9333ea;
                --unterkunft-pension-text: #581c87;
                --unterkunft-airbnb-bg: #fef3c7;
                --unterkunft-airbnb-border: #d97706;
                --unterkunft-airbnb-text: #92400e;
                --gebiet-land-bg: #dcfce7;
                --gebiet-land-border: #16a34a;
                --gebiet-land-text: #14532d;
                --gebiet-region-bg: #e0f2fe;
                --gebiet-region-border: #0891b2;
                --gebiet-region-text: #164e63;
                --gebiet-ort-bg: #dbeafe;
                --gebiet-ort-border: #2563eb;
                --gebiet-ort-text: #1e3a8a;
                --poi-restaurant-bg: #f3e8ff;
                --poi-restaurant-border: #9333ea;
                --poi-restaurant-text: #581c87;
                --poi-museum-bg: #fef3c7;
                --poi-museum-border: #d97706;
                --poi-museum-text: #92400e;
                --poi-sehenswuerdigkeit-bg: #fef3c7;
                --poi-sehenswuerdigkeit-border: #d97706;
                --poi-sehenswuerdigkeit-text: #92400e;
                --basis-poi-bg: #fef3c7;
                --basis-poi-border: #d97706;
                --basis-poi-text: #92400e;
                --basis-route-bg: #f0fdf4;
                --basis-route-border: #22c55e;
                --basis-route-text: #15803d;
                --route-wanderung-bg: #ecfdf5;
                --route-wanderung-border: #10b981;
                --route-wanderung-text: #064e3b;
                --route-fahrrad-bg: #eff6ff;
                --route-fahrrad-border: #3b82f6;
                --route-fahrrad-text: #1e3a8a;
                --route-motorrad-bg: #fef2f2;
                --route-motorrad-border: #ef4444;
                --route-motorrad-text: #991b1b;
                --route-automobil-bg: #f8fafc;
                --route-automobil-border: #64748b;
                --route-automobil-text: #334155;
                --route-eisenbahn-bg: #f1f5f9;
                --route-eisenbahn-border: #475569;
                --route-eisenbahn-text: #1e293b;
                --route-schiff-bg: #f0f9ff;
                --route-schiff-border: #0ea5e9;
                --route-schiff-text: #0c4a6e;
                --route-stadtspaziergang-bg: #f8fafc;
                --route-stadtspaziergang-border: #64748b;
                --route-stadtspaziergang-text: #334155;
                --unassigned-bg: #f8fafc;
                --unassigned-border: #cbd5e1;
                --unassigned-text: #64748b;
                --linked-bg: #f0f9ff;
                --linked-border: #0ea5e9;
                --linked-text: #0c4a6e;

                --bg-primary: #ffffff;
                --bg-secondary: #f8fafc;
                --bg-tertiary: #f1f5f9;
                --bg-sidebar: #1e293b;
                --text-primary: #0f172a;
                --text-secondary: #475569;
                --text-muted: #94a3b8;
                --text-inverse: #f8fafc;
                --border: #e2e8f0;
                --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
                --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
                --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
                --radius: 8px;
                --radius-sm: 4px;
                --radius-lg: 12px;
            }

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

            body {
                font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
                background: var(--bg-secondary);
                color: var(--text-primary);
                line-height: 1.6;
                -webkit-font-smoothing: antialiased;
                -moz-osx-font-smoothing: grayscale;
            }

            .ttiles-app {
                height: 100vh;
                display: flex;
                overflow: hidden;
            }

            .sidebar {
                width: 280px;
                background: var(--bg-sidebar);
                color: var(--text-inverse);
                flex-shrink: 0;
                display: flex;
                flex-direction: column;
                overflow-y: auto;
            }

            .sidebar.collapsed {
                width: 60px;
            }

            .main-content {
                flex: 1;
                display: flex;
                flex-direction: column;
                overflow: hidden;
            }

            .header {
                height: 60px;
                background: var(--bg-primary);
                border-bottom: 1px solid var(--border);
                display: flex;
                align-items: center;
                justify-content: space-between;
                padding: 0 24px;
            }

            .content-area {
                flex: 1;
                overflow: hidden;
                display: flex;
                flex-direction: column;
            }

            /* SQL-basierte Tiles */
            .tile {
                border: 2px solid;
                border-radius: var(--radius);
                padding: 16px;
                margin-bottom: 12px;
                cursor: pointer;
                transition: all 0.3s ease;
                position: relative;
                display: flex;
                flex-direction: column;
                min-height: 140px;
                max-width: 380px;
                background: var(--bg-primary);
            }

            .tile.entity-basis-unterkunft {
                background: var(--basis-unterkunft-bg);
                border-color: var(--basis-unterkunft-border);
                color: var(--basis-unterkunft-text);
            }

            .tile.entity-unterkunft-hotel {
                background: var(--unterkunft-hotel-bg);
                border-color: var(--unterkunft-hotel-border);
                color: var(--unterkunft-hotel-text);
            }

            .tile.entity-unterkunft-boutique-hotel {
                background: var(--unterkunft-boutique-hotel-bg);
                border-color: var(--unterkunft-boutique-hotel-border);
                color: var(--unterkunft-boutique-hotel-text);
            }

            .tile.entity-unterkunft-design-hotel {
                background: var(--unterkunft-design-hotel-bg);
                border-color: var(--unterkunft-design-hotel-border);
                color: var(--unterkunft-design-hotel-text);
            }

            .tile.entity-unterkunft-resort {
                background: var(--unterkunft-resort-bg);
                border-color: var(--unterkunft-resort-border);
                color: var(--unterkunft-resort-text);
            }

            .tile.entity-unterkunft-bedbreakfast {
                background: var(--unterkunft-bedbreakfast-bg);
                border-color: var(--unterkunft-bedbreakfast-border);
                color: var(--unterkunft-bedbreakfast-text);
            }

            .tile.entity-unterkunft-pension {
                background: var(--unterkunft-pension-bg);
                border-color: var(--unterkunft-pension-border);
                color: var(--unterkunft-pension-text);
            }

            .tile.entity-unterkunft-airbnb {
                background: var(--unterkunft-airbnb-bg);
                border-color: var(--unterkunft-airbnb-border);
                color: var(--unterkunft-airbnb-text);
            }

            .tile.entity-gebiet-land {
                background: var(--gebiet-land-bg);
                border-color: var(--gebiet-land-border);
                color: var(--gebiet-land-text);
            }

            .tile.entity-gebiet-region {
                background: var(--gebiet-region-bg);
                border-color: var(--gebiet-region-border);
                color: var(--gebiet-region-text);
            }

            .tile.entity-gebiet-ort {
                background: var(--gebiet-ort-bg);
                border-color: var(--gebiet-ort-border);
                color: var(--gebiet-ort-text);
            }

            .tile.entity-poi-restaurant {
                background: var(--poi-restaurant-bg);
                border-color: var(--poi-restaurant-border);
                color: var(--poi-restaurant-text);
            }

            .tile.entity-poi-museum {
                background: var(--poi-museum-bg);
                border-color: var(--poi-museum-border);
                color: var(--poi-museum-text);
            }

            .tile.entity-poi-sehenswuerdigkeit {
                background: var(--poi-sehenswuerdigkeit-bg);
                border-color: var(--poi-sehenswuerdigkeit-border);
                color: var(--poi-sehenswuerdigkeit-text);
            }

            .tile.entity-basis-poi {
                background: var(--basis-poi-bg);
                border-color: var(--basis-poi-border);
                color: var(--basis-poi-text);
            }

            .tile.entity-basis-route {
                background: var(--basis-route-bg);
                border-color: var(--basis-route-border);
                color: var(--basis-route-text);
            }

            .tile.entity-route-wanderung {
                background: var(--route-wanderung-bg);
                border-color: var(--route-wanderung-border);
                color: var(--route-wanderung-text);
            }

            .tile.entity-route-fahrrad {
                background: var(--route-fahrrad-bg);
                border-color: var(--route-fahrrad-border);
                color: var(--route-fahrrad-text);
            }

            .tile.entity-route-motorrad {
                background: var(--route-motorrad-bg);
                border-color: var(--route-motorrad-border);
                color: var(--route-motorrad-text);
            }

            .tile.entity-route-automobil {
                background: var(--route-automobil-bg);
                border-color: var(--route-automobil-border);
                color: var(--route-automobil-text);
            }

            .tile.entity-route-eisenbahn {
                background: var(--route-eisenbahn-bg);
                border-color: var(--route-eisenbahn-border);
                color: var(--route-eisenbahn-text);
            }

            .tile.entity-route-schiff {
                background: var(--route-schiff-bg);
                border-color: var(--route-schiff-border);
                color: var(--route-schiff-text);
            }

            .tile.entity-route-stadtspaziergang {
                background: var(--route-stadtspaziergang-bg);
                border-color: var(--route-stadtspaziergang-border);
                color: var(--route-stadtspaziergang-text);
            }

            .tile.entity-unassigned {
                background: var(--unassigned-bg);
                border-color: var(--unassigned-border);
                color: var(--unassigned-text);
            }

            .tile.entity-linked {
                background: var(--linked-bg);
                border-color: var(--linked-border);
                color: var(--linked-text);
            }

            .tile:hover {
                transform: translateY(-2px);
                box-shadow: var(--shadow-lg);
            }

            .tile.selected {
                outline: 3px solid var(--primary);
                outline-offset: 2px;
            }

            .tile-header {
                display: flex;
                justify-content: space-between;
                align-items: flex-start;
                margin-bottom: 12px;
                min-height: 40px;
            }

            .tile-type {
                font-size: 0.875rem;
                font-weight: 600;
                display: flex;
                align-items: center;
                gap: 8px;
            }

            .tile-type-icon {
                font-size: 1.2rem;
            }

            .tile-actions {
                display: flex;
                gap: 4px;
                position: absolute;
                right: 12px;
                top: 12px;
                opacity: 0;
                transition: opacity 0.3s ease;
            }

            .tile:hover .tile-actions {
                opacity: 1;
            }

            .tile-action {
                width: 28px;
                height: 28px;
                border: none;
                border-radius: var(--radius-sm);
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 0.75rem;
                transition: all 0.2s ease;
            }

            .action-correct {
                background: var(--success);
                color: white;
            }

            .action-wrong {
                background: var(--danger);
                color: white;
            }

            .action-edit {
                background: var(--info);
                color: white;
            }

            .action-link {
                background: var(--warning);
                color: white;
            }

            .action-split {
                background: var(--secondary);
                color: white;
            }

            .tile-text {
                flex: 1;
                word-wrap: break-word;
                line-height: 1.4;
            }

            .tile-tags {
                display: flex;
                gap: 4px;
                flex-wrap: wrap;
                margin-top: 8px;
            }

            .tile-tag {
                padding: 2px 6px;
                background: rgba(0, 0, 0, 0.1);
                border-radius: var(--radius-sm);
                font-size: 0.7rem;
            }

            .confidence-indicator {
                position: absolute;
                bottom: 8px;
                right: 8px;
                font-size: 0.7rem;
                padding: 2px 6px;
                border-radius: var(--radius-sm);
                background: rgba(0, 0, 0, 0.1);
            }

            /* Navigation */
            .nav {
                padding: 24px 0;
            }

            .nav-item {
                display: flex;
                align-items: center;
                gap: 12px;
                padding: 12px 24px;
                cursor: pointer;
                transition: background-color 0.2s ease;
                text-decoration: none;
                color: inherit;
            }

            .nav-item:hover {
                background: rgba(255, 255, 255, 0.1);
            }

            .nav-item.active {
                background: var(--primary);
                color: white;
            }

            .nav-icon {
                width: 20px;
                text-align: center;
            }

            /* Layout */
            .view {
                flex: 1;
                overflow: hidden;
            }

            .view.active {
                display: flex;
                flex-direction: column;
            }

            .view-content {
                flex: 1;
                overflow-y: auto;
                padding: 24px;
                max-height: calc(100vh - 120px);
            }

            .content-grid {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
                gap: 16px;
            }

            /* Forms & Controls */
            .form-group {
                margin-bottom: 16px;
            }

            .form-label {
                display: block;
                margin-bottom: 4px;
                font-weight: 500;
                color: var(--text-secondary);
            }

            .form-input,
            .form-select,
            .form-textarea {
                width: 100%;
                padding: 8px 12px;
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
                font-size: 0.875rem;
            }

            .form-textarea {
                min-height: 120px;
                resize: vertical;
                font-family: inherit;
            }

            .btn {
                padding: 8px 16px;
                border: none;
                border-radius: var(--radius-sm);
                cursor: pointer;
                font-size: 0.875rem;
                font-weight: 500;
                transition: all 0.2s ease;
                display: inline-flex;
                align-items: center;
                gap: 8px;
            }

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

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

            .btn-secondary {
                background: var(--secondary);
                color: white;
            }

            .btn-success {
                background: var(--success);
                color: white;
            }

            .btn-warning {
                background: var(--warning);
                color: white;
            }

            .btn-danger {
                background: var(--danger);
                color: white;
            }

            .btn-sm {
                padding: 4px 8px;
                font-size: 0.75rem;
            }

            .btn-lg {
                padding: 12px 24px;
                font-size: 1rem;
            }

            /* Modals */
            .modal-overlay {
                position: fixed;
                inset: 0;
                background: rgba(0, 0, 0, 0.5);
                display: flex;
                align-items: center;
                justify-content: center;
                z-index: 1000;
            }

            .modal {
                background: var(--bg-primary);
                border-radius: var(--radius);
                box-shadow: var(--shadow-lg);
                width: 90%;
                max-width: 500px;
                max-height: 90vh;
                display: flex;
                flex-direction: column;
                overflow: hidden;
            }

            .modal-header {
                padding: 20px 24px;
                border-bottom: 1px solid var(--border);
                /*display: flex;*/
                justify-content: space-between;
                align-items: center;
                position: sticky;
                top: 0;
                z-index: 10;
                background-color: #ffffff;
                border-bottom: 2px solid #e5e7eb;
                padding: 20px 24px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                flex-shrink: 0;
                
                /* Schatten für bessere Abgrenzung beim Scrollen */
                box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            }

            .modal-title {
                font-size: 1.125rem;
                font-weight: 600;
            }

            .modal-body {
                padding: 24px;
                flex: 1;
                overflow-y: auto;
                padding: 24px;
                
                /* Smooth Scrolling */
                scroll-behavior: smooth;
            }

            .modal-footer {
                padding: 16px 24px;
                border-top: 1px solid var(--border);
                display: flex;
                justify-content: flex-end;
                gap: 8px;
            }

            /* Cards */
            .card {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                overflow: hidden;
            }

            .card-header {
                padding: 16px 20px;
                background: var(--bg-tertiary);
                border-bottom: 1px solid var(--border);
                font-weight: 600;
            }

            .card-body {
                padding: 20px;
            }

            /* Loading */
            .loading-overlay {
                position: absolute;
                inset: 0;
                background: rgba(255, 255, 255, 0.9);
                display: flex;
                align-items: center;
                justify-content: center;
                flex-direction: column;
                gap: 16px;
            }

            .processing-overlay {
                position: fixed;
                inset: 0;
                background: rgba(0, 0, 0, 0.7);
                display: flex;
                align-items: center;
                justify-content: center;
                flex-direction: column;
                gap: 16px;
                z-index: 999;
                color: white;
            }

            .processing-message {
                font-size: 1.125rem;
                font-weight: 500;
            }

            .split-points {
                margin: 16px 0;
            }

            .split-point {
                display: inline-block;
                margin: 4px;
                padding: 6px 12px;
                background: var(--info);
                color: white;
                border-radius: var(--radius-sm);
                cursor: pointer;
                font-size: 0.875rem;
            }

            .split-point:hover {
                background: var(--primary);
            }

            .split-preview {
                margin: 16px 0;
                padding: 16px;
                background: var(--bg-secondary);
                border-radius: var(--radius);
            }

            .split-result {
                margin: 8px 0;
                padding: 12px;
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
                background: var(--bg-primary);
            }

            .split-result-header {
                font-size: 0.875rem;
                color: var(--text-secondary);
                margin-bottom: 8px;
            }

            .selectable-text {
                user-select: text;
                cursor: text;
            }

            .selectable-text::selection {
                background: rgba(99, 102, 241, 0.3);
            }

            .spinner {
                width: 40px;
                height: 40px;
                border: 3px solid var(--border);
                border-top: 3px solid var(--primary);
                border-radius: 50%;
                animation: spin 1s linear infinite;
                margin-bottom: 16px;
            }

            @keyframes spin {
                0% {
                    transform: rotate(0deg);
                }

                100% {
                    transform: rotate(360deg);
                }
            }

            .toast-container {
                position: fixed;
                top: 20px;
                right: 20px;
                z-index: 1000;
                display: flex;
                flex-direction: column;
                gap: 8px;
            }

            .toast {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                padding: 12px 16px;
                box-shadow: var(--shadow-lg);
                display: flex;
                align-items: center;
                gap: 8px;
                min-width: 300px;
                animation: slideIn 0.3s ease;
            }

            .toast.success {
                border-left: 4px solid var(--success);
            }

            .toast.error {
                border-left: 4px solid var(--danger);
            }

            .toast.warning {
                border-left: 4px solid var(--warning);
            }

            @keyframes slideIn {
                from {
                    transform: translateX(100%);
                    opacity: 0;
                }

                to {
                    transform: translateX(0);
                    opacity: 1;
                }
            }

            .flex {
                display: flex;
            }

            .flex-col {
                flex-direction: column;
            }

            .items-center {
                align-items: center;
            }

            .justify-between {
                justify-content: space-between;
            }

            .gap-2 {
                gap: 8px;
            }

            .gap-4 {
                gap: 16px;
            }

            .mb-4 {
                margin-bottom: 16px;
            }

            .text-sm {
                font-size: 0.875rem;
            }

            .text-lg {
                font-size: 1.125rem;
            }

            .font-bold {
                font-weight: 700;
            }

            .hidden {
                display: none !important;
            }

            /* ⭐ SQL-BASIERTE STYLES FÜR ENTITÄTEN UND HIERARCHIE */
            .tile.entity-basis-route .tile-actions .action-btn:hover {
                color: var(--basis-route-border);
            }
            /* Entity Grid Layout */
            .entity-grid {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
                gap: 20px;
            }

            .entity-group {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                overflow: hidden;
                margin-bottom: 24px;
            }

            .entity-group-header {
                padding: 16px 20px;
                background: var(--bg-tertiary);
                border-bottom: 1px solid var(--border);
                display: flex;
                align-items: center;
                justify-content: space-between;
            }

            .entity-group-title {
                font-weight: 600;
                display: flex;
                align-items: center;
                gap: 8px;
            }

            .entity-group-count {
                background: var(--primary);
                color: white;
                padding: 2px 8px;
                border-radius: 12px;
                font-size: 0.75rem;
            }

            .entity-list {
                padding: 16px;
            }

            .entity-item {
                padding: 12px;
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
                margin-bottom: 8px;
                background: var(--bg-secondary);
            }

            .entity-item:last-child {
                margin-bottom: 0;
            }

            .entity-item-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 8px;
            }

            .entity-item-text {
                font-size: 0.9rem;
                line-height: 1.4;
            }

            .entity-badges {
                display: flex;
                gap: 4px;
                flex-wrap: wrap;
            }

            .entity-badge {
                padding: 2px 6px;
                border-radius: 4px;
                font-size: 0.7rem;
                font-weight: 500;
            }

            .entity-badge.main {
                background: var(--info);
                color: white;
            }

            .entity-badge.correct {
                background: var(--success);
                color: white;
            }

            .entity-badge.wrong {
                background: var(--danger);
                color: white;
            }

            .entity-badge.pending {
                background: var(--warning);
                color: white;
            }

            /* SQL-basierte Hierarchy Styles */
            .hierarchy-container {
                padding: 20px;
            }

            .hierarchy-tree {
                display: flex;
                flex-direction: column;
                gap: 24px;
            }

            .hierarchy-entity {
                border: 2px solid var(--border);
                border-radius: var(--radius);
                background: var(--bg-primary);
            }

            .hierarchy-entity.main-entity {
                border-color: var(--primary);
            }

            .hierarchy-header {
                padding: 16px 20px;
                background: var(--bg-tertiary);
                border-bottom: 1px solid var(--border);
                display: flex;
                justify-content: space-between;
                align-items: center;
            }

            .hierarchy-title {
                font-weight: 600;
                display: flex;
                align-items: center;
                gap: 8px;
            }

            .hierarchy-content {
                padding: 16px 20px;
            }

            .hierarchy-attributes {
                margin-top: 16px;
                padding-left: 20px;
                border-left: 3px solid var(--border);
            }

            .hierarchy-attribute {
                margin-bottom: 12px;
                padding: 8px 12px;
                background: var(--bg-secondary);
                border-radius: var(--radius-sm);
                border-left: 3px solid var(--linked-border);
                position: relative;
            }

            .hierarchy-attribute:last-child {
                margin-bottom: 0;
            }

            .hierarchy-attribute::before {
                content: '↳';
                position: absolute;
                left: -15px;
                top: 8px;
                color: var(--linked-border);
                font-weight: bold;
            }

            .attribute-type {
                font-size: 0.75rem;
                color: var(--primary);
                font-weight: 600;
                margin-bottom: 4px;
            }

            .attribute-text {
                font-size: 0.875rem;
                color: var(--text-primary);
            }

            /* Database Manager Styles */
            .database-dashboard {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
                gap: 16px;
                margin-bottom: 24px;
            }

            .db-stat-card {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                padding: 20px;
                text-align: center;
            }

            .db-stat-value {
                font-size: 2rem;
                font-weight: 700;
                color: var(--primary);
            }

            .db-stat-label {
                font-size: 0.875rem;
                color: var(--text-secondary);
                margin-top: 4px;
            }

            .db-table-grid {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
                gap: 16px;
            }

            .db-table-card {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                overflow: hidden;
            }

            .db-table-header {
                background: var(--bg-tertiary);
                padding: 12px 16px;
                font-weight: 600;
                display: flex;
                justify-content: space-between;
                align-items: center;
            }

            .db-table-body {
                padding: 16px;
            }

            .db-table-meta {
                font-size: 0.875rem;
                color: var(--text-secondary);
            }

            .db-operations {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                padding: 20px;
                margin-bottom: 24px;
            }

            .sql-editor {
                font-family: 'Courier New', monospace;
                background: #1e1e1e;
                color: #d4d4d4;
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
                padding: 16px;
                min-height: 200px;
                resize: vertical;
            }

            .sql-results {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                overflow: hidden;
            }

            .sql-results-header {
                background: var(--bg-tertiary);
                padding: 12px 16px;
                font-weight: 600;
            }

            .sql-results-table {
                width: 100%;
                border-collapse: collapse;
            }

            .sql-results-table th,
            .sql-results-table td {
                padding: 8px 12px;
                border-bottom: 1px solid var(--border);
                text-align: left;
            }

            .sql-results-table th {
                background: var(--bg-tertiary);
                font-weight: 600;
            }

            /* Debug Styles */
            .debug-container {
                padding: 24px;
                height: 100%;
                overflow-y: auto;
                max-height: calc(100vh - 120px);
            }

            .debug-content {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                padding: 20px;
                font-family: 'Courier New', monospace;
                font-size: 0.875rem;
                overflow-x: auto;
                white-space: pre-wrap;
                word-wrap: break-word;
            }

            /* Mobile Responsive */
            @media (max-width: 768px) {
                .sidebar {
                    width: 100%;
                    height: auto;
                }

                .sidebar.collapsed {
                    width: 100%;
                    height: 60px;
                    overflow: hidden;
                }

                .main-content {
                    max-width: 100vw;
                }

                .tile-actions {
                    opacity: 1;
                }

                .content-grid {
                    grid-template-columns: 1fr;
                }

                .entity-grid {
                    grid-template-columns: 1fr;
                }

                .database-dashboard {
                    grid-template-columns: 1fr;
                }

                .db-table-grid {
                    grid-template-columns: 1fr;
                }
            }

            /* Advanced Filter Styles */
            .filter-container {
                display: flex;
                gap: 12px;
                align-items: center;
                flex-wrap: wrap;
            }

            .filter-group {
                display: flex;
                flex-direction: column;
                gap: 4px;
            }

            .filter-checkbox-group {
                display: flex;
                gap: 8px;
                flex-wrap: wrap;
            }

            .filter-checkbox {
                display: flex;
                align-items: center;
                gap: 4px;
                padding: 4px 8px;
                border-radius: var(--radius-sm);
                background: var(--bg-secondary);
                cursor: pointer;
            }

            .filter-checkbox input[type="checkbox"] {
                margin: 0;
            }

            .filter-checkbox:hover {
                background: var(--bg-tertiary);
            }

            /* Search Bar Styles */
            .search-container {
                position: relative;
                flex: 1;
                min-width: 200px;
            }

            .search-input {
                width: 100%;
                padding: 8px 40px 8px 12px;
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
            }

            .search-icon {
                position: absolute;
                right: 12px;
                top: 75%;
                transform: translateY(-50%);
                color: var(--text-muted);
            }

            .search-results {
                position: absolute;
                top: 100%;
                left: 0;
                right: 0;
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-top: none;
                border-radius: 0 0 var(--radius-sm) var(--radius-sm);
                max-height: 300px;
                overflow-y: auto;
                z-index: 100;
            }

            .search-result-item {
                padding: 8px 12px;
                cursor: pointer;
                border-bottom: 1px solid var(--border);
            }

            .search-result-item:hover {
                background: var(--bg-secondary);
            }

            .search-result-item:last-child {
                border-bottom: none;
            }

            /* Bulk Actions */
            .bulk-actions {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                padding: 16px;
                margin-bottom: 16px;
                display: none;
            }

            .bulk-actions.visible {
                display: block;
            }

            .bulk-actions-header {
                font-weight: 600;
                margin-bottom: 12px;
            }

            .bulk-actions-buttons {
                display: flex;
                gap: 8px;
                flex-wrap: wrap;
            }

            /* Advanced Entity Management */
            .entity-management-toolbar {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 16px;
                flex-wrap: wrap;
                gap: 12px;
            }

            .entity-stats {
                display: flex;
                gap: 16px;
                margin-bottom: 24px;
                overflow-x: auto;
            }

            .entity-stat {
                flex: 1;
                text-align: center;
                padding: 16px;
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                min-width: 120px;
            }

            .entity-stat-value {
                font-size: 2rem;
                font-weight: 700;
                color: var(--primary);
                display: block;
            }

            .entity-stat-label {
                font-size: 0.875rem;
                color: var(--text-secondary);
            }


            .stats {
                display: flex;
                gap: 16px;
                margin-bottom: 24px;
                overflow-x: auto;
            }

            .stat {
                flex: 1;
                text-align: center;
                padding: 16px;
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                min-width: 120px;
            }

            .stat-number {
                font-size: 2rem;
                font-weight: 700;
                color: var(--primary);
                display: block;
            }

            .stat-label {
                font-size: 0.875rem;
                color: var(--text-secondary);
            }


            /* Import/Export Enhanced */
            .import-export-section {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                padding: 20px;
                margin-bottom: 24px;
            }

            .import-export-grid {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
                gap: 16px;
            }

            .import-export-card {
                background: var(--bg-secondary);
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
                padding: 16px;
                text-align: center;
            }

            .import-export-icon {
                font-size: 2rem;
                margin-bottom: 8px;
            }

            .import-export-title {
                font-weight: 600;
                margin-bottom: 4px;
            }

            .import-export-desc {
                font-size: 0.875rem;
                color: var(--text-secondary);
                margin-bottom: 12px;
            }

            /* Validation & Error Handling */
            .validation-message {
                padding: 8px 12px;
                border-radius: var(--radius-sm);
                font-size: 0.875rem;
                margin-top: 4px;
            }

            .validation-message.error {
                background: #fef2f2;
                color: #dc2626;
                border: 1px solid #fecaca;
            }

            .validation-message.warning {
                background: #fffbeb;
                color: #d97706;
                border: 1px solid #fed7aa;
            }

            .validation-message.success {
                background: #f0fdf4;
                color: #16a34a;
                border: 1px solid #bbf7d0;
            }

            /* Progress Indicators */
            .progress-container {
                margin: 16px 0;
            }

            .progress-bar {
                width: 100%;
                height: 8px;
                background: var(--bg-secondary);
                border-radius: var(--radius-sm);
                overflow: hidden;
            }

            .progress-fill {
                height: 100%;
                background: var(--primary);
                transition: width 0.3s ease;
            }

            .progress-text {
                font-size: 0.875rem;
                color: var(--text-secondary);
                margin-top: 4px;
            }

            /* Tag Management */
            .tag-input-container {
                display: flex;
                flex-wrap: wrap;
                gap: 4px;
                padding: 8px;
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
                min-height: 40px;
            }

            .tag-item {
                background: var(--primary);
                color: white;
                padding: 2px 8px;
                border-radius: var(--radius-sm);
                font-size: 0.75rem;
                display: flex;
                align-items: center;
                gap: 4px;
            }

            .tag-remove {
                cursor: pointer;
                font-weight: bold;
            }

            .tag-input {
                border: none;
                outline: none;
                flex: 1;
                min-width: 100px;
            }

            /* Tooltip System */
            .tooltip {
                position: relative;
                display: inline-block;
            }

            .tooltip .tooltiptext {
                visibility: hidden;
                width: 200px;
                background-color: #333;
                color: #fff;
                text-align: center;
                border-radius: 6px;
                padding: 8px;
                position: absolute;
                z-index: 1;
                bottom: 125%;
                left: 50%;
                margin-left: -100px;
                opacity: 0;
                transition: opacity 0.3s;
                font-size: 0.75rem;
            }

            .tooltip:hover .tooltiptext {
                visibility: visible;
                opacity: 1;
            }

            /* Context Menu */
            .context-menu {
                position: fixed;
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: var(--radius-sm);
                box-shadow: var(--shadow-lg);
                z-index: 1000;
                min-width: 150px;
            }

            .context-menu-item {
                padding: 8px 12px;
                cursor: pointer;
                display: flex;
                align-items: center;
                gap: 8px;
                font-size: 0.875rem;
            }

            .context-menu-item:hover {
                background: var(--bg-secondary);
            }

            .context-menu-separator {
                height: 1px;
                background: var(--border);
                margin: 4px 0;
            }

            /* Keyboard Shortcuts */
            .keyboard-shortcut {
                background: var(--bg-tertiary);
                border: 1px solid var(--border);
                border-radius: 3px;
                padding: 2px 6px;
                font-size: 0.75rem;
                font-family: monospace;
            }

            /* Advanced Animation */
            @keyframes fadeInUp {
                from {
                    opacity: 0;
                    transform: translateY(20px);
                }

                to {
                    opacity: 1;
                    transform: translateY(0);
                }
            }

            @keyframes fadeInLeft {
                from {
                    opacity: 0;
                    transform: translateX(-20px);
                }

                to {
                    opacity: 1;
                    transform: translateX(0);
                }
            }

            @keyframes bounce {

                0%,
                20%,
                53%,
                80%,
                100% {
                    transform: translate3d(0, 0, 0);
                }

                40%,
                43% {
                    transform: translate3d(0, -10px, 0);
                }

                70% {
                    transform: translate3d(0, -5px, 0);
                }

                90% {
                    transform: translate3d(0, -2px, 0);
                }
            }

            .animate-fade-in-up {
                animation: fadeInUp 0.5s ease;
            }

            .animate-fade-in-left {
                animation: fadeInLeft 0.5s ease;
            }

            .animate-bounce {
                animation: bounce 1s;
            }

            /* Print Styles */
            @media print {

                .sidebar,
                .header,
                .tile-actions,
                .btn {
                    display: none !important;
                }

                .main-content {
                    margin: 0;
                }

                .tile {
                    border: 1px solid #000;
                    margin-bottom: 10px;
                    break-inside: avoid;
                }
            }

            .hierarchical-section {
                background: var(--bg-secondary);
                border-radius: var(--radius);
                padding: 16px;
                margin: 16px 0;
                border-left: 4px solid var(--primary);
            }

            .hierarchy-header h4 {
                margin: 0 0 8px 0;
                color: var(--primary);
                font-size: 1.1rem;
            }

            .hierarchy-header p {
                margin: 0 0 16px 0;
                font-style: italic;
            }

            .summary-section {
                margin-top: 16px;
            }

            .summary-section ul {
                margin: 8px 0 0 16px;
                padding: 0;
            }

            .summary-section li {
                margin-bottom: 4px;
            }

            .validation-message.success {
                background: #f0fdf4;
                color: #16a34a;
                border: 1px solid #bbf7d0;
            }

            .validation-message.warning {
                background: #fffbeb;
                color: #d97706;
                border: 1px solid #fed7aa;
            }

            /* Predefined Tags Styling */
            .predefined-tags {
                margin-top: 16px;
                padding: 16px;
                background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            }

            .predefined-tags .form-label {
                font-size: 0.875rem;
                font-weight: 600;
                color: var(--text-secondary);
                margin-bottom: 12px;
                display: flex;
                align-items: center;
                gap: 8px;
            }

            .predefined-tags .form-label::before {
                content: "✨";
                font-size: 1rem;
            }

            .predefined-tags-container {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
                gap: 8px;
                max-height: 160px;
                overflow-y: auto;
                padding: 4px;

                /* Custom Scrollbar */
                scrollbar-width: thin;
                scrollbar-color: var(--primary) var(--bg-tertiary);
            }

            .predefined-tags-container::-webkit-scrollbar {
                width: 6px;
            }

            .predefined-tags-container::-webkit-scrollbar-track {
                background: var(--bg-tertiary);
                border-radius: 3px;
            }

            .predefined-tags-container::-webkit-scrollbar-thumb {
                background: var(--primary);
                border-radius: 3px;
            }

            .predefined-tag {
                font-family: inherit;
                font-size: 0.8rem;
                font-weight: 500;
                padding: 8px 12px;
                border: 2px solid transparent;
                border-radius: var(--radius-sm);
                background: white;
                color: var(--text-primary);
                cursor: pointer;
                transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
                position: relative;
                overflow: hidden;

                /* Subtle gradient background */
                background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
                box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

                /* Subtle border */
                border: 1px solid rgba(0, 0, 0, 0.08);
            }

            .predefined-tag::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
                transition: left 0.5s;
            }

            .predefined-tag.available:hover {
                background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
                color: white;
                border-color: var(--primary);
                transform: translateY(-2px) scale(1.02);
                box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
            }

            .predefined-tag.available:hover::before {
                left: 100%;
            }

            .predefined-tag.available:active {
                transform: translateY(-1px) scale(1.01);
                transition: all 0.1s ease;
            }

            .predefined-tag.used {
                background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
                color: white;
                border-color: var(--success);
                cursor: not-allowed;
                opacity: 0.9;
                position: relative;
            }

            .predefined-tag.used::after {
                content: "✓";
                position: absolute;
                top: -2px;
                right: 4px;
                font-size: 0.7rem;
                font-weight: bold;
                color: rgba(255, 255, 255, 0.9);
            }

            /* Animationen beim Erscheinen */
            .predefined-tag {
                animation: fadeInUp 0.3s ease forwards;
            }

            .predefined-tag:nth-child(1) {
                animation-delay: 0.05s;
            }

            .predefined-tag:nth-child(2) {
                animation-delay: 0.1s;
            }

            .predefined-tag:nth-child(3) {
                animation-delay: 0.15s;
            }

            .predefined-tag:nth-child(4) {
                animation-delay: 0.2s;
            }

            .predefined-tag:nth-child(5) {
                animation-delay: 0.25s;
            }

            .predefined-tag:nth-child(6) {
                animation-delay: 0.3s;
            }

            @keyframes fadeInUp {
                from {
                    opacity: 0;
                    transform: translateY(10px);
                }

                to {
                    opacity: 1;
                    transform: translateY(0);
                }
            }

            /* Responsive Design */
            @media (max-width: 768px) {
                .predefined-tags-container {
                    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
                    gap: 6px;
                }

                .predefined-tag {
                    font-size: 0.75rem;
                    padding: 6px 10px;
                }
            }

            /* Dark Mode Support */
            @media (prefers-color-scheme: dark) {
                .predefined-tag {
                    background: var(--secondary);
                    color: #f9fafb;
                    border-color: #4b5563;
                }

                .predefined-tags {
                    /*background: linear-gradient(135deg, #1f2937 0%, #111827 100%);*/
                }
            }

            .tile-type {
                font-size: 0.875rem;
                font-weight: 600;
                display: flex;
                align-items: center;
                gap: 8px;
            }

            /* Optional: Style für den Punkt */
            .tile-type span:contains('·') {
                opacity: 0.6;
                margin: 0 4px;
            }


            /* Styling für die Recent Countries */
            .form-select optgroup[label*="Zuletzt"] {
                background-color: #f0f9ff;
                font-weight: 600;
            }

            .form-select optgroup[label*="Zuletzt"] option {
                background-color: #e0f2fe;
                padding-left: 20px;
            }

            .form-select option[value="__separator__"] {
                color: #ccc;
                font-size: 0.8em;
                pointer-events: none;
            }

            /* Hover-Effekt für Recent Countries */
            .form-select optgroup[label*="Zuletzt"] option:hover {
                background-color: #bae6fd;
            }


            .form-select optgroup[label*="Zuletzt"] {
                background-color: #f0f9ff;
                font-weight: 600;
            }

            .form-select optgroup[label*="Zuletzt"] option {
                background-color: #e0f2fe !important;
                font-weight: 600;
                position: relative;
                padding-left: 25px;
            }

            .form-select optgroup[label*="Zuletzt"] option::before {
                content: "⭐";
                position: absolute;
                left: 8px;
            }

            /* Separator styling */
            .form-select option[disabled] {
                color: #d1d5db;
                font-size: 0.75rem;
                padding: 2px 0;
                background: #f9fafb;
            }

            /* Hover-Effekt für Recent Countries */

            /* Clean Country Select mit Separatoren - IMMER HELL */
            .clean-country-select {
                background-color: #ffffff !important;
                color: #111827 !important;
                border: 2px solid #e5e7eb !important;
                transition: all 0.2s ease;
                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            }

            .clean-country-select:focus {
                border-color: #3b82f6 !important;
                box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
            }

            /* Optgroup Labels */
            .clean-country-select optgroup {
                background-color: #ffffff !important;
                color: #6b7280 !important;
                font-weight: 600;
                font-size: 0.875rem;
                text-transform: uppercase;
                letter-spacing: 0.05em;
            }

            .clean-country-select optgroup.recent-group {
                color: #1e40af !important;
            }

            /* Recent Options */
            .clean-country-select .recent-option {
                background-color: #eff6ff !important;
                font-weight: 600;
                border-left: 3px solid #3b82f6;
                padding-left: 12px !important;
                color: #1e40af !important;
            }

            /* Regular Options */
            .clean-country-select option {
                background-color: #ffffff !important;
                color: #111827 !important;
                padding: 8px 12px;
            }

            /* Separator */
            .clean-country-select .separator {
                font-size: 0.6rem !important;
                color: #e5e7eb !important;
                padding: 2px 0 !important;
                background: #fafafa !important;
                text-align: center;
                cursor: default !important;
            }

            /* Hover Effects */
            .clean-country-select option:hover:not(.separator):not(:disabled) {
                background-color: #f3f4f6 !important;
            }

            .clean-country-select .recent-option:hover {
                background-color: #dbeafe !important;
            }

            /* Focus States */
            .clean-country-select:focus-visible {
                outline: 2px solid #3b82f6 !important;
                outline-offset: 2px;
            }

            /* Animation für Recent Countries */
            @keyframes slideInFromLeft {
                from {
                    opacity: 0;
                    transform: translateX(-10px);
                }

                to {
                    opacity: 1;
                    transform: translateX(0);
                }
            }

            .clean-country-select .recent-option {
                animation: slideInFromLeft 0.3s ease-out;
            }

            /* Scrollbar Styling (für lange Listen) */
            .clean-country-select::-webkit-scrollbar {
                width: 8px;
            }

            .clean-country-select::-webkit-scrollbar-track {
                background: #f3f4f6;
            }

            .clean-country-select::-webkit-scrollbar-thumb {
                background: #d1d5db;
                border-radius: 4px;
            }

            .clean-country-select::-webkit-scrollbar-thumb:hover {
                background: #9ca3af;
            }

            /* ==================== 2. TAG CONTAINER ANPASSUNGEN ==================== */

            /* Haupt-Container für die Tag-Sektion */
            .tag-selection-container {
                margin-bottom: 20px;
            }

            /* Label bleibt außerhalb des scrollbaren Bereichs */
            .tag-selection-container .form-label {
                margin-bottom: 12px;
                position: sticky;
                top: -24px; /* Anpassung je nach modal-body padding */
                background-color: #ffffff;
                z-index: 5;
                padding: 4px 0;
            }

            /* Scrollbarer Tag-Container */
            .predefined-tags-container {
                display: grid;
                grid-template-columns: repeat(3, 1fr); /* 3 Spalten nebeneinander */
                gap: 8px;
                
                /* Höhe für genau 6 Reihen (6 Tags vertikal sichtbar) */
                max-height: 240px; /* Anpassbar: ~40px pro Tag-Reihe */
                overflow-y: auto;
                padding: 8px;
                
                /* Optischer Rahmen für bessere Abgrenzung */
                border: 1px solid #e5e7eb;
                border-radius: 8px;
                background-color: #fafafa;
                
                /* Scrollbar Styling */
                scrollbar-width: thin;
                scrollbar-color: #d1d5db #f3f4f6;
            }

            /* Scrollbar Styling für Webkit Browser */
            .predefined-tags-container::-webkit-scrollbar {
                width: 8px;
            }

            .predefined-tags-container::-webkit-scrollbar-track {
                background: #f3f4f6;
                border-radius: 4px;
            }

            .predefined-tags-container::-webkit-scrollbar-thumb {
                background: #d1d5db;
                border-radius: 4px;
            }

            .predefined-tags-container::-webkit-scrollbar-thumb:hover {
                background: #9ca3af;
            }

            /* Tag Styling bleibt gleich */
            .predefined-tag {
                padding: 8px 12px;
                background: var(--primary);
                color: white;
                border-radius: var(--radius-sm);
                cursor: pointer;
                transition: all 0.2s ease;
                text-align: center;
                font-size: 0.875rem;
                font-weight: 500;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            /* Hover & Active States */
            .predefined-tag:hover {
                transform: translateY(-1px);
                box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
            }

            .predefined-tag.selected {
                background: var(--success);
                cursor: not-allowed;
                opacity: 0.9;
            }

            /* ==================== MODAL FOOTER ==================== */
            .modal-footer {
                position: sticky;
                bottom: 0;
                background-color: #ffffff;
                border-top: 1px solid #e5e7eb;
                padding: 16px 24px;
                display: flex;
                justify-content: flex-end;
                gap: 12px;
                flex-shrink: 0;
                
                /* Schatten nach oben für bessere Abgrenzung */
                box-shadow: 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
            }

            /* ==================== RESPONSIVE ANPASSUNGEN ==================== */
            @media (max-width: 768px) {
                .predefined-tags-container {
                    grid-template-columns: repeat(2, 1fr); /* 2 Spalten auf Mobile */
                    max-height: 200px; /* Etwas niedriger auf Mobile */
                }
                
                .modal {
                    max-height: 95vh; /* Mehr Platz auf Mobile */
                }
            }

            /* ==================== SCROLL-INDIKATOR (OPTIONAL) ==================== */
            /* Zeigt an, dass mehr Tags verfügbar sind */
            .predefined-tags-container::after {
                content: '';
                position: sticky;
                bottom: 0;
                left: 0;
                right: 0;
                height: 20px;
                background: linear-gradient(to bottom, transparent, rgba(250, 250, 250, 0.9));
                pointer-events: none;
                opacity: 0;
                transition: opacity 0.3s ease;
            }

            .predefined-tags-container:not(:hover)::after {
                opacity: 1;
            }

            /* ==================== DARK MODE ANPASSUNGEN ==================== */
            @media (prefers-color-scheme: dark) {
                .modal-header,
                .modal-footer,
                .tag-selection-container .form-label {
                    background-color: #1f2937;
                    color: #f3f4f6;
            }
            
            .modal-header {
                border-bottom-color: #374151;
            }
            
            .modal-footer {
                border-top-color: #374151;
            }
            
            .predefined-tags-container {
                background-color: #111827;
                border-color: #374151;
            }
            
            .predefined-tags-container::-webkit-scrollbar-track {
                background: #1f2937;
            }
            
            .predefined-tags-container::-webkit-scrollbar-thumb {
                background: #4b5563;
            }
        }

        .modal-backdrop {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1050;
        }
        
        .modal-content {
            background: white;
            border-radius: 8px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
            width: 90%;
            max-width: 800px;
        }
        
        .modal-header {
            display: flex;
            align-items: center;
            padding: 1.25rem;
            border-bottom: 1px solid #dee2e6;
        }
        
        .modal-body {
            padding: 1.25rem;
        }
        
        .modal-footer {
            padding: 1rem 1.25rem;
            border-top: 1px solid #dee2e6;
            background-color: #1f2937;
        }
        
        .form-group {
            margin-bottom: 1.25rem;
        }
        
        .form-label {
            margin-bottom: 0.5rem;
            font-weight: 500;
            color: #212529;
        }
        
        .tag-selector {
            border: 1px solid #dee2e6;
            border-radius: 4px;
            padding: 0.5rem;
            max-height: 150px;
            overflow-y: auto;
        }
        
        .is-invalid {
            border-color: #dc3545 !important;
        }
        
        .form-control:focus,
        .form-select:focus {
            border-color: #86b7fe;
            box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
        }
        
        /* Highlight Animation */
        @keyframes highlight-flash {
            0%, 100% { background-color: transparent; }
            50% { background-color: rgba(255, 193, 7, 0.3); }
        }
        
        .highlight-flash {
            animation: highlight-flash 1s ease-in-out;
        }

/* ===== AUTOCOMPLETE STYLES - OPTIMIZED MERGE ===== */

/* Container & Input Struktur */
.autocomplete-container {
    position: relative;
}

.input-group,
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

/* Spinner/Loading Indikator */
.input-spinner,
.input-icon-right {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}

/* Clear Button */
.btn-clear,
.input-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-clear:hover,
.input-clear-btn:hover {
    background: var(--bg-tertiary);
    color: var(--danger);
}

/* Spin Animation */
.spin {
    animation: spin 1s linear infinite;
}

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

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    margin-top: -1px;
}

.autocomplete-results {
    padding: 0;
}

/* Autocomplete Items */
.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
}

.autocomplete-item:hover {
    background: var(--bg-secondary);
}

.autocomplete-item.selected {
    background: var(--primary);
    color: white;
}

.autocomplete-item.selected .text-muted,
.autocomplete-item.selected .ort-region,
.autocomplete-item.selected .ort-details {
    color: rgba(255, 255, 255, 0.8) !important;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

/* Ort-spezifische Styles */
.ort-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ort-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.ort-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.ort-name i {
    color: var(--primary);
    font-size: 0.9rem;
}

.ort-region {
    color: var(--text-muted);
    font-size: 0.9em;
}

.ort-details {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 24px;
}

.ort-details i {
    font-size: 0.8rem;
    margin-right: 4px;
}

/* No Results */
.no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

.no-results i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 8px;
}

/* Selected Ort Info */
.selected-ort-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-ort-info i {
    font-size: 1rem;
}

/* Badges */
.badge {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.badge-secondary {
    background: var(--secondary);
    color: white;
}

.badge-info {
    background: var(--info);
    color: white;
}

/* Info & Alert Boxes */
.info-box {
    background: var(--bg-tertiary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.alert {
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning-dark);
    border: 1px solid var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: var(--info-dark);
    border: 1px solid var(--info);
}

/* Modal Extensions */
.modal-lg {
    max-width: 800px;
    width: 90%;
}

/* Hierarchical Sections */
.hierarchical-section {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.hierarchy-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.hierarchy-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.summary-section {
    margin-top: 16px;
}

.preview-name {
    word-break: break-word;
}

/* Validation */
.validation-errors {
    margin-top: 16px;
}

/* Utility Classes */
.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.875rem;
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-primary {
    color: var(--primary);
}

.mt-2 {
    margin-top: 8px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .autocomplete-dropdown {
        max-height: 200px;
    }
    
    .ort-details {
        flex-direction: column;
        gap: 4px;
        margin-left: 16px;
    }
    
    .modal-lg {
        max-width: 95%;
    }
}

/* Dark Mode Support (falls vorhanden) */
@media (prefers-color-scheme: dark) {
    .autocomplete-dropdown {
        background: var(--bg-tertiary, #1a1a1a);
        border-color: var(--border-dark, #333);
    }
    
    .autocomplete-item:hover {
        background: var(--bg-secondary, #2a2a2a);
    }
    
    .info-box,
    .selected-ort-info {
        background: var(--bg-tertiary, #2a2a2a);
    }
}










/* Pending Routes Indicator */
.pending-routes-indicator {
    margin-right: 16px;
}

.pending-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--warning-bg, #fff3cd);
    color: var(--warning-text, #856404);
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.pending-link:hover {
    background: var(--warning-hover, #ffe8a1);
    transform: translateY(-1px);
}