@import url('./design-tokens.css');
/* Entity Table Styles */
@import url('./design-tokens.css');

.entity-table-window {
    position: absolute;
    width: 800px;
    height: 500px;
    padding: 0;
    background: var(--window-bg, rgba(10, 15, 25, 0.85));
    border: 1px solid var(--window-border, var(--glass-border));
    border-radius: var(--radius-lg);
    color: white;
    font-family: var(--font-sans, sans-serif);
    font-size: var(--text-xs);
    z-index: var(--z-dropdown);
    cursor: default;
    resize: both;
    min-width: 400px;
    min-height: 200px;
    /* max-width/max-height ENTFERNT für Expertaizer 2026 Standard (2000px) */
    overflow: hidden; /* Header Fix */
    box-sizing: border-box;
    display: none;
    flex-direction: column;
}

/* Header nutzt Unified System - Overrides entfernen */
.entity-table-header.unified-header {
    background: var(--header-bg) !important;
    border-bottom: 1px solid var(--header-border) !important;
    height: var(--header-height, 38px) !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.entity-table-content {
    flex: 1 1 auto; /* Nimmt den verfügbaren Raum ein */
    overflow: auto; /* Ermöglicht Scrollen */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Wichtig für Flex-Overflow */
    padding: 0;
    margin: 0;
}

.table-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 0; /* Entfernt untere Lücke */
    align-items: center;
    padding: 5px; /* Leichtes Padding für Controls */
    width: 100%;
    flex-wrap: wrap; /* Erlaubt Zeilenumbruch, damit Counter sichtbar bleibt */
}

.control-btn {
    background: var(--color-primary);
    border: none;
    color: var(--text-primary);
    padding: 3px 8px;
    cursor: pointer;
    border-radius: var(--radius-xs);
    font-size: var(--text-2xs);
    transition: background var(--transition-fast) ease;
}

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

.entity-table-search {
    flex: 1 1 360px; /* bevorzugt ~360px, kann wachsen/schrumpfen */
    width: auto;
    max-width: 440px;
    min-width: 200px;
    padding: 8px 12px; /* Erhöht von 4px für bessere Lesbarkeit */
    margin: 0;
    background: var(--glass-bg-subtle);
    border: 1px solid var(--color-primary);
    color: var(--text-primary);
    font-size: var(--text-md); /* Erhöht von 10px für bessere Lesbarkeit */
    border-radius: var(--radius-xs);
    box-sizing: border-box;
    line-height: 1.4;
}

.entity-table-search::placeholder {
    color: var(--text-muted); /* Helleres Blau für besseren Kontrast */
    font-weight: 400;
}

.entity-table-search:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--shadow-glow-primary);
    background: var(--glass-bg-light);
}

.entity-table {
    width: 100%;
    border-collapse: collapse;
    flex: 1 1 auto; /* Füllt den restlichen Raum */
    display: block; /* Stellt sicher, dass Tabelle den Raum nutzt */
    overflow-y: auto; /* Vertikales Scrollen */
    overflow-x: auto; /* Horizontales Scrollen für breite Tabellen */
    max-height: 100%; /* Verhindert Überlauf */
}

.entity-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(0, 0, 0, 0.3);
}

.entity-table thead .icon {
  width: 14px; /* Kompaktere Icons */
  height: 14px;
  display: inline-block;
  vertical-align: middle;
  pointer-events: none;
  filter: brightness(0) invert(1); /* optional */
}

.entity-table th {
    padding: 4px 8px; /* Kompakteres Padding */
    text-align: left;
    border-bottom: 1px solid rgba(0, 191, 255, 0.3);
    line-height: 1.2; /* Etwas mehr Zeilenhöhe für Lesbarkeit */
    font-size: var(--text-xs); /* Kleinere Schrift für Header */
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), rgba(0, 0, 255, 0.2));
    background-size: cover;
    box-shadow:
        0 0 10px rgba(0, 255, 255, 0.5),
        inset 0 0 10px rgba(0, 255, 255, 0.3);
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.8);
    mix-blend-mode: screen;
    position: relative; /* Für Resizer */
    resize: horizontal; /* Grundsätzliche Resizing-Unterstützung */
    overflow: hidden;
}

.entity-table th .resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    user-select: none;
}

.entity-table th .resizer:hover,
.entity-table th .resizer.active {
    background: #00bfff; /* Hervorhebung beim Hover/Drag */
}

.entity-table th:hover {
    box-shadow:
        0 0 15px rgba(0, 255, 255, 0.7),
        inset 0 0 12px rgba(0, 255, 255, 0.4);
    transform: scale(1.01);
}

.entity-table td {
    padding: 3px 8px; /* Kompakteres Padding */
    text-align: left;
    border-bottom: 1px solid rgba(0, 191, 255, 0.3);
    line-height: 1.3; /* Bessere Lesbarkeit */
    font-size: var(--text-xs); /* Konsistente Schriftgröße */
}

.entity-table td.name-col {
    font-weight: bold;
    font-size: var(--text-xs); /* Explizit gleiche Größe wie andere Zellen */
}

.entity-table th.sortable {
    cursor: pointer;
    position: relative;
}

.entity-table th.filterable {
    cursor: pointer;
    position: relative;
}

.entity-table th.level-col,
.entity-table td.level-col {
    min-width: 35px; /* Optimiert für Level-Zahlen */
    max-width: 50px;
    text-align: center;
}

/* Größere Schrift für Zahlen in der Level-Spalte */
.entity-table td.level-col {
    font-size: var(--text-md); /* Etwas kleiner für Kompaktheit */
    font-weight: 700;
}

.entity-table th.name-col,
.entity-table td.name-col {
    min-width: 50px; /* Reduziert von 150px (100px weniger) */
    max-width: 250px; /* Maximalbreite für bessere Kontrolle */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-table th.desc-col,
.entity-table td.desc-col {
    min-width: 120px; /* Kompakter */
    max-width: 300px; /* Maximale Breite begrenzt */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none; /* Hide by default */
}

.entity-table th.userdata-col,
.entity-table td.userdata-col {
    min-width: 150px; /* Kompakter */
    max-width: 350px; /* Maximale Breite begrenzt */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none; /* Hide by default */
}

/* Optimierte Spaltenbreiten im Vollbildmodus */
:fullscreen .entity-table th.desc-col,
:fullscreen .entity-table td.desc-col {
    min-width: 80px; /* Reduziert von 150px */
    width: auto;
}

:fullscreen .entity-table th.userdata-col,
:fullscreen .entity-table td.userdata-col {
    min-width: 100px; /* Reduziert von 200px */
    width: auto;
}

.entity-table th.value-col,
.entity-table td.value-col {
    min-width: 45px;
    max-width: 60px;
    width: 55px;
    font-size: 10px;
    padding: 2px 4px;
}

/* Input-Felder in value-col Spalten (Importance/Confidentiality) */
/* Value column inputs */
.entity-table .value-col input[type="number"] {
    width: 50px !important;
    min-width: 45px !important;
    max-width: 60px !important;
    padding: 2px 4px !important;
    font-size: 10px !important;
    text-align: center !important;
}

.entity-table th.last-change-col,
.entity-table td.last-change-col {
    min-width: 85px; /* Kompakter für Datumswerte */
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-table th.need-attention-col,
.entity-table td.need-attention-col {
    min-width: 30px; /* Optimiert für Icon/Symbol */
    max-width: 40px;
    text-align: center;
}

.entity-table th.edit-col,
.entity-table td.edit-col {
    min-width: 50px;
    max-width: 70px;
    width: 60px;
    text-align: center;
}

.entity-table th.delete-col,
.entity-table td.delete-col {
    min-width: 40px;
    max-width: 60px;
    width: 50px;
    text-align: center;
}

.entity-table .toggle {
    cursor: pointer;
    margin-right: 4px; /* Kompakterer Abstand */
    font-size: 10px; /* Kleinere Toggle-Icons */
}

.entity-table .name-col {
    cursor: pointer;
}

.entity-table .edit-btn {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), rgba(0, 0, 255, 0.2));
    border: none;
    color: white;
    padding: 2px 6px; /* Kompakteres Padding */
    cursor: pointer;
    border-radius: 3px;
    font-size: 10px; /* Kleinere Schrift */
    box-shadow:
        0 0 10px rgba(0, 255, 255, 0.5),
        inset 0 0 10px rgba(0, 255, 255, 0.3);
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.8);
    mix-blend-mode: screen;
}

