/* =========================================================================
   KI-Begleiter – Stylesheet
   Dark Mode, Mobile-first, Clean & Modern
   ========================================================================= */

/* -------------------------------------------------------------------------
   CSS CUSTOM PROPERTIES
   ------------------------------------------------------------------------- */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --bg-chat-ai: #1e2a4a;
    --bg-chat-user: #533483;
    --bg-input: #1e1e3a;
    --bg-hover: #2a2a4a;
    --bg-modal: rgba(0, 0, 0, 0.7);
    
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a82;
    --text-inverse: #ffffff;
    
    --accent: #e94560;
    --accent-hover: #ff5a75;
    --accent-secondary: #f5a623;
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #ef4444;
    
    --border: #2a2a4a;
    --border-light: #3a3a5a;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;
    
    --sidebar-width: 280px;
    --header-height: 56px;
    --input-height: 60px;
    
    --transition: 0.2s ease;
}

/* -------------------------------------------------------------------------
   RESET & BASE
   ------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    height: 100%;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    height: 100%;
}

.screen {
    height: 100%;
}

.hidden {
    display: none !important;
}

/* -------------------------------------------------------------------------
   AUTH SCREEN
   ------------------------------------------------------------------------- */
#auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 40px 24px;
    text-align: center;
}

.auth-logo {
    font-size: 64px;
    margin-bottom: 8px;
    animation: pulse 2s ease-in-out infinite;
}

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

.auth-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setup-section-title {
    margin: 8px 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.setup-section-hint {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.auth-form .form-hint a {
    color: var(--accent);
    text-decoration: none;
}

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

.auth-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 14px;
}

.input-error {
    border-color: var(--error) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25) !important;
}

.key-validation-error {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--error);
    font-weight: 500;
}

/* -------------------------------------------------------------------------
   FORM ELEMENTS
   ------------------------------------------------------------------------- */
.form-group {
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition);
}

input:focus,
textarea:focus {
    border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* -------------------------------------------------------------------------
   BUTTONS
   ------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
}

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

.btn-accent {
    background: var(--accent);
    color: var(--text-inverse);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-full {
    width: 100%;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn:disabled, .btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* -------------------------------------------------------------------------
   LAYOUT – MAIN APP
   ------------------------------------------------------------------------- */
#main-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh; /* iOS Safari dynamic viewport height */
    overflow: hidden;
}

/* -------------------------------------------------------------------------
   HEADER
   ------------------------------------------------------------------------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: var(--header-height);
    min-height: var(--header-height);
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 300;
}

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

.header-logo {
    font-size: 22px;
    display: flex;
    align-items: center;
}

.header-ai-img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--accent);
}

#header-conv-title {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Cron-Trigger-Buttons (G = Gemini, O = Opus) */
.cron-trigger-btn {
    font-size: 11px;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.cron-trigger-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: rgba(78, 204, 163, 0.12);
}

.cron-trigger-btn:disabled {
    opacity: 0.4;
    cursor: wait;
}

.cron-trigger-btn.running {
    color: var(--accent);
    border-color: var(--accent);
    animation: cronPulse 1.5s ease infinite;
}

@keyframes cronPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(78, 204, 163, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(78, 204, 163, 0); }
}

/* Activity-Log Overlay */
.activity-log-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}

.activity-log-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.activity-log-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.activity-log-header h3 {
    margin: 0;
    font-size: 16px;
    flex: 1;
}

.activity-log-filters select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 8px;
    font-size: 12px;
}

.activity-log-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.activity-log-close:hover {
    color: var(--text-primary);
}

.activity-log-content {
    overflow-y: auto;
    padding: 12px 16px;
    flex: 1;
}

.log-date-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

.log-entry {
    display: grid;
    grid-template-columns: 42px 22px auto auto 1fr;
    gap: 4px;
    align-items: baseline;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 13px;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-muted);
    font-size: 11px;
    font-family: monospace;
}

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

.log-tool {
    font-weight: 600;
    color: var(--accent);
    font-size: 11px;
    white-space: nowrap;
}

