/* Originale Layoutregeln der iMac-Referenz. */
* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

:root {
  /* Leicht anpassbare Standardwerte für das Eingabefeld */
  --chat-input-min-width: 300px;
  --chat-input-max-width: calc(100% - 130px); /* lässt Platz für die beiden Buttons */
  --chat-input-min-height: 50px;
  --chat-input-max-height: 60vh; /* bis zu 60% der sichtbaren Höhe */
    /* Multi-KI Layout */
  --multi-ki-row-min-height: 560px;   /* Mindesthöhe je KI-Fenster */
  --multi-ki-scroll-padding: 140px;   /* Puffer, damit die Eingabe nicht überlappt */
  --role-list-row-height: 40px;      /* Höhe einer Zeile in der Rollenvorschlagsliste */
  --role-list-visible-rows: 10;      /* Anzahl sichtbar gewünschter Zeilen */

  --fs-width: 94vw; /* Breite im Vollbild – hier einfach anpassbar */
  --fs-height: 88vh; /* Höhe im Vollbild – hier einfach anpassbar */

}

        .settings-dropdown-menu.show {
            display: flex;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
            min-height: 100vh;
            padding: 20px;
            overflow: hidden;
            margin: 0;
        }

        /* NEU: Mobile-responsive Body */
        @media (max-width: 768px) {
            body {
                padding: 10px;
                overflow-x: hidden;
            }
        }

        .main-container {
            width: 100%;
            height: calc(100vh - 40px);
            display: flex;
            gap: 10px;
            position: relative;
            flex-wrap: wrap;
        }

        /* NEU: Mobile-responsive Main-Container */
        @media (max-width: 768px) {
            .main-container {
                height: calc(100vh - 20px);
                gap: 0;
                flex-wrap: nowrap;
                overflow-x: hidden;
            }
        }
        
        /* KORRIGIERT: Container für Single-Mode nimmt vollen Platz */
        .main-container.single-mode {
            justify-content: center;
            align-items: center;
        }
        
        /* NEU: Multi-KI Container mit Grid-Layout */
        .multi-ki-container {
        display: none;
        width: 100%;
        height: calc(100vh - 140px);
        gap: 10px;

        /* Zwei Spalten bleiben, Zeilen entstehen dynamisch */
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto; /* statt repeat(2, 1fr) */
        grid-auto-rows: minmax(var(--multi-ki-row-min-height), auto);

        /* Vertikal scrollen statt abschneiden */
        overflow-y: auto;
        overflow-x: hidden;

        /* Start oben ausrichten, nichts wird gequetscht */
        align-content: start;

        /* Genug Abstand, damit das Eingabemodal nichts überdeckt */
        padding-bottom: var(--multi-ki-scroll-padding);
        scroll-padding-bottom: var(--multi-ki-scroll-padding);
        }

        /* Desktop-Layout: Immer 2 Spalten nebeneinander */
        @media (min-width: 768px) {
        .multi-ki-container {
            grid-template-columns: repeat(2, 1fr) !important;
            grid-template-rows: auto !important;
            grid-auto-rows: minmax(var(--multi-ki-row-min-height), auto) !important;
        }
        
        .multi-ki-container.dual,
        .multi-ki-container.triple,
        .multi-ki-container.quad {
            grid-template-columns: repeat(2, 1fr) !important;
            grid-template-rows: auto !important;
        }
        }

        /* NEU: Mobile-responsive Multi-KI Layout */
        @media (max-width: 768px) {
            .multi-ki-container {
                display: flex;
                flex-direction: row;
                overflow-x: auto;
                overflow-y: hidden;
                height: calc(100vh - 120px);
                gap: 15px;
                padding: 10px;
                scroll-snap-type: x mandatory;
                -webkit-overflow-scrolling: touch;
            }
            
            .chat-container.multi-mode {
                flex: 0 0 90vw;
                max-width: 90vw;
                min-width: 90vw;
                height: calc(100vh - 140px);
                scroll-snap-align: start;
                scroll-snap-stop: always;
            }
        }

        /* NEU: Tablet-responsive Multi-KI Layout */
        @media (min-width: 769px) and (max-width: 1024px) {
            .multi-ki-container {
                grid-template-columns: 1fr;
                gap: 15px;
            }
            
            .chat-container.multi-mode {
                width: 100%;
                max-width: none;
            }
        }

        
        .multi-ki-container.active {
            display: grid;
        }
        
        /* KORRIGIERT: Single-KI nimmt vollen Platz ein */
        .multi-ki-container.single {
        grid-template-columns: 1fr;
        grid-template-rows: auto; /* keine fixe Zeilenhöhe */
        display: grid;
        }

        
        .multi-ki-container.dual {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto; /* keine fixe Zeilenhöhe */
        }

        
        .multi-ki-container.triple,
        .multi-ki-container.quad {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto; /* keine fixe Zeilenhöhe */
        }

        /* KORRIGIERT: Chat-Container für Single-Mode vergrößert */
        .chat-container {
            width: 900px;
            height: calc(100vh - 40px);
            min-width: 600px;
            min-height: 500px;
            max-width: calc(100vw - 40px);
            max-height: calc(100vh - 40px);
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            border-radius: 20px;
            border: 1px solid rgba(0, 0, 0, 0.1);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: relative;
            resize: both;
        }
        
        /* KORRIGIERT: Single-Mode Container nimmt Platz von 2 Fenstern */
        .chat-container.single-ki-mode {
            width: calc(100vw - 60px);
            max-width: 1400px;
            height: calc(100vh - 180px);
        }
        
        .chat-container.multi-mode {
            width: 100%;
            height: var(--multi-ki-row-min-height);
            min-width: 400px;
            min-height: 400px;
            max-height: none;
            resize: both;
            justify-self: start;
            align-self: start;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        /* NEU: Mobile-responsive Chat-Container */
        @media (max-width: 768px) {
            .chat-container.multi-mode {
                min-width: 90vw;
                max-width: 90vw;
                width: 90vw;
                height: calc(100vh - 140px);
                max-height: none;
                border-radius: 15px;
                box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
                resize: both;
            }
            
            .chat-messages {
                height: calc(100% - 120px);
                max-height: none;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }
            
            .chat-header {
                padding: 10px 15px;
                font-size: 14px;
            }
            
            .chat-title {
                font-size: 16px;
            }
            
            .chat-subtitle {
                font-size: 12px;
            }
            
            /* Mobile-responsive Chat-Input */
            .chat-input-container {
                padding: 10px;
                gap: 8px;
            }
            
            .chat-input {
                min-width: 200px;
                max-width: calc(100% - 80px);
                font-size: 14px;
                padding: 12px 15px;
            }
            
            .send-button, .reset-button {
                width: 40px;
                height: 40px;
                font-size: 16px;
            }
            
            /* NEU: Mobile-responsive Input-Row - vertikale Anordnung */
            .input-row {
                flex-direction: column;
                gap: 8px;
                align-items: stretch;
            }
            
            .chat-input {
                flex: 1 1 auto;
                width: 100%;
                max-width: 100%;
                min-width: 200px;
                margin-bottom: 0;
                resize: vertical;
            }
            
            .send-button, .reset-button {
                width: 45px;
                height: 45px;
                border-radius: 8px;
                margin-bottom: 0;
                flex-shrink: 0;
            }
        }

        /* Vollbild-Zustand für ein einzelnes Chatfenster */
        .chat-container.fullscreen {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: var(--fs-width);
            height: var(--fs-height);
            max-width: calc(100vw - 20px);
            max-height: calc(100vh - 20px);
            z-index: 2001;              /* über dem Backdrop/anderen Fenstern */
            border-radius: 16px;
            overflow: hidden;
        }


        /* Vollbild-Zustand für ein einzelnes Chatfenster */
        .chat-container.fullscreen {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: var(--fs-width);
            height: var(--fs-height);
            max-width: calc(100vw - 20px);
            max-height: calc(100vh - 20px);
            z-index: 2001;              /* über Modals/Backdrops */
            border-radius: 16px;        /* optisch sauber */
            /* resize bleibt erlaubt – Griffe funktionieren weiter */
        }


        .chat-header {
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
            backdrop-filter: blur(10px);
            padding: 20px;
            text-align: center;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            position: relative;
            height: 100px;
            resize: none !important;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            justify-content: center;
            width: 100%;
            flex-shrink: 0;
        }

        .chat-title {
            color: white;
            font-size: clamp(18px, 3vw, 24px);
            font-weight: 600;
            margin-bottom: 5px;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .chat-subtitle {
            color: rgba(255, 255, 255, 0.9);
            font-size: clamp(12px, 2vw, 14px);
        }

        .status-indicator {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 12px;
            height: 12px;
            background: #4ade80;
            border-radius: 50%;
            box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
            animation: pulse 2s infinite;
        }
        
        /* Anmeldestatus: jetzt in der Fußzeile, siehe responsive.css */

        /* NEU: Schließ-Button für Chat-Fenster */
        .window-close-btn {
            position: absolute;
            top: 15px;
            right: 50px;
            background: rgba(255, 255, 255, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            font-size: 20px;
            font-weight: bold;
            line-height: 1;
            cursor: pointer;
            transition: all 0.2s;
            padding: 5px 10px;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .window-close-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }


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

        .chat-messages {
            flex: 1 1 auto;
            padding: 20px;
            overflow-y: auto;
            overflow-x: hidden;
            display: flex;
            flex-direction: column;
            gap: 20px;
            scroll-behavior: smooth;
            min-height: 200px;
            max-height: none;
            height: auto;
            position: relative;
            background: #fafbfc;
            resize: none;
        }

        .chat-messages.show-line-numbers { padding-left: 60px; }
        .chat-messages::-webkit-scrollbar { 
            width: 12px; 
        }
        .chat-messages::-webkit-scrollbar-track { 
            background: rgba(0, 0, 0, 0.1); 
            border-radius: 6px; 
            margin: 4px;
        }
        .chat-messages::-webkit-scrollbar-thumb { 
            background: rgba(0, 0, 0, 0.3); 
            border-radius: 6px; 
            border: 2px solid transparent;
            background-clip: content-box;
        }
        .chat-messages::-webkit-scrollbar-thumb:hover { 
            background: rgba(0, 0, 0, 0.5); 
            background-clip: content-box;
        }

        .line-numbers-chat {
            position: absolute;
            left: 0; top: 20px; bottom: 20px;
            width: 40px;
            background: rgba(0, 0, 0, 0.05);
            border-right: 1px solid rgba(0, 0, 0, 0.1);
            font-family: 'Courier New', monospace;
            font-size: 12px;
            color: rgba(0, 0, 0, 0.5);
            padding: 10px 5px;
            display: none;
            overflow: hidden;
        }
        .line-numbers-chat.active { display: block; }

        .message-wrapper {
            display: flex;
            margin-bottom: 15px;
            animation: slideIn 0.3s ease-out;
            position: relative;
        }
        @keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
        .message-wrapper.user { justify-content: flex-end; }
        .message-wrapper.assistant { justify-content: flex-start; }

        .message-bubble {
            max-width: 70%;
            min-width: 200px;
            position: relative;
            border-radius: 20px;
            padding: 15px 20px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            resize: horizontal;
            overflow: hidden;
            word-wrap: break-word;
            line-height: 1.6;
        }

        .message-wrapper.user .message-bubble { 
            background: linear-gradient(135deg, var(--user-bubble-start, #6366f1) 0%, var(--user-bubble-end, #8b5cf6) 100%); 
            color: white; 
            border-bottom-right-radius: 5px; 
        }
        .message-wrapper.user .message-bubble::after { 
            content: ''; 
            position: absolute; 
            bottom: 0; 
            right: -10px; 
            width: 0; 
            height: 0; 
            border: 10px solid transparent; 
            border-left-color: var(--user-bubble-end, #8b5cf6); 
            border-bottom: 0; 
            border-right: 0; 
        }

        .message-wrapper.assistant .message-bubble { 
            background: white; 
            color: #1f2937; 
            border: 1px solid rgba(0, 0, 0, 0.1);
            border-bottom-left-radius: 5px; 
        }
        .message-wrapper.assistant .message-bubble::after { 
            content: ''; 
            position: absolute; 
            bottom: 0; 
            left: -10px; 
            width: 0; 
            height: 0; 
            border: 10px solid transparent; 
            border-right-color: white; 
            border-bottom: 0; 
            border-left: 0; 
        }
        
        .message-header { 
            display: flex; 
            justify-content: space-between; 
            align-items: center; 
            margin-bottom: 10px; 
            font-size: 11px; 
            opacity: 0.8; 
            border-bottom: 1px solid rgba(0, 0, 0, 0.1); 
            padding-bottom: 5px;
            flex-wrap: wrap;
        }
        .message-wrapper.user .message-header {
            border-bottom-color: rgba(255, 255, 255, 0.2);
        }
        .message-sender { font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
        .message-timestamp { 
            font-family: 'Courier New', monospace; 
            background: rgba(0, 0, 0, 0.05); 
            padding: 2px 6px; 
            border-radius: 8px; 
            font-size: 10px;
            white-space: pre;
        }
        .message-wrapper.user .message-timestamp {
            background: rgba(255, 255, 255, 0.2);
        }
        .message-content { font-size: 14px; line-height: 1.6; }
        .message-content p:first-child { margin-top: 0; }
        .message-content p:last-child { margin-bottom: 0; }
        
        /* ERWEITERT: Token-Anzeige in Message-Header */
        .token-info {
            font-size: 10px;
            margin-top: 5px;
            display: flex;
            gap: 15px;
            opacity: 0.7;
            flex-wrap: wrap;
            width: 100%;
        }
        
        .token-estimated {
            color: #6b7280;
            background: rgba(107, 114, 128, 0.1);
            padding: 2px 6px;
            border-radius: 4px;
        }
        
        .token-actual {
            color: #10b981;
            font-weight: 600;
            background: rgba(16, 185, 129, 0.1);
            padding: 2px 6px;
            border-radius: 4px;
        }

        .token-prompt {
            color: #3b82f6;
            background: rgba(59, 130, 246, 0.1);
            padding: 2px 6px;
            border-radius: 4px;
        }

        .token-completion {
            color: #8b5cf6;
            background: rgba(139, 92, 246, 0.1);
            padding: 2px 6px;
            border-radius: 4px;
        }

        /* NEU: KI-spezifische Rollenauswahl */
        .ki-role-selector {
            padding: 10px;
            background: rgba(255, 255, 255, 0.1);
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            position: relative;
        }
        
        /* Rollen-Suchfeld ausblenden wenn Login-Modal geöffnet ist */
        .auth-modal.show ~ .main-container .ki-role-selector {
            display: none;
        }
        
        /* Alternative: Direkte Klasse für verstecktes Rollen-Suchfeld */
        .ki-role-selector.hidden {
            display: none !important;
        }
        
        .ki-role-search-input {
            width: 100%;
            background: rgba(255, 255, 255, 0.9);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 8px;
            padding: 8px 35px 8px 12px;
            color: #1f2937;
            font-size: 13px;
            outline: none;
        }
        
        .ki-role-search-input.selected {
            background: #007AFF;
            color: white;
        }
        
        .ki-role-clear {
            position: absolute;
            top: 18px;
            right: 15px;
            cursor: pointer;
            font-weight: bold;
            color: rgba(255, 255, 255, 0.6);
            display: none;
            font-size: 12px;
        }
        
        .ki-role-suggestions {
            position: absolute;
            top: 100%;
            left: 10px;
            right: 10px;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            z-index: 1000;
            max-height: calc(var(--role-list-row-height) * var(--role-list-visible-rows));
            overflow-y: auto;
            list-style: none;
            padding: 0;
            margin: 4px 0 0 0;
            display: none;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }
        
        .ki-role-suggestions li {
            padding: 10px 12px;
            cursor: pointer;
            color: #1f2937;
            font-size: 13px;
            transition: background 0.2s;
        }
        
        .ki-role-suggestions li:hover,
        .ki-role-suggestions li.selected {
            background: #7d7d7d;
        }

        .ki-role-suggestions-item {
            padding: 10px 12px;
            cursor: pointer;
            color: #1f2937;
            font-size: 13px;
            transition: background 0.2s;
            border-bottom: 1px solid #f3f4f6;
        }

        .ki-role-suggestions-item:hover,
        .ki-role-suggestions-item.selected {
            background: #007AFF;
            color: white;
        }

        .role-suggestion-title {
            font-weight: 600;
            margin-bottom: 2px;
        }

        .role-suggestion-categories {
            font-size: 11px;
            opacity: 0.7;
        }

        .code-block { 
            background: #1e1e1e; 
            border-radius: 8px; 
            margin: 10px 0; 
            overflow: hidden; 
            border: 1px solid rgba(0, 0, 0, 0.2); 
            position: relative; 
            resize: both; 
            min-width: 300px; 
            min-height: 100px; 
        }
        .code-header { 
            background: #2d2d2d; 
            padding: 8px 15px; 
            display: flex; 
            justify-content: space-between; 
            align-items: center; 
            border-bottom: 1px solid #444; 
        }
        .code-language { color: #fbbf24; font-size: 12px; font-weight: 600; text-transform: uppercase; }
        .code-actions { display: flex; gap: 8px; }
        .code-action-btn { 
            background: rgba(255, 255, 255, 0.1); 
            border: 1px solid rgba(255, 255, 255, 0.2); 
            border-radius: 4px; 
            color: white; 
            padding: 4px 8px; 
            font-size: 11px; 
            cursor: pointer; 
            transition: all 0.2s ease; 
        }
        .code-action-btn:hover { background: rgba(255, 255, 255, 0.2); }
        .code-content { position: relative; overflow: auto; max-height: 400px; }
        .code-content pre { 
            margin: 0; 
            padding: 15px; 
            background: transparent; 
            color: #e5e7eb; 
            font-family: 'Courier New', Monaco, monospace; 
            font-size: 13px; 
            line-height: 1.5; 
            overflow-x: auto; 
        }
        .code-content.show-line-numbers pre { padding-left: 60px; }
        .code-line-numbers { 
            position: absolute; 
            left: 0; 
            top: 0; 
            bottom: 0; 
            width: 45px; 
            background: #2d2d2d; 
            border-right: 1px solid #444; 
            font-family: 'Courier New', Monaco, monospace; 
            font-size: 12px; 
            color: #6b7280; 
            padding: 15px 8px; 
            user-select: none; 
            display: none; 
        }
        .code-content.show-line-numbers .code-line-numbers { display: block; }
        
        /* NEU: Chat-Eingabe als eigenständiges Modal */
        .chat-input-modal {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            width: auto;
            min-width: 600px;
            max-width: calc(100vw - 40px);
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(20px);
            border-radius: 20px;
            border: 1px solid rgba(0, 0, 0, 0.1);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
            padding: 15px 20px 20px 20px;
            z-index: 5000;
            resize: both;
            overflow: visible;
            transition: width 0.3s ease;
        }
        
        .chat-input-modal.expanded {
            width: calc(100vw - 40px);
        }
        
        #token-counter { 
            font-size: 12px; 
            color: #6b7280; 
            text-align: right; 
            height: 20px; 
            transition: color 0.3s; 
            margin-bottom: 5px;
        }
        
        .input-row { 
            display: flex; 
            flex-direction: column;
            gap: 10px; 
            align-items: stretch; 
            width: 100%;
            position: relative;
            overflow: visible;
            flex-wrap: nowrap;
        }
        
        .button-row {
            display: flex;
            gap: 10px;
            justify-content: center;
            align-items: center;
            width: 100%;
        }
        .chat-input {
        /* WICHTIG: Flex so setzen, dass man die Breite manuell anpacken darf */
        flex: 1 1 auto;

        background: #f3f4f6;
        border: 1px solid #e5e7eb;
        border-radius: 25px;
        padding: 15px 20px;
        color: #1f2937;
        font-size: 16px;
        outline: none;
        transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;

        /* Größen jetzt zentral über Variablen (vorher in Schritt 1.1 angelegt) */
        min-height: var(--chat-input-min-height);
        height: auto;                       /* Grundhöhe dynamisch; Auto-Grow kommt in Schritt 1.3 */
        max-height: var(--chat-input-max-height);

        min-width: var(--chat-input-min-width);
        width: var(--chat-input-max-width);
        max-width: var(--chat-input-max-width);

        font-family: inherit;

        /* Jetzt in beide Richtungen vergrößerbar */
        resize: both;
        overflow: auto;

        box-sizing: border-box;
        position: relative;
        }
        .chat-input::placeholder { color: #9ca3af; }
        .chat-input:focus { 
            border-color: #6366f1; 
            background: white; 
            box-shadow: 0 0 20px rgba(99, 102, 241, 0.1); 
        }
        .send-button, .reset-button { 
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); 
            border: none; 
            border-radius: 50%; 
            width: 50px; 
            height: 50px; 
            min-width: 50px; 
            min-height: 50px; 
            max-width: 50px;
            max-height: 50px;
            color: white; 
            cursor: pointer; 
            transition: all 0.3s ease; 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3); 
            flex-shrink: 0;
            overflow: hidden; 
            align-self: flex-start;
            margin-top: 0;
        }
        .send-button:hover, .reset-button:hover { 
            transform: scale(1.1); 
            box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5); 
        }
        .send-button:active, .reset-button:active { transform: scale(0.95); }
        
        .reset-button { 
            background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); 
            box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3); 
        }
        .reset-button:hover { box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5); }
        
        /* NEU: KI-Auswahl-Button (unter Settings) */
        .ki-selection-button {
            position: fixed;
            top: 210px;
            right: 30px;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 50%;
            color: #6b7280;
            width: 50px;
            height: 50px;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            z-index: 999;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }
        
        .ki-selection-button:hover {
            background: #f3f4f6;
            transform: scale(1.1);
        }


        /* NEU: Icon-Auswahl-Styling */
        .icon-selection-container {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin: 10px 0;
        }

        .icon-preview {
            font-size: 32px;
            text-align: center;
            padding: 10px;
            background: #f8f9fa;
            border: 2px solid #e9ecef;
            border-radius: 8px;
            width: 60px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto;
        }

        .icon-suggestions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: center;
            margin-top: 10px;
        }

        .icon-suggestion {
            font-size: 24px;
            padding: 8px;
            background: #f8f9fa;
            border: 2px solid #e9ecef;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
        }

        .icon-suggestion:hover {
            background: #e9ecef;
            border-color: #6c757d;
            transform: scale(1.1);
        }

        /* NEU: Icon-Anzeige in Rollen-Suchfeld */
        .role-suggestion-title {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .role-icon {
            font-size: 18px;
            min-width: 20px;
            text-align: center;
        }

        .role-name {
            flex: 1;
        }
        
        
        .ki-selection-dropdown {
            position: fixed;
            top: 150px;
            right: 30px;
            background: white;
            border-radius: 12px;
            border: 1px solid #e5e7eb;
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
            padding: 10px;
            min-width: 250px;
            max-height: 400px;
            overflow-y: auto;
            display: none;
            z-index: 9998;
        }
        
        .ki-selection-dropdown.show {
            display: block;
        }
        
        .ki-selection-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px;
            border-radius: 6px;
            transition: background 0.2s;
        }
        
        .ki-selection-item:hover {
            background: #f3f4f6;
        }
        
        .ki-selection-item input[type="checkbox"] {
            cursor: pointer;
        }
        
        .ki-selection-item label {
            cursor: pointer;
            color: #1f2937;
            font-size: 13px;
            flex: 1;
        }
        
        .settings-panel { 
            width: 350px; 
            min-width: 300px; 
            max-width: 500px; 
            height: 100%; 
            background: rgba(255, 255, 255, 0.95); 
            backdrop-filter: blur(20px); 
            border-radius: 20px; 
            border: 1px solid rgba(0, 0, 0, 0.1); 
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); 
            padding: 20px; 
            resize: horizontal; 
            overflow-y: auto; 
            display: none; 
            flex-direction: column; 
            gap: 15px; 
        }
        .settings-panel.active { display: flex; }