.entity-table .edit-btn:hover {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.3), rgba(0, 0, 255, 0.3));
    box-shadow:
        0 0 15px rgba(0, 255, 255, 0.7),
        inset 0 0 12px rgba(0, 255, 255, 0.4);
    transform: scale(1.05);
}

.entity-table .edit-btn.attention {
    border: 2px solid #ff0000;
    animation: pulse 1.5s infinite;
}

.entity-table tr:hover {
    background: rgba(0, 191, 255, 0.1);
}

.entity-table .conf-rec-exceeds {
    background-color: #ff00004d; /* Rot mit 30% Opacity */
}

/* Show desc-col and userdata-col in fullscreen */
:fullscreen .entity-table th.desc-col,
:fullscreen .entity-table td.desc-col,
:fullscreen .entity-table th.userdata-col,
:fullscreen .entity-table td.userdata-col {
    display: table-cell;
}

/* Fullscreen: Tabelle über gesamte Breite */
:fullscreen .entity-table-window {
    width: 100vw !important; /* Vollbreite */
    height: 100vh !important;
    max-width: none;
    max-height: none;
    left: 0;
    bottom: 0;
    padding: 0;
    margin: 0;
    border: none; /* Clean look */
}

:fullscreen .entity-table {
    width: 100%; /* Tabelle füllt den Container */
    table-layout: auto; /* Automatische Spaltenanpassung */
}

/* Fullscreen: Deaktiviere transform beim Hover um Cursor-Springen zu verhindern */
:fullscreen .entity-table th:hover {
    transform: none;
}

/* Icon-Styling */
.entity-table .icon {
    display: inline-block;
    width: 12px; /* Kompaktere Icons */
    height: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    position: relative;
}

.entity-table .importance-icon {
    background-image: url('/images/Tabelle/Importance.png');
}

.entity-table .confidentiality-icon {
    background-image: url('/images/Tabelle/Confidentiality.png');
}

.entity-table .confidentiality-rec-icon {
    background-image: url('/images/Tabelle/ConfidentialityRecommended.png');
}

.entity-table .need-attention-icon {
    background-image: url('/images/Tabelle/needattention.png');
}

.entity-table th.sortable:hover .icon::after,
.entity-table th.sortable.level-col:hover::after,
.entity-table th.sortable.last-change-col:hover::after,
.entity-table th.sortable.edit-col:hover::after {
    content: attr(title);
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    white-space: nowrap;
    z-index: 10;
}

/* Styling für Trefferanzahl bei Suche */
.search-results {
    margin-left: 10px;
    font-size: 12px;
    color: #00bfff;
    white-space: nowrap; /* Nie umbrechen */
    flex: 0 0 auto; /* Nimmt nur so viel Platz wie nötig ein */
}

/* ==================== ADDITIONAL ENTITY TABLE STYLES ==================== */

/* Editable Your Data cells in Entity Table */
.entity-table th.userdata-col::after {
    content: ' ✎';
    opacity: 0.7;
    font-size: 0.9em;
}

.entity-table td.userdata-col .userdata-input {
    background: rgba(41, 182, 246, 0.08);
    border: 1px dashed rgba(41, 182, 246, 0.45);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    min-height: 24px;
    cursor: text;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.entity-table td.userdata-col .userdata-input:hover {
    background: rgba(41, 182, 246, 0.12);
    border-color: rgba(41, 182, 246, 0.65);
}

.entity-table td.userdata-col .userdata-input:focus {
    background: rgba(41, 182, 246, 0.16);
    border-color: #29b6f6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(41, 182, 246, 0.25);
}

.entity-table td.userdata-col .userdata-input.changed {
    background: rgba(255, 214, 0, 0.18);
    border-color: rgba(255, 214, 0, 0.6);
}

/* Click affordance for entity expanders */
.entity-table td.name-col,
.entity-table td.level-col,
.entity-table .toggle { cursor: pointer; }

/* Filterable column header styling */
.entity-table th.filterable {
    cursor: pointer;
    user-select: none;
    transition: background-color 150ms ease;
}

.entity-table th.filterable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.entity-table th.filterable .filter-indicator {
    font-size: 14px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ============================
   v3.0 Entity Fields Columns
   ============================ */

/* Entity Type column */
.entity-table th.entity-type-col,
.entity-table td.entity-type-col {
    text-align: center;
    width: 35px;
    max-width: 40px;
    min-width: 30px;
    padding: 2px 4px;
    font-size: 14px;
    cursor: help;
}

/* Status column */
.entity-table th.status-col,
.entity-table td.status-col {
    text-align: center;
    width: 60px;
    max-width: 70px;
    min-width: 50px;
    padding: 2px 4px;
}

.entity-table td.status-col .status-badge {
    display: inline-block;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Priority column */
.entity-table th.priority-col,
.entity-table td.priority-col {
    text-align: center;
    width: 55px;
    max-width: 65px;
    min-width: 45px;
    padding: 2px 4px;
    font-size: 9px;
    letter-spacing: 1px;
}

.entity-table td.priority-col .priority-dots {
    font-weight: bold;
}

/* Alias indicator on name */
.entity-table td.name-col .alias-indicator {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.7;
    cursor: help;
}

.entity-table td.name-col .alias-indicator:hover {
    opacity: 1;
}

/* User Entity column styling */
.entity-table th.user-entity-col,
.entity-table td.user-entity-col {
    text-align: center;
    width: 40px;
    max-width: 50px;
    min-width: 35px;
    padding: 2px 4px;
}

.entity-table td.user-entity-col {
    font-size: 16px;
    color: #4caf50;
    font-weight: bold;
    text-align: center; /* Zentriert ohne Flex */
    vertical-align: middle;
    padding: 2px 3px; /* Kompakteres Padding */
    cursor: help;
}

/* Unterschiedliche Farben für User vs Base Entities */
.entity-row-user .user-entity-col {
    color: #4caf50; /* Grün für User Entities (✓) */
}

.entity-row-base .user-entity-col {
    color: #ffa726; /* Orange für Base Entities (🔒) */
    font-size: 11px; /* Etwas kleiner für Schloss-Icon */
}

/* Delete Button Styles */
.entity-table .delete-btn {
    font-size: 14px; /* Größeres Emoji */
    padding: 2px 6px;
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.4);
    border-radius: 3px;
    cursor: pointer;
    transition: all 150ms ease;
    display: inline-block;
    vertical-align: middle;
}

.entity-table .delete-btn:hover:not(:disabled) {
    background: rgba(244, 67, 54, 0.4);
    border-color: rgba(244, 67, 54, 0.7);
    transform: scale(1.05);
}

.entity-table .delete-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Controls row in Entity Table */
.table-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 12px 0;
}
.table-controls .control-btn {
    font-size: 15px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.28);
    background: rgba(255,255,255,0.12);
    color: #fff;
    letter-spacing: 0.2px;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.table-controls .control-btn:hover {
    background: rgba(255,255,255,0.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.table-controls .control-btn:active {
    transform: translateY(1px);
}
/* Save = 3D green, increased opacity for recognizability */
.table-controls #save-userdata-btn {
    border-color: rgba(56, 142, 60, 0.7);
    background: linear-gradient(180deg, rgba(76, 175, 80, 0.60) 0%, rgba(56, 142, 60, 0.45) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 3px 0 rgba(0, 0, 0, 0.25),
        0 6px 12px rgba(0, 0, 0, 0.25);
    text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}
.table-controls #save-userdata-btn:hover {
    background: linear-gradient(180deg, rgba(76, 175, 80, 0.68) 0%, rgba(56, 142, 60, 0.53) 100%);
}
.table-controls #save-userdata-btn:active {
    box-shadow:
        inset 0 2px 0 rgba(0, 0, 0, 0.18),
        0 2px 0 rgba(0, 0, 0, 0.28),
        0 4px 10px rgba(0, 0, 0, 0.22);
}

/* Expand/Collapse = 3D blue, increased opacity for recognizability */
.table-controls #expand-all-btn,
.table-controls #collapse-all-btn {
    border-color: rgba(13, 71, 161, 0.72);
    background: linear-gradient(180deg, rgba(33, 150, 243, 0.50) 0%, rgba(13, 71, 161, 0.38) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 3px 0 rgba(0, 0, 0, 0.25),
        0 6px 12px rgba(0, 0, 0, 0.25);
    text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}
.table-controls #expand-all-btn:hover,
.table-controls #collapse-all-btn:hover {
    background: linear-gradient(180deg, rgba(33, 150, 243, 0.58) 0%, rgba(13, 71, 161, 0.45) 100%);
}
.table-controls #expand-all-btn:active,
.table-controls #collapse-all-btn:active {
    box-shadow:
        inset 0 2px 0 rgba(0, 0, 0, 0.18),
        0 2px 0 rgba(0, 0, 0, 0.28),
        0 4px 10px rgba(0, 0, 0, 0.22);
}