.log-action {
    color: var(--text-secondary);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-result {
    grid-column: 4 / -1;
    color: var(--text-muted);
    font-size: 11px;
    padding: 2px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Modell-Badge im Log */
.log-model {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.log-model-opus { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.log-model-sonnet { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.log-model-haiku { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.log-model-gemini { background: rgba(251, 146, 60, 0.2); color: #fb923c; }

/* Tageskosten-Badge im Header */
.daily-cost-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 3px 8px;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1.2;
}

.daily-cost-badge:hover {
    color: var(--text-primary);
    border-color: var(--accent-secondary);
    background: rgba(78, 204, 163, 0.08);
}

.daily-cost-badge.cost-high {
    color: var(--warning, #f59e0b);
    border-color: rgba(245, 158, 11, 0.3);
}

.daily-cost-badge.cost-flash {
    animation: costFlash 0.6s ease;
}

@keyframes costFlash {
    0% { background: rgba(78, 204, 163, 0.2); }
    100% { background: rgba(255, 255, 255, 0.06); }
}

/* Header Postfach-Button */
.header-mailbox-btn {
    position: relative;
}

.header-mailbox-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
    pointer-events: none;
    animation: badgePop 0.3s ease-out;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* -------------------------------------------------------------------------
   SIDEBAR
   ------------------------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
    overflow: hidden;
}

.sidebar.open {
    transform: translateX(0);
}

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

.sidebar-overlay {
    position: fixed;
    inset: 0;
    top: var(--header-height);
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
    opacity: 1;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conv-group-label {
    padding: 8px 12px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Sidebar-Akkordeon (Task-Chats, Eigengedanken, Zeitgruppen) */
.conv-group-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.conv-group-toggle:hover {
    background: var(--bg-hover);
}

.conv-group-arrow {
    font-size: 9px;
    width: 12px;
    text-align: center;
    flex-shrink: 0;
}

.conv-group-count {
    font-weight: 400;
    opacity: 0.6;
}

.conv-group-badge {
    background: var(--accent);
    color: white;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 8px;
    font-weight: 600;
    margin-left: auto;
}

.conv-group-items.hidden {
    display: none;
}

.conv-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    gap: 8px;
}

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

.conv-item.active {
    background: var(--bg-tertiary);
}

.conv-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.conv-item-delete,
.conv-item-hide {
    opacity: 0;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    transition: opacity var(--transition);
}

.conv-item-delete { font-size: 12px; }
.conv-item-hide { font-size: 11px; }

.conv-item:hover .conv-item-delete,
.conv-item:hover .conv-item-hide {
    opacity: 1;
}

.conv-item-delete:hover {
    color: var(--error);
}

.conv-item-hide:hover {
    color: var(--accent);
}

.conv-group-task {
    color: var(--accent);
}

.conv-item-task {
    border-left: 2px solid var(--accent);
    padding-left: 10px;
}

.conv-item-task .conv-item-title {
    font-size: 13px;
}

.conv-item-task.unread,
.conv-item.unread {
    background: rgba(99,102,241,0.08);
}
.conv-item-task.unread .conv-item-title,
.conv-item.unread .conv-item-title {
    font-weight: 600;
    color: var(--text-primary);
}

/* Eigengedanken (Denkfäden) in der Sidebar */
.conv-group-eigengedanke {
    color: #d4a574;
}

.conv-item-eigengedanke {
    border-left: 2px solid #c9a227;
    padding-left: 10px;
}

.conv-item-eigengedanke .conv-item-title {
    font-size: 13px;
}

.conv-item-eigengedanke.unread {
    background: rgba(201, 162, 39, 0.12);
}

.conv-item-eigengedanke.unread .conv-item-title {
    font-weight: 600;
    color: var(--text-primary);
}

.conv-unread-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 0 6px rgba(99,102,241,0.5);
    flex-shrink: 0;
}

.conv-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

/* ===== SIDEBAR TABS ===== */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-tab {
    flex: 1;
    padding: 10px 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.sidebar-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.sidebar-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}
.sidebar-tab-badge {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}
.sidebar-tab-badge.has-unread {
    background: #f87171;
    animation: pulse-badge 2s ease-in-out infinite;
}
.sidebar-tab-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.sidebar-tab-content.hidden {
    display: none;
}

/* Sidebar Post-its / Postfach */
.sidebar-postits-list {
    padding: 4px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.btn-icon-sm {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    margin-left: auto;
    line-height: 1;
}

.btn-icon-sm:hover {
    color: var(--text-primary);
}

.sidebar-postit-card {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--postit-color, #fbbf24);
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    transition: background var(--transition), transform 0.15s ease;
}

.sidebar-postit-card:hover {
    background: var(--bg-hover);
    transform: translateX(2px);
}

.sidebar-postit-unread {
    background: var(--bg-secondary);
    border-left-width: 4px;
}

.sidebar-postit-unread .sidebar-postit-text {
    color: var(--text-primary);
    font-weight: 500;
}

.sidebar-postit-pinned {
    border-left-style: double;
}

.sidebar-postit-preview {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-postit-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-postit-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.sidebar-postit-meta {
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: auto;
}
.sidebar-postit-pin-badge {
    font-size: 10px;
    flex-shrink: 0;
}
.sidebar-postit-type-badge {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
}
.sidebar-postit-type-reflexion,
.sidebar-postit-type-system {
    border-left-color: #60a5fa;
}
.sidebar-postit-type-impuls { border-left-color: #a78bfa; }
.sidebar-postit-type-frage { border-left-color: #fb923c; }
.sidebar-postit-type-erinnerung { border-left-color: #34d399; }

/* Reflexionen-Historie */
.reflexion-day { margin-bottom: 16px; }
.reflexion-day-header {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    padding: 6px 0; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.reflexion-entry {
    padding: 8px 12px; margin-bottom: 6px; border-radius: var(--radius);
    background: var(--bg-primary); cursor: pointer; transition: background var(--transition);
}
.reflexion-entry:hover { background: var(--bg-hover); }
.reflexion-entry-header {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; margin-bottom: 4px;
}
.reflexion-entry-time { color: var(--text-muted); font-size: 11px; }
.reflexion-entry-preview { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.reflexion-entry-full { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.reflexion-entry-full-reflexion { background: rgba(59,130,246,0.05); }
.reflexion-entry-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.reflexion-impulse-box {
    font-size: 12px; line-height: 1.5; padding: 8px 10px; margin: 6px 0;
    background: rgba(167,139,250,0.1); border-radius: var(--radius); color: var(--text-secondary);
}

.sidebar-postit-empty {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 8px;
    font-style: italic;
}

.sidebar-tab-badge.hidden {
    display: none;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Alte expandierte Postit-Styles entfernt – Details jetzt im Fullscreen-Modal */

.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: background var(--transition);
}

.btn-xs:hover {
    background: var(--bg-hover);
}

.btn-xs.btn-accent {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-xs.btn-accent:hover {
    filter: brightness(1.1);
}

.btn-xs.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-xs.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* -------------------------------------------------------------------------
   CHAT AREA
   ------------------------------------------------------------------------- */
.chat-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Flexbox overflow fix */
    overflow: hidden;
    position: relative;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-content {
    text-align: center;
}

.welcome-icon {
    font-size: 72px;
    margin-bottom: 16px;
}

.welcome-ai-img {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 3px solid var(--accent);
    box-shadow: 0 4px 24px rgba(233, 69, 96, 0.25);
}

.welcome-ai-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.welcome-ai-emoji {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    background: var(--bg-secondary, #1e1e3a);
}

.welcome-content h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-content p {
    color: var(--text-secondary);
    font-size: 18px;
}

/* ===== POSTFACH-SYSTEM ===== */

/* Postfach-Indikator auf Welcome-Screen */
.mailbox-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.3s ease;
    animation: postcardFadeIn 0.8s ease-out;
}

.mailbox-indicator:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mailbox-icon {
    font-size: 20px;
}

.mailbox-label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.mailbox-badge {
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 11px;
    padding: 0 6px;
    animation: badgePop 0.4s ease;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Postfach-Overlay */
.mailbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

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

.mailbox-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

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

.mailbox-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.mailbox-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mailbox-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.mailbox-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.mailbox-filter {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mailbox-filter:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.mailbox-filter.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    font-weight: 600;
}

.mailbox-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Video in der Expression-Lightbox */
#expression-lightbox-video {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
}

.mailbox-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.mailbox-close-btn:hover {
    color: var(--text-primary);
}

/* Gedanken-Liste */
.mailbox-thoughts {
    overflow-y: auto;
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mailbox-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mailbox-card-unread {
    border-left: 3px solid var(--accent);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(var(--accent-rgb, 139, 92, 246), 0.05));
}

.mailbox-card-pinned {
    border-left: 3px solid var(--warning, #f59e0b);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(245, 158, 11, 0.05));
}

.mailbox-card-pinned.mailbox-card-unread {
    border-left: 3px solid var(--accent);
}

.mailbox-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.mailbox-card-icon {
    font-size: 16px;
}

.mailbox-card-type {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
    font-weight: 500;
}

.mailbox-card-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

.mailbox-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.mailbox-card-text {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 12px 0;
    max-height: 150px;
    overflow: hidden;
    position: relative;
}
.mailbox-card-text.truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--bg-secondary));
    pointer-events: none;
}
.mailbox-card-text img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 10px;
    margin: 8px 0;
    cursor: pointer;
}
.mailbox-card-text p {
    margin: 0 0 8px 0;
}
.mailbox-card-text p:last-child {
    margin-bottom: 0;
}

.mailbox-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.mailbox-card-actions .btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.mailbox-card-actions .btn-accent {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.mailbox-card-actions .btn-accent:hover {
    filter: brightness(1.1);
}

/* Postfach – Emoji-Reaktionen */
.mailbox-thought-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    min-height: 0;
}

.mailbox-thought-reactions:empty {
    display: none;
}

.mailbox-react-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 8px;
    transition: all 0.2s;
}

.mailbox-react-btn:hover {
    border-color: var(--accent-secondary);
    background: rgba(78, 204, 163, 0.08);
}

.thought-emoji-picker {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    margin-top: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 100;
    animation: reactionPopIn 0.15s ease-out;
}

.thought-emoji-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 6px;
}

.thought-emoji-more {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 8px;
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.thought-emoji-more:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.thought-emoji-full {
    max-height: 200px;
    overflow-y: auto;
}

/* Leerer Postfach-State */
.mailbox-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.mailbox-empty p:first-child {
    font-size: 16px;
    margin-bottom: 8px;
}

/* ===== GEDANKEN/POST-IT FULLSCREEN MODAL ===== */
.postit-fullscreen-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    padding: 20px;
}

.postit-fullscreen-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    animation: slideUp 0.25s ease;
}

.postit-fullscreen-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}

.postit-fullscreen-time {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: auto;
}

.postit-fullscreen-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
    margin-left: 8px;
}
.postit-fullscreen-close:hover {
    color: var(--text-primary);
}

.postit-fullscreen-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
}
.postit-fullscreen-body p {
    margin: 0 0 12px 0;
}
.postit-fullscreen-body p:last-child {
    margin-bottom: 0;
}
.postit-fullscreen-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}
.postit-fullscreen-body pre {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 13px;
}
.postit-fullscreen-body ul, .postit-fullscreen-body ol {
    margin: 8px 0;
    padding-left: 24px;
}
.postit-fullscreen-body strong {
    color: var(--text-primary);
}

.postit-fullscreen-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.postit-fullscreen-footer .fs-spacer {
    flex: 1;
}

@media (max-width: 768px) {
    .postit-fullscreen-card {
        width: 100%;
        max-height: 95vh;
        border-radius: var(--radius-md);
    }
    .postit-fullscreen-body {
        padding: 16px;
        font-size: 14px;
    }
}

/* ===== LEGACY POSTCARD (veraltet, für Kompatibilität) ===== */
.postcard {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    text-align: left;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.postcard-icon {
    font-size: 24px;
    margin-bottom: 10px;
}

.postcard-text {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    font-style: italic;
    margin: 0 0 12px 0;
}

.postcard-time {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    text-align: right;
}

@keyframes postcardFadeIn {
    0% { opacity: 0; transform: translateY(12px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* KI denkt nach – Loading-State auf Welcome-Screen */
.thought-generating {
    text-align: center;
    animation: thoughtFadeIn 0.5s ease;
}

.thought-generating p {
    color: var(--text-muted);
    font-size: 16px;
    font-style: italic;
    margin-top: 8px;
}

.thought-loading-dots {
    display: inline-flex;
    gap: 6px;
    padding: 8px 0;
}

.thought-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: thoughtDotPulse 1.6s ease-in-out infinite;
}

.thought-loading-dots span:nth-child(2) { animation-delay: 0.25s; }
.thought-loading-dots span:nth-child(3) { animation-delay: 0.5s; }

@keyframes thoughtDotPulse {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
    40% { transform: scale(1.1); opacity: 1; }
}

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

@media (max-width: 768px) {
    .mailbox-indicator {
        padding: 10px 18px;
    }
    
    .mailbox-panel {
        width: 95%;
        max-height: 85vh;
    }
    
    .mailbox-card-text {
        font-size: 13px;
    }
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeIn 0.3s ease;
}

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

.message-avatar {
    flex-shrink: 0;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
    /* Smooth transition für Größenwechsel */
    transition: width 0.4s ease, height 0.4s ease;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-chat-user);
}

/* Expression-Bild inline im Text (float auf Desktop, volle Breite auf Mobile) */
.ai-expr-float {
    float: left;
    margin: 2px 16px 8px 0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: width 0.4s ease, opacity 0.3s ease;
}

.ai-expr-float.expr-normal {
    width: 220px;
}

.ai-expr-float.expr-gross {
    width: 300px;
}

.ai-expr-float.expr-kompakt {
    width: 150px;
}

/* Fallback wenn keine Größen-Klasse gesetzt */
.ai-expr-float:not(.expr-normal):not(.expr-gross):not(.expr-kompakt) {
    width: 220px;
}

.ai-expr-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ai-expr-float:hover .ai-expr-img {
    transform: scale(1.02);
    opacity: 0.92;
}

/* Reactions/Actions: unterhalb des Float-Bildes */
.message-reactions,
.reaction-picker,
.message-actions {
    clear: both;
}

.message-body {
    flex: 1;
    min-width: 0;
    overflow: hidden; /* Float-Containment für Expression-Bild */
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message-sender {
    font-size: 14px;
    font-weight: 600;
}

.message-model {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    transition: all 0.3s ease;
}

.message-model.model-switched {
    color: #e94560;
    background: rgba(233, 69, 96, 0.15);
    font-weight: 600;
}

.message-model.model-routed {
    color: #4ecdc4;
    background: rgba(78, 205, 196, 0.15);
    font-weight: 600;
    cursor: help;
}

/* Extended-Thinking-Hinweis (Anthropic Opus) */
.thinking-badge {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(139, 92, 246, 0.12);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    margin-left: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.message-content {
    font-size: 15px;
    line-height: 1.7;
    word-wrap: break-word;
}

/* Markdown Styling in Messages */
.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.message-content em {
    font-style: italic;
    color: var(--text-secondary);
}

.message-content code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.message-content pre {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-content ul, .message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    color: var(--text-secondary);
    margin: 12px 0;
}

.message-content h1, .message-content h2, .message-content h3 {
    margin-top: 20px;
    margin-bottom: 8px;
}

.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.2em; }
.message-content h3 { font-size: 1.1em; }

/* Bilder standardmäßig klein (50%) – Toggle schaltet auf Original */
.message-content img:not(.expression-img):not(.header-ai-img) {
    max-width: 50%;
    height: auto;
}
.generated-image {
    max-width: 160px !important;
    max-height: 160px !important;
}

/* Original-Größe wenn Toggle aktiv */
body.full-images .message-content img:not(.expression-img):not(.header-ai-img) {
    max-width: 100%;
}
body.full-images .generated-image {
    max-width: 320px !important;
    max-height: 320px !important;
}

.img-toggle-btn {
    font-size: 9px !important;
    letter-spacing: -0.5px;
}

#location-btn {
    min-width: 40px;
    min-height: 40px;
}

.message-content a {
    color: var(--accent);
    text-decoration: underline;
}

.message-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

/* Save Button */
.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity var(--transition);
}

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

.save-btn,
.tts-btn {
    padding: 4px 10px;
    font-size: 13px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.save-btn:hover,
.tts-btn:hover {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.tts-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ===== Emoji-Reaktionen ===== */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 0;
    margin-top: 2px;
}

.message-reactions.has-reactions {
    margin-top: 6px;
    margin-bottom: 2px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    width: 28px;
    height: 28px;
    background: rgba(78, 204, 163, 0.12);
    border: 1px solid rgba(78, 204, 163, 0.25);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition);
}

.reaction-badge:hover {
    background: rgba(78, 204, 163, 0.25);
    transform: scale(1.15);
}

.reaction-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    opacity: 0;
    transition: opacity var(--transition);
    margin-top: 4px;
}

.message:hover .reaction-picker {
    opacity: 1;
}

.reaction-trigger {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    width: 28px;
    height: 28px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
    padding: 0;
}

.reaction-trigger:hover {
    border-color: var(--accent-secondary);
    background: rgba(78, 204, 163, 0.08);
}

.reaction-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 280px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 50;
    animation: reactionPopIn 0.15s ease-out;
}

.reaction-panel::-webkit-scrollbar {
    width: 4px;
}

.reaction-panel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* Mobile Bottom-Sheet Animation */
@keyframes slideUpPanel {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* Backdrop für mobile Emoji-Picker */
.reaction-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    animation: fadeIn 0.15s ease-out;
}

.reaction-backdrop.active {
    display: block;
}

@keyframes reactionPopIn {
    from { opacity: 0; transform: translateY(4px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.emoji-category {
    margin-bottom: 6px;
}

.emoji-category-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 2px 4px 4px;
}

.emoji-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
}

.reaction-btn {
    background: transparent;
    border: none;
    font-size: 19px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
    padding: 0;
}

.reaction-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.25);
}

/* KI Save Suggestion (überarbeitet) */
.save-suggestion {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(233, 69, 96, 0.08);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    animation: savePulse 0.3s ease;
    transition: opacity 0.3s ease;
}

.save-suggestion-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent);
}

.save-icon { font-size: 1.2rem; }
.save-label { color: var(--accent); }

.save-suggestion-preview {
    margin-bottom: 0.5rem;
}

.save-text {
    font-style: italic;
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.save-context {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}

.save-suggestion-actions {
    display: flex;
    gap: 0.5rem;
}

.save-approve {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.save-approve:hover {
    background: var(--accent-hover);
}

.save-dismiss {
    background: none;
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.save-dismiss:hover {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

@keyframes savePulse {
    0% { opacity: 0; transform: translateX(-10px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ===== Memory Action Suggestions ===== */
.memory-action-suggestion {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(100, 180, 255, 0.08);
    border-left: 3px solid #64b4ff;
    border-radius: 0 8px 8px 0;
    animation: savePulse 0.3s ease;
    transition: opacity 0.3s ease;
}
.mem-action-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #64b4ff;
}
.mem-action-icon { font-size: 1.1rem; }
.mem-action-label { flex: 1; }
.mem-action-id {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}
.mem-action-preview { margin-bottom: 0.5rem; }
.mem-action-text {
    font-style: italic;
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}
.mem-action-reason {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}
.mem-action-context {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}
.mem-action-buttons {
    display: flex;
    gap: 0.5rem;
}
.mem-action-approve {
    background: #64b4ff;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all var(--transition);
}
.mem-action-approve:hover { background: #4a9ae6; }
.mem-action-reject {
    background: none;
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
}
.mem-action-reject:hover {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}
.mem-action-done {
    color: var(--success, #4caf50);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Model Suggestion */
/* Auto-Suche Nachricht */
.search-auto-msg .message-body {
    opacity: 0.7;
    font-style: italic;
}

.search-error-hint {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.model-suggestion {
    margin-top: 0.75rem;
    padding: 0.6rem 1rem;
    background: rgba(83, 52, 131, 0.15);
    border: 1px solid rgba(83, 52, 131, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    animation: fadeIn 0.3s ease;
}

.model-suggest-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
}

.model-suggest-btn {
    background: rgba(83, 52, 131, 0.7);
    color: white;
    border: none;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition);
}

.model-suggest-btn:hover {
    background: rgba(83, 52, 131, 0.9);
}

.model-suggest-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
}

/* KI-Gedanken-Banner */
.ai-thought-banner {
    margin: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(83, 52, 131, 0.2), rgba(15, 52, 96, 0.2));
    border: 1px solid rgba(233, 69, 96, 0.25);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    animation: thoughtFadeIn 0.5s ease;
    transition: opacity 0.3s ease;
}

.thought-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 1;
}

.thought-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }

.thought-text {
    margin: 0;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.5;
}

.thought-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.thought-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s;
}

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

@keyframes thoughtFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Message Attachments */
.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.attachment {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.attachment-img {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

/* File Preview (under input) */
.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 800px;
    margin: 0 auto 8px;
    padding: 0 16px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    animation: fadeIn 0.2s ease;
}

.file-thumb {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.file-icon {
    font-size: 24px;
    line-height: 1;
}

.file-info {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-size: 13px;
    color: var(--text-primary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 11px;
    color: var(--text-muted);
}

.file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color var(--transition);
}

.file-remove:hover {
    color: var(--error);
}

/* Drag & Drop Overlay */
.chat-area.drag-over {
    position: relative;
}

.chat-area.drag-over::after {
    content: '📎 Datei hier ablegen';
    position: absolute;
    inset: 0;
    background: rgba(233, 69, 96, 0.1);
    border: 2px dashed var(--accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--accent);
    z-index: 50;
    pointer-events: none;
}

/* Expression Lightbox */
.expression-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: fadeIn 0.2s ease;
}

.lightbox-image-wrap {
    position: relative;
    display: inline-block;
}

.expression-lightbox img {
    max-width: 85vw;
    max-height: 85vh;
    border-radius: var(--radius-lg);
    border: 3px solid var(--accent);
    box-shadow: 0 8px 40px rgba(233, 69, 96, 0.3);
    object-fit: contain;
    display: block;
}

.lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 40px;
    height: 40px;
    background: var(--accent);
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 710;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: background 0.2s, transform 0.15s;
}

.lightbox-close:hover {
    background: var(--accent-hover, #d63352);
    transform: scale(1.15);
}

@media (max-width: 768px) {
    .lightbox-close {
        top: -12px;
        right: -12px;
        width: 44px;
        height: 44px;
        font-size: 26px;
    }
}

/* Expression klickbar (Lightbox) – Hover bereits über .ai-expr-float:hover definiert */

/* Prompt Actions */
.prompt-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* =========================================================================
   EXPRESSIONS TAB
   ========================================================================= */

.expressions-header {
    margin-bottom: 20px;
}

.expressions-intro {
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.expressions-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.expressions-danger-zone {
    margin-top: 32px;
    padding: 16px 20px;
    border: 1px dashed rgba(220,38,38,0.3);
    border-radius: var(--radius);
    background: rgba(220,38,38,0.05);
}
.expressions-danger-zone h4 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.expressions-danger-zone p {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.expressions-status {
    display: flex;
    gap: 16px;
    padding: 10px 14px;
    background: var(--surface-lighter, rgba(255,255,255,0.05));
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-learned {
    color: var(--success, #4CAF50);
}

.status-unlearned {
    color: var(--warning, #ff9800);
}

.expressions-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.expr-grid-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.expr-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--surface-lighter, rgba(255,255,255,0.03));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: border-color 0.2s ease;
}

.expr-card:hover {
    border-color: var(--accent);
}

.expr-card.expr-learned {
    border-left: 3px solid var(--success, #4CAF50);
}

.expr-card.expr-unlearned {
    border-left: 3px solid var(--warning, #ff9800);
    opacity: 0.8;
}

.expr-card-img {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent);
}

.expr-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.expr-card-info {
    flex: 1;
    min-width: 0;
}

.expr-card-info strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.expr-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 4px 0;
    line-height: 1.4;
}

.expr-desc.expr-unknown {
    color: var(--warning, #ff9800);
    font-style: italic;
}

.expr-use {
    font-size: 0.8rem;
    color: var(--accent);
    margin: 2px 0;
}

.expr-date {
    font-size: 0.75rem;
    color: var(--text-tertiary, rgba(255,255,255,0.3));
}

.expr-card-actions {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: 4px;
}
.expr-delete-btn {
    background: transparent;
    border: 1px solid var(--error);
    color: var(--error);
    font-size: 14px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    min-width: 30px;
}
.expr-delete-btn:hover {
    background: var(--error);
    color: #fff;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
}

@media (max-width: 768px) {
    .expr-card {
        flex-wrap: wrap;
    }
    
    .expr-card-img {
        width: 50px;
        height: 50px;
    }
    
    .expr-card-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .settings-tabs {
        flex-wrap: wrap;
    }
}

/* Streaming Cursor */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--accent);
    margin-left: 2px;
    animation: blink 0.7s infinite;
    vertical-align: text-bottom;
}

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

/* Research Indicator */
.research-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.research-indicator svg {
    width: 14px;
    height: 14px;
}

/* -------------------------------------------------------------------------
   CHAT INPUT
   ------------------------------------------------------------------------- */
/* Save-Reminder (persistente Leiste über dem Input) */
.save-reminder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.1), rgba(233, 69, 96, 0.05));
    border-top: 1px solid rgba(233, 69, 96, 0.25);
    animation: slideDown 0.3s ease-out;
}

.save-reminder-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.save-reminder-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.save-reminder-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.save-reminder-btn:hover {
    background: var(--accent-hover, #d63352);
}

.save-reminder-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
}

.save-reminder-close:hover {
    color: var(--text-primary);
}

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

/* Save-Suggestion Highlight (beim Scrollen) */
.save-suggestion.save-highlight {
    box-shadow: 0 0 0 2px var(--accent), 0 4px 16px rgba(233, 69, 96, 0.3);
    transition: box-shadow 0.3s ease;
}

.chat-input-area {
    padding: 12px 16px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
}

.input-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
    transition: border-color var(--transition);
}

/* Obere Zeile: Upload-Button + Textarea */
.input-row-text {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    width: 100%;
}

/* Untere Zeile: Model-Selector + Action-Buttons */
.input-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    position: relative;
}

/* Desktop: Einzeilig (Rows nebeneinander, kompakt) */
@media (min-width: 769px) {
    .input-container {
        flex-direction: row;
        align-items: flex-end;
    }
    
    .input-row-text {
        flex: 1;
        min-width: 0;
    }
    
    .input-row-actions {
        flex-shrink: 0;
        width: auto;
    }
}

/* Model-Selector im Input-Bereich */
.model-selector-btn {
    position: relative;
    height: 36px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    flex-shrink: 0;
    padding: 0 10px;
    width: auto !important;
    cursor: pointer;
    transition: all var(--transition);
}

.model-selector-btn:hover {
    color: var(--accent);
    background: rgba(233, 69, 96, 0.1);
}

.model-selector-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.model-selector-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    min-width: 180px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 100;
}

.model-option {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    border-radius: var(--radius-sm);
    text-align: left;
    transition: background var(--transition);
}

.model-option:hover {
    background: rgba(233, 69, 96, 0.1);
}

.model-option.active {
    background: rgba(233, 69, 96, 0.15);
    border-left: 2px solid var(--accent);
}

.model-option-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.model-option-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

#file-upload-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    flex-shrink: 0;
}

#file-upload-btn:hover {
    color: var(--accent);
    background: rgba(233, 69, 96, 0.1);
}