.settings-section { 
            background: #f9fafb; 
            border-radius: 15px; 
            overflow: hidden; 
            border: 1px solid #e5e7eb;
        }
        .settings-section .settings-header { 
            cursor: pointer; 
            display: flex; 
            justify-content: space-between; 
            align-items: center; 
            padding: 15px; 
            background: #f3f4f6; 
            transition: background 0.3s; 
        }
        .settings-section .settings-header:hover { background: #e5e7eb; }
        .settings-section .settings-content { 
            padding: 15px; 
            display: none; 
            border-top: 1px solid #e5e7eb; 
        }
        .settings-header h3 { 
            margin-bottom: 0; 
            color: #1f2937; 
            font-size: 16px; 
            display: flex; 
            align-items: center; 
            gap: 10px; 
        }
        .settings-header .toggle-icon { 
            transition: transform 0.3s ease; 
            color: #6b7280; 
            font-size: 14px; 
        }
        .settings-header.open .toggle-icon { transform: rotate(90deg); }

        .settings-content label { 
            color: #374151; 
            display: block; 
            margin-bottom: 8px; 
            font-size: 14px; 
            font-weight: 500; 
        }
        .settings-content select, 
        .settings-content input, 
        .settings-content textarea { 
            width: 100%; 
            padding: 10px; 
            border: 1px solid #e5e7eb; 
            border-radius: 10px; 
            background: white; 
            color: #1f2937; 
            margin-bottom: 10px; 
            font-size: 14px; 
        }
        
        .provider-list-item { 
            display: flex; 
            align-items: center; 
            justify-content: space-between; 
            padding: 10px; 
            border-radius: 8px; 
            margin-bottom: 8px; 
            background: white; 
            border: 1px solid #e5e7eb; 
        }
        .model-list-item { 
            display: flex; 
            align-items: center; 
            justify-content: space-between; 
            padding: 8px 8px 8px 25px; 
            border-radius: 8px; 
            margin-bottom: 5px; 
            background: #f9fafb; 
            border: 1px solid #f3f4f6;
        }
        .model-list-item input[type="color"] {
            width: 25px;
            height: 25px;
            border: 1px solid #ccc;
            border-radius: 4px;
            cursor: pointer;
        }

        .btn-small { 
            background: #f3f4f6; 
            border: 1px solid #e5e7eb; 
            border-radius: 4px; 
            color: #374151; 
            padding: 3px 8px; 
            font-size: 11px; 
            cursor: pointer; 
            transition: background 0.2s; 
        }
        .btn-small:hover { background: #e5e7eb; }
        .btn-delete { color: #ef4444; }
        .btn-delete:hover { 
            background: #fee2e2; 
            border-color: #fecaca;
        }
        .btn-edit { color: #3b82f6; }
        .btn-edit:hover { 
            background: #dbeafe; 
            border-color: #93c5fd;
        }

        .stat-item { 
            display: flex; 
            justify-content: space-between; 
            color: #374151; 
            margin-bottom: 8px; 
            font-size: 14px; 
        }
        .welcome-message { 
            text-align: center; 
            color: #4b5563; 
            padding: 40px 20px; 
            font-size: 16px; 
            line-height: 1.6; 
        }
        .welcome-message h3 { 
            color: #1f2937; 
            margin-bottom: 10px; 
            font-size: 20px; 
        }
        .error-message { 
            background: #fee2e2; 
            border: 1px solid #fecaca; 
            color: #dc2626; 
            padding: 15px; 
            border-radius: 10px; 
            margin: 10px 0; 
            text-align: center; 
        }
        .typing-indicator { 
            display: flex; 
            align-items: center; 
            gap: 10px; 
            padding: 15px 20px; 
            background: white; 
            border-radius: 20px; 
            border-bottom-left-radius: 5px; 
            align-self: flex-start; 
            max-width: 70%; 
            color: #6b7280; 
            border: 1px solid #e5e7eb;
        }
        .loading-dots { display: flex; gap: 3px; }
        .loading-dot { 
            width: 6px; 
            height: 6px; 
            background: #6b7280; 
            border-radius: 50%; 
            animation: bounce 1.4s infinite ease-in-out both; 
        }
        .loading-dot:nth-child(1) { animation-delay: -0.32s; }
        .loading-dot:nth-child(2) { animation-delay: -0.16s; }
        @keyframes bounce { 
            0%, 80%, 100% { transform: scale(0); opacity: 0.5; } 
            40% { transform: scale(1); opacity: 1; } 
        }
        
        .toggle-settings { 
            position: fixed; 
            top: 90px; 
            right: 30px; 
            background: white; 
            border: 1px solid #e5e7eb; 
            border-radius: 50%; 
            color: #6b7280; 
            width: 50px; 
            height: 50px; 
            cursor: pointer; 
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            z-index: 1000; 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            transition: all 0.3s ease; 
        }
        .toggle-settings:hover { 
            background: #f3f4f6; 
            transform: scale(1.1); 
        }
        
        /* Login/Register Button - jetzt oben, vor Einstellungen */
        .auth-button {
            position: fixed;
            top: 30px;
            right: 30px;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
            border: none;
            color: white;
            font-size: 20px;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
            transition: all 0.3s ease;
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }
        
        .auth-button:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
        }
        
        /* Logout Button - jetzt oben, vor Einstellungen */
        .logout-button {
            position: fixed;
            top: 30px;
            right: 30px;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%) !important;
            border: none !important;
            color: #d32f2f !important;
            font-size: 20px;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(244, 67, 54, 0.2);
            transition: all 0.3s ease;
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .logout-button:hover {
            transform: scale(1.1) !important;
            background: linear-gradient(135deg, #ffcdd2 0%, #ef9a9a 100%) !important;
            box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4) !important;
        }
        
        /* NEU: PDF-Export-Button (unter KI-Auswahl-Button) */
        .pdf-export-button {
            position: fixed;
            top: 150px;
            right: 30px;
            z-index: 1001;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 50%;
            color: #6b7280;
            width: 50px;
            height: 50px;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            z-index: 999;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            font-size: 20px;
        }
        
        .pdf-export-button:hover {
            background: #f3f4f6;
            transform: scale(1.1);
            color: #dc2626;
            box-shadow: 0 6px 20px rgba(220, 38, 38, 0.2);
        }
        
        .copy-notification { 
            position: fixed; 
            top: 50%; 
            left: 50%; 
            transform: translate(-50%, -50%); 
            background: #10b981; 
            color: white; 
            padding: 10px 20px; 
            border-radius: 10px; 
            font-size: 14px; 
            z-index: 10000; 
            animation: fadeInOut 2s ease-in-out; 
        }

        .error-notification {
            position: fixed;
            top: 20px; /* Oben anzeigen, um Eingabefelder nicht zu verdecken */
            left: 50%;
            transform: translateX(-50%);
            background: #ef4444; /* Rote Farbe für Fehler */
            color: white;
            padding: 12px 20px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            z-index: 10001; /* Eine Ebene über den Modals */
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            animation: fadeInOut 4s ease-in-out; /* Längere Anzeigezeit */
        }
        @keyframes fadeInOut { 
            0%, 100% { opacity: 0; } 
            10%, 90% { opacity: 1; } 
        }
        
        @media (max-width: 1024px) { 
            .main-container { flex-direction: column; } 
            .settings-panel { width: 100%; height: auto; max-height: 40vh; max-width: none; } 
            .chat-container { width: 100%; max-width: none; min-width: auto; }
            .chat-input-modal { min-width: 90%; }
        }
        @media (max-width: 768px) { 
            .main-container { padding: 10px; height: calc(100vh - 20px); } 
            .message-bubble { max-width: 85%; }
            .multi-ki-container {
                grid-template-columns: 1fr;
                grid-template-rows: auto;
            }
        }

        /* Modal Styles */
        .modal-backdrop {
            display: none !important;
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background-color: rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(5px);
            z-index: 1040;
        }

        .modal-backdrop.is-visible {
            display: block !important; /* per JS umschalten */
        }

        .modal {
            display: none !important;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 1050;
            width: 600px;
            max-width: 90vw;
            max-height: 80vh;
            min-width: 400px;
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(30px);
            border: 1px solid rgba(0, 0, 0, 0.1);
            border-radius: 20px;
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
            flex-direction: column;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }

        .modal.open {
            display: flex;
        }

        .modal-header {
            padding: 15px 20px;
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
            cursor: move;
        }

        .modal-header h3 {
            margin: 0;
            color: white;
            font-size: 18px;
            font-weight: 600;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        }

        .modal-close-btn {
            background: rgba(255, 255, 255, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            font-size: 20px;
            font-weight: bold;
            line-height: 1;
            cursor: pointer;
            transition: all 0.2s;
            padding: 5px 10px;
            border-radius: 8px;
        }

        .modal-close-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }

        .modal-content {
            padding: 20px;
            overflow-y: auto;
            color: #1f2937;
        }

        .modal-content h4,
        .modal-content p,
        .modal-content label,
        .modal-content span,
        .modal-content div {
            color: #1f2937 !important;
        }

        .settings-dropdown-menu {
            display: none;
            position: fixed;
            top: 90px;
            right: 30px;
            background: white;
            backdrop-filter: blur(15px);
            border-radius: 12px;
            border: 1px solid #e5e7eb;
            box-shadow: 0 8px 20px rgba(0,0,0,0.1);
            z-index: 9999;
            padding: 12px;
            flex-direction: column;
            gap: 8px;
            min-width: 250px;
            max-width: 300px;
        }
        
        /* Visibility classes for user interface elements - controlled by JavaScript */
        .guest-only {
            display: flex;
        }
        
        .authenticated-only {
            display: none;
        }
        
        .admin-only {
            display: none;
        }
        
        .settings-dropdown-menu.show {
            display: flex;
        }
        
        .settings-dropdown-menu > div {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        
        .settings-dropdown-menu button {
            background: #f3f4f6;
            border: none;
            color: #1f2937;
            padding: 12px 16px;
            border-radius: 8px;
            text-align: left;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
            font-size: 14px;
            font-weight: 500;
            width: 100%;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .settings-dropdown-menu button:hover {
            background: #e5e7eb;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        
        /* Admin Form Modal Styles */
        .admin-form-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10001;
            align-items: center;
            justify-content: center;
        }
        
        .admin-form-modal.show {
            display: flex;
        }
        
        .admin-form-content {
            background: white;
            border-radius: 12px;
            width: 90%;
            max-width: 600px;
            max-height: 90vh;
            overflow-y: auto;
            overflow-x: hidden;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }
        
        .admin-form-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px;
            border-radius: 12px 12px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .admin-form-header h3 {
            margin: 0;
            font-size: 18px;
        }
        
        .admin-form-close {
            background: none;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            padding: 0;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .admin-form-body {
            padding: 30px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #374151;
        }
        
        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 12px;
            border: 1px solid #d1d5db;
            border-radius: 8px;
            font-size: 14px;
            transition: border-color 0.2s;
        }
        
        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }
        
        .form-actions {
            display: flex;
            gap: 12px;
            justify-content: flex-end;
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #e5e7eb;
        }
        
        .btn-primary,
        .btn-secondary {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .btn-primary {
            background: #667eea;
            color: white;
        }
        
        .btn-primary:hover {
            background: #5a67d8;
            transform: translateY(-1px);
        }
        
        .btn-secondary {
            background: #f3f4f6;
            color: #374151;
        }
        
        .btn-secondary:hover {
            background: #e5e7eb;
        }
        
        /* Erweiterte Formular-Styles */
        .form-section {
            margin-bottom: 30px;
            padding: 20px;
            background: #f8f9fa;
            border-radius: 8px;
            border-left: 4px solid #667eea;
        }
        
        .form-section h4 {
            margin: 0 0 15px 0;
            color: #374151;
            font-size: 16px;
            font-weight: 600;
        }
        
        .form-row {
            display: flex;
            gap: 15px;
        }
        
        .form-row .form-group {
            flex: 1;
        }
        
        .checkbox-group {
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-height: 200px;
            overflow-y: auto;
            overflow-x: hidden;
            border: 1px solid #d1d5db;
            border-radius: 8px;
            padding: 15px;
            background: #f9fafb;
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }
        
        .checkbox-item {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .checkbox-item input[type="checkbox"] {
            width: auto;
            margin: 0;
        }
        
        .checkbox-item label {
            margin: 0;
            font-weight: 500;
            cursor: pointer;
        }
        
        /* Mobile-Responsive für Settings Dropdown */
        @media (max-width: 768px) {
            .settings-dropdown-menu {
                top: 80px;
                right: 20px;
                left: 20px;
                min-width: auto;
                max-width: none;
            }
            
            .settings-dropdown-menu button {
                padding: 14px 16px;
                font-size: 15px;
            }
        }

        .checkbox-container {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 15px;
        }

        .checkbox-container input[type="checkbox"] {
            width: auto !important;
            margin: 0 !important;
        }

        .checkbox-container label {
            margin: 0 !important;
            cursor: pointer;
        }
        
        .role-item-card {
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 10px;
            padding: 15px;
            margin-bottom: 10px;
        }
        
        .role-item-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }
        
        .role-item-title {
            font-weight: 600;
            color: #1f2937;
            font-size: 16px;
        }
        
        .role-item-categories {
            display: flex;
            gap: 10px;
            margin-bottom: 8px;
            font-size: 12px;
            color: #6b7280;
        }
        
        .role-item-description {
            color: #4b5563;
            font-size: 14px;
            margin-bottom: 8px;
        }
        
        .role-item-prompt {
            background: #f9fafb;
            padding: 8px;
            border-radius: 6px;
            font-size: 12px;
            color: #6b7280;
            max-height: 60px;
            overflow-y: auto;
        }
        
        .role-item-actions {
            display: flex;
            gap: 8px;
        }
        
        .add-role-button {
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            margin-bottom: 15px;
            transition: all 0.2s;
        }
        
        .add-role-button:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
        }
        
        .role-search-field {
            position: relative;
        }
        
        .role-search-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            max-height: 200px;
            overflow-y: auto;
            display: none;
            z-index: 1000;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }
        
        .role-search-dropdown.show {
            display: block;
        }
        
        .role-search-item {
            padding: 10px 15px;
            cursor: pointer;
            transition: background 0.2s;
            color: #1f2937;
            font-size: 14px;
        }
        
        .role-search-item:hover {
            background: #f3f4f6;
        }
        
        .role-search-item.selected {
            background: #6366f1;
            color: white;
        }

                .attachment-container {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            align-items: center;
        }
        .attachment-chip {
            background-color: rgba(0,0,0,0.08);
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 11px;
            cursor: pointer;
            transition: background-color 0.2s;
            border: 1px solid rgba(0,0,0,0.1);
        }
        .attachment-chip:hover {
            background-color: rgba(0,0,0,0.15);
        }
                .results-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 12px;
            background-color: #fff;
        }
        .results-table th, .results-table td {
            border: 1px solid #ddd;
            padding: 6px 8px;
            text-align: left;
            white-space: normal;
        }
        .results-table th {
            background-color: #f2f2f2;
            font-weight: 600;
        }


        /* NEU: Stile für die Griffe zur Größenänderung */
        .resize-handle {
        position: absolute;
        background: transparent; 
        z-index: 10;
        }
        .resize-handle.se { /* Ecke unten rechts */
        bottom: 0;
        right: 0;
        width: 12px;
        height: 12px;
        cursor: nwse-resize;
        }
        .resize-handle.s { /* Rand unten */
        bottom: 0;
        left: 12px;
        right: 12px;
        height: 8px;
        cursor: ns-resize;
        }
        .resize-handle.e { /* Rand rechts */
        top: 40px; 
        right: 0;
        bottom: 12px;
        width: 8px;
        cursor: ew-resize;
        }
        /* ENDE: Stile für die Griffe */

        /* Auth Modal Styles */
        .auth-modal {
            display: none !important;
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            height: 100% !important;
            background: rgba(0, 0, 0, 0.8) !important;
            z-index: 10000 !important;
            overflow-y: auto !important;
        }

        .auth-modal.show {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
        }

        .auth-content {
            background: white;
            border-radius: 20px;
            width: 90%;
            max-width: 500px;
            overflow: hidden;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }

        .auth-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 30px;
            text-align: center;
            position: relative;
        }

        .auth-title {
            font-size: 28px;
            font-weight: bold;
            margin-bottom: 10px;
        }

        .auth-subtitle {
            opacity: 0.9;
            font-size: 16px;
        }

        .auth-close {
            position: absolute;
            top: 15px;
            right: 15px;
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: none;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            font-size: 18px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .auth-close:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }

        .auth-body {
            padding: 40px;
        }

        .auth-tabs {
            display: flex;
            margin-bottom: 30px;
            border-bottom: 2px solid #e9ecef;
        }

        .auth-tab {
            flex: 1;
            padding: 15px;
            background: none;
            border: none;
            font-size: 16px;
            font-weight: 600;
            color: #6c757d;
            cursor: pointer;
            transition: all 0.3s ease;
            border-bottom: 3px solid transparent;
        }

        .auth-tab.active {
            color: #667eea;
            border-bottom-color: #667eea;
        }

        .auth-tab:hover {
            color: #667eea;
        }

        .auth-form {
            display: none;
        }

        .auth-form.active {
            display: block;
        }

        /* Auth Form Submit Buttons */
        .auth-form .auth-button {
            position: static;
            width: 100%;
            height: auto;
            padding: 12px 20px;
            margin-top: 15px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        }

        .auth-form .auth-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
        }

        .auth-form .auth-button:active {
            transform: translateY(0);
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #495057;
        }

        .form-group input {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid #e9ecef;
            border-radius: 10px;
            font-size: 16px;
            transition: border-color 0.3s ease;
        }

        .form-group input:focus {
            outline: none;
            border-color: #667eea;
        }

        .form-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #495057;
        }

        .form-input {
            width: 100%;
            padding: 15px;
            border: 2px solid #e9ecef;
            border-radius: 10px;
            font-size: 16px;
            transition: all 0.3s ease;
            box-sizing: border-box;
        }

        .form-input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

        .auth-link {
            text-align: center;
            color: #6c757d;
            font-size: 14px;
            margin-top: 15px;
        }

        .auth-link a {
            color: #667eea;
            text-decoration: none;
        }

        .auth-link a:hover {
            text-decoration: underline;
        }



        .user-info {
            display: none;
        }

        .user-info.show {
            display: block;
        }

        .user-details {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .user-avatar {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 20px;
            font-weight: bold;
        }

        .user-text {
            flex: 1;
        }

        .user-name {
            font-weight: 600;
            color: #495057;
            margin-bottom: 5px;
        }

        .user-role {
            color: #6c757d;
            font-size: 14px;
        }

        .user-balance {
            background: white;
            padding: 10px 15px;
            border-radius: 20px;
            font-weight: 600;
            color: #28a745;
        }


        /* Mobile Responsive */
        @media (max-width: 768px) {
            .auth-content {
                width: 95%;
                margin: 20px;
            }
            
            .auth-body {
                padding: 30px 20px;
            }
            
            .auth-header {
                padding: 20px;
            }
            
            .auth-title {
                font-size: 24px;
            }
        }

        /* Admin Dashboard Styles */
        .admin-dashboard {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10000;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }

        .admin-dashboard.show {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .admin-content {
            background: white;
            border-radius: 20px;
            width: 95%;
            max-width: 1400px;
            max-height: 90vh;
            overflow-y: auto;
            overflow-x: hidden;
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }

        .admin-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .admin-title {
            font-size: 24px;
            font-weight: bold;
        }

        .admin-close {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 18px;
            transition: all 0.3s ease;
        }

        .admin-close:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }

        .admin-nav {
            background: #f8f9fa;
            padding: 15px 30px;
            border-bottom: 1px solid #e9ecef;
            display: flex;
            gap: 20px;
            flex-wrap: wrap;
        }

        .admin-nav-item {
            background: white;
            border: 1px solid #dee2e6;
            padding: 10px 20px;
            border-radius: 25px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 500;
        }

        .admin-nav-item:hover {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        .admin-nav-item.active {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        .admin-body {
            flex: 1;
            padding: 30px;
            overflow-y: auto;
        }

        .admin-section {
            display: none;
        }

        .admin-section.active {
            display: block;
        }
        
        /* Admin sections should be visible when admin dashboard is open */
        .admin-dashboard.show .admin-section {
            display: block;
        }
        
        /* Only active section should be visible */
        .admin-dashboard.show .admin-section:not(.active) {
            display: none;
        }
        
        .admin-dashboard.show .admin-section.active {
            display: block;
        }
        
        /* Stammdaten Grid Styles */
        .stammdaten-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
            gap: 20px;
            margin-bottom: 20px;
        }
        
        .stammdaten-card {
            background: #f8f9fa;
            border-radius: 12px;
            border: 1px solid #e5e7eb;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }
        
        .stammdaten-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .stammdaten-header h3 {
            margin: 0;
            font-size: 16px;
            font-weight: 600;
        }
        
        .stammdaten-content {
            padding: 20px;
            max-height: 300px;
            overflow-y: auto;
        }
        
        .stammdaten-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 0;
            border-bottom: 1px solid #e5e7eb;
        }
        
        .stammdaten-item:last-child {
            border-bottom: none;
        }
        
        .stammdaten-item-info {
            flex: 1;
        }
        
        .stammdaten-item-name {
            font-weight: 500;
            color: #374151;
        }
        
        .stammdaten-item-details {
            font-size: 12px;
            color: #6b7280;
            margin-top: 2px;
        }
        
        .stammdaten-item-actions {
            display: flex;
            gap: 5px;
        }
        
        .stammdaten-item-actions button {
            padding: 4px 8px;
            font-size: 12px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        
        .edit-btn {
            background: #3b82f6;
            color: white;
        }
        
        .edit-btn:hover {
            background: #2563eb;
        }
        
        .delete-btn {
            background: #ef4444 !important;
            color: white !important;
            display: inline-block !important;
            visibility: visible !important;
            opacity: 1 !important;
            width: auto !important;
            height: auto !important;
            min-width: 60px !important;
            min-height: 30px !important;
        }
        
        .delete-btn:hover {
            background: #dc2626 !important;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .stat-card {
            background: white;
            border: 1px solid #e9ecef;
            border-radius: 15px;
            padding: 20px;
            text-align: center;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease;
        }

        .stat-card:hover {
            transform: translateY(-5px);
        }

        .stat-value {
            font-size: 32px;
            font-weight: bold;
            color: #667eea;
            margin-bottom: 10px;
        }

        .stat-label {
            color: #6c757d;
            font-size: 14px;
        }

        .data-table {
            background: white;
            border-radius: 15px;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .table-header {
            background: #f8f9fa;
            padding: 15px 20px;
            border-bottom: 1px solid #dee2e6;
            font-weight: 600;
        }

        .table-content {
            max-height: 400px;
            overflow-y: auto;
        }

        .table-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            padding: 15px 20px;
            border-bottom: 1px solid #f1f3f4;
            align-items: center;
        }

        .table-row:hover {
            background: #f8f9fa;
        }

        .table-row.header {
            background: #e9ecef;
            font-weight: 600;
            border-bottom: 2px solid #dee2e6;
        }

        .btn {
            background: #667eea;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 20px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .btn:hover {
            background: #5a6fd8;
            transform: translateY(-2px);
        }

        .btn-danger {
            background: #dc3545;
            color: white;
        }

        .btn-danger:hover {
            background: #c82333;
            color: white;
        }

        .btn-success {
            background: #28a745;
        }

        .btn-success:hover {
            background: #218838;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            display: block;
            margin-bottom: 5px;
            font-weight: 600;
            color: #495057;
        }

        .form-input {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #dee2e6;
            border-radius: 8px;
            font-size: 14px;
            transition: border-color 0.3s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

        .form-select {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #dee2e6;
            border-radius: 8px;
            font-size: 14px;
            background: white;
        }

        .loading {
            text-align: center;
            padding: 40px;
            color: #6c757d;
        }

        .error {
            background: #f8d7da;
            color: #721c24;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
        }

        .success {
            background: #d4edda;
            color: #155724;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
        }

        /* Mobile Responsive */
        @media (max-width: 768px) {
            .admin-content {
                width: 100%;
                height: 100%;
                border-radius: 0;
            }
            
            .admin-nav {
                flex-direction: column;
                gap: 10px;
            }
            
            .stats-grid {
                grid-template-columns: 1fr;
            }
            
            .table-row {
                grid-template-columns: 1fr;
                gap: 10px;
            }
        }
        
        /* Notification Styles */
        .notification {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 10001;
            background: white;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            padding: 16px;
            max-width: 400px;
            transform: translateX(100%);
            transition: transform 0.3s ease;
        }
        
        .notification.show {
            transform: translateX(0);
        }
        
        .notification.success {
            border-left: 4px solid #10b981;
            background: #f0fdf4;
            color: #166534;
        }
        
        .notification.error {
            border-left: 4px solid #ef4444;
            background: #fef2f2;
            color: #dc2626;
        }
        
        .notification-content {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .notification-icon {
            font-size: 20px;
        }
        
        .notification-message {
            font-weight: 500;
            color: inherit;
        }
        
        /* MwSt-Arten Styles */
        .stammdaten-item-mwst {
            font-size: 12px;
            color: #6b7280;
            margin-top: 4px;
            font-style: italic;
        }
        
        .mwst-selection-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
        }
        
        .mwst-selection-content {
            background: white;
            border-radius: 12px;
            padding: 24px;
            max-width: 600px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
        }
        
        .mwst-selection-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 12px;
            border-bottom: 1px solid #e5e7eb;
        }
        
        .mwst-selection-title {
            font-size: 18px;
            font-weight: 600;
            color: #1f2937;
        }
        
        .mwst-selection-close {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #6b7280;
        }
        
        .mwst-checkbox-list {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 12px;
            margin-bottom: 20px;
        }
        
        .mwst-checkbox-item {
            display: flex;
            align-items: center;
            padding: 12px;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .mwst-checkbox-item:hover {
            background: #f9fafb;
            border-color: #d1d5db;
        }
        
        .mwst-checkbox-item.selected {
            background: #eff6ff;
            border-color: #3b82f6;
        }
        
        .mwst-checkbox-item input[type="checkbox"] {
            margin-right: 8px;
        }
        
        .mwst-checkbox-label {
            font-size: 14px;
            color: #374151;
        }
        
        .mwst-checkbox-value {
            font-size: 12px;
            color: #6b7280;
            margin-left: auto;
        }

/* Billing Modal Styles - Integration in bestehendes Design */
        .billing-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10000;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }

        .billing-modal.show {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .billing-content {
            background: white;
            border-radius: 20px;
            width: 95%;
            max-width: 800px;
            max-height: 90vh;
            overflow-y: auto;
            overflow-x: hidden;
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            -webkit-overflow-scrolling: touch;
            scroll-behavior: smooth;
        }

        .billing-header {
            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
            color: white;
            padding: 20px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .billing-title {
            font-size: 24px;
            font-weight: bold;
        }

        .billing-close {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 18px;
            transition: all 0.3s ease;
        }

        .billing-close:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }

        .billing-body {
            flex: 1;
            padding: 30px;
            overflow-y: auto;
        }

        .balance-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 15px;
            padding: 25px;
            margin-bottom: 30px;
            text-align: center;
        }

        .balance-amount {
            font-size: 36px;
            font-weight: bold;
            margin-bottom: 10px;
        }

        .balance-label {
            opacity: 0.9;
            font-size: 16px;
        }

        .balance-actions {
            display: flex;
            gap: 15px;
            justify-content: center;
            margin-top: 20px;
        }

        .btn {
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: 1px solid rgba(255, 255, 255, 0.3);
            padding: 10px 20px;
            border-radius: 25px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(-2px);
        }

        .btn-primary {
            background: #007bff;
            border-color: #007bff;
        }

        .btn-success {
            background: #28a745;
            border-color: #28a745;
        }

        .section {
            margin-bottom: 30px;
        }

        .section-title {
            font-size: 20px;
            font-weight: 600;
            color: #495057;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .products-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 20px;
        }

        .product-card {
            background: white;
            border: 2px solid #e9ecef;
            border-radius: 15px;
            padding: 20px;
            text-align: center;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .product-card:hover {
            border-color: #667eea;
            transform: translateY(-5px);
            box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
        }

        .product-card.selected {
            border-color: #28a745;
            background: #f8fff9;
        }

        .product-name {
            font-size: 18px;
            font-weight: 600;
            color: #495057;
            margin-bottom: 10px;
        }

        .product-description {
            color: #6c757d;
            font-size: 14px;
            margin-bottom: 15px;
        }

        .product-price {
            font-size: 24px;
            font-weight: bold;
            color: #28a745;
            margin-bottom: 15px;
        }

        .product-tokens {
            color: #6c757d;
            font-size: 14px;
            margin-bottom: 15px;
        }

        .transactions-table {
            background: white;
            border-radius: 15px;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .table-header {
            background: #f8f9fa;
            padding: 15px 20px;
            border-bottom: 1px solid #dee2e6;
            font-weight: 600;
        }

        .table-content {
            max-height: 300px;
            overflow-y: auto;
        }

        .table-row {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr 1fr;
            padding: 15px 20px;
            border-bottom: 1px solid #f1f3f4;
            align-items: center;
        }

        .table-row:hover {
            background: #f8f9fa;
        }

        .table-row.header {
            background: #e9ecef;
            font-weight: 600;
            border-bottom: 2px solid #dee2e6;
        }

        .transaction-type {
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 600;
            text-align: center;
        }

        .transaction-type.purchase {
            background: #d4edda;
            color: #155724;
        }

        .transaction-type.usage {
            background: #f8d7da;
            color: #721c24;
        }

        .transaction-type.bonus {
            background: #d1ecf1;
            color: #0c5460;
        }

        .amount {
            font-weight: 600;
        }

        .amount.positive {
            color: #28a745;
        }

        .amount.negative {
            color: #dc3545;
        }

        .loading {
            text-align: center;
            padding: 40px;
            color: #6c757d;
        }

        .error {
            background: #f8d7da;
            color: #721c24;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
        }

        .success {
            background: #d4edda;
            color: #155724;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
        }

        /* Mobile Responsive */
        @media (max-width: 768px) {
            .billing-content {
                width: 100%;
                height: 100%;
                border-radius: 0;
            }
            
            .products-grid {
                grid-template-columns: 1fr;
            }
            
            .table-row {
                grid-template-columns: 1fr;
                gap: 10px;
            }
            
            .balance-actions {
                flex-direction: column;
            }
        }