/* Mark edited numeric cells (Importance/Confidentiality) */
.entity-table td.value-col.changed {
    position: relative;
    box-shadow: inset 0 0 0 2px rgba(255, 214, 0, 0.65);
}
.entity-table td.value-col.changed::after {
    content: '•';
    position: absolute;
    top: 4px;
    right: 6px;
    color: #ffd600;
    font-size: 14px;
    opacity: 0.95;
}
.entity-table td.value-col.changed input[type="number"] {
    border-color: rgba(255, 214, 0, 0.85) !important;
    box-shadow: 0 0 0 2px rgba(255, 214, 0, 0.25);
}

/* Larger entity name font */
.entity-table td.name-col {
    font-size: 1.12rem;
    font-weight: 600;
}

/* ===================================
   v2.4.0 Feature 7 Phase 2: Search Integration Styles
   =================================== */

/* Search match highlight - yellow glow */
.entity-table tr.search-match-highlight {
    background: rgba(251, 191, 36, 0.08) !important;
    border-left: 3px solid rgba(251, 191, 36, 0.6) !important;
    transition: all 0.3s ease;
}

.entity-table tr.search-match-highlight:hover {
    background: rgba(251, 191, 36, 0.15) !important;
}

/* Search dimmed - non-matching rows */
.entity-table tr.search-dimmed {
    opacity: 0.3;
    transition: all 0.3s ease;
}

.entity-table tr.search-dimmed:hover {
    opacity: 0.5;
}

/* Pulse animation for first match */
@keyframes pulse-highlight {
    0% {
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(251, 191, 36, 0);
        background: rgba(251, 191, 36, 0.2) !important;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0);
    }
}

/* Match count badge styling */
#search-results-count {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
}

#search-results-count:empty {
    display: none;
}
/* Suchleiste */
#search-container {
    position: absolute;
    top: 520px;
    left: 10px;
    z-index: 1003;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 5px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
    cursor: move;
    overflow: hidden;
    opacity: 1;
}

#search-container input[type="text"] {
    padding: 8px;
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: var(--radius-xs);
    width: 270px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.2);
    color: #00ffff;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    box-shadow: inset 0 0 5px rgba(0, 255, 255, 0.3);
    margin-left: 0;
    margin-right: 5px;
}

#search-container input[type="text"]:focus {
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.5), 0 0 10px rgba(0, 255, 255, 0.8);
}

#search-container button {
    padding: 8px 10px;
    margin-left: 5px;
    border: 1px solid rgba(0, 255, 255, 0.5);
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.4), rgba(0, 0, 255, 0.4));
    color: #00ffff;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 14px;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    transition: all 0.3s ease;
}

#search-container button:hover {
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
    transform: scale(1.05);
}

#search-container button#clear-search-button {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.2), rgba(139, 0, 0, 0.2));
    border: 1px solid rgba(255, 0, 0, 0.5);
    color: #ff0000;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.8);
}

#search-container button#clear-search-button:hover {
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
}

/* Suchergebnis-Text (z.B. "X Entitäten gefunden") */
#search-results-count {
    color: #00ffff;
    font-size: 12px;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    margin-top: 5px;
    display: none;
}

/* Responsive Anpassungen für mobile Geräte */
@media (max-width: 600px) {
    #search-container {
        flex-direction: column;
        align-items: stretch;
    }

    #search-container input[type="text"] {
        width: 100%;
        margin-bottom: 8px;
    }

    #search-container button {
        width: 100%;
        margin-left: 0;
    }

    #search-container button#clear-search-button {
        margin-left: 0;
        margin-top: 5px;
    }
}
/* Modal-Overlay als fixed Fullscreen (wichtig) */
#entity-detail-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: var(--z-max);
  width: 100vw !important;
  height: 100vh !important;
  display: none;             /* <- standardmäßig VERSTECKT */
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: rgba(12,18,34,0.58);
  backdrop-filter: blur(var(--glass-blur-md));
  pointer-events: auto !important;
  isolation: isolate;
}
/* Sichtbar nur mit .open */
#entity-detail-modal.open { display: flex !important; }

body.modal-open { overflow: hidden; }

#entity-detail-box {
  width: 900px;
  max-width: 96vw;
  height: auto;               /* statt fixer Höhe */
  max-height: 85vh;           /* kompakter: 85vh statt 96vh */
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 48px rgba(6,12,24,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
  color: #fff;
  text-align: center;
  position: relative !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;           /* scrollt nur im Content-Bereich */
  z-index: var(--z-dropdown);
  pointer-events: auto !important;
  background: linear-gradient(155deg, #1a2541 0%, #0d1528 100%) !important;
}

/* Theme-Variablen (nur innerhalb des Modals) */
#entity-detail-box {
  --bg-0: #0f1524;
  --bg-1: #161f34;
  --bg-2: #1c2740;
  --panel-bg: rgba(255,255,255,0.04);
  --panel-brd: rgba(255,255,255,0.10);
  --shadow: 0 10px 28px rgba(10,16,28,0.35);
  --text: #eef3ff;
  --muted: #cfd8e3;
  --accent: #3c88ff;
  --accent-2: #6195d6;
  --radius: 12px;
  --gap: 14px;
  /* Textfarben explizit setzen */
  color: var(--text);
}