.input-container:focus-within {
    border-color: var(--accent);
}

#message-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 4px 0;
    min-height: 24px;
    max-height: 200px;
    resize: none;
    font-size: 15px;
    line-height: 1.5;
}

#message-input:focus {
    border: none;
    outline: none;
}

.input-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.input-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
}

.btn-send {
    background: var(--accent);
    color: var(--text-inverse);
}

.btn-send:hover {
    background: var(--accent-hover);
}

.btn-send:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.btn-send-speak {
    background: var(--accent);
    color: var(--text-inverse);
    opacity: 0.8;
    position: relative;
}

.btn-send-speak:hover {
    background: var(--accent-hover);
    opacity: 1;
}

.btn-send-speak:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    opacity: 0.5;
}

.btn-send-speak.auto-tts-active {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--accent);
}

/* -------------------------------------------------------------------------
   SETTINGS PANEL
   ------------------------------------------------------------------------- */
.settings-panel {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-container {
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.settings-header h2 {
    font-size: 20px;
}

.settings-header .btn-icon {
    font-size: 24px;
    width: 36px;
    height: 36px;
}

.settings-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    gap: 0;
}

/* Avatar Upload (Profil-Tab) */
.profile-section h3 {
    margin-bottom: 16px;
}

.avatar-upload-area {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.avatar-preview:hover {
    border-color: var(--accent);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* User Avatar im Chat */
.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
}

.tab-btn {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}

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

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
}

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

.tab-content {
    display: none;
}

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

.settings-editor {
    width: 100%;
    min-height: 300px;
    margin-bottom: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
}

/* Konnektoren (MCP) */
#tab-connectors {
    overflow-y: auto;
    max-height: calc(85vh - 140px);
    padding-right: 4px;
}

.connectors-intro h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.connectors-bridge-status {
    font-size: 13px;
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.connectors-bridge-ok {
    background: rgba(46, 204, 113, 0.12);
    color: var(--text-primary);
    border: 1px solid rgba(46, 204, 113, 0.35);
}

.connectors-bridge-warn {
    background: rgba(241, 196, 15, 0.12);
    color: var(--text-primary);
    border: 1px solid rgba(241, 196, 15, 0.4);
}

.connectors-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}

.connectors-search {
    flex: 1;
    min-width: 160px;
}

.connectors-category-select {
    min-width: 180px;
}

.connector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.connector-grid.connectors-grid-busy {
    opacity: 0.72;
    transition: opacity 0.2s ease;
}

.connector-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.connector-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.connector-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: contain;
    background: var(--bg-secondary);
}

.connector-card-main {
    flex: 1;
    min-width: 0;
}

.connector-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.connector-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.connector-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.connector-status-ok {
    background: #2ecc71;
}

.connector-status-active {
    background: #2ecc71;
    box-shadow: 0 0 6px rgba(46, 204, 113, 0.6);
}

.connector-status-setup {
    background: #f1c40f;
}

.connector-status-clickable {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.connector-status-clickable:hover,
.connector-status-clickable:focus-visible {
    transform: scale(1.6);
    box-shadow: 0 0 8px rgba(241, 196, 15, 0.7);
    outline: none;
}

.connector-status-planned {
    background: #95a5a6;
}

.connector-setup-hint {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid #f1c40f;
    border-radius: var(--radius);
    animation: connectorHintIn 0.2s ease;
}

@keyframes connectorHintIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.connector-setup-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.connector-btn-setup-chat {
    font-size: 0.78rem;
}

.connector-oauth-url-preview {
    word-break: break-all;
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    max-height: 4.5em;
    overflow-y: auto;
}

.connector-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.connector-card-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.connector-card-actions {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
}

.connector-card-actions .btn-sm {
    min-width: 40px;
    padding: 6px 12px;
}

.connector-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.connector-modal-overlay.hidden {
    display: none;
}

.connector-modal {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.connector-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.connector-modal-header h3 {
    margin: 0;
    font-size: 17px;
}

.connector-modal-body {
    padding: 16px 18px;
}

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

.memory-view {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    max-height: 250px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.costs-grid {
    display: grid;
    gap: 16px;
}

.cost-card {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-sm);
}

.cost-card h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.cost-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-secondary);
}

.cost-detail {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.cost-card-total {
    border-left: 3px solid var(--accent-secondary);
}

.cost-eur-small {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-muted);
}

.cost-daily-list {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.cost-daily-list h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.cost-day-row {
    display: grid;
    grid-template-columns: 80px 120px 1fr;
    grid-template-rows: auto auto;
    gap: 2px 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    align-items: baseline;
}

.cost-day-row:last-child {
    border-bottom: none;
}

.cost-day-date {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    grid-row: 1 / 3;
    align-self: center;
}

.cost-day-amount {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-secondary);
}

.cost-day-eur {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 6px;
}

.cost-day-details {
    font-size: 12px;
    color: var(--text-muted);
    grid-column: 2;
}

.cost-day-models {
    grid-column: 3;
    grid-row: 1 / 3;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-self: center;
}

.cost-model-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    white-space: nowrap;
}

@media (max-width: 600px) {
    .cost-day-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }
    .cost-day-date {
        grid-row: 1;
        grid-column: 1;
    }
    .cost-day-amount {
        grid-row: 1;
        grid-column: 2;
        text-align: right;
    }
    .cost-day-details {
        grid-column: 1 / -1;
    }
    .cost-day-models {
        grid-column: 1 / -1;
        grid-row: 3;
    }
}

/* Push Notifications Tab */
.push-status {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 15px;
}

.push-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.push-info {
    background: rgba(78, 204, 163, 0.08);
    border-radius: 12px;
    padding: 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    line-height: 1.6;
}

.push-info p {
    margin-bottom: 8px;
    color: rgba(255,255,255,0.8);
}

.push-info ul {
    padding-left: 20px;
    margin: 0;
}

.push-info li {
    margin-bottom: 4px;
}

.settings-hint {
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    margin-bottom: 16px;
}

/* Backups Tab */
.backup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.backup-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.backup-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.backup-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.backup-date {
    font-size: 14px;
    color: var(--text-primary);
}

.backup-size {
    font-size: 12px;
    color: var(--text-muted);
}

/* -------------------------------------------------------------------------
   IDENTITÄTS-BRIEF TAB
   ------------------------------------------------------------------------- */

.identity-section {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.identity-section:last-child {
    border-bottom: none;
}

.identity-section h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.identity-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.identity-letter-display {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.7;
}

.identity-letter-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
}

.identity-trigger-status {
    margin-left: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.identity-archive-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.identity-archive-table th,
.identity-archive-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.identity-archive-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.identity-archive-table td {
    color: var(--text-primary);
}

.identity-archive-table tr:hover td {
    background: var(--bg-hover);
}

.prompt-archive-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.prompt-archive-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    transition: border-color 0.15s;
}

.prompt-archive-item:hover {
    border-color: var(--accent);
}

.prompt-archive-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.prompt-archive-preview {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-bottom: 6px;
}

.prompt-archive-actions {
    display: flex;
    gap: 6px;
}

.identity-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.identity-letter-modal .modal-content {
    max-height: 80vh;
    overflow-y: auto;
}

.modal-wide {
    max-width: 700px;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    margin: 0;
}

/* -------------------------------------------------------------------------
   MODAL
   ------------------------------------------------------------------------- */
.modal {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.modal-content h3 {
    margin-bottom: 16px;
}

.save-preview {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* -------------------------------------------------------------------------
   LOADING / SPINNER
   ------------------------------------------------------------------------- */
.loading-dots {
    display: inline-flex;
    gap: 4px;
    padding: 8px 0;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* -------------------------------------------------------------------------
   SETUP WIZARD
   ------------------------------------------------------------------------- */
#setup-chat-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, #0d1b3e 100%);
    padding: 16px;
}

.setup-wizard {
    width: 100%;
    max-width: 680px;
    height: min(92vh, 800px);
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 58, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    overflow: hidden;
    animation: wizardAppear 0.5s ease;
}

@keyframes wizardAppear {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.setup-wizard-header {
    padding: 32px 28px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(233, 69, 96, 0.06) 0%, transparent 100%);
    flex-shrink: 0;
}

.setup-wizard-icon {
    font-size: 40px;
    margin-bottom: 8px;
    animation: pulse 2s ease-in-out infinite;
}

.setup-wizard-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.setup-wizard-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 420px;
    margin: 0 auto 16px;
}

.setup-wizard-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
}

.setup-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.setup-progress-fill {
    height: 100%;
    width: 8%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: 2px;
    transition: width 0.8s ease;
}

.setup-progress-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
}

/* --- Chat-Bereich --- */
.setup-wizard-chat {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 8px;
    scroll-behavior: smooth;
}

.setup-wizard-chat .message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
    max-width: 100%;
}

.setup-wizard-chat .message.user {
    flex-direction: row-reverse;
}

.setup-wizard-chat .message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.65;
    max-width: 85%;
    word-wrap: break-word;
}

.setup-wizard-chat .message.assistant .message-content {
    background: var(--bg-chat-ai);
    border-bottom-left-radius: 4px;
}

.setup-wizard-chat .message.user .message-content {
    background: var(--bg-chat-user);
    color: var(--text-inverse);
    border-bottom-right-radius: 4px;
}

.setup-wizard-chat .message-content p { margin-bottom: 10px; }
.setup-wizard-chat .message-content p:last-child { margin-bottom: 0; }
.setup-wizard-chat .message-content strong { font-weight: 600; color: var(--text-primary); }
.setup-wizard-chat .message-content em { font-style: italic; color: var(--text-secondary); }
.setup-wizard-chat .message-content ul,
.setup-wizard-chat .message-content ol { margin: 6px 0; padding-left: 20px; }
.setup-wizard-chat .message-content li { margin-bottom: 3px; }
.setup-wizard-chat .message-content code {
    background: rgba(0,0,0,0.25);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* --- Input-Bereich --- */
.setup-wizard-input-area {
    padding: 12px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.setup-wizard-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px 8px 8px 16px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.setup-wizard-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

.setup-wizard-textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 120px;
    min-height: 24px;
    padding: 4px 0;
}

.setup-wizard-textarea::placeholder {
    color: var(--text-muted);
}

.setup-wizard-send {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: var(--text-inverse);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), transform var(--transition);
}

.setup-wizard-send:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.setup-wizard-send:active {
    transform: scale(0.95);
}

.setup-wizard-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.setup-wizard-send svg {
    margin-left: 2px;
}

/* Loading dots im Wizard */
.setup-wizard-chat .loading-dots {
    display: inline-flex;
    gap: 5px;
    padding: 4px 0;
}

.setup-wizard-chat .loading-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: dotPulse 1.4s ease-in-out infinite;
}

