/* LEXI-KI-Chat Custom Styles
   Tenant-Farben kommen aus YAML (base.html ueberschreibt :root).
   Fallback = LEXI Experts (lexi-experts.de): Navy #002B5C, Cyan #0096DE, Orange #F5A623 */

:root {
    --color-primary: #0096DE;
    --color-primary-dark: #0077B3;
    --color-primary-hover: #0086C7;
    --color-primary-rgb: 0, 150, 222;
    --color-accent: #F5A623;
    --color-neutral: #000000;
    --color-neutral-dark: #000000;
    --color-neutral-light: #1A1A1A;

    --color-bg: #F4F6F8;
    --color-sidebar-bg: #002B5C;
    --color-sidebar-text: #D9DFE5;
    --color-sidebar-hover: #003A7A;
    --color-text: #002B5C;
    --color-coach-bg: #F4F6F8;
    --sidebar-width: 280px;
    --coach-width: 288px;
    --navbar-height: 52px;
}

.btn-primary {
    --bs-btn-bg: var(--color-primary);
    --bs-btn-border-color: var(--color-primary);
    --bs-btn-hover-bg: var(--color-primary-hover);
    --bs-btn-hover-border-color: var(--color-primary-hover);
    --bs-btn-active-bg: var(--color-primary-dark);
    --bs-btn-active-border-color: var(--color-primary-dark);
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

/* --- Navbar --- */
.cv-navbar {
    background-color: var(--color-neutral);
    height: var(--navbar-height);
    border-bottom: 3px solid var(--color-primary);
    flex-wrap: nowrap;
    align-items: center;
}

.cv-brand-dot {
    color: var(--color-primary);
}

.cv-navbar .nav-link {
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
}

.cv-navbar .nav-link:hover {
    color: #fff;
}

.cv-navbar .nav-link.admin-link {
    color: var(--color-primary);
    font-weight: 600;
}

.cv-navbar .nav-link.admin-link:hover {
    color: var(--color-primary-hover);
}

.cv-user-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
    border-radius: 7px;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cv-nav-surname {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 8px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cv-nav-surname:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.cv-user-btn:hover,
.cv-user-btn.show {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

.cv-user-btn::after {
    display: none;
}

.cv-user-name {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cv-user-dropdown {
    min-width: 210px;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.28);
    border: 1px solid #3a3a3a;
    padding: 6px 0;
    overflow: hidden;
    background: #2c2c2c;
}

.cv-user-dropdown .dropdown-item-text {
    padding: 7px 16px 5px;
    font-size: .76rem;
    color: rgba(255,255,255,0.45);
    font-weight: 500;
    letter-spacing: .02em;
}

.cv-user-dropdown .dropdown-item {
    padding: 9px 16px;
    font-size: .85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    background: transparent;
    display: flex;
    align-items: center;
    gap: 9px;
    transition: background 0.12s, color 0.12s;
}

.cv-user-dropdown .dropdown-item:hover,
.cv-user-dropdown .dropdown-item:focus {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.cv-user-dropdown .dropdown-item.text-danger {
    color: #f87171;
}

.cv-user-dropdown .dropdown-item.text-danger:hover {
    background: rgba(var(--color-primary-rgb), 0.18);
    color: #ff8fa3;
}

.cv-user-dropdown .dropdown-divider {
    margin: 4px 0;
    border-color: rgba(255,255,255,0.1);
}

.cv-navbar .navbar-brand {
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
}

.cv-nav-logo-wrap {
    background: #fff;
    border-radius: 6px;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.cv-nav-logo-wrap--on-dark {
    background: transparent;
    padding: 0;
}

.cv-nav-logo-img {
    height: 26px;
    width: auto;
    display: block;
}

.cv-nav-logo-wrap--on-dark .cv-nav-logo-img {
    height: 28px;
    max-width: 150px;
}

.cv-brand-divider {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.3);
}

.cv-brand {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.cv-brand-main {
    font-weight: 600;
}

.cv-brand-sub {
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.85;
}

@media (max-width: 576px) {
    .cv-brand-sub {
        display: none;
    }
    .cv-brand-main {
        font-size: 0.85rem;
    }
}

/* --- Chat Layout --- */
.chat-container {
    display: flex;
    height: calc(100vh - var(--navbar-height));
    overflow: hidden;
}

/* Sidebar */
.chat-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 8px;
    overflow-y: auto;
    transition: width .2s ease, min-width .2s ease;
    overflow-x: hidden;
}

/* Eingeklappte Sidebar */
.chat-sidebar.collapsed {
    width: 52px;
    min-width: 52px;
    padding: 8px 6px;
}
.chat-sidebar.collapsed .sidebar-expanded-content { display: none; }

.sidebar-expanded-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.sidebar-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-delete-all-chats {
    width: 100%;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #c9a0a0;
    font-size: 0.78rem;
    padding: 6px 8px;
    border-radius: 5px;
    cursor: pointer;
    transition: color .15s, background .15s, border-color .15s;
}

.btn-delete-all-chats:hover {
    color: #fff;
    background: rgba(180, 60, 60, 0.35);
    border-color: rgba(220, 80, 80, 0.5);
}

/* Sidebar Topbar (Toggle + Neuer Chat Icon) */
.sidebar-topbar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

/* Toggle-Button – größer, quadratisch */
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 6px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    transition: color .15s, background .15s;
}
.sidebar-toggle-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Das Panel-Icon bleibt immer gleich – kein Icon-Wechsel nötig */

.sidebar-icon-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 7px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}
.sidebar-icon-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

.btn-sidebar-action {
    background: none;
    border: none;
    color: #aaa;
    font-size: 0.78rem;
    padding: 2px 4px;
    cursor: pointer;
    border-radius: 4px;
}
.btn-sidebar-action:hover { color: #fff; background: rgba(255,255,255,0.08); }

.project-block { margin-top: 8px; padding-top: 4px; border-top: 1px solid rgba(255,255,255,0.08); }
.project-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 4px;
}
.btn-session-move {
    background: none;
    border: none;
    color: #888;
    font-size: 0.65rem;
    padding: 0 4px;
    cursor: pointer;
    opacity: 0;
    flex-shrink: 0;
}
.session-item:hover .btn-session-move { opacity: 1; }
.btn-session-move:hover { color: #fff; }
.session-move-menu {
    position: absolute;
    z-index: 20;
    min-width: 140px;
    background: #2f2f2f;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 4px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
.session-move-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 0.78rem;
    padding: 5px 10px;
    cursor: pointer;
}
.session-move-menu button:hover { background: rgba(255,255,255,0.08); }
.project-empty {
    font-size: 0.72rem;
    color: #888;
    padding: 2px 8px 6px 20px;
}
.project-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #ccc;
    user-select: none;
}
.project-header:hover { background: rgba(255,255,255,0.07); }
.project-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.project-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-toggle { font-size: 0.65rem; color: #888; }
.project-sessions { padding-left: 6px; }
.project-sessions.collapsed { display: none; }
.project-delete-btn {
    background: none; border: none; color: #888;
    font-size: 0.7rem; padding: 0 2px; cursor: pointer;
    opacity: 0; transition: opacity 0.15s;
}
.project-header:hover .project-delete-btn,
.project-header:hover .project-knowledge-btn { opacity: 1; }
.project-knowledge-btn {
    background: none;
    border: 1px solid transparent;
    color: #aaa;
    font-size: 0.68rem;
    padding: 0 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.project-knowledge-btn.is-on {
    opacity: 1;
    color: #e8e8e8;
    border-color: rgba(192, 0, 60, 0.55);
}
.knowledge-rules {
    padding-left: 1.1rem;
}
.project-delete-btn:hover { color: #e85d7a; }

.sidebar-section-label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 8px 2px;
}

.sidebar-search-wrap input {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #e0e0e0;
    font-size: 0.82rem;
}
.sidebar-search-wrap input::placeholder { color: #aaa; }
.sidebar-search-wrap input:focus {
    background: rgba(255,255,255,0.13);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
    box-shadow: none;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.session-list {
    overflow: visible;
    min-height: 0;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 1px;
    position: relative;
}

.session-item:hover {
    background-color: var(--color-sidebar-hover);
}

.session-item.active {
    background-color: var(--color-primary);
    color: #fff;
}

.session-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    flex: 1;
    line-height: 1.3;
}

.btn-delete-session {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    font-size: 1.2rem;
    padding: 0 4px;
    display: none;
}

.session-item:hover .btn-delete-session {
    display: block;
}

.btn-delete-session:hover {
    opacity: 1;
    color: #ef4444;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;  /* Inhalt horizontal zentrieren */
}

/* Zentrierte Nachrichten-Spur (wie Claude / ChatGPT) */
.chat-messages > *,
.chat-messages > .message {
    width: 100%;
    max-width: 720px;
    box-sizing: border-box;
}

.chat-messages > .welcome-screen {
    max-width: 720px;
    width: 100%;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 20px;
}

.welcome-logo-img {
    height: 52px;
    width: auto;
    max-width: 280px;
    margin-bottom: 20px;
    opacity: 0.95;
}

.login-logo-img {
    height: 48px;
    width: auto;
    max-width: 240px;
}

.welcome-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 6px;
}

.welcome-sub {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-bottom: 32px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 600px;
}

.quick-action-chip {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 0.875rem;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.quick-action-chip:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(var(--color-primary-rgb), 0.25);
}

/* =====================================================================
   NACHRICHTEN – Layout nach Claude/ChatGPT-Vorbild, CV-Farben
   ===================================================================== */

.message {
    width: 100%;
    margin-bottom: 4px;   /* Nachrichten dicht – Absatz kommt aus padding */
    display: flex;
    flex-direction: column;
}

/* User-Nachricht: rechtsbündig */
.message.user {
    align-items: flex-end;
    padding: 6px 0 2px;
}
.message.user .message-content {
    max-width: 72%;
    background: #f0e8e8;       /* zartes Rosa – CV-konform, nicht rot */
    color: #1a1a1a;
    border-radius: 18px 18px 4px 18px;  /* "Sprechblasen"-Form rechts */
    padding: 10px 15px;
    font-size: .93rem;
    line-height: 1.55;
    word-break: break-word;
}

/* Assistent-Nachricht: linksbündig, kein Rahmen wie Claude */
.message.assistant {
    align-items: flex-start;
    padding: 10px 0 2px;
}
.message.assistant .message-content {
    width: 100%;
    background: transparent;   /* kein Kasten – wie Claude */
    border: none;
    padding: 0;
    font-size: .93rem;
    line-height: 1.65;
    color: #1a1a1a;
}

/* Marker vor Assistent-Antworten – grau, klein, kein Ampel-Rot */
.message.assistant::before {
    content: "";
    display: block;
    width: 10px;
    height: 10px;
    background: #9ca3af;
    border-radius: 2px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

/* Horizontaler Trenner zwischen Gesprächsrunden */
.message.assistant + .message.user {
    border-top: 1px solid #f0f0f0;
    margin-top: 8px;
    padding-top: 14px;
}

/* Code-Blöcke */
.message-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 14px 16px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: .83rem;
    margin: .6rem 0;
    border: 1px solid #334155;
}
.message-content pre code {
    background: none;
    color: inherit;
    font-size: inherit;
    padding: 0;
}
.message-content code:not(pre code) {
    background: #f1f5f9;
    color: var(--color-primary);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: .86em;
}

/* Headings – kompakt, kein Seitentitel-Feeling */
.message-content h1 { font-size: 1.15rem; font-weight: 700; margin: .7rem 0 .3rem; border-bottom: 1px solid #f0f0f0; padding-bottom: .2rem; }
.message-content h2 { font-size: 1.02rem; font-weight: 700; margin: .65rem 0 .25rem; }
.message-content h3 { font-size: .94rem;  font-weight: 600; margin: .55rem 0 .2rem; color: #374151; }
.message-content h4,
.message-content h5,
.message-content h6 { font-size: .88rem;  font-weight: 600; margin: .4rem 0 .15rem; color: #4b5563; }

/* Listen */
.message-content ul,
.message-content ol  { padding-left: 1.5rem; margin: .35rem 0 .5rem; }
.message-content li  { margin-bottom: .25rem; }
.message-content li > p { margin: 0; }

/* Paragraph-Abstand innerhalb Antwort */
.message-content p   { margin-bottom: .5rem; }
.message-content p:last-child { margin-bottom: 0; }

/* Blockquote */
.message-content blockquote {
    border-left: 3px solid var(--color-primary);
    margin: .5rem 0;
    padding: .3rem .75rem;
    color: #555;
    background: #fdf6f7;
    border-radius: 0 6px 6px 0;
    font-style: italic;
}

/* Tabellen */
.message-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
    margin: .6rem 0 .75rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.message-content th {
    background: #f8fafc;
    font-weight: 600;
    padding: 7px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: .82rem;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.message-content td {
    padding: 6px 12px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}
.message-content tr:last-child td { border-bottom: none; }
.message-content tr:hover td { background: #f9fafb; }

/* Trennlinie */
.message-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: .75rem 0;
}

/* Links */
.message-content a {
    color: #1d4ed8;
    text-decoration: none;
    border-bottom: 1px solid #bfdbfe;
    word-break: break-word;
    transition: color .15s, border-color .15s;
}
.message-content a:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* =====================================================================
   REFERENZEN / ZITATE (Perplexity Sonar)
   ===================================================================== */
.citation-ref {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: .65rem;
    font-weight: 700;
    text-decoration: none !important;
    border: none !important;
    vertical-align: super;
    margin: 0 1px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s;
}
.citation-ref:hover {
    background: #1d4ed8;
    color: #fff;
}

.citations-box {
    margin-top: 14px;
    border-top: 1px solid #e5e7eb;
    padding-top: 10px;
}
.citations-toggle {
    font-size: .78rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.citations-toggle:hover { color: #1d4ed8; }

.citations-list {
    margin-top: 6px;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.citations-list li {
    font-size: .78rem;
    display: flex;
    align-items: baseline;
    gap: 5px;
    color: #6b7280;
}
.citations-list li::before {
    content: attr(data-num);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #3730a3;
    font-size: .6rem;
    font-weight: 700;
    flex-shrink: 0;
}
.citations-list a {
    color: #1d4ed8;
    text-decoration: none;
    border: none !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 340px;
}
.citations-list a:hover { text-decoration: underline; }

/* Modell-Cutoff-Hinweis */
.model-cutoff-hint {
    font-size: .7rem;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
    cursor: help;
}

.streaming-cursor::after {
    content: "|";
    animation: blink 0.8s infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Typing-Indikator (drei Punkte) */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input Area */
.chat-input-area {
    padding: 12px 20px 16px;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chat-input-wrapper {
    width: 100%;
    max-width: 720px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 2px 12px rgba(var(--color-primary-rgb), 0.12);
}

.chat-input {
    resize: none;
    border: none;
    border-radius: 0;
    overflow-y: auto;
    transition: height 0.1s ease;
    padding: 12px 16px 8px;
    background: transparent;
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-input:focus {
    box-shadow: none;
    outline: none;
}

.chat-input-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px 8px;
    border-top: 1px solid #f0f0f0;
}

.input-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-toggle {
    padding: 2px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    color: #475569;
    background: #f8fafc;
}

.live-toggle.active {
    border-color: var(--color-primary);
    color: #fff;
    background: var(--color-primary);
}

.live-toggle:hover {
    border-color: var(--color-primary);
}

.input-file-hint {
    margin: 4px 0 0;
    font-size: 0.75rem;
    color: #9f1239;
}

.pdf-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    max-width: 280px;
}

.pdf-chip {
    display: inline-flex;
    align-items: center;
    max-width: 140px;
    padding: 2px 8px;
    font-size: 0.72rem;
    border-radius: 999px;
    background: #fee2e2;
    color: #9f1239;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-pdf {
    padding: 2px 8px;
    font-size: 0.8rem;
}

.image-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    max-width: 280px;
}

.image-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 140px;
    padding: 2px 8px;
    font-size: 0.72rem;
    border-radius: 999px;
    background: #fee2e2;
    color: #9f1239;
    cursor: pointer;
}

.image-chip img {
    width: 18px;
    height: 18px;
    object-fit: cover;
    border-radius: 4px;
}

.image-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bubble-attach {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 8px;
}

.bubble-attach-tile {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 112px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
}

.bubble-attach-tile img {
    display: block;
    width: 100%;
    height: 80px;
    object-fit: cover;
    background: #e5e7eb;
}

.bubble-attach-kind {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.04em;
}

.bubble-attach-pdf .bubble-attach-kind { color: #9f1239; }

.bubble-attach-pdf {
    background: #fef2f2;
    border-color: #fecaca;
}

.bubble-attach-txt {
    background: #f1f5f9;
}

.bubble-attach-name {
    padding: 4px 6px;
    font-size: 0.68rem;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message.user .message-user-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.image-memory-hint {
    font-size: 0.75rem;
    color: #64748b;
    margin: 4px 0 12px 0;
}

.chat-pdf-hint {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.78rem;
}

.input-bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-model-select {
    font-size: 0.8rem;
    border-radius: 8px;
    padding: 3px 8px;
    border-color: #e2e8f0;
    background: #f8f9fa;
    max-width: 160px;
}

.char-count {
    font-size: 0.78rem;
    color: #94a3b8;
}

.btn-send-icon {
    border-radius: 8px;
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send-icon:disabled {
    opacity: 0.4;
}

/* Coach Panel */
.coach-panel {
    --coach-min: 200px;
    width: var(--coach-width);
    min-width: var(--coach-min);
    max-width: 480px;
    background-color: var(--color-coach-bg);
    border-left: 1px solid #e2e8f0;
    padding: 0;
    font-size: 0.82rem;
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    container-type: inline-size;
    container-name: coach;
}
/* Innerer scrollbarer Bereich */
.coach-panel > *:not(.coach-resize-handle):not(.coach-chat-input-area) {
    padding-left: 12px;
    padding-right: 12px;
}
.coach-panel > .coach-header-row { padding-top: 12px; }

.coach-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
    z-index: 10;
}

.coach-resize-handle:hover,
.coach-resize-handle.dragging {
    background: var(--color-primary);
    opacity: 0.35;
}

.coach-panel h6 {
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* Coach Avatar Header – schmal: kein Ueberlapp, kurze Labels */
.coach-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}
.coach-header-main {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}
.coach-header-meta {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-shrink: 0;
}
.coach-avatar {
    width: 64px;
    height: auto;
    object-fit: contain;
    background: transparent;
    flex-shrink: 0;
    border-radius: 6px;
}
.coach-header-text {
    min-width: 0;
    padding-top: 2px;
    overflow: hidden;
}
.coach-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.coach-subtitle {
    font-size: 0.68rem;
    color: #6c757d;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.coach-model-info-name {
    font-size: 0.74rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.coach-model-info-hint {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 6px;
}
.coach-info-muted {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-bottom: 0;
}
.coach-chips-area {
    padding: 6px 10px 10px;
    border-top: 1px solid #eef2f7;
    flex-shrink: 0;
}
.coach-topic-pills {
    margin-bottom: 8px;
}
.coach-topic-pills-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.coach-topic-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 72px;
    overflow-y: auto;
}
.coach-topic-pill {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.68rem;
    line-height: 1.3;
    cursor: pointer;
}
.coach-topic-pill:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}
.coach-topic-pill.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.coach-chip.active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.08);
}


@container coach (max-width: 260px) {
    .coach-avatar { width: 40px; }
    .coach-subtitle { display: none; }
    .coach-title { font-size: 0.72rem; }
    .coach-token-badge {
        max-width: 72px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@container coach (max-width: 200px) {
    .coach-header-row {
        flex-wrap: wrap;
    }
    .coach-header-meta {
        width: 100%;
        justify-content: flex-end;
    }
    .coach-avatar { width: 36px; }
}

/* Mini-Ampel im Coach-Header (vertikal, leuchtet aktiv) */
.coach-ampel-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 18px;
    padding: 5px 3px;
    margin-top: 2px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #1e293b;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
    transition: box-shadow .15s, border-color .15s;
}
.coach-ampel-mini:hover {
    border-color: #64748b;
}
.coach-ampel-mini .ampel-lamp {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0.22;
    box-shadow: none;
    transition: opacity .2s, box-shadow .2s;
}
.coach-ampel-mini .lamp-rot   { background: #ef4444; }
.coach-ampel-mini .lamp-gelb  { background: #f59e0b; }
.coach-ampel-mini .lamp-gruen { background: #22c55e; }

.coach-ampel-mini.lit-rot .lamp-rot {
    opacity: 1;
    box-shadow: 0 0 6px 2px rgba(239, 68, 68, 0.75);
}
.coach-ampel-mini.lit-gelb .lamp-gelb {
    opacity: 1;
    box-shadow: 0 0 6px 2px rgba(245, 158, 11, 0.75);
}
.coach-ampel-mini.lit-gruen .lamp-gruen {
    opacity: 1;
    box-shadow: 0 0 6px 2px rgba(34, 197, 94, 0.75);
}
.coach-ampel-mini.lit-neutral .ampel-lamp {
    opacity: 0.35;
}
.coach-ampel-mini.lit-rot.ampel-pulse .lamp-rot {
    animation: blink-dot .8s ease-in-out infinite;
}
.coach-action-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #ced4da;
    background: #fff;
    color: #6c757d;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s, color .15s;
}
.coach-action-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.coach-action-btn.active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: #fff0f2;
}
.coach-info-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 0.78rem;
    margin-bottom: 8px;
    animation: fadeIn .15s ease;
    max-height: 260px;
    overflow-y: auto;
}

/* Modell-Karten in der Coach-Übersicht */
.coach-model-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 5px;
    border: 1px solid #e9ecef;
    background: #fff;
    margin-bottom: 4px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.coach-model-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}
.coach-model-card.active-model {
    border-color: var(--color-primary);
    background: #fff5f5;
}
.coach-model-card-name {
    font-weight: 600;
    font-size: .73rem;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.coach-model-card-caps {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}
.coach-model-card-caps .cbadge {
    font-size: .60rem;
    padding: 1px 4px;
    border-radius: 3px;
    background: #e9ecef;
    color: #495057;
    white-space: nowrap;
}
.coach-model-card-caps .cbadge.web   { background: #d1fae5; color: #065f46; }
.coach-model-card-caps .cbadge.img   { background: #dbeafe; color: #1e40af; }
.coach-model-card-caps .cbadge.think { background: #ede9fe; color: #5b21b6; }
.coach-model-select-hint {
    font-size: .68rem;
    color: #6c757d;
    margin-top: 4px;
    text-align: center;
}

.coach-panel hr {
    margin: 6px 0;
    border-color: #e2e8f0;
}

/* KI-READY Übungen */
.coach-exercises-bar {
    padding: 0 12px 6px;
    flex-shrink: 0;
}
.coach-exercises-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: .73rem;
    color: #374151;
    transition: border-color .15s;
}
.coach-exercises-toggle:hover { border-color: var(--color-primary); }
.exercises-progress-wrap {
    flex: 1;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}
.exercises-progress-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width .4s ease;
    width: 0%;
}
.exercises-count {
    font-size: .68rem;
    color: #6c757d;
    white-space: nowrap;
}
.exercises-chevron {
    font-size: .65rem;
    color: #9ca3af;
}
.coach-exercises-panel {
    padding: 0 12px 8px;
    flex-shrink: 0;
}
.ex-intro {
    font-size: .70rem;
    color: #6c757d;
    margin-bottom: 6px;
}
.ex-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 7px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    background: #fff;
    margin-bottom: 4px;
    transition: border-color .15s;
}
.ex-item:hover { border-color: var(--color-primary); }
.ex-item.ex-done { background: #f0fdf4; border-color: #86efac; }
.ex-icon { font-size: 1.1rem; flex-shrink: 0; }
.ex-body { flex: 1; min-width: 0; }
.ex-title {
    font-size: .74rem;
    font-weight: 600;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ex-check { color: #16a34a; font-size: .8rem; }
.ex-desc { font-size: .67rem; color: #6c757d; margin-top: 1px; }
.ex-start-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #374151;
    font-size: .8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.ex-start-btn:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.ki-ready-cert {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 6px;
    font-size: .78rem;
    color: #065f46;
}
.ki-cert-icon { font-size: 1.4rem; }

/* Token-Badge im Coach-Header */
.coach-token-badge {
    font-size: .65rem;
    color: #6c757d;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1px 6px;
    white-space: nowrap;
    line-height: 1.6;
}
.coach-cost-est {
    margin-left: 3px;
    color: #b45309;
    font-weight: 600;
}

/* Coach-Chat-Nachrichten (Antworten auf direkte Fragen) */
.coach-chat-messages {
    margin-top: 8px;
    font-size: .78rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.coach-chat-msg {
    padding: 5px 8px;
    border-radius: 6px;
    line-height: 1.45;
    word-break: break-word;
}
.coach-chat-msg.user-q {
    background: #f0e8e8;
    color: #1a1a1a;
    border-radius: 8px 8px 2px 8px;
    align-self: flex-end;
    max-width: 90%;
}
.coach-chat-msg.coach-a {
    background: #f8f9fa;
    border-left: 2px solid var(--color-primary);
    color: #1a1a1a;
    max-width: 100%;
    font-size: .82rem;
}
.coach-chat-msg.coach-a.streaming::after {
    content: '▋';
    animation: blink .7s step-end infinite;
}

/* Markdown-Rendering im Coach-Chat */
.coach-chat-msg.coach-a h1,
.coach-chat-msg.coach-a h2,
.coach-chat-msg.coach-a h3,
.coach-chat-msg.coach-a h4 {
    font-size: .9rem;
    font-weight: 700;
    margin: 6px 0 3px;
}
.coach-chat-msg.coach-a ul,
.coach-chat-msg.coach-a ol {
    padding-left: 1.2em;
    margin: 4px 0;
}
.coach-chat-msg.coach-a li { margin-bottom: 2px; }
.coach-chat-msg.coach-a p  { margin: 0 0 4px; }
.coach-chat-msg.coach-a p:last-child { margin-bottom: 0; }
.coach-chat-msg.coach-a code {
    background: #e9ecef;
    border-radius: 3px;
    padding: 1px 4px;
    font-size: .80rem;
}
.coach-chat-msg.coach-a pre {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    overflow-x: auto;
    font-size: .75rem;
    margin: 4px 0;
}
.coach-chat-msg.coach-a pre code {
    background: none;
    color: inherit;
    padding: 0;
}
.coach-chat-msg.coach-a table {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
    margin: 4px 0;
}
.coach-chat-msg.coach-a th,
.coach-chat-msg.coach-a td {
    border: 1px solid #dee2e6;
    padding: 3px 6px;
    text-align: left;
}
.coach-chat-msg.coach-a th { background: #e9ecef; font-weight: 600; }
.coach-chat-msg.coach-a strong { font-weight: 700; }
.coach-chat-msg.coach-a blockquote {
    border-left: 3px solid #c62a3b;
    padding: 2px 8px;
    color: #6c757d;
    margin: 4px 0;
    font-style: italic;
}

/* Coach Quick-Chips */
.coach-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 5px;
}
.coach-chip {
    font-size: .67rem;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    white-space: nowrap;
}
.coach-chip:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* Coach-Chat-Eingabebereich */
.coach-chat-input-area {
    border-top: 1px solid #e9ecef;
    padding: 6px 8px 6px;
    background: #fff;
    flex-shrink: 0;
}
.coach-chat-label {
    font-size: .65rem;
    color: #9ca3af;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.coach-chat-row {
    display: flex;
    align-items: flex-end;
    gap: 5px;
}
.coach-chat-textarea {
    flex: 1;
    resize: none;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: .78rem;
    line-height: 1.5;
    min-height: 52px;
    max-height: 120px;
    overflow-y: auto;
    background: #f8f9fa;
    transition: border-color .15s;
    color: var(--color-text);
}
.coach-chat-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #fff;
}
.coach-send-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
.coach-send-btn:hover { background: #a00; }
.coach-send-btn:disabled { background: #ccc; cursor: default; }

.coach-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 0 12px;
    font-size: 0.82rem;
}

/* Label über dem Haupt-Chat-Textarea */
.chat-context-label {
    width: 100%;
    max-width: 720px;
    font-size: .65rem;
    color: #9ca3af;
    margin-bottom: 3px;
    padding-left: 2px;
    letter-spacing: .03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Analytics: Ampel-Karten */
.ampel-stat-card {
    border-radius: 8px;
    padding: 10px 16px;
    text-align: center;
    min-width: 80px;
    border: 1px solid rgba(0,0,0,.06);
}
.ampel-stat-val  { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.ampel-stat-label { font-size: .72rem; color: #374151; margin-top: 2px; }
.ampel-stat-pct  { font-size: .68rem; color: #6c757d; }

.truncation-hint {
    font-size: .78rem;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 5px;
    padding: 5px 10px;
    margin: 4px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Coach: Modell-Info-Box */
/* Toggle-Button für Modell-Info */
.coach-model-info-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0f4f8;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 9px;
    margin: 0 12px 4px;
    width: calc(100% - 24px);
    cursor: pointer;
    font-size: .73rem;
    color: #374151;
    text-align: left;
    transition: background .15s;
    flex-shrink: 0;
}
.coach-model-info-toggle:hover { background: #e5eaf0; }
.coach-model-info-chevron { font-size: .62rem; color: #9ca3af; flex-shrink: 0; }
.cap-badge-xs {
    display: inline-block;
    font-size: .60rem;
    padding: 1px 4px;
    border-radius: 3px;
    background: #e2e8f0;
    color: #374151;
    margin-left: 2px;
    vertical-align: middle;
}

.coach-model-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 8px 8px;
    border-top: none;
    padding: 8px 10px 10px;
    margin: -4px 12px 8px;
    font-size: .78rem;
    max-height: 260px;
    overflow-y: auto;
}
.cap-model-name {
    font-weight: 700;
    font-size: .8rem;
    color: #1e293b;
    margin-bottom: 5px;
}
.cap-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}
.cap-badge {
    font-size: .68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: .02em;
}
.cap-web   { background: #dbeafe; color: #1d4ed8; }
.cap-img   { background: #d1fae5; color: #065f46; }
.cap-think { background: #ede9fe; color: #5b21b6; }
.cap-ctx   { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.cap-price { font-size: .7rem; color: #6b7280; margin-top: 2px; }

/* Kompakte Richtlinie-Zeile (ersetzt den alten Block) */
.coach-richtlinie-mini {
    font-size: .67rem;
    color: #92400e;
    background: #fffbeb;
    border-left: 2px solid #f0a500;
    padding: 3px 8px;
    margin: 0 12px 6px;
    line-height: 1.4;
    flex-shrink: 0;
}
.coach-richtlinie-icon { margin-right: 3px; }

/* Ampel-Badge */
.coach-ampel-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 12px 4px;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s;
    flex-shrink: 0;
    user-select: none;
}
.coach-ampel-bar:hover { filter: brightness(.96); }
.ampel-gruen   { background: #f0fdf4; border-color: #86efac; }
.ampel-gelb    { background: #fffbeb; border-color: #fcd34d; }
.ampel-rot     { background: #fff1f2; border-color: #fca5a5; }
.ampel-neutral { background: #f1f5f9; border-color: #e2e8f0; }

.coach-ampel-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-gruen   { background: #16a34a; }
.dot-gelb    { background: #d97706; }
.dot-rot     { background: #dc2626; }
.dot-neutral { background: #9ca3af; }

@keyframes blink-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: .2; }
}
.dot-blink { animation: blink-dot .8s ease-in-out infinite; }

.coach-ampel-summary {
    flex: 1;
    font-size: .74rem;
    font-weight: 600;
    color: #1a1a1a;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.coach-ampel-chevron { font-size: .62rem; color: #9ca3af; }
.coach-ampel-loading {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .70rem;
    color: #6c757d;
    margin: 0 12px 4px;
    flex-shrink: 0;
}
.coach-placeholder-text {
    font-size: .75rem;
    color: #9ca3af;
    margin-top: 6px;
}
.coach-tip-detail {
    font-size: .75rem;
    line-height: 1.5;
    padding-top: 4px;
}

/* Modell-Hinweis in Übungen */
.ex-hint {
    font-size: .65rem;
    color: #1d4ed8;
    background: #eff6ff;
    border-radius: 3px;
    padding: 2px 5px;
    margin-top: 3px;
    display: inline-block;
}

/* Alte .coach-richtlinie bleibt für Rückwärtskompatibilität */
.coach-richtlinie {
    background: #fff3cd;
    border-left: 3px solid #f0a500;
    border-radius: 3px;
    padding: 5px 8px;
    font-size: 0.78rem;
    color: #664d00;
    line-height: 1.3;
    margin-bottom: 8px;
    display: none;   /* ersetzt durch .coach-richtlinie-mini */
}

#coach-placeholder {
    font-size: 0.8rem;
    color: #999;
    line-height: 1.4;
}

#coach-tip {
    border-radius: 4px;
    padding: 8px 10px;
    color: #1e293b;
    line-height: 1.35;
    font-size: 0.82rem;
    border-left: 3px solid #94a3b8;
    background: #f8fafc;
}

/* Modell- / Schreib-Info: hellblau – nicht mit Ampel-Rot verwechseln */
#coach-tip.tip-info,
#coach-tip.tip-typing {
    background: #eff6ff;
    border-left-color: #60a5fa;
    color: #1e3a5f;
}
#coach-tip.tip-info strong,
#coach-tip.tip-typing strong {
    color: #1d4ed8;
    border-top-color: #bfdbfe;
}

/* Chip-Vertiefung: neutrales Indigo */
#coach-tip.tip-chip {
    background: #f5f3ff;
    border-left-color: #818cf8;
    color: #312e81;
}
#coach-tip.tip-chip strong {
    color: #4338ca;
    border-top-color: #c7d2fe;
}

/* Ampel-Antworten in Ampel-Farben */
#coach-tip.tip-ampel-gruen {
    background: #f0fdf4;
    border-left-color: #22c55e;
    color: #14532d;
}
#coach-tip.tip-ampel-gruen strong {
    color: #15803d;
    border-top-color: #bbf7d0;
}
#coach-tip.tip-ampel-gelb {
    background: #fffbeb;
    border-left-color: #f59e0b;
    color: #78350f;
}
#coach-tip.tip-ampel-gelb strong {
    color: #b45309;
    border-top-color: #fde68a;
}
#coach-tip.tip-ampel-rot {
    background: #fff1f2;
    border-left-color: #ef4444;
    color: #881337;
}
#coach-tip.tip-ampel-rot strong {
    color: #be123c;
    border-top-color: #fecdd3;
}

#coach-tip p {
    margin-bottom: 4px;
    line-height: 1.35;
}

#coach-tip p:last-child {
    margin-bottom: 0;
}

#coach-tip ul {
    margin: 2px 0 5px 0;
    padding-left: 14px;
}

#coach-tip li {
    margin-bottom: 2px;
    line-height: 1.3;
}

#coach-tip strong {
    display: inline;
    margin: 0;
    font-size: inherit;
    text-transform: none;
    letter-spacing: normal;
    border-top: none;
    padding-top: 0;
    color: inherit;
}

#coach-tip strong:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* Model Select */
.model-select-wrapper {
    font-size: 0.85rem;
}

/* Admin Layout */
.admin-nav {
    margin-top: 8px;
}

/* Nutzer: Zusatzgruppen */
.extra-groups-list {
    max-height: 16rem;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
}

/* Gruppen: Modellliste ausklappbar */
.group-models-summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-neutral);
    user-select: none;
}
.group-models-summary:hover {
    color: var(--color-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-sidebar {
        display: none;
    }
    .coach-panel {
        display: none;
    }
    .message {
        max-width: 95%;
    }
}

/* Alert overrides */
.alert-info {
    background-color: #e0f2fe;
    color: #0369a1;
}

.alert-success {
    background-color: #dcfce7;
    color: #15803d;
}

.alert-warning {
    background-color: #fef9c3;
    color: #a16207;
}

.alert-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* === Citations: Styles oben bei Nachrichten definiert === */

/* Sortierbare Tabellenspalten (Admin) */
th.sort-col {
    user-select: none;
    white-space: nowrap;
    transition: background .12s, color .12s;
}
th.sort-col:hover {
    background: #f0f4ff !important;
    color: #1a56db;
}
.sort-arrow {
    font-size: .75em;
    opacity: .6;
    margin-left: 2px;
}

/* === LearnMode Hilfe-Tour === */
.lm-shade {
    position: fixed;
    background: rgba(0, 0, 0, 0.48);
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 15000;
    display: none;
}
.lm-highlight {
    position: fixed;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15);
    background: transparent;
    z-index: 15001;
    display: none;
    pointer-events: none;
}
.lm-tooltip {
    position: fixed;
    max-width: 340px;
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.14);
    padding: 14px 14px 10px 14px;
    z-index: 15002;
    display: none;
}
.lm-tooltip-title {
    font-weight: 700;
    font-size: .95rem;
    margin-bottom: 6px;
    color: #111827;
}
.lm-tooltip-text {
    font-size: .85rem;
    color: #374151;
    margin-bottom: 10px;
    line-height: 1.45;
}
.lm-tooltip-controls {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.lm-shade.is-visible,
.lm-highlight.is-visible,
.lm-tooltip.is-visible {
    display: block;
}
#learnmode-start-btn {
    font-size: .78rem;
    padding: 0;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.7);
    color: #fff;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    letter-spacing: 0;
}
#learnmode-start-btn:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    transform: scale(1.1);
}

/* LearnMode: Sidebar waehrend Tour sichtbar (collapsed aufheben) */
.chat-sidebar.lm-tour-sidebar-open:not(.collapsed) {
    /* Marker-Klasse; Breite kommt vom Normalzustand ohne .collapsed */
}

.lm-tooltip.is-visible {
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
}
.lm-highlight.is-visible {
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.35);
}

/* Admin Nutzer-Tabelle: Spalten sortieren */
#users-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
#users-table th.sortable::after {
    content: " \2195";
    opacity: 0.35;
    font-size: 0.85em;
}
#users-table th.sortable.sort-asc::after {
    content: " \2191";
    opacity: 0.9;
}
#users-table th.sortable.sort-desc::after {
    content: " \2193";
    opacity: 0.9;
}

.shared-block {
    margin-top: 12px;
}

.session-item.shared .btn-session-move,
.session-item.shared .btn-delete-session {
    display: none;
}

.session-item.shared-by-me:not(.active) {
    box-shadow: inset 3px 0 0 #c0003c;
}

.session-share-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 600;
    color: #c0003c;
    background: rgba(192, 0, 60, 0.12);
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: 6px;
}

.session-item.active .session-share-badge {
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
}

.session-shared-meta {
    display: block;
    font-size: 0.68rem;
    color: #6b7280;
    line-height: 1.2;
}

.share-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.share-badge {
    font-size: 0.72rem;
    color: #6b7280;
}

.share-guest-label {
    font-size: 0.8rem;
    color: #374151;
}

.share-readonly-hint {
    font-size: 0.8rem;
    color: #9f1239;
    margin: 0 0 6px;
}

.share-person {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #e5e7eb;
}

.share-person-owner {
    font-weight: 600;
}

.share-search-results button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    border: 0;
    background: #f8fafc;
    padding: 6px 8px;
    margin-top: 4px;
    font-size: 0.85rem;
}

.share-invite-label {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: #c0003c;
    border-radius: 4px;
    padding: 2px 8px;
}

.share-status {
    color: #166534;
}