/* Hintergrund ruhiger, weniger Sättigung/Glow */
#entity-detail-box {
  background:
    radial-gradient(1100px 600px at 0% 0%, #4b5f8f 0%, #2a3857 40%, #141c2e 100%);
  box-shadow: 0 10px 42px rgba(6,12,24,0.45), inset 0 1px 0 rgba(255,255,255,0.05);
  color: var(--text);
}

/* Content mit angenehmeren Scrollbars */
#entity-detail-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 14px 12px;
  scrollbar-width: thin;
  scrollbar-color: #ffffff33 transparent;
}

#entity-detail-content::-webkit-scrollbar-thumb { background: #ffffff33; border-radius: 10px; }

/* Kompakter Header (aus vorherigem Patch bleibt), weniger Glow */
.entity-title {
  box-shadow: 0 1px 6px rgba(16,32,64,0.20), inset 0 1px 2px rgba(255,255,255,0.10);
}

/* Panels für Abschnitte: dezente Karten, klare Trennung, ruhige Schatten */
.modal-section.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-brd);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 4px auto;
  box-shadow: var(--shadow);
}
.section-title {
  display: block;
  font-weight: 600;
  margin: 0 0 6px;
  color: #f3f7ff;
}

/* Sliders */
.sliders-row {
  display: flex;
  gap: var(--spacing-md);
  justify-content: space-between;
  width: 100%;
  max-width: 760px;
  margin: 4px 0 2px;
}
.slider-wrapper { position: relative; width: 360px; } /* vorher 320px */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: var(--radius-sm); outline: none; }
input[type="range"]::-webkit-slider-runnable-track,
input[type="range"]::-moz-range-track { height: 10px; border-radius: var(--radius-sm); }
input[type="range"]::-webkit-slider-thumb,
input[type="range"]::-moz-range-thumb {
  background: #fff; opacity: 0.9; border: 2px solid #67aaff;
  width: 22px; height: 22px; border-radius: 50%;
  box-shadow: 0 1px 4px rgba(61,137,255,0.25); cursor: pointer;
}
#imp-slider::-webkit-slider-runnable-track,
#imp-slider::-moz-range-track { background: linear-gradient(90deg, #e53935 0%, #ffe74d 50%, #43a047 100%); }
#conf-slider::-webkit-slider-runnable-track,
#conf-slider::-moz-range-track { background: linear-gradient(90deg, #5fff82 0%, #ffe74d 50%, #e53935 100%); }

/* Description and textarea */
.entity-description {
  margin: 2px 0 4px;
  max-height: 45px;
  overflow-y: auto;
  color: #eaf1ff;
  font-size: 0.9em;
}
#entity-detail-box textarea#userdata-edit {
  width: 98%;
  min-height: 80px;
  max-height: 150px;
  resize: vertical;
  border-radius: var(--radius-md);
  padding: 8px;
  border: 1.2px solid #d1ecff;
  margin-top: 6px;
  font-size: 0.95em;
  font-family: var(--font-mono, monospace);
  background: #f5f9ff;
  color: #0b1b2f;
}

/* Sicherstellen dass alle Texte in der Modal sichtbar sind */
#entity-detail-modal * {
  color: inherit;
}

#entity-detail-modal input,
#entity-detail-modal textarea,
#entity-detail-modal select,
#entity-detail-modal label {
  color: #0b1b2f !important;
}

#entity-detail-modal .modal-section,
#entity-detail-modal .panel {
  color: #eaf1ff;
}

#entity-detail-modal .section-title {
  color: #f3f7ff !important;
}

#entity-detail-modal .entity-description {
  color: #eaf1ff !important;
}

#entity-detail-modal .muted {
  color: #cfd8e3 !important;
}

/* Spezifische Fixes für Form-Elemente */
#entity-detail-modal input[type="text"],
#entity-detail-modal input[type="number"],
#entity-detail-modal input[type="email"],
#entity-detail-modal input[type="url"] {
  background: #f5f9ff !important;
  color: #0b1b2f !important;
  border: 1px solid #d1ecff !important;
}

#entity-detail-modal input[type="text"]:focus,
#entity-detail-modal input[type="number"]:focus,
#entity-detail-modal input[type="email"]:focus,
#entity-detail-modal input[type="url"]:focus,
#entity-detail-modal textarea:focus {
  background: #ffffff !important;
  color: #0b1b2f !important;
}

/* Slider-Labels */
#entity-detail-modal .slider-wrapper label {
  color: #eaf1ff !important;
  font-weight: 600;
}

/* Slider-Werte */
#entity-detail-modal .slider-wrapper .muted {
  color: #cfd8e3 !important;
}

/* Entity Info Modal (das andere Modal mit weißem Hintergrund) */
#entity-info-modal {
  color: #333 !important;
}

#entity-info-modal * {
  color: #333 !important;
}

#entity-info-modal #entity-info-content {
  color: #333 !important;
}

#entity-info-modal #close-info-btn {
  color: #333 !important;
}

/* Assigned Experts Grid - horizontal layout */
.assigned-experts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
  padding: 8px 0;
}

.assigned-experts-grid .expert-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  min-width: 80px;
  max-width: 120px;
}

.assigned-experts-grid .expert-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.assigned-experts-grid .expert-name {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.assigned-experts-grid .expert-title {
  font-size: 10px;
  color: #a0aec0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Experts section - limit height to prevent button overlap */
.experts-section {
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 12px;
}

/* Buttons */
#entity-detail-box .modal-buttons {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  padding: 12px 16px;
  margin-top: 12px;
  background: rgba(15, 21, 36, 0.95);
  backdrop-filter: blur(var(--glass-blur-md));
  border-top: 1px solid rgba(255,255,255,0.12);
  z-index: 10;
}
#entity-detail-box button#save-userdata {
  background: linear-gradient(180deg, #2b80f6, #1c62cd);
  color: #fff;
  padding: 10px 36px;
  border-radius: 10px;
  border: none;
  font-size: 1.07em;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(41,122,255,0.25);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
#entity-detail-box button#save-userdata:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}
#entity-detail-box button#close-entity-modal {
  appearance: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  color: #eaf1ff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 10px 26px;
  font-weight: 600;
  letter-spacing: .2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease, border-color .12s ease;
}
#entity-detail-box button#close-entity-modal:hover {
  background: var(--glass-bg-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
  border-color: rgba(255,255,255,0.35);
}
#entity-detail-box button#close-entity-modal:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(62,132,255,0.28), 0 2px 8px rgba(0,0,0,0.18);
}

/* Muted Helper */
.muted { color: var(--muted); opacity: 0.95; }

/* Kinderliste dichter */
.children-list {
  gap: 6px 8px;
  margin: 4px 0 6px;
}

/* Avatar leicht ruhiger */
.entity-avatar {
  border: 2px solid rgba(255,255,255,0.75);
  box-shadow: 0 6px 16px rgba(0,0,0,0.30);
}