.setup-wizard-chat .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.setup-wizard-chat .loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Tool-Status Anzeige */
.setup-wizard-chat .tool-indicator {
    font-size: 12px;
    color: var(--text-muted);
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Responsive */
@media (max-width: 600px) {
    #setup-chat-screen { padding: 0; }

    .setup-wizard {
        max-width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }

    .setup-wizard-header {
        padding: 24px 20px 16px;
    }

    .setup-wizard-title { font-size: 20px; }
    .setup-wizard-subtitle { font-size: 13px; }

    .setup-wizard-chat { padding: 16px 12px 8px; }

    .setup-wizard-chat .message-content {
        max-width: 92%;
        font-size: 14px;
    }

    .setup-wizard-input-area {
        padding: 8px 12px 12px;
    }
}

/* -------------------------------------------------------------------------
   SCROLLBAR
   ------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* -------------------------------------------------------------------------
   DESKTOP (> 768px)
   ------------------------------------------------------------------------- */
@media (min-width: 769px) {
    #main-app {
        display: grid;
        grid-template-rows: var(--header-height) 1fr;
        grid-template-columns: var(--sidebar-width) 1fr;
    }
    
    .app-header {
        grid-column: 1 / -1;
    }
    
    .sidebar {
        position: relative;
        top: 0;
        transform: translateX(0);
    }
    
    #sidebar-toggle {
        display: none;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    #header-conv-title {
        max-width: 400px;
    }

    /* Desktop Expression-Größen (inline float) */
    .ai-expr-float.expr-normal {
        width: 240px;
    }

    .ai-expr-float.expr-gross {
        width: 320px;
    }

    .ai-expr-float.expr-kompakt {
        width: 160px;
    }

    .ai-expr-float:not(.expr-normal):not(.expr-gross):not(.expr-kompakt) {
        width: 240px;
    }
}

/* Große Desktops (> 1200px) */
@media (min-width: 1201px) {
    .ai-expr-float.expr-normal {
        width: 260px;
    }

    .ai-expr-float.expr-gross {
        width: 360px;
    }

    .ai-expr-float.expr-kompakt {
        width: 180px;
    }

    .ai-expr-float:not(.expr-normal):not(.expr-gross):not(.expr-kompakt) {
        width: 260px;
    }
}

/* -------------------------------------------------------------------------
   MOBILE TWEAKS (< 768px)
   ------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .message-actions {
        opacity: 1;
    }
    
    .reaction-picker {
        opacity: 1;
    }
    
    /* Mobile: Emoji-Picker als Bottom-Sheet */
    .reaction-panel {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-height: 55vh;
        border-radius: 16px 16px 0 0;
        z-index: 1100;
        animation: slideUpPanel 0.25s ease-out;
        padding: 12px 12px 20px;
    }
    
    .reaction-panel::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: 0 auto 10px;
    }
    
    .reaction-btn {
        font-size: 22px;
        width: 40px;
        height: 40px;
    }
    
    .emoji-row {
        gap: 2px;
    }
    
    .reaction-trigger {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }
    
    .chat-messages {
        padding: 12px 8px;
    }
    
    .message {
        gap: 8px;
    }
    
    /* Mobile Avatare – gleiche Größe wie Desktop */
    .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* Mobile: Expression-Bild – Standard = kompakt (55%), Toggle → volle Breite */
    .ai-expr-float {
        float: none;
        width: 55% !important;
        margin: 0 0 12px 0;
    }

    .ai-expr-float.expr-kompakt {
        width: 40% !important;
    }

    .ai-expr-float.expr-gross {
        width: 70% !important;
    }

    /* Original-Größe wenn Toggle aktiv */
    body.full-images .ai-expr-float {
        width: 100% !important;
    }

    body.full-images .ai-expr-float.expr-kompakt {
        width: 70% !important;
    }

    body.full-images .ai-expr-float.expr-gross {
        width: 100% !important;
    }

    /* Sidebar-Toggle – deutlich sichtbar als Menü/Zurück-Button */
    #sidebar-toggle {
        width: 44px;
        height: 44px;
        min-width: 44px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: var(--accent);
        color: white;
        border-radius: var(--radius-sm);
    }

    #sidebar-toggle:hover,
    #sidebar-toggle:active {
        background: var(--accent-hover);
    }

    #sidebar-toggle svg {
        width: 26px;
        height: 26px;
    }

    /* Header */
    .app-header {
        padding: 0 8px;
        gap: 6px;
    }

    .header-title {
        font-size: 15px;
        min-width: 0;
    }

    #header-conv-title {
        max-width: 110px;
    }

    .header-actions {
        gap: 2px;
    }

    /* Nachrichten-Abstand für große Avatare */
    .message {
        align-items: flex-start;
    }

    .settings-container {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .settings-tabs {
        font-size: 13px;
        padding: 0 8px;
    }

    .tab-btn {
        padding: 10px 8px;
        font-size: 12px;
    }

    .welcome-ai-img {
        width: 120px;
        height: 120px;
    }
    
    .welcome-content h2 {
        font-size: 24px;
    }

    .file-preview {
        padding: 0 8px;
    }

    .file-preview-item {
        padding: 6px 8px;
    }

    .file-name {
        max-width: 100px;
    }

    /* Avatar-Upload auf Mobile */
    .avatar-upload-area {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Input-Bereich Mobile: Textarea oben, Buttons unten */
    .chat-input-area {
        padding: 8px 10px 12px;
    }

    .input-container {
        flex-direction: column;
        gap: 6px;
        padding: 8px;
    }

    .input-row-text {
        display: flex;
        align-items: flex-end;
        gap: 4px;
        width: 100%;
    }

    #message-input {
        font-size: 16px; /* Verhindert iOS-Zoom beim Fokus */
    }

    .input-row-actions {
        display: flex;
        align-items: center;
        gap: 2px;
        width: 100%;
        padding-top: 2px;
        border-top: 1px solid var(--border);
    }

    .input-row-actions .model-selector-btn {
        margin-right: auto; /* Modell-Selector nach links, Aktions-Buttons nach rechts */
    }

    .input-actions {
        margin-left: auto;
    }
}

/* -------------------------------------------------------------------------
   SAFE AREA (iPhone Notch)
   ------------------------------------------------------------------------- */
@supports (padding: env(safe-area-inset-bottom)) {
    .chat-input-area {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    
    .sidebar-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}

/* Tool-Use Indikator */
.tool-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 8px 0 8px 72px;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tool-indicator-active {
    opacity: 1;
}

.tool-indicator-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    animation: tool-dot-pulse 1.2s ease-in-out infinite;
}

@keyframes tool-dot-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

@media (max-width: 480px) {
    .tool-indicator {
        margin-left: 12px;
        margin-right: 12px;
        font-size: 0.8rem;
    }
}

/* Ghost-Tool-Hinweis (Gemini hat Tool angekündigt aber nicht genutzt) */
.ghost-tool-notice {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.ghost-tool-notice strong {
    color: #eab308;
}

/* =========================================================================
   VOICE RECORDING
   ========================================================================= */

/* Mikrofon-Button: Aufnahme aktiv */
#voice-btn.recording {
    color: #ef4444;
    animation: voice-pulse 1s ease-in-out infinite;
}

#voice-btn.recording svg path {
    fill: #ef4444;
}

#voice-btn.transcribing {
    color: var(--accent, #a78bfa);
    opacity: 0.7;
    pointer-events: none;
}

#voice-btn.transcribing svg path {
    fill: var(--accent, #a78bfa);
}

@keyframes voice-pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1); 
    }
    50% { 
        opacity: 0.6; 
        transform: scale(1.15); 
    }
}

/* Recording Timer */
.recording-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #ef4444;
    font-weight: 500;
    animation: recording-blink 1.5s ease-in-out infinite;
}

@keyframes recording-blink {
    0%, 100% { border-color: rgba(239, 68, 68, 0.2); }
    50% { border-color: rgba(239, 68, 68, 0.5); }
}

/* Voice Preview (nach Aufnahme: Absenden oder Verwerfen) */
.voice-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    margin-bottom: 8px;
    gap: 12px;
}

.voice-preview-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-primary, #e6edf3);
}

.voice-preview-icon {
    font-size: 1.2rem;
}

.voice-preview-duration {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #a5b4fc;
}

.voice-preview-model {
    font-size: 0.78rem;
    color: var(--text-secondary, #8b949e);
}

.voice-preview-actions {
    display: flex;
    gap: 8px;
}

.voice-preview-cancel,
.voice-preview-send,
.voice-preview-send-speak {
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.voice-preview-cancel {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.voice-preview-cancel:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

.voice-preview-send {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.voice-preview-send:hover {
    background: rgba(99, 102, 241, 0.4);
    transform: scale(1.1);
}

.voice-preview-send-speak {
    background: rgba(233, 69, 96, 0.2);
    color: var(--accent, #e94560);
}

.voice-preview-send-speak:hover {
    background: rgba(233, 69, 96, 0.4);
    transform: scale(1.1);
}

/* =========================================================================
   GENERATED IMAGES
   ========================================================================= */

/* Inline-Bilder im Chat (Markdown ![alt](url)) */
.chat-inline-image {
    max-width: 320px;
    max-height: 320px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid var(--border, rgba(255,255,255,0.1));
    display: block;
    margin: 8px 0;
}

.chat-inline-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.generated-image-wrap {
    margin: 12px 0;
    display: inline-block;
    max-width: 100%;
}

.generated-image {
    max-width: 320px;
    max-height: 320px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid var(--border, rgba(255,255,255,0.1));
}

.generated-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.generated-image-label {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
    font-style: italic;
}

/* ===== Generierte Videos ===== */
.generated-video-wrap {
    margin: 12px 0;
    display: inline-block;
    max-width: 100%;
}

.generated-video {
    max-width: 480px;
    width: 100%;
    border-radius: 12px;
    border: 2px solid var(--border, rgba(255,255,255,0.1));
    background: #000;
}

.generated-video-label {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
    font-style: italic;
}

@media (max-width: 768px) {
    .generated-video {
        max-width: 100%;
    }
}

/* ===== Toast-Benachrichtigungen ===== */
.app-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
}
.app-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.app-toast-info {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.app-toast-error {
    background: rgba(231, 76, 60, 0.9);
    color: #fff;
}
.app-toast-success {
    background: rgba(78, 204, 163, 0.9);
    color: #fff;
}

/* ===== Onboarding Hint ===== */
.onboarding-hint {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1500;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.onboarding-hint.visible {
    opacity: 1;
    transform: translateY(0);
}
.onboarding-hint-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--accent, #6c5ce7) 0%, #a29bfe 100%);
    color: #fff;
    font-size: 0.95rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.onboarding-hint-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.onboarding-hint-text {
    flex: 1;
}
.onboarding-hint-btn {
    flex-shrink: 0;
    padding: 8px 18px;
    border: 2px solid #fff;
    border-radius: var(--radius, 8px);
    background: transparent;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}
.onboarding-hint-btn:hover {
    background: rgba(255,255,255,0.2);
}
.onboarding-hint-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.onboarding-hint-close:hover {
    background: rgba(255,255,255,0.35);
}

/* ===== Live Voice Overlay ===== */
#live-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 20, 0.97);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#live-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.live-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}
.live-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.live-badge {
    color: #ef4444;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    animation: live-blink 1.5s ease-in-out infinite;
}
@keyframes live-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.live-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: all 0.2s;
}
.live-close:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Avatar + Pulse */
.live-visual {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.live-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.15);
    z-index: 2;
    position: relative;
}
.live-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.live-pulse {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    z-index: 1;
    transition: all 0.3s ease;
}
.live-pulse.listening {
    box-shadow: 0 0 0 0 rgba(78, 204, 163, 0.5);
    animation: pulse-listen 2s ease-in-out infinite;
}
.live-pulse.speaking {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5);
    animation: pulse-speak 0.8s ease-in-out infinite;
}
@keyframes pulse-listen {
    0% { box-shadow: 0 0 0 0 rgba(78, 204, 163, 0.4); }
    50% { box-shadow: 0 0 0 20px rgba(78, 204, 163, 0); }
    100% { box-shadow: 0 0 0 0 rgba(78, 204, 163, 0); }
}
@keyframes pulse-speak {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5); transform: scale(1); }
    50% { box-shadow: 0 0 0 15px rgba(139, 92, 246, 0); transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); transform: scale(1); }
}

/* Status */
.live-status {
    font-size: 1rem;
    color: var(--text-secondary);
    min-height: 24px;
}
.live-status-connecting { color: var(--text-secondary); }
.live-status-listening { color: #4ecaa3; }
.live-status-speaking { color: #8b5cf6; }
.live-status-error { color: #ef4444; }
.live-status-warning { color: #f59e0b; }
.live-status-disconnected { color: var(--text-secondary); }

/* Transkription */
.live-transcript {
    width: 100%;
    max-height: 150px;
    overflow-y: auto;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: left;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.06);
    min-height: 60px;
}
.live-transcript:empty::before {
    content: 'Transkription erscheint hier…';
    color: rgba(255,255,255,0.2);
    font-style: italic;
}
.live-transcript-ai {
    margin-bottom: 8px;
    color: #c4b5fd;
}
.live-transcript-user {
    margin-bottom: 8px;
    color: #94a3b8;
}

/* Controls */
.live-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 8px;
}
.live-mute-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.live-mute-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}
.live-end-btn {
    padding: 12px 32px;
    border-radius: 999px;
    border: none;
    background: #ef4444;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.live-end-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Live-Button im Header */
.live-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.05em;
}
.live-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.03);
}
.live-btn .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: live-blink 1.5s ease-in-out infinite;
}

/* Live-Button Wrapper mit Provider-Menü */
.live-btn-wrapper {
    position: relative;
}
.live-provider-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary, #1a1a2e);
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    border-radius: 12px;
    padding: 6px;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 100;
    flex-direction: column;
    gap: 4px;
}
.live-provider-menu.active {
    display: flex;
}
.live-provider-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
    width: 100%;
}
.live-provider-option:hover {
    background: rgba(239, 68, 68, 0.12);
}
.live-provider-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary, #e2e8f0);
}
.live-provider-desc {
    font-size: 0.72rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.3;
}