/* Close-Button oben rechts */
#entity-detail-box .close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  line-height: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #eaf1ff;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.14), rgba(255,255,255,0.06) 60%, transparent 61%),
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.28);
  box-shadow: 0 6px 16px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.35);
  backdrop-filter: blur(var(--glass-blur-md));
  opacity: 0.95;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease, opacity .15s ease;
}
#entity-detail-box .close-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.4);
  filter: brightness(1.03);
  opacity: 1;
}
#entity-detail-box .close-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.3);
}
#entity-detail-box .close-btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(62,132,255,0.28),
    0 6px 16px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.35);
}

/* Level-Badge – kompakt, pill-förmig, mit Stern */
.entity-level-badge {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.95em;
  font-weight: 700;
  line-height: 1;
  color: #0e1526;
  background: linear-gradient(135deg, #eaf2ff, #cfe0ff);
  border: 1px solid rgba(255,255,255,0.65);
  box-shadow: 0 2px 8px rgba(20,40,80,0.16), inset 0 1px 0 rgba(255,255,255,0.5);
}
.entity-level-badge::before {
  content: '★';
  color: #1a3a8a;
  font-size: 1.05em;
  line-height: 1;
  display: inline-block;
}
.entity-level-badge b {
  font-weight: 800;
  color: #0b1326;
}

/* Pills (Parent/Children/Cross) */
.entity-link-pill {
  --pill-bg: linear-gradient(90deg, rgba(60,73,122,0.45) 0%, rgba(97,149,214,0.35) 100%);
  --pill-border: rgba(97,149,214,0.55);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 10px;
  padding: 4px 12px;
  font-size: 0.98em;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  box-shadow: 0 2px 6px rgba(33,150,243,0.20);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, background .12s ease;
  white-space: nowrap;
}
.entity-link-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(41,122,255,0.28);
  filter: saturate(1.05);
}
/* Generic entity link pill icons retain their small inline size */
.entity-link-pill img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff22;
  object-fit: cover;
  box-shadow: 0 0 3px rgba(0,0,0,0.25);
}

/* Expert pills: vertical layout and larger avatar without affecting generic entity pills */
.expert-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  min-width: 120px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.expert-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  background-color: rgba(255,255,255,0.1);
}
.expert-pill img.expert-avatar {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  background: #ffffff22;
  object-fit: cover;
  box-shadow: 0 0 6px rgba(0,0,0,0.25);
}
.expert-pill .expert-name { font-weight: 800; letter-spacing: .2px; }
.expert-pill .expert-title { font-size: 11px; opacity: .9; }

/* --- Compact header + subtle level badge (override) --- */

/* Parent-Zeile sehr schmal */
.entity-header-wrap {
  max-width: 880px;
  margin: 0 auto 8px auto;
}
.entity-parent-row {
  gap: 6px;
  margin-bottom: 4px;
  padding-bottom: 0;
}

/* Kompakter Header: kleines Avatar, kleine Titel-Zeile, Level rechts */
.entity-modal-header {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: var(--spacing-sm);
  width: 100%;
  margin: 0;
}
.entity-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.7);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

/* Titel kompakt, ohne starken Glow/Flächen */
.entity-title {
  font-size: 1.35em;
  line-height: 1.25;
  margin: 0;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  text-align: left;
  /* Hintergrund in Entitätsfarbe einfärben */
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--headerColor, #6ea8ff) 52%, transparent) 0%,
    color-mix(in srgb, var(--headerColor, #6ea8ff) 32%, transparent) 100%
  );
  border-left: 3px solid color-mix(in srgb, var(--headerColor, #6ea8ff) 75%, transparent);
  box-shadow: none;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}

/* Level als Label/Tag – kein Buttonlook */
.entity-level-badge {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.92em;
  font-weight: 600;
  line-height: 1;
  color: #e8efff;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: none;
  backdrop-filter: blur(var(--glass-blur-md));
}
.entity-level-badge::before {
  content: '★';
  color: currentColor;
  opacity: 0.9;
  font-size: 1em;
  line-height: 1;
}
.entity-level-badge b {
  font-weight: 700;
  color: #ffffff;
}

/* System Entity Badge - shows that entity is part of immutable base graph */
.entity-system-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1;
  color: #ffeaa7;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(121, 211, 255, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.5);
  backdrop-filter: blur(var(--glass-blur-md));
  margin-left: 8px;
}
.system-badge-icon {
  font-size: 1em;
}
.system-badge-text {
  font-size: 0.9em;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Alte Level-Zeile sicher ausblenden (falls noch vorhanden) */
.entity-level { display: none !important; }

/* Mobile weiterhin sehr kompakt */
@media (max-width: 640px) {
  .entity-modal-header { grid-template-columns: 60px 1fr auto; gap: var(--spacing-sm); }
  .entity-avatar { width: 60px; height: 60px; }
  .entity-title { font-size: 1.2em; padding: 5px 8px; }
  .entity-level-badge { font-size: 0.88em; padding: 4px 8px; }
}

/* Slider breiter + kompaktere Beschreibungstexte */
.sliders-row {
  max-width: 760px;   /* vorher 660px */
  gap: 28px;          /* etwas mehr Abstand */
}
.slider-wrapper {
  width: 360px;       /* vorher 320px */
}
.slider-wrapper .muted {
  font-size: 0.90em;  /* kleinerer Text unter den Slidern */
  line-height: 1.35;
  opacity: 0.9;
}

/* Responsiv: bei schmalen Breiten umbrechen */
@media (max-width: 860px) {
  .sliders-row { max-width: 100%; flex-wrap: wrap; }
  .slider-wrapper { width: 100%; }
}

/* ==================== EDIT FORM STYLES ==================== */

#edit-form label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
}

#edit-form input[type="range"],
#edit-form input[type="number"],
#edit-form input[type="text"],
#edit-form textarea,
#edit-form textarea#userdata {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    box-sizing: border-box;
}

#edit-form textarea,
#edit-form textarea#userdata {
    min-width: 400px;
}

#edit-form button {
    padding: 10px 15px;
    margin-top: 15px;
    margin-right: 10px;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 14px;
}

#edit-form button[type="submit"] {
    background-color: #4CAF50;
    color: white;
}

#edit-form button[type="submit"]:hover {
    background-color: #45a049;
}

#edit-form button#cancel-edit {
    background-color: #f44336;
    color: white;
}

#edit-form button#cancel-edit:hover {
    background-color: #da190b;
}
/* ============================================================================
   ENTITY MANAGER CSS
   ============================================================================
   Unified styling for Entity Manager (Table + Matrix views)
   Version: 1.0.0
   ============================================================================ */

/* ============================================================================
   ENTITY MATRIX WINDOW (In-App Panel – replaces popup window)
   ============================================================================ */

.entity-matrix-window {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 92vw;
    max-width: 1700px;
    height: 85vh;
    max-height: 960px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg,
        rgba(14, 18, 35, 0.99) 0%,
        rgba(10, 14, 28, 0.97) 100%);
    border: 1px solid rgba(121, 211, 255, 0.2);
    border-radius: var(--radius-xl);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(121, 211, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(var(--glass-blur-md));
    z-index: var(--z-modal);
    overflow: hidden;
    resize: both;
}

/* Panel-Inhaltsbereich: position:relative für Three.js CSS3DRenderer */
.em-matrix-panel-content {
    flex: 1 1 0;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    background: #141827;
}