/* Live Overlay Provider-Badge */
.live-badge-grok {
    color: #a855f7 !important;
}
.live-tools-indicator {
    text-align: center;
    margin-top: 8px;
}
.live-tools-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.live-status-tool {
    color: #a855f7 !important;
}

/* -------------------------------------------------------------------------
   E-MAIL SETTINGS
   ------------------------------------------------------------------------- */

.email-settings-header {
    margin-bottom: 16px;
}

.email-settings-header h3 {
    margin: 0 0 4px;
}

.email-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.email-account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary, rgba(255,255,255,0.05));
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 10px;
    transition: opacity 0.2s;
}

.email-account-card.disabled {
    opacity: 0.5;
}

.email-account-info {
    flex: 1;
    min-width: 0;
}

.email-account-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.email-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.email-status-dot.active {
    background: #22c55e;
}

.email-status-dot.inactive {
    background: #6b7280;
}

.email-account-detail {
    font-size: 13px;
    color: var(--text-secondary, rgba(255,255,255,0.6));
    margin-top: 2px;
}

.email-account-server {
    font-size: 12px;
    color: var(--text-secondary, rgba(255,255,255,0.4));
    margin-top: 1px;
}

.email-account-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.email-action-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
    border-radius: 8px;
}

.email-add-section {
    margin-bottom: 16px;
}

.email-form {
    padding: 16px;
    background: var(--bg-secondary, rgba(255,255,255,0.03));
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 10px;
}

.email-form h4 {
    margin: 0 0 14px;
    font-size: 16px;
}

.email-form .form-group {
    margin-bottom: 12px;
}

.email-form label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: var(--text-secondary, rgba(255,255,255,0.7));
}

.email-form input,
.email-form select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary, rgba(0,0,0,0.3));
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    border-radius: 8px;
    color: var(--text-primary, #fff);
    font-size: 14px;
    box-sizing: border-box;
}

.email-form input:focus,
.email-form select:focus,
.email-form textarea:focus {
    border-color: var(--accent, #8b5cf6);
    outline: none;
}

.email-signature-field {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary, rgba(0,0,0,0.2));
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 8px;
    color: var(--text-primary, #fff);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.email-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.email-test-result {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    font-size: 13px;
}

.text-success {
    color: #22c55e;
}

.text-error {
    color: #ef4444;
}

/* -------------------------------------------------------------------------
   CONTEXT TOGGLE (Privat / Business)
   ------------------------------------------------------------------------- */

.context-toggle {
    display: flex;
    gap: 0;
    background: var(--bg-secondary, rgba(255,255,255,0.05));
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 10px;
}

.ctx-btn {
    flex: 1;
    padding: 7px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary, rgba(255,255,255,0.5));
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ctx-btn.active {
    background: var(--accent, #8b5cf6);
    color: #fff;
    box-shadow: 0 1px 4px rgba(139, 92, 246, 0.3);
}

.ctx-btn:not(.active):hover {
    color: var(--text-primary, rgba(255,255,255,0.8));
    background: rgba(255,255,255,0.08);
}

/* -------------------------------------------------------------------------
   STOPP-BUTTON (während Streaming)
   ------------------------------------------------------------------------- */

.btn-send.btn-stop {
    background: #ef4444 !important;
    color: white !important;
    border-color: #ef4444 !important;
    animation: pulse-stop 1.5s infinite;
}

.btn-send.btn-stop:hover {
    background: #dc2626 !important;
}

@keyframes pulse-stop {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* -------------------------------------------------------------------------
   EDIT+RESEND BUTTON (an letzter User-Nachricht)
   ------------------------------------------------------------------------- */

.msg-edit-btn {
    position: absolute;
    bottom: -4px;
    left: -8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: var(--bg-primary, #1a1a2e);
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    padding: 0;
}

.message.user:hover .msg-edit-btn {
    opacity: 1;
}

.msg-edit-btn:hover {
    color: var(--accent, #8b5cf6);
    border-color: var(--accent, #8b5cf6);
    background: rgba(139, 92, 246, 0.1);
}

.message.user {
    position: relative;
}

/* -------------------------------------------------------------------------
   CONTEXT WINDOWING – Archivierte Nachrichten + Trennbalken
   ------------------------------------------------------------------------- */
.archived-msg {
    opacity: 0.55;
    transition: opacity 0.2s;
}
.archived-msg:hover {
    opacity: 0.85;
}
.archive-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px auto;
    max-width: 800px;
    color: var(--text-secondary, #888);
    font-size: 0.78rem;
    user-select: none;
}
.archive-separator::before,
.archive-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border, #333);
}
.archive-separator span {
    white-space: nowrap;
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--bg-secondary, #1a1a2e);
    border: 1px solid var(--border, #333);
}

/* -------------------------------------------------------------------------
   TOOL-BADGES (persistente Info über genutzte Tools)
   ------------------------------------------------------------------------- */

.tool-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
}
.token-badge { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.15); }
.token-badge .token-up { color: #f87171; font-weight: 600; }
.token-badge .token-down { color: #4ade80; font-weight: 600; }
.token-badge.token-caution { background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.25); color: rgba(251, 191, 36, 0.7); }
.token-badge.token-warn { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.25); color: rgba(248, 113, 113, 0.7); }
.token-badge .prefetch-cost { opacity: 0.65; font-size: 0.9em; cursor: help; }
.profiler-badge { background: rgba(168, 85, 247, 0.08); border-color: rgba(168, 85, 247, 0.15); cursor: help; }
.video-badge { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.2); color: rgba(147, 197, 253, 0.9); cursor: help; }
.video-badge.video-error { background: rgba(248, 113, 113, 0.15); border-color: rgba(248, 113, 113, 0.3); color: rgba(248, 113, 113, 0.9); cursor: help; }

/* -------------------------------------------------------------------------
   CODE REVIEW BANNER – Status-Anzeige für Bridge/Claude Code
   ------------------------------------------------------------------------- */

.cr-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    animation: crBannerSlideIn 0.3s ease-out;
    z-index: 10;
    position: relative;
    flex-shrink: 0;
}

@keyframes crBannerSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.cr-banner-submitted, .cr-banner-pending {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.06));
    border-left: 3px solid #3b82f6;
    color: #93c5fd;
}

.cr-banner-processing {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.06));
    border-left: 3px solid #f59e0b;
    color: #fcd34d;
}

.cr-banner-completed, .cr-banner-delivered {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.06));
    border-left: 3px solid #22c55e;
    color: #86efac;
}

.cr-banner-failed {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.06));
    border-left: 3px solid #ef4444;
    color: #fca5a5;
}

.cr-banner-cancelled {
    background: linear-gradient(135deg, rgba(156, 163, 175, 0.12), rgba(156, 163, 175, 0.06));
    border-left: 3px solid #9ca3af;
    color: #d1d5db;
}

.cr-banner-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.cr-banner-text {
    flex: 1;
}

.cr-banner-time {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    opacity: 0.7;
    min-width: 40px;
    text-align: right;
}

.cr-banner-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
}

.cr-banner-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
}

.cr-banner-cancel {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: inherit;
    opacity: 0.8;
    cursor: pointer;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    transition: all 0.15s;
    white-space: nowrap;
}

.cr-banner-cancel:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.cr-banner-processing .cr-banner-icon {
    animation: crSpin 2s linear infinite;
}

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

/* =========================================================================
   Memory Search (Settings → Erinnerungen)
   ========================================================================= */

.memory-search-box {
    margin-bottom: 8px;
}

.memory-search-box h3 {
    margin-bottom: 10px;
}

.memory-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.memory-search-row input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

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

.memory-search-row select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.memory-search-results {
    margin-top: 14px;
    max-height: 60vh;
    overflow-y: auto;
}

.memory-search-loading,
.memory-search-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.memory-search-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.mem-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}

.mem-card:hover {
    border-color: var(--accent);
}