/* Fullscreen */
.entity-matrix-window:fullscreen,
#entity-matrix-window:fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.entity-matrix-window:fullscreen .em-matrix-panel-content,
#entity-matrix-window:fullscreen .em-matrix-panel-content {
    flex: 1 1 0 !important;
    height: auto !important;
}

/* ============================================================================
   CONTAINER
   ============================================================================ */

.entity-manager-window {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 90vw;
    max-width: 1600px;
    height: 80vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg,
        rgba(20, 25, 40, 0.98) 0%,
        rgba(15, 20, 35, 0.95) 100%);
    border: 1px solid rgba(121, 211, 255, 0.25);
    border-radius: var(--radius-xl);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(121, 211, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(var(--glass-blur-md));
    z-index: var(--z-modal);
    overflow: hidden;
    resize: both;
}

/* Fullscreen-Modus */
.entity-manager-window:fullscreen,
#entity-manager-window:fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Fullscreen: Content-Bereich muss sich anpassen */
.entity-manager-window:fullscreen .em-content,
#entity-manager-window:fullscreen .em-content {
    flex: 1 1 0 !important;
    height: auto !important;
    min-height: 0 !important;
}

/* Fullscreen: Table-View muss den gesamten Content füllen */
.entity-manager-window:fullscreen .em-table-view,
#entity-manager-window:fullscreen .em-table-view {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
}

/* Fullscreen: Table-Wrapper scrollbar und voll */
.entity-manager-window:fullscreen .table-wrapper,
.entity-manager-window:fullscreen #entity-table-wrapper,
#entity-manager-window:fullscreen .table-wrapper,
#entity-manager-window:fullscreen #entity-table-wrapper {
    flex: 1 1 0 !important;
    height: 100% !important;
    overflow: auto !important;
}

/* Fullscreen: Tabelle volle Breite */
.entity-manager-window:fullscreen .entity-table,
#entity-manager-window:fullscreen .entity-table {
    width: 100% !important;
    table-layout: fixed !important;
}

/* Fullscreen: Modal innerhalb des Fullscreen-Elements */
.entity-manager-window:fullscreen #entity-detail-modal,
#entity-manager-window:fullscreen #entity-detail-modal,
.entity-manager-window:fullscreen .modal,
#entity-manager-window:fullscreen .modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: var(--z-max);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.7) !important;
}

.entity-manager-window:fullscreen #entity-detail-modal:not(.open),
#entity-manager-window:fullscreen #entity-detail-modal:not(.open) {
    display: none !important;
}

/* ============================================================================
   ENTITY MANAGER WINDOW
   ============================================================================ */

.em-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(180deg,
        rgba(30, 40, 60, 0.9) 0%,
        rgba(25, 35, 55, 0.85) 100%);
    border-bottom: 1px solid rgba(121, 211, 255, 0.2);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.em-header .header-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.3px;
}

.em-view-toggle {
    display: flex;
    gap: var(--spacing-xs);
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: var(--radius-md);
    margin: 0 16px;
}

.em-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.em-view-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: var(--glass-bg-light);
}

.em-view-btn.active {
    background: rgba(121, 211, 255, 0.2);
    color: #79d3ff;
}

.em-header .controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================================
   TOOLBAR
   ============================================================================ */

.em-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.em-search {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 13px;
}

.em-search:focus {
    outline: none;
    border-color: rgba(121, 211, 255, 0.5);
    box-shadow: 0 0 10px rgba(121, 211, 255, 0.2);
}

.em-filter-level,
.em-sort-by {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

.em-filter-level:focus,
.em-sort-by:focus {
    outline: none;
    border-color: rgba(121, 211, 255, 0.5);
}

/* ============================================================================
   CONTENT AREA
   ============================================================================ */

.em-content {
    flex: 1 1 0;
    overflow: hidden;
    position: relative;
    min-height: 0; /* wichtig für flex overflow */
    height: 100%; /* Explizite Höhe */
}

.em-table-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Stelle sicher, dass der table-wrapper den gesamten Raum nutzt */
.em-table-view .table-wrapper,
.em-table-view #entity-table-wrapper {
    flex: 1 1 0;
    overflow: auto;
    height: 100%;
    width: 100%;
}

.em-matrix-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    min-height: 0;
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.em-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.em-stats {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================================================
   BULK EDIT BAR
   ============================================================================ */

.em-bulk-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: linear-gradient(90deg,
        rgba(14, 165, 233, 0.15) 0%,
        rgba(14, 165, 233, 0.08) 100%);
    border-top: 1px solid rgba(14, 165, 233, 0.3);
    flex-shrink: 0;
    animation: emBulkSlideIn 0.2s ease;
}

@keyframes emBulkSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.em-bulk-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary-light, #38bdf8);
    white-space: nowrap;
}

.em-bulk-fields {
    display: flex;
    gap: 12px;
    flex: 1;
}

.em-bulk-field {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary, #cbd5e1);
}

.em-bulk-field input[type="number"] {
    width: 64px;
    padding: 4px 8px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm, 6px);
    color: var(--text-primary, #f8fafc);
    outline: none;
    transition: border-color 0.15s;
}

.em-bulk-field input[type="number"]:focus {
    border-color: var(--color-primary, #0ea5e9);
}

.em-bulk-apply {
    background: var(--color-primary, #0ea5e9) !important;
    color: white !important;
    font-weight: 600;
}

.em-bulk-apply:hover {
    background: var(--color-primary-light, #38bdf8) !important;
}

/* Select column checkbox styling */
.select-col {
    text-align: center;
    width: 32px !important;
}

.em-row-select,
#em-select-all {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--color-primary, #0ea5e9);
}

/* Highlight selected rows */
tr:has(.em-row-select:checked) {
    background: rgba(14, 165, 233, 0.08) !important;
}

/* ============================================================================
   VIEW TOGGLE (Legacy support)
   ============================================================================ */

.view-toggle {
    display: flex;
    gap: var(--spacing-xs);
    padding: 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.view-btn:hover {
    background: var(--glass-bg-light);
    color: rgba(255, 255, 255, 0.85);
}

.view-btn.active {
    background: linear-gradient(180deg,
        rgba(121, 211, 255, 0.25) 0%,
        rgba(100, 180, 255, 0.18) 100%);
    color: #a8e4ff;
    box-shadow:
        0 2px 8px rgba(121, 211, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.view-btn.active svg {
    opacity: 1;
}

/* ============================================================================
   TOOLBAR
   ============================================================================ */

.entity-manager-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    gap: var(--spacing-md);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

#entity-manager-search {
    width: 240px;
    padding: 8px 12px;
    padding-right: 80px;
    background: var(--glass-bg-light);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
}

#entity-manager-search:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(121, 211, 255, 0.5);
    box-shadow: 0 0 12px rgba(121, 211, 255, 0.15);
}

#entity-manager-search::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-results {
    position: absolute;
    right: 12px;
    font-size: 11px;
    color: rgba(121, 211, 255, 0.7);
}

.toolbar-select {
    padding: 8px 12px;
    padding-right: 28px;
    background: var(--glass-bg-light);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s ease;
}

.toolbar-select:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.toolbar-select:focus {
    border-color: rgba(121, 211, 255, 0.5);
}

.toolbar-select option {
    background: #1a2035;
    color: #fff;
}

.save-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    min-width: 80px;
}

/* ============================================================================
   CONTENT AREA
   ============================================================================ */

.entity-manager-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.view-container {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.view-container.active {
    display: flex;
}

/* ============================================================================
   TABLE VIEW
   ============================================================================ */

.table-view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-wrapper,
#entity-table-wrapper {
    flex: 1 1 auto;
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    padding: 0;
    min-height: 0;
    /* Don't use flex for the wrapper - let the table flow naturally */
}

.entity-manager-window .entity-table,
#entity-manager-window .entity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed; /* Feste Spaltenbreiten, Tabelle füllt Container */
}