.mem-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.mem-id {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    background: rgba(233, 69, 96, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: default;
}

.mem-badge {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mem-badge-ai {
    background: rgba(245, 166, 35, 0.15);
    color: var(--accent-secondary);
}

.mem-badge-user {
    background: rgba(99, 179, 237, 0.15);
    color: #63b3ed;
}

.mem-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.mem-content {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

.mem-context {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    border-left: 3px solid var(--border-light);
}

.mem-conv-title {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.mem-tags {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.mem-tag {
    font-size: 11px;
    padding: 1px 7px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
}

.mem-card-footer {
    display: flex;
    gap: 14px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.04);
    font-size: 12px;
    color: var(--text-muted);
}

/* Archiv-Chunks Header */
.archive-chunks-header {
    margin: 8px 16px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.archive-summary-label {
    padding: 10px 16px;
    background: var(--bg-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background var(--transition);
}
.archive-summary-label:hover { background: var(--bg-hover); }
.archive-chunks-list { padding: 0 12px 12px; }
.archive-chunk {
    padding: 10px 12px;
    margin-top: 8px;
    border-radius: var(--radius);
    background: var(--bg-primary);
    border: 1px solid var(--border);
}
.archive-chunk-header { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.archive-chunk-summary { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.4; }
.archive-chunk-expand { margin-top: 4px; }
.archive-chunk-messages { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.archive-msg { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; line-height: 1.4; }
.archive-msg-meta { font-weight: 500; color: var(--text-secondary); }

.delete-msg-btn {
    opacity: 0; transition: opacity var(--transition); background: none; border: none;
    cursor: pointer; font-size: 12px; padding: 2px 4px; color: var(--text-muted);
}
.message:hover .delete-msg-btn { opacity: 0.6; }
.delete-msg-btn:hover { opacity: 1 !important; color: var(--error); }
.archive-chunk-delete { font-size: 12px !important; }

/* Admin-Panel: Erinnerungen, Tagebuch, Selbstmodell */
.admin-browse-controls {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px;
}
.admin-browse-controls select, .admin-browse-controls input {
    padding: 6px 10px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg-primary); color: var(--text-primary); font-size: 13px;
}
.admin-browse-list { max-height: 70vh; overflow-y: auto; }
.admin-pager {
    display: flex; gap: 8px; align-items: center; justify-content: center;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.admin-pager button { padding: 4px 12px; font-size: 12px; }

/* Admin Memory/Diary Card */
.admin-card {
    padding: 12px; margin-bottom: 8px; border-radius: var(--radius);
    background: var(--bg-secondary); border: 1px solid var(--border); position: relative;
}
.admin-card-header {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin-bottom: 6px; font-size: 12px; color: var(--text-muted);
}
.admin-card-header .mem-badge { font-size: 11px; padding: 1px 6px; border-radius: 8px; }
.admin-card-content {
    font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
    color: var(--text-primary); margin-bottom: 6px;
}
.admin-card-meta {
    display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); flex-wrap: wrap;
}
.admin-card-actions {
    display: flex; gap: 6px; margin-top: 8px;
}
.admin-card-actions button {
    padding: 3px 10px; font-size: 11px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-primary);
    color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.admin-card-actions button:hover { background: var(--bg-hover); }
.admin-card-actions button.btn-danger { color: var(--error); border-color: var(--error); }
.admin-card-actions button.btn-danger:hover { background: var(--error); color: #fff; }
.admin-card-actions button.btn-save { color: var(--accent); border-color: var(--accent); }
.admin-card-actions button.btn-save:hover { background: var(--accent); color: #fff; }

.admin-card textarea {
    width: 100%; min-height: 80px; padding: 8px; border-radius: var(--radius);
    border: 1px solid var(--accent); background: var(--bg-primary); color: var(--text-primary);
    font-size: 13px; line-height: 1.5; resize: vertical; font-family: inherit;
}
.admin-card .edit-row { margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.admin-card .edit-row label { font-size: 11px; color: var(--text-muted); }
.admin-card .edit-row input { width: 60px; padding: 3px 6px; font-size: 12px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-primary); color: var(--text-primary); }

/* Selbstmodell */
.sm-section { margin-bottom: 16px; }
.sm-section h4 { font-size: 14px; margin-bottom: 6px; color: var(--text-primary); }
.sm-section .sm-desc { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.sm-field-string textarea {
    width: 100%; min-height: 60px; padding: 8px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-primary); color: var(--text-primary);
    font-size: 13px; line-height: 1.5; resize: vertical; font-family: inherit;
}
.sm-array-item {
    display: flex; gap: 6px; align-items: flex-start; margin-bottom: 4px; font-size: 13px;
}
.sm-array-item input[type="text"] {
    flex: 1; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-primary); color: var(--text-primary); font-size: 13px;
}
.sm-array-item button {
    padding: 3px 8px; font-size: 11px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-primary); color: var(--text-muted);
    cursor: pointer;
}
.sm-array-item button:hover { color: var(--error); border-color: var(--error); }
.sm-add-btn {
    padding: 3px 10px; font-size: 11px; border-radius: var(--radius);
    border: 1px dashed var(--border); background: transparent; color: var(--text-muted);
    cursor: pointer; margin-top: 4px;
}
.sm-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Gelerntes Verhalten Karten */
.gv-card {
    padding: 8px 12px; margin-bottom: 6px; border-radius: var(--radius);
    background: var(--bg-secondary); border: 1px solid var(--border); font-size: 13px;
}
.gv-card-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;
}
.gv-card-header .gv-score {
    font-size: 12px; font-weight: 600; padding: 1px 6px;
    border-radius: 8px; background: var(--bg-primary);
}
.gv-card-header .gv-score.high { color: #4caf50; }
.gv-card-header .gv-score.mid { color: #ff9800; }
.gv-card-header .gv-score.low { color: var(--error); }
.gv-card-header .gv-status { font-size: 11px; color: var(--text-muted); }
.gv-card textarea {
    width: 100%; min-height: 40px; padding: 6px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-primary); color: var(--text-primary);
    font-size: 12px; resize: vertical; font-family: inherit;
}
.gv-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.gv-card-actions { display: flex; gap: 6px; margin-top: 6px; }

.sm-save-bar {
    position: sticky; bottom: 0; background: var(--bg-secondary); padding: 10px 0;
    border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: center;
}

/* Delegierte Aufträge */
.delegate-cost-summary {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius);
    background: var(--bg-secondary); border: 1px solid var(--border);
    font-size: 13px; font-weight: 600; color: var(--text-primary);
}
.delegate-card { position: relative; }
.delegate-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.delegate-card-header strong { font-size: 14px; }
.delegate-status { font-size: 12px; }
.delegate-card-meta {
    font-size: 11px; color: var(--text-muted); margin-bottom: 8px;
}
.delegate-details { margin-bottom: 6px; }
.delegate-details summary {
    cursor: pointer; font-size: 12px; color: var(--accent);
    user-select: none; padding: 2px 0;
}
.delegate-details summary:hover { text-decoration: underline; }
.delegate-prompt {
    font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
    background: var(--bg-primary); padding: 8px; border-radius: var(--radius);
    border: 1px solid var(--border); margin-top: 4px; max-height: 300px; overflow-y: auto;
}
.delegate-result {
    font-size: 13px; line-height: 1.6; background: var(--bg-primary);
    padding: 10px; border-radius: var(--radius); border: 1px solid var(--border);
    margin-top: 4px; max-height: 400px; overflow-y: auto;
}
.delegate-error {
    font-size: 12px; color: var(--error); margin: 4px 0;
}
.delegate-urls {
    font-size: 11px; color: var(--text-muted); margin: 2px 0;
    word-break: break-all;
}
.delegate-card-actions {
    display: flex; gap: 6px; margin-top: 8px;
}

/* =========================================================================
   GALERIE
   ========================================================================= */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.gallery-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}
.gallery-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.gallery-card-img-wrap {
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-tertiary);
}
.gallery-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.gallery-card:hover .gallery-card-img-wrap img {
    transform: scale(1.05);
}
.gallery-card-info {
    padding: 8px 10px;
}
.gallery-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.gallery-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    margin-bottom: 4px;
}
.gallery-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}
.gallery-tag {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
}
.gallery-card-id {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.6;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}
.gallery-card-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}
.gallery-card:hover .gallery-card-actions {
    opacity: 1;
}
.gallery-card-actions .btn {
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding: 0;
}
.gallery-card-actions .btn:hover {
    background: rgba(220,38,38,0.8);
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
}

/* -------------------------------------------------------------------------
   PREFETCH A/B TEST
   ------------------------------------------------------------------------- */
.prefetch-model-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; padding: 2px 8px; border-radius: 6px; background: var(--bg-tertiary); }
.prefetch-model-check input { accent-color: var(--accent); }
.prefetch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.prefetch-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.prefetch-card.prefetch-error { border-color: var(--error); opacity: 0.7; }
.prefetch-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.prefetch-card-header strong { font-size: 14px; }
.prefetch-cost { font-size: 15px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.cost-cheap { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.cost-ok { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.cost-warn { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.cost-expensive { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.prefetch-card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.dur-fast { color: #4ade80; }
.dur-ok { color: #fbbf24; }
.dur-slow { color: #f87171; }
.prefetch-reasoning { font-size: 12px; font-style: italic; color: var(--text-secondary); margin-bottom: 6px; padding: 6px 8px; background: var(--bg-tertiary); border-radius: 6px; }
.prefetch-motifs { font-size: 11px; color: var(--accent); margin-bottom: 6px; }
.prefetch-overlap { font-size: 11px; margin-bottom: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.overlap-tag { background: rgba(139, 92, 246, 0.15); color: #a78bfa; padding: 1px 6px; border-radius: 4px; }
.prefetch-error-msg { color: var(--error); font-size: 12px; padding: 8px; }
.prefetch-memories { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.prefetch-mem-item { font-size: 11px; padding: 6px 8px; background: var(--bg-primary); border-radius: 6px; border-left: 3px solid var(--accent); }
.prefetch-mem-id { font-weight: 600; font-family: monospace; font-size: 11px; }
.prefetch-mem-date { font-size: 10px; color: var(--text-muted); margin-left: 6px; }
.prefetch-mem-preview { color: var(--text-secondary); margin-top: 3px; line-height: 1.4; }
.prefetch-mem-motifs { color: var(--accent); font-size: 10px; margin-top: 2px; opacity: 0.8; }
.prefetch-raw { font-size: 11px; margin-top: 6px; }
.prefetch-raw summary { cursor: pointer; color: var(--text-muted); }
.prefetch-raw pre { white-space: pre-wrap; word-break: break-all; font-size: 10px; max-height: 150px; overflow-y: auto; padding: 6px; background: var(--bg-primary); border-radius: 4px; margin-top: 4px; }

/* -------------------------------------------------------------------------
   EVENT-SYSTEM DASHBOARD
   ------------------------------------------------------------------------- */

/* Header */
.ev-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.ev-header-left h3 { margin: 0; font-size: 16px; }
.ev-subtitle { font-size: 11px; color: var(--text-muted); }
.ev-header-tabs { display: flex; gap: 0; background: var(--bg-tertiary); border-radius: 8px; padding: 3px; }
.ev-tab {
    font-size: 12px; padding: 4px 14px; border-radius: 6px; border: none;
    background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.15s;
    font-weight: 500;
}
.ev-tab.active { background: var(--accent); color: #fff; }
.ev-tab:hover:not(.active) { color: var(--text-primary); }

/* Filter + Stats bar */
.ev-filter-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ev-filters { display: flex; gap: 4px; }
.ev-filter {
    font-size: 11px; padding: 2px 10px; border-radius: 10px; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.ev-filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ev-stats { font-size: 11px; color: var(--text-muted); }

/* Views */
.ev-view.hidden { display: none; }
.ev-back {
    font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border);
    background: transparent; color: var(--text-secondary); cursor: pointer; margin-bottom: 12px;
}
.ev-back:hover { border-color: var(--accent); color: var(--text-primary); }

/* Event List – compact rows */
.ev-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: 10px; overflow: hidden; }

/* Event Row */
.ev-row {
    display: grid;
    grid-template-columns: 28px 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}
.ev-row:hover { background: var(--bg-tertiary); }
.ev-row.inactive { opacity: 0.45; }
.ev-row.retry-row { background: rgba(245,158,11,0.05); }

/* Col 1: Icon */
.ev-row-icon { font-size: 16px; text-align: center; line-height: 1; }

/* Col 2: Info block */
.ev-row-info { min-width: 0; }
.ev-row-name {
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    display: flex; align-items: center; gap: 6px;
}
.ev-row-name .ev-dot { width: 7px; height: 7px; }
.ev-row-sub {
    font-size: 11px; color: var(--text-muted); margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ev-row-sub .ev-target { color: var(--accent); }

/* Col 3: Badges */
.ev-row-badges { display: flex; gap: 4px; align-items: center; }

/* Col 4: Actions (always visible, small) */
.ev-row-actions { display: flex; gap: 2px; }
.ev-act {
    width: 26px; height: 26px; border-radius: 6px; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 12px;
    background: transparent; transition: background 0.12s; color: var(--text-muted);
}
.ev-act:hover { background: var(--bg-secondary); color: var(--text-primary); }
.ev-act.danger:hover { background: rgba(248,113,113,0.15); color: #f87171; }

/* Status Dot */
.ev-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.ev-dot.active { background: #4ade80; box-shadow: 0 0 4px rgba(74,222,128,0.5); }
.ev-dot.paused { background: #6b7280; }
.ev-dot.retry { background: #f59e0b; animation: ev-pulse 1.5s infinite; }
@keyframes ev-pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

/* Badges */
.ev-badge {
    font-size: 9px; padding: 1px 6px; border-radius: 8px;
    font-weight: 600; white-space: nowrap; letter-spacing: 0.2px;
}
.ev-badge.retry { background: rgba(245,158,11,0.15); color: #f59e0b; }
.ev-badge.manuell { background: rgba(99,102,241,0.15); color: #818cf8; }
.ev-badge.typ-op { background: rgba(59,130,246,0.08); color: #60a5fa; }
.ev-badge.typ-ref { background: rgba(168,85,247,0.08); color: #c084fc; }

/* Error hint */
.ev-row-error {
    grid-column: 2 / -1; font-size: 10px; color: #f87171;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- Detail View ---- */
.ev-detail-top {
    display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.ev-detail-icon {
    width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center;
    justify-content: center; font-size: 20px; background: var(--bg-tertiary); flex-shrink: 0;
}
.ev-detail-title { flex: 1; min-width: 0; }
.ev-detail-title h3 { margin: 0; font-size: 16px; }
.ev-detail-title .ev-row-sub { font-size: 12px; margin-top: 3px; }
.ev-detail-actions { display: flex; gap: 4px; flex-shrink: 0; }

.ev-detail-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px;
}
.ev-field {
    background: var(--bg-primary); border-radius: 8px; padding: 8px 10px;
    border: 1px solid var(--border);
}
.ev-field-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.ev-field-value { font-size: 12px; color: var(--text-primary); }
.ev-field-value.accent { color: var(--accent); }

.ev-detail-desc {
    font-size: 12px; color: var(--text-secondary); padding: 8px 10px;
    background: var(--bg-primary); border-radius: 8px; margin-bottom: 14px;
    border: 1px solid var(--border); line-height: 1.5;
}

.ev-config { margin-bottom: 10px; }
.ev-config summary { cursor: pointer; font-size: 11px; color: var(--text-muted); padding: 4px 0; }
.ev-config pre {
    white-space: pre-wrap; word-break: break-all; font-size: 10px; max-height: 180px;
    overflow-y: auto; padding: 8px; background: var(--bg-primary); border-radius: 8px;
    border: 1px solid var(--border); margin-top: 4px;
}

/* ---- History ---- */
.ev-history-list { display: flex; flex-direction: column; gap: 2px; }
.ev-hist {
    display: flex; align-items: center; gap: 6px; padding: 7px 10px;
    background: var(--bg-primary); border-radius: 6px; font-size: 12px;
    border-left: 3px solid var(--border); flex-wrap: wrap;
}
.ev-hist.erfolg { border-left-color: #4ade80; }
.ev-hist.fehler { border-left-color: #f87171; }
.ev-hist.stattgefunden { border-left-color: #a78bfa; }
.ev-hist-icon { font-size: 13px; }
.ev-hist-name { font-weight: 500; font-size: 12px; }
.ev-hist-time { color: var(--text-muted); font-size: 11px; }
.ev-hist-model { color: var(--text-secondary); font-size: 11px; }
.ev-hist-cost { margin-left: auto; font-weight: 600; font-size: 11px; }
.ev-hist-error {
    width: 100%; font-size: 10px; color: #f87171; margin-top: 3px;
    padding: 3px 6px; background: rgba(248,113,113,0.08); border-radius: 4px;
}

/* ---- Costs ---- */
.ev-costs-header { margin-bottom: 10px; }
.ev-costs-header select {
    padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg-primary); color: var(--text-primary); font-size: 12px;
}
.ev-costs-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ev-costs-table th {
    text-align: left; font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; padding: 5px 6px; border-bottom: 1px solid var(--border);
}
.ev-costs-table td { padding: 6px; border-bottom: 1px solid var(--border); }
.ev-costs-table tfoot td { border-top: 2px solid var(--border); font-weight: 600; }

/* Responsive */
@media (max-width: 500px) {
    .ev-row { grid-template-columns: 24px 1fr auto; }
    .ev-row-badges { display: none; }
    .ev-detail-grid { grid-template-columns: 1fr; }
    .ev-header { flex-direction: column; align-items: flex-start; }
}

/* Legacy compat */
.btn-xs { font-size: 11px; padding: 2px 8px; }
.btn-danger { background: rgba(220,38,38,0.15); color: #f87171; border: 1px solid rgba(220,38,38,0.3); }
.btn-danger:hover { background: rgba(220,38,38,0.3); }

/* Scroll-to-Bottom Button */
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    -webkit-tap-highlight-color: transparent;
}
.scroll-to-bottom-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}
.scroll-to-bottom-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
@media (max-width: 768px) {
    .scroll-to-bottom-btn {
        bottom: 80px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* ============================================================
   Tool-Drohne (SSE drone_status)
   ============================================================ */
.drone-status-box {
    display: none;
    padding: 12px 18px 14px;
    margin: 10px 0 10px 72px;
    font-size: 0.88rem;
    color: var(--text-primary);
    background: linear-gradient(145deg, rgba(255, 200, 60, 0.22) 0%, rgba(255, 160, 40, 0.12) 45%, rgba(40, 32, 20, 0.35) 100%);
    border: 2px solid rgba(255, 200, 80, 0.55);
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.35s ease;
    overflow: visible;
    position: relative;
    min-height: 52px;
    box-shadow:
        0 0 20px rgba(255, 190, 50, 0.35),
        0 0 40px rgba(255, 180, 40, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.drone-particle-host {
    position: absolute;
    left: -12px;
    right: -12px;
    top: -28px;
    bottom: -220px;
    pointer-events: none;
    overflow: visible;
    z-index: 5;
}

.drone-particle {
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fffef0, #ffd700 55%, #b8860b);
    box-shadow:
        0 0 14px #ffd700,
        0 0 28px rgba(255, 215, 0, 0.85),
        0 0 4px #fff;
    transform: translate(-50%, -50%);
    animation: drone-particle-fly 1.28s cubic-bezier(0.12, 0.88, 0.22, 1) forwards;
}

.drone-particle-star {
    border-radius: 2px;
    clip-path: polygon(50% 0%, 63% 38%, 100% 38%, 69% 59%, 82% 100%, 50% 75%, 18% 100%, 31% 59%, 0% 38%, 37% 38%);
}

.drone-particle-celebrate {
    animation-duration: 1.05s;
}

@keyframes drone-particle-fly {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
        filter: brightness(1.5) saturate(1.3);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--pfx, 0px)), calc(-50% + var(--pfy, 0px))) scale(0.1);
        filter: brightness(1) saturate(1);
    }
}

.drone-confetti {
    position: absolute;
    pointer-events: none;
    z-index: 6;
    opacity: 1;
    animation: drone-confetti-fall linear forwards;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

.drone-confetti-strip {
    width: 9px;
    height: 16px;
    border-radius: 2px;
}

.drone-confetti-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

@keyframes drone-confetti-fall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(240px) translateX(var(--drift, 0px)) rotate(var(--rot, 720deg));
        opacity: 0;
    }
}

.drone-box-active {
    opacity: 1;
    animation: drone-box-pulse-glow 2.4s ease-in-out infinite;
}

.drone-box-done {
    animation: drone-box-celebrate-glow 1.2s ease-out 1;
    border-color: rgba(255, 220, 120, 0.75);
}

@keyframes drone-box-pulse-glow {
    0%, 100% {
        box-shadow:
            0 0 18px rgba(255, 200, 60, 0.45),
            0 0 50px rgba(255, 180, 40, 0.2),
            inset 0 0 24px rgba(255, 200, 80, 0.08);
    }
    50% {
        box-shadow:
            0 0 32px rgba(255, 210, 80, 0.65),
            0 0 70px rgba(255, 190, 50, 0.35),
            inset 0 0 36px rgba(255, 220, 120, 0.14);
    }
}

@keyframes drone-box-celebrate-glow {
    0% {
        box-shadow: 0 0 24px rgba(255, 215, 0, 0.6), 0 0 60px rgba(255, 100, 180, 0.25);
    }
    100% {
        box-shadow: 0 0 18px rgba(255, 200, 60, 0.4), 0 0 40px rgba(255, 180, 40, 0.2);
    }
}

.drone-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    position: relative;
    z-index: 2;
}

.drone-row + .drone-row {
    border-top: 1px solid rgba(255, 200, 80, 0.15);
}

.drone-bee {
    font-size: 1.75rem;
    flex-shrink: 0;
    position: relative;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 16px rgba(255, 180, 0, 0.5));
}

.drone-bee-active {
    animation: drone-ufo-zip 11s linear infinite;
    will-change: transform, filter;
}

.drone-bee-active::before,
.drone-bee-active::after {
    content: '✦';
    position: absolute;
    font-size: 0.65rem;
    color: #fff8dc;
    text-shadow: 0 0 8px #ffd700, 0 0 14px #ffb347;
    pointer-events: none;
    animation: drone-orbit-sparkle 0.9s ease-in-out infinite;
}
.drone-bee-active::before {
    top: -6px;
    left: -8px;
    animation-delay: 0s;
}
.drone-bee-active::after {
    bottom: -4px;
    right: -10px;
    animation-delay: 0.45s;
}

@keyframes drone-orbit-sparkle {
    0%, 100% { opacity: 0.5; transform: scale(0.85) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.35) rotate(180deg); }
}

.drone-row.drone-arrival .drone-bee {
    animation: drone-bee-swoop-in 0.95s cubic-bezier(0.22, 1.1, 0.36, 1) both,
        drone-ufo-zip 11s linear 0.95s infinite;
}

@keyframes drone-bee-swoop-in {
    0% {
        transform: translateX(calc(-55vw - 40px)) translateY(28px) rotate(-35deg) scale(0.25);
        opacity: 0;
        filter: blur(3px) drop-shadow(0 0 20px rgba(255, 215, 0, 0.9));
    }
    55% {
        transform: translateX(12px) translateY(-8px) rotate(12deg) scale(1.35);
        opacity: 1;
        filter: blur(0) drop-shadow(0 0 24px rgba(255, 215, 0, 1));
    }
    80% {
        transform: translateX(-4px) translateY(2px) rotate(-4deg) scale(0.95);
    }
    100% {
        transform: translateX(0) translateY(0) rotate(0) scale(1);
        opacity: 1;
        filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.85));
    }
}

.drone-row.drone-arrival::before {
    content: '';
    position: absolute;
    left: -100%;
    top: 50%;
    width: 100%;
    height: 4px;
    transform: translateY(-50%);
    background: linear-gradient(90deg, transparent, rgba(255, 220, 100, 0.9), rgba(255, 200, 60, 0.4), transparent);
    border-radius: 4px;
    animation: drone-speed-lines 0.75s ease-out forwards;
    pointer-events: none;
    z-index: 0;
}

@keyframes drone-speed-lines {
    0% { opacity: 1; transform: translateY(-50%) translateX(0); }
    100% { opacity: 0; transform: translateY(-50%) translateX(40%); }
}

@keyframes drone-ufo-zip {
    0% {
        transform: translateX(0) translateY(0) rotate(-8deg) scale(1);
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.9));
    }
    3% {
        transform: translateX(3px) translateY(2px) rotate(-16deg) scale(0.86, 1.15);
        filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.95));
    }
    10% {
        transform: translateX(min(38vw, 250px)) translateY(-8px) rotate(20deg) scale(1.18, 0.88);
        filter: drop-shadow(0 0 22px rgba(255, 235, 140, 1))
            drop-shadow(12px 0 20px rgba(255, 200, 80, 0.6))
            blur(0.3px);
    }
    14% {
        transform: translateX(min(55vw, 360px)) translateY(-3px) rotate(8deg) scale(1.08, 1.02);
        filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.95));
    }
    17% {
        transform: translateX(min(45vw, 295px)) translateY(5px) rotate(-6deg) scale(0.94, 1.08);
        filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.85));
    }
    20% {
        transform: translateX(min(48vw, 315px)) translateY(-7px) rotate(12deg) scale(1.06);
    }
    22% {
        transform: translateX(min(43vw, 280px)) translateY(4px) rotate(-14deg) scale(0.97, 1.05);
    }
    25% {
        transform: translateX(min(50vw, 325px)) translateY(-2px) rotate(8deg) scale(1.03);
    }
    33% {
        transform: translateX(min(12vw, 80px)) translateY(8px) rotate(-22deg) scale(0.93, 1.08);
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
    }
    37% {
        transform: translateX(-4px) translateY(3px) rotate(-26deg) scale(0.85, 1.16);
    }
    40% {
        transform: translateX(6px) translateY(-3px) rotate(10deg) scale(1.12, 0.9);
        filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.95));
    }
    47% {
        transform: translateX(min(46vw, 300px)) translateY(-10px) rotate(25deg) scale(1.16, 0.87);
        filter: drop-shadow(0 0 20px rgba(255, 235, 140, 1))
            blur(0.25px);
    }
    51% {
        transform: translateX(min(42vw, 275px)) translateY(3px) rotate(-10deg) scale(0.92, 1.1);
        filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.9));
    }
    60% {
        transform: translateX(min(18vw, 118px)) translateY(6px) rotate(-16deg) scale(0.96);
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
    }
    66% {
        transform: translateX(-2px) translateY(-1px) rotate(4deg) scale(0.98);
    }
    72% {
        transform: translateX(min(24vw, 158px)) translateY(-9px) rotate(22deg) scale(1.12, 0.9);
        filter: drop-shadow(0 0 16px rgba(255, 235, 140, 0.95))
            blur(0.2px);
    }
    78% {
        transform: translateX(min(4vw, 26px)) translateY(4px) rotate(-12deg) scale(0.95, 1.04);
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
    }
    86% {
        transform: translateX(3px) translateY(-3px) rotate(-5deg) scale(1.02);
    }
    93% {
        transform: translateX(-3px) translateY(2px) rotate(4deg) scale(0.97);
    }
    100% {
        transform: translateX(0) translateY(0) rotate(-8deg) scale(1);
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.9));
    }
}

.drone-id {
    font-weight: 600;
    color: rgba(255, 220, 120, 0.95);
    white-space: nowrap;
    font-size: 0.82rem;
    text-shadow: 0 0 10px rgba(255, 200, 60, 0.4);
}

.drone-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.drone-status-icon {
    flex-shrink: 0;
    white-space: nowrap;
    color: rgba(255, 215, 100, 0.85);
    font-size: 0.85rem;
    font-weight: 600;
}

.drone-row.done .drone-bee {
    animation: drone-land-bounce 0.7s cubic-bezier(0.34, 1.4, 0.64, 1) both;
    font-size: 1.9rem;
    filter: drop-shadow(0 0 14px rgba(255, 215, 0, 1)) drop-shadow(0 0 28px rgba(255, 180, 100, 0.7));
}

.drone-row.done .drone-bee::before,
.drone-row.done .drone-bee::after {
    content: '✨';
    font-size: 0.75rem;
    animation: drone-star-burst 0.85s ease-out forwards;
}
.drone-row.done .drone-bee::before {
    top: -10px;
    left: -12px;
}
.drone-row.done .drone-bee::after {
    bottom: -8px;
    right: -14px;
    animation-delay: 0.08s;
}

@keyframes drone-land-bounce {
    0% { transform: translateX(80px) translateY(-30px) scale(0.5) rotate(25deg); opacity: 0.7; }
    60% { transform: translateX(-6px) translateY(4px) scale(1.15) rotate(-8deg); opacity: 1; }
    100% { transform: translateX(0) translateY(0) scale(1) rotate(0); }
}

@keyframes drone-star-burst {
    0% { opacity: 0; transform: scale(0.2); }
    40% { opacity: 1; transform: scale(1.6); }
    100% { opacity: 0; transform: scale(2.8) translateY(-12px); }
}

.drone-row.done .drone-status-icon {
    color: rgba(255, 230, 140, 1);
    animation: drone-done-flash 0.5s ease-out;
}

.drone-row.done .drone-label {
    color: rgba(255, 235, 180, 0.98);
    text-shadow: 0 0 12px rgba(255, 200, 80, 0.25);
}

.drone-row.error .drone-status-icon {
    color: var(--error);
}

.drone-row.error .drone-bee {
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.7));
    animation: none;
}