#entity-manager-window .entity-table th,
.entity-manager-window .entity-table th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg,
        rgba(30, 40, 60, 0.98) 0%,
        rgba(25, 35, 55, 0.95) 100%);
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(121, 211, 255, 0.2);
    z-index: 10;
    white-space: nowrap;
}

#entity-manager-window .entity-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

#entity-manager-window .entity-table th.sortable:hover {
    background: rgba(121, 211, 255, 0.1);
}

#entity-manager-window .entity-table th.sort-asc::after {
    content: ' ▲';
    font-size: 9px;
    opacity: 0.7;
}

#entity-manager-window .entity-table th.sort-desc::after {
    content: ' ▼';
    font-size: 9px;
    opacity: 0.7;
}

#entity-manager-window .entity-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
    vertical-align: middle;
}

#entity-manager-window .entity-table tr:hover {
    background: rgba(121, 211, 255, 0.05);
}

#entity-manager-window .entity-table tr.entity-row-base {
    background: rgba(255, 255, 255, 0.02);
}

#entity-manager-window .entity-table tr.entity-row-base:hover {
    background: var(--glass-bg-light);
}

/* Column widths - prozentual für volle Breite */
#entity-manager-window .level-col { width: 3%; min-width: 35px; text-align: center; }
#entity-manager-window .name-col { width: auto; } /* nimmt restlichen Platz */
#entity-manager-window .value-col { width: 5%; min-width: 50px; text-align: center; }
#entity-manager-window .need-attention-col { width: 4%; min-width: 40px; text-align: center; }
#entity-manager-window .last-change-col { width: 12%; min-width: 130px; }
#entity-manager-window .user-entity-col { width: 4%; min-width: 45px; text-align: center; }
#entity-manager-window .edit-col { width: 5%; min-width: 55px; text-align: center; }
#entity-manager-window .delete-col { width: 4%; min-width: 45px; text-align: center; }

/* Toggle & Name styling */
#entity-manager-window .toggle {
    cursor: pointer;
    user-select: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#entity-manager-window .toggle:hover {
    opacity: 1;
}

#entity-manager-window .name-col {
    cursor: pointer;
}

/* Number inputs */
#entity-manager-window .imp-input,
#entity-manager-window .conf-input {
    width: 50px;
    padding: 4px;
    background: transparent;
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-xs);
    color: #fff;
    font-size: 12px;
    text-align: center;
    outline: none;
}

#entity-manager-window .imp-input:focus,
#entity-manager-window .conf-input:focus {
    border-color: rgba(121, 211, 255, 0.5);
    background: rgba(0, 0, 0, 0.2);
}

/* Attention indicators */
#entity-manager-window .conf-rec-exceeds {
    background: rgba(255, 100, 100, 0.15) !important;
    color: #ff8080;
}

#entity-manager-window td.changed {
    position: relative;
}

#entity-manager-window td.changed::after {
    content: '•';
    position: absolute;
    top: 2px;
    right: 2px;
    color: #50c878;
    font-size: 14px;
}

/* ============================================================================
   MATRIX VIEW
   ============================================================================ */

.matrix-view {
    padding: 16px;
    overflow: hidden;
}

.matrix-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 16px;
}

.matrix-control {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.matrix-control input[type="range"] {
    width: 80px;
}

.matrix-control input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #50c878;
}

#matrix-opacity-value {
    min-width: 35px;
    text-align: right;
    color: rgba(121, 211, 255, 0.9);
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
    overflow-y: auto;
    max-height: calc(100% - 60px);
    padding: 4px;
}

/* Matrix Tiles */
.matrix-tile {
    display: flex;
    flex-direction: column;
    background: rgba(30, 40, 60, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.matrix-tile:hover,
.matrix-tile.matrix-tile-glow {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(121, 211, 255, 0.15);
}

.tile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tile-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
}

.tile-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-body {
    padding: 12px;
    flex: 1;
}

.tile-stats {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: 10px;
}

.tile-stats .stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.stat-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
}

.tile-children {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

.tile-userdata {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile-footer {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tile-footer .btn {
    flex: 1;
    font-size: 10px;
    padding: 5px 8px;
}

/* Matrix Sub-grid (expanded children) */
.matrix-subgrid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    border: 1px dashed rgba(121, 211, 255, 0.25);
}

.matrix-tile-child {
    transform: scale(0.95);
}

.matrix-tile-child .tile-header {
    padding: 8px;
}

.matrix-tile-child .tile-icon {
    width: 28px;
    height: 28px;
}

.matrix-tile-child .tile-name {
    font-size: 12px;
}

.matrix-tile-child .tile-body {
    padding: 8px;
}

.matrix-tile-child .stat-value {
    font-size: 14px;
}

/* ============================================================================
   SCROLLBARS
   ============================================================================ */

.entity-manager

.entity-manager ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-xs);
}

.entity-manager ::-webkit-scrollbar-thumb {
    background: rgba(121, 211, 255, 0.3);
    border-radius: var(--radius-xs);
}

.entity-manager ::-webkit-scrollbar-thumb:hover {
    background: rgba(121, 211, 255, 0.5);
}

/* ============================================================================
   FULLSCREEN MODE
   ============================================================================ */

.entity-manager:fullscreen {
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1200px) {
    .entity-manager {
        width: 95vw;
    }

    .matrix-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 900px) {
    .entity-manager-toolbar {
        flex-wrap: wrap;
    }

    .toolbar-left,
    .toolbar-right {
        flex: 1 1 100%;
        justify-content: center;
    }

    #entity-manager-search {
        width: 100%;
    }

    .matrix-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: var(--space-3);
    }
}

@media (max-width: 600px) {
    .view-btn span:not(:empty) {
        display: none;
    }

    .header-title {
        font-size: 13px;
    }

    .matrix-tile {
        min-width: 140px;
    }
}
/**
 * Entity Operations Modal Styles
 * For: Delete confirmation, Link suggestions, Duplicates finder
 */

/* Modal container */
.entity-operation-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-dropdown);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.2s ease-out;
}

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

/* Backdrop */
.entity-operation-modal .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(var(--glass-blur-md));
}

/* Modal content box */
.entity-operation-modal .modal-content {
    position: relative;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    background: linear-gradient(145deg, rgba(30, 40, 60, 0.95), rgba(20, 28, 45, 0.98));
    border: 1px solid rgba(100, 150, 255, 0.2);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

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

/* Danger variant (delete modal) */
.entity-operation-modal .modal-content.modal-danger {
    border-color: rgba(255, 100, 100, 0.3);
}

.entity-operation-modal .modal-content.modal-danger .modal-header {
    background: linear-gradient(90deg, rgba(255, 80, 80, 0.15), transparent);
}

/* Modal header */
.entity-operation-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(90deg, rgba(100, 150, 255, 0.1), transparent);
}

.entity-operation-modal .modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.entity-operation-modal .modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.entity-operation-modal .modal-close:hover {
    background: rgba(255, 100, 100, 0.3);
}

/* Modal body */
.entity-operation-modal .modal-body {
    padding: 20px;
    overflow-y: auto;
    color: rgba(255, 255, 255, 0.9);
}

.entity-operation-modal .modal-description {
    margin: 0 0 16px 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.entity-operation-modal .modal-hint {
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-style: italic;
}

.entity-operation-modal .warning {
    color: #ff9966;
    background: rgba(255, 150, 100, 0.1);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border-left: 3px solid #ff9966;
    margin: 12px 0;
}

/* Modal footer */
.entity-operation-modal .modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

/* Buttons */
.entity-operation-modal .btn-primary,
.entity-operation-modal .btn-secondary,
.entity-operation-modal .btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.entity-operation-modal .btn-primary {
    background: linear-gradient(135deg, #00b4ff, #0088cc);
    color: #fff;
}

.entity-operation-modal .btn-primary:hover {
    background: linear-gradient(135deg, #00c8ff, #009ae6);
    transform: translateY(-1px);
}

.entity-operation-modal .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--glass-border-light);
}

.entity-operation-modal .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.entity-operation-modal .btn-danger {
    background: linear-gradient(135deg, #ff5555, #cc3333);
    color: #fff;
}

.entity-operation-modal .btn-danger:hover {
    background: linear-gradient(135deg, #ff6666, #dd4444);
    transform: translateY(-1px);
}

/* Placement check modal */
.entity-operation-modal .placement-ok {
    color: #4caf50;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
}

.entity-operation-modal .placement-current {
    background: rgba(255, 255, 255, 0.08);
    border-left: 3px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    margin: 4px 0;
}

.entity-operation-modal .placement-arrow {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin: 4px 0;
    text-align: center;
}

.entity-operation-modal .placement-suggested {
    background: rgba(100, 180, 255, 0.12);
    border-left: 3px solid #64b4ff;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 4px 0;
    color: #90caf9;
    font-weight: 500;
}

/* KG Health Check modal */
.kg-health-row {
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    margin-bottom: 8px;
    border-left: 3px solid rgba(255, 180, 50, 0.5);
}

.kg-health-entity {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.kg-health-path {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.kg-health-from {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: line-through;
}

.kg-health-arrow {
    color: #64b4ff;
    font-weight: 700;
}

.kg-health-to {
    color: #90caf9;
    font-weight: 500;
}

.kg-health-reason {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 5px;
    font-style: italic;
}

/* Link suggestions list */
.link-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-height: 300px;
    overflow-y: auto;
}

.link-suggestion {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 12px;
    background: var(--glass-bg-light);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s;
}

.link-suggestion:hover {
    background: var(--glass-bg-light);
    border-color: rgba(100, 150, 255, 0.3);
}

.link-suggestion input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.link-suggestion label {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    cursor: pointer;
    flex: 1;
}

.link-suggestion .link-target {
    font-weight: 600;
    color: #fff;
}

.link-suggestion .link-type {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(100, 150, 255, 0.2);
    color: #8bb8ff;
    border-radius: var(--radius-xs);
    font-size: 11px;
    text-transform: uppercase;
}

.link-suggestion .link-reason {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.link-suggestion .link-confidence {
    color: #88ff88;
    font-size: 12px;
    font-weight: 600;
}

/* Duplicates list */
.duplicates-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 350px;
    overflow-y: auto;
}

.duplicate-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--glass-bg-light);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.duplicate-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.duplicate-name {
    font-weight: 600;
    color: #fff;
}

.duplicate-path {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.duplicate-similarity {
    color: #ffcc66;
    font-size: 13px;
    font-weight: 600;
}

.duplicate-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small.btn-merge {
    background: rgba(100, 200, 100, 0.2);
    color: #88ff88;
    border: 1px solid rgba(100, 200, 100, 0.3);
}

.btn-small.btn-merge:hover {
    background: rgba(100, 200, 100, 0.3);
}

.btn-small.btn-goto {
    background: rgba(100, 150, 255, 0.2);
    color: #88bbff;
    border: 1px solid rgba(100, 150, 255, 0.3);
}

.btn-small.btn-goto:hover {
    background: rgba(100, 150, 255, 0.3);
}
/* Expertaizer Window Styles (ähnlich wie DNA) */
#expertaizer-window {
    cursor: default;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5); /* Hinzugefügter Glow für Fenster */
}

#expertaizer-content {
    flex-grow: 1;
    overflow: hidden;
    position: relative; /* For absolute positioning of logo */
}

/* Centered Logo Overlay - ONLY for Expertaizer Window */
#expertaizer-window #expertaizer-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px; /* Larger size */
    height: 320px;
    background-image: url('../images/All-Expertaizer.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center; /* Explicitly center both axes */
    opacity: 0.75;
    pointer-events: none; /* Allow clicks to pass through */
    z-index: var(--z-dropdown); /* Very high z-index to ensure it's above everything */
    filter: drop-shadow(0 0 25px rgba(0, 255, 255, 0.7)) brightness(1.1);
    transition: opacity 0.3s ease;
}

/* Explicitly prevent logo on other windows */
#brain-window .brain-content::before,
#dna-window .brain-content::before,
#digital-twin-window .brain-content::before,
#intelligainzer-window .brain-content::before {
    content: none !important;
    display: none !important;
}

/* Fade out logo when window is smaller */
@media (max-width: 600px), (max-height: 600px) {
    #expertaizer-window #expertaizer-content::before {
        opacity: 0.4;
        width: 180px;
        height: 180px;
    }
}

#expertaizer-canvas {
    background: transparent;
    filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.8)); /* Glow auf Canvas für 3D-Effekt */
}

/* Holografische Karten-Styles (für Text-Overlays, falls nötig – hauptsächlich für Three.js) */
.card-holo {
    opacity: 1.0;
    border: 1px solid #00bfff;
    border-radius: var(--radius-md);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.8);
    transition: transform 0.3s ease;
}

.card-holo:hover {
    opacity: 1;
    transform: scale(1.05) rotateY(10deg);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

/* Shimmer für Karten (wie in .holo-button) */
.card-holo::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(45deg);
    animation: shimmer 15s infinite linear;
}

/* Hinzugefügter Keyframe für Shimmer (für HTML-Fallback, falls nötig) */

/* Filter-Leiste oben */
#cards-filter {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: rgba(12,14,18,0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  backdrop-filter: blur(var(--glass-blur-md));
}

/* Stylische Checkbox-Chips */
#cards-filter .chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 6px 12px;
  border-radius: 999px;
  background: #171b22;
  color: #cfd6de;
  cursor: pointer;
  user-select: none;
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
#cards-filter .chip:hover { transform: translateY(-1px); }
#cards-filter .chip input { display: none; }
#cards-filter .chip input:checked + span {
  color: #0b0e12;
}
#cards-filter .chip:has(input[value="gold"]:checked)    { background: linear-gradient(135deg,#f7d57a,#b38a32); color:#0b0e12; }
#cards-filter .chip:has(input[value="bronze"]:checked)  { background: linear-gradient(135deg,#d79a6b,#8c532a); color:#0b0e12; }
#cards-filter .chip:has(input[value="silver"]:checked)  { background: linear-gradient(135deg,#dfe6ee,#7c8a98); color:#101418; }
#cards-filter .chip:has(input[value="free"]:checked)    { background: linear-gradient(135deg,#b8c4d0,#657383); color:#0b0e12; }