.drone-summary {
    padding: 6px 0 2px;
    text-align: center;
    color: rgba(255, 220, 120, 0.95);
    font-size: 0.88rem;
    font-weight: 600;
    text-shadow: 0 0 12px rgba(255, 200, 60, 0.35);
}

.drone-progress {
    padding: 4px 0 0;
    text-align: right;
    color: rgba(255, 200, 100, 0.75);
    font-size: 0.78rem;
}

@keyframes drone-done-flash {
    0% { opacity: 0; transform: scale(1.8); }
    100% { opacity: 1; transform: scale(1); }
}

@media (max-width: 480px) {
    .drone-status-box {
        margin-left: 12px;
        margin-right: 12px;
        font-size: 0.82rem;
    }
    .drone-bee {
        font-size: 1.45rem;
    }
}

/* =========================================================================
   TOOLS OVERVIEW PANEL – Fähigkeiten-Seite
   ========================================================================= */
.tools-panel {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    z-index: 510;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: toolsFadeIn 0.25s ease;
}

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

.tools-container {
    width: 94%;
    max-width: 860px;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg), 0 0 80px rgba(233, 69, 96, 0.08);
}

.tools-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.tools-header h2 {
    font-size: 22px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tools-header .btn-icon {
    font-size: 24px;
    width: 36px;
    height: 36px;
}

.tools-content {
    overflow-y: auto;
    padding: 0;
    scroll-behavior: smooth;
}

.tools-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 80px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.tools-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- Header-Button --- */
.tools-btn {
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.15), rgba(167, 139, 250, 0.15)) !important;
    color: var(--accent) !important;
    border-color: rgba(233, 69, 96, 0.3) !important;
    font-size: 13px !important;
    letter-spacing: -0.5px;
}
.tools-btn:hover {
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.3), rgba(167, 139, 250, 0.3)) !important;
    transform: scale(1.1);
}

/* --- Architektur-Infografik --- */
.tools-architecture {
    position: relative;
    height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(ellipse at center, rgba(15, 52, 96, 0.6) 0%, transparent 70%);
}

.tools-arch-center {
    position: relative;
    z-index: 10;
    text-align: center;
}

.tools-ai-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    margin: 0 auto 12px;
    border: 3px solid var(--accent);
    overflow: hidden;
    box-shadow: 0 0 30px rgba(233, 69, 96, 0.25), 0 0 60px rgba(233, 69, 96, 0.1);
    animation: avatarPulse 3s ease-in-out infinite;
}

@keyframes avatarPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(233, 69, 96, 0.25), 0 0 60px rgba(233, 69, 96, 0.1); }
    50% { box-shadow: 0 0 40px rgba(233, 69, 96, 0.35), 0 0 80px rgba(233, 69, 96, 0.15); }
}

.tools-ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tools-ai-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: var(--bg-primary);
}

.tools-ai-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.tools-ai-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Orbit-Nodes --- */
.tools-orbit {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.tools-orbit-node {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 80px;
    margin-left: -40px;
    margin-top: -28px;
    text-align: center;
    cursor: pointer;
    pointer-events: all;
    transition: transform 0.3s ease, filter 0.3s ease;
    animation: orbitAppear 0.6s ease backwards;
}

@keyframes orbitAppear {
    from { opacity: 0; filter: blur(6px); }
    to { opacity: 1; filter: blur(0); }
}

.tools-orbit-node:hover {
    filter: brightness(1.2);
    z-index: 5;
}

.tools-orbit-icon {
    display: block;
    font-size: 28px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    margin-bottom: 2px;
}

.tools-orbit-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* --- SVG-Verbindungslinien --- */
.tools-connections {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.tools-conn-line {
    stroke: var(--line-color, var(--border));
    stroke-width: 1;
    stroke-dasharray: 6 4;
    opacity: 0.35;
    animation: connDash 15s linear infinite, connFadeIn 1s ease backwards;
}

@keyframes connDash {
    to { stroke-dashoffset: -100; }
}

@keyframes connFadeIn {
    from { opacity: 0; }
    to { opacity: 0.35; }
}

/* --- Stats-Leiste --- */
.tools-stats-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
}

.tools-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    font-size: 12px;
}

.tools-stat-icon {
    font-size: 14px;
}

.tools-stat-val {
    font-weight: 700;
    color: var(--text-primary);
}

.tools-stat-label {
    color: var(--text-muted);
}

/* --- Sektionen --- */
.tools-section {
    padding: 24px 24px 8px;
}

.tools-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.tools-section-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* --- Tool-Karten-Grid --- */
.tools-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.tools-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tools-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--accent));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tools-card:hover {
    border-color: var(--card-accent, var(--accent));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.tools-card:hover::before {
    opacity: 1;
}

.tools-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.tools-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.tools-card-title-wrap {
    flex: 1;
    min-width: 0;
}

.tools-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.tools-card-badge {
    font-size: 10px;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tools-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.tools-card-stats {
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.tools-card-example {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    padding: 8px 10px;
    border-left: 3px solid var(--card-accent, var(--accent));
    background: rgba(233, 69, 96, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 8px;
}

.tools-card-example-label {
    font-style: normal;
    font-weight: 600;
    color: var(--text-muted);
}

.tools-card-suggestion {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    margin-bottom: 8px;
    line-height: 1.45;
}

.tools-card-suggestion-label {
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 4px;
}

.tools-detail-suggestion-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.tools-detail-suggestion {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.65;
    padding: 14px 16px;
    background: rgba(34, 197, 94, 0.08);
    border-radius: var(--radius-sm);
    border-left: 3px solid #22c55e;
    margin-bottom: 20px;
}

.tools-card-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tools-card-tool-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--accent-secondary);
    font-family: var(--font-mono);
    border: 1px solid rgba(245, 166, 35, 0.15);
}

/* Klickbare Karten */
.tools-card-clickable {
    cursor: pointer;
}

.tools-card-expand-hint {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tools-card-clickable:hover .tools-card-expand-hint {
    opacity: 1;
    color: var(--card-accent, var(--accent));
}

/* Personalisierungs-Hinweis */
.tools-personalize-hint {
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 24px 8px;
    margin: 0;
}

.tools-regenerate-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.tools-regenerate-link:hover {
    text-decoration: underline;
}

/* ===== Detail-Modal ===== */
.tools-detail-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: toolsDetailFadeIn 0.2s ease;
}

.tools-detail-modal.hidden {
    display: none;
}

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

.tools-detail-container {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    animation: toolsDetailSlideUp 0.25s ease;
}

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

.tools-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.tools-detail-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.tools-detail-title {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.tools-detail-close {
    font-size: 24px;
    flex-shrink: 0;
}

.tools-detail-intro {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.tools-detail-stats {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.tools-detail-examples-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.tools-detail-examples {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.tools-detail-example-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tools-detail-example-quote {
    color: var(--accent);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    margin-top: -2px;
}

.tools-detail-fallback {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.tools-detail-fallback-sub {
    font-size: 12px;
    margin-top: 6px;
    opacity: 0.7;
}

.tools-detail-tool-list {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 8px;
}

.tools-detail-tool-list h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .tools-container {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .tools-architecture {
        height: 280px;
    }

    .tools-orbit-node {
        width: 64px;
        margin-left: -32px;
    }

    .tools-orbit-icon { font-size: 22px; }
    .tools-orbit-label { font-size: 9px; }

    .tools-cards-grid {
        grid-template-columns: 1fr;
    }

    .tools-stats-bar {
        gap: 4px;
        padding: 12px 12px;
    }

    .tools-stat {
        padding: 4px 10px;
        font-size: 11px;
    }

    .tools-section {
        padding: 16px 16px 8px;
    }

    .tools-detail-modal {
        padding: 12px;
    }

    .tools-detail-container {
        max-height: 90vh;
        padding: 20px;
    }
}

/* ===  Bridge Tab  === */
.bridge-status-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 10px;
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border, #333);
    margin-bottom: 24px;
}
.bridge-status-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.bridge-status-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.bridge-status-info strong {
    font-size: 14px;
}
.bridge-status-detail {
    font-size: 12px;
    color: var(--text-muted, #888);
}
.bridge-status-card.bridge-connected {
    border-color: #22c55e44;
    background: #22c55e0a;
}
.bridge-status-card.bridge-disconnected {
    border-color: #ef444444;
    background: #ef44440a;
}

.bridge-download-section {
    margin-top: 8px;
}
.bridge-download-section h4 {
    margin: 0 0 8px;
    font-size: 15px;
}

.bridge-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 16px 0;
}
.bridge-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.bridge-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent, #6366f1);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}
.bridge-step div {
    flex: 1;
}
.bridge-step strong {
    font-size: 14px;
    display: block;
    margin-bottom: 2px;
}
.bridge-step p {
    font-size: 12.5px;
    color: var(--text-muted, #888);
    margin: 0 0 6px;
    line-height: 1.5;
}
.bridge-step .btn {
    margin-top: 4px;
}

.bridge-requirements {
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-muted, #888);
}
.bridge-requirements summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text, #e0e0e0);
}
.bridge-requirements ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}
.bridge-requirements li {
    margin-bottom: 4px;
    line-height: 1.5;
}
.bridge-requirements a {
    color: var(--accent, #6366f1);
}

/* ============================================================ */
/* SATELLITEN                                                    */
/* ============================================================ */

.satellite-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: 4px;
}

.satellite-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1;
    transition: background 0.15s, transform 0.15s;
    position: relative;
}

.satellite-nav-btn:hover {
    background: var(--bg-hover, rgba(255,255,255,0.1));
    transform: scale(1.1);
}

.satellite-nav-btn.active {
    background: var(--accent-color, #6c5ce7);
    border-radius: 8px;
}

.satellite-nav-btn .satellite-nav-icon {
    display: block;
}

/* Satellite-Active: Vollbild-Modus */

#main-app.satellite-active {
    grid-template-columns: 1fr;
}

#main-app.satellite-active .sidebar,
#main-app.satellite-active .sidebar-overlay {
    display: none !important;
}

#main-app.satellite-active .chat-area:not(.satellite-embedded) {
    display: none !important;
}

/* Klapper: Chat ein-/ausblenden (Desktop + Mobile, Standard: zugeklappt) — identisch Pepper App */
.sat-chat-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 0;
    background: var(--bg-secondary, #16213e);
    border-top: 1px solid var(--border, #2a2a4a);
    color: var(--text-secondary, #a0a0b8);
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.sat-chat-toggle:active {
    background: var(--bg-tertiary, #1a1a2e);
}

.sat-chat-toggle .sat-chat-toggle-icon {
    transition: transform 0.2s ease;
}

.sat-chat-toggle.sat-chat-open .sat-chat-toggle-icon {
    transform: rotate(180deg);
}

#main-app .chat-area.satellite-embedded {
    flex-direction: column;
    max-height: 700px;
    min-height: 0;
    border-top: 1px solid var(--border, #2a2a4a);
    flex-shrink: 0;
    overflow: hidden;
    display: none !important;
}

#main-app .chat-area.satellite-embedded.sat-chat-visible {
    display: flex !important;
}

.chat-area.satellite-embedded .welcome-screen,
.chat-area.satellite-embedded .mailbox-overlay,
.chat-area.satellite-embedded .panel-view,
.chat-area.satellite-embedded .save-reminder {
    display: none !important;
}

.chat-area.satellite-embedded .chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.chat-area.satellite-embedded .chat-input-area {
    flex-shrink: 0;
    padding: 8px 12px 12px;
}

.chat-area.satellite-embedded .pepper-expr-float {
    width: 100px !important;
    float: left;
    margin: 2px 10px 4px 0;
}

.chat-area.satellite-embedded .pepper-expr-float.expr-gross {
    width: 130px !important;
}

.chat-area.satellite-embedded .pepper-expr-float.expr-kompakt {
    width: 70px !important;
}

.chat-area.satellite-embedded .message-content img:not(.pepper-expr-img) {
    max-width: 150px !important;
    height: auto !important;
}

.chat-area.satellite-embedded .chat-messages video {
    max-width: 150px !important;
    height: auto !important;
}

.chat-area.satellite-embedded .chat-messages .message {
    padding: 6px 12px;
    margin: 2px 0;
}

.chat-area.satellite-embedded .message-content {
    font-size: 13px;
    line-height: 1.5;
}

.chat-area.satellite-embedded .chat-input-area {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 6px 12px 10px !important;
}

.chat-area.satellite-embedded .input-container {
    max-width: 100% !important;
}

.chat-area.satellite-embedded .chat-messages .message {
    max-width: 100% !important;
}

#main-app.satellite-active #sidebar-toggle {
    display: none !important;
}

#main-app.satellite-active .satellite-view {
    position: relative;
    grid-column: 1 / -1;
}

/* Satellite-View */

.satellite-view {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #1a1a2e);
    min-height: 0;
    overflow: hidden;
}

.satellite-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    background: var(--bg-secondary, #16213e);
    min-height: 48px;
    flex-shrink: 0;
}

.satellite-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    flex-shrink: 0;
}

.satellite-view-nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
    overflow-x: auto;
}

.satellite-view-tab {
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary, #a0a0b0);
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.15s;
}

.satellite-view-tab:hover {
    color: var(--text-primary, #fff);
    background: var(--bg-hover, rgba(255,255,255,0.05));
}

.satellite-view-tab.active {
    color: var(--text-primary, #fff);
    background: var(--accent-color, #6c5ce7);
    border-color: var(--accent-color, #6c5ce7);
}

.satellite-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.satellite-body > .satellite-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    padding: 0;
}

/* Satelliten-Verwaltung (Einstellungs-Tab) */

.sat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    background: var(--bg-secondary, #16213e);
    transition: border-color 0.15s;
}

.sat-card:hover {
    border-color: var(--accent-color, #6c5ce7);
}

.sat-card-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    width: 40px;
    text-align: center;
}

.sat-card-info {
    flex: 1;
    min-width: 0;
}

.sat-card-info strong {
    font-size: 15px;
    color: var(--text-primary, #fff);
}

.sat-card-version {
    font-size: 12px;
    color: var(--text-muted, #777);
    margin-left: 8px;
}

.sat-card-desc {
    font-size: 13px;
    color: var(--text-secondary, #a0a0b0);
    margin: 4px 0 0;
    line-height: 1.3;
}

.sat-card .btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .satellite-nav-btn {
        padding: 4px;
        font-size: 16px;
    }

    #main-app.satellite-active .chat-area:not(.satellite-embedded) {
        display: none !important;
    }

    #main-app .chat-area.satellite-embedded {
        max-height: 50vh;
    }

    #main-app.satellite-active .sidebar {
        transform: translateX(-100%);
    }

    #main-app.satellite-active .satellite-view {
        position: relative;
        flex: 1;
    }

    .satellite-header {
        padding: 6px 10px;
        gap: 8px;
    }

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

    .satellite-view-nav {
        gap: 2px;
    }

    .satellite-view-nav button {
        font-size: 11px;
        padding: 3px 8px;
    }

    .sat-card {
        flex-wrap: wrap;
    }
    .sat-card .btn-sm {
        width: 100%;
        text-align: center;
    }
}

/* Denkfäden-Tab (Einstellungen) */
.denkfaeden-stats {
    font-size: 15px;
    line-height: 1.5;
}

.denkfaeden-scan-result {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    display: none;
}
.denkfaeden-scan-result.warn {
    display: block;
    background: rgba(255, 180, 50, 0.15);
    border-left: 3px solid #e8a020;
    color: #f0c060;
}
.denkfaeden-scan-result.success {
    display: block;
    background: rgba(80, 200, 120, 0.15);
    border-left: 3px solid #50c878;
    color: #70e090;
}
.denkfaeden-scan-result.info {
    display: block;
    background: rgba(100, 160, 255, 0.12);
    border-left: 3px solid #5090d0;
    color: #80b8f0;
}
.denkfaeden-scan-result.error {
    display: block;
    background: rgba(255, 80, 80, 0.15);
    border-left: 3px solid #e04040;
    color: #ff7070;
}

.denkfaeden-box,
.denkfaeden-box-inner {
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.5;
}

.denkfaeden-kernel-table { display: flex; flex-direction: column; gap: 8px; }
.denkfaeden-kernel-row {
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: var(--radius-sm);
}
.denkfaeden-kernel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.denkfaeden-kernel-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    background: rgba(255,255,255,0.08);
    padding: 1px 6px;
    border-radius: 3px;
}
.denkfaeden-kernel-cat { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.denkfaeden-kernel-matches { font-size: 11px; color: var(--accent); font-weight: 500; }
.denkfaeden-kernel-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
}
.denkfaeden-kernel-badge.ruhend { background: rgba(255,180,50,0.2); color: #e8a020; }
.denkfaeden-kernel-badge.archiviert { background: rgba(255,255,255,0.1); color: var(--text-muted); }
.denkfaeden-kernel-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.denkfaeden-kernel-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 6px;
}
.denkfaeden-kernel-source { color: var(--text-secondary); }
.denkfaeden-kernel-date { color: var(--text-muted); }
.denkfaeden-kernel-imported {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e8a020;
    background: rgba(255,180,50,0.15);
    padding: 1px 6px;
    border-radius: 3px;
}

.denkfaeden-kernel-ref {
    display: inline-block;
    max-width: 100%;
    word-break: break-all;
    font-size: 11px;
    font-family: ui-monospace, monospace;
    background: rgba(255,255,255,0.06);
    padding: 2px 4px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

.denkfaeden-compare-results { margin-top: 12px; }
.denkfaeden-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
@media (max-width: 900px) {
    .denkfaeden-compare-grid { grid-template-columns: 1fr; }
}
.denkfaeden-compare-card {
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.denkfaeden-compare-card.skipped { opacity: 0.75; }
.denkfaeden-compare-head {
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.denkfaeden-compare-http {
    font-weight: 400;
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 6px;
}
.denkfaeden-compare-meta { margin: 0 0 8px; font-size: 13px; }
.denkfaeden-compare-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-primary);
}
.denkfaeden-compare-err { color: #ff7070; margin: 0; }
.denkfaeden-compare-hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.denkfaeden-compare-section { margin-bottom: 4px; }

.denkfaeden-match-card {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid rgba(201, 162, 39, 0.35);
}

.denkfaeden-match-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.denkfaeden-confidence {
    color: #d4a574;
    font-weight: 600;
    flex-shrink: 0;
}

.denkfaeden-preview {
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-secondary);
    max-height: 180px;
    overflow-y: auto;
    margin: 0 0 10px;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.denkfaeden-match-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.denkfaeden-eigen-row {
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    border-left: 3px solid #c9a227;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: background var(--transition);
}

.denkfaeden-eigen-row:hover {
    background: var(--bg-hover);
}

.denkfaeden-eigen-title {
    font-size: 14px;
}

.denkfaeden-eigen-unread {
    color: #d4a574;
    font-size: 10px;
    vertical-align: middle;
}
