/* ===================================================
   HandwerkAI - Modern Design System & Stylesheet
   =================================================== */

/* ===== 1. CSS VARIABLES & DESIGN TOKENS ===== */
:root {
    /* Color Palette - Modern Minimalist SaaS */
    --bg-body: #FFFFFF;
    --bg-surface: #F8FAFC;         /* Slate 50 */
    --bg-surface-hover: #F1F5F9;   /* Slate 100 */
    --bg-sidebar: #F8FAFC;         /* Modern subtle sidebar tint */
    --bg-card: #FFFFFF;
    --bg-input: #FFFFFF;
    --bg-active-pill: #EBF3FE;     /* Soft blue highlight */

    /* Typography Colors */
    --text-primary: #0F172A;       /* Slate 900 - Crisp contrast */
    --text-secondary: #334155;     /* Slate 700 */
    --text-tertiary: #64748B;      /* Slate 500 */
    --text-muted: #94A3B8;         /* Slate 400 */
    --text-on-primary: #FFFFFF;

    /* Brand Accents */
    --primary: #0284C7;            /* Sky 600 - High trust blue */
    --primary-hover: #0369A1;      /* Sky 700 */
    --primary-light: #E0F2FE;      /* Sky 100 */
    --primary-soft: rgba(2, 132, 199, 0.08);
    --primary-glow: rgba(2, 132, 199, 0.22);
    
    --accent: #EA580C;             /* Orange 600 */
    --accent-light: #FFEDD5;
    
    --success: #10B981;            /* Emerald 500 */
    --success-bg: #ECFDF5;
    --danger: #EF4444;             /* Red 500 */
    --danger-bg: #FEF2F2;

    /* Borders */
    --border-subtle: #E2E8F0;      /* Slate 200 */
    --border-strong: #CBD5E1;      /* Slate 300 */
    --border-focus: #0284C7;

    /* Spacing & Radii */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-full: 9999px;
    
    --sidebar-width: 310px;
    --header-height: 72px;

    /* Ambient Elevation & Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
    --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
    --shadow-float: 0 20px 35px -6px rgba(15, 23, 42, 0.10), 0 10px 15px -4px rgba(15, 23, 42, 0.04);
    --shadow-primary: 0 4px 14px rgba(2, 132, 199, 0.25);

    /* Fonts */
    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== 2. RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.6;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* ===== 3. SIDEBAR STYLING ===== */
aside#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 18px 16px 16px 16px;
    height: 100vh;
    flex-shrink: 0;
    z-index: 50;
    overflow: hidden;
    box-sizing: border-box;
    transition: transform var(--transition-smooth);
    user-select: none;
}

/* Sidebar Brand Header */
.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 2px;
}

.brand-logotype {
    display: flex;
    align-items: center;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #FFFFFF;
    border: 1.5px solid var(--border-subtle);
    padding: 6px 14px 6px 8px;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: #0d1b2a;
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.brand-pill:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.brand-logo-img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.brand-text-main {
    font-weight: 800;
    color: #0d1b2a;
    letter-spacing: -0.02em;
}

.brand-text-accent {
    color: #1d6bf3;
}

.brand-pill i {
    color: #FFFFFF;
    background: linear-gradient(135deg, #FF385C 0%, #E11D48 100%);
    border-radius: 50%;
    font-size: 0.78rem;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
}

.sidebar-icon-action {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-tertiary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-icon-action:hover {
    background: #FFFFFF;
    border-color: var(--border-subtle);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
}

/* Primary Navigation */
.primary-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 8px;
}

/* New Chat Button */
.nav-item.new-chat {
    background: #FFFFFF;
    border: 1.5px solid var(--border-subtle);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.96rem;
}

.nav-item.new-chat:hover {
    background: #FFFFFF;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
    transform: translateY(-1px);
}

.nav-item.new-chat i {
    color: var(--primary);
    font-size: 0.95rem;
}

.new-chat-shortcut {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-tertiary);
    background: #F1F5F9;
    border: 1px solid var(--border-subtle);
    padding: 2.5px 7px;
    border-radius: 4px;
    flex: 0 0 auto !important;
}

/* Search Box */
.search-box {
    position: relative;
    margin: 2px 0 10px 0;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.92rem;
    pointer-events: none;
    transition: color var(--transition-fast);
}

.search-box input {
    width: 100%;
    padding: 9.5px 14px 9.5px 38px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-subtle);
    background-color: #FFFFFF;
    font-size: 0.94rem;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}

.search-box input:focus + i,
.search-box:focus-within i {
    color: var(--primary);
}

.search-box input::placeholder {
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* Nav Items */
.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8.5px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    cursor: pointer;
}

.nav-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Refined icon colors on hover */
.nav-item:hover .nav-icon-inbox { color: #0284C7; }
.nav-item:hover .nav-icon-folder { color: #D97706; }
.nav-item:hover .nav-icon-agents { color: #8B5CF6; }
.nav-item:hover .nav-icon-skills { color: #EC4899; }
.nav-item:hover .nav-icon-workflows { color: #06B6D4; }
.nav-item:hover .nav-icon-prompts { color: #10B981; }
.nav-item:hover .nav-icon-integrations { color: #6366F1; }
.nav-item:hover .nav-icon-compliance { color: #059669; }

.nav-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* Active Nav Item */
.nav-item.active {
    background-color: var(--bg-active-pill);
    color: var(--primary);
    font-weight: 600;
    border-color: rgba(2, 132, 199, 0.16);
    position: relative;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.05);
}

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

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3.5px;
    background-color: var(--primary);
    border-radius: 0 4px 4px 0;
}

.nav-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-subtle) 15%, var(--border-subtle) 85%, transparent);
    margin: 8px 0;
}

/* Nav Scroll & Collapsible Sections */
.nav-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 9px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.nav-section-title-row:hover {
    background-color: var(--bg-surface-hover);
}

.nav-section-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
}

.section-count {
    font-size: 0.74rem;
    background: #E2E8F0;
    color: var(--text-secondary);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-weight: 600;
    letter-spacing: 0;
}

.section-caret {
    font-size: 0.68rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.nav-section.collapsed .section-caret {
    transform: rotate(-90deg);
}

.nav-section.collapsed ul {
    display: none;
}

ul#active-projects-list, ul#chat-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-item, .project-item {
    font-size: 0.92rem;
    padding: 7.5px 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.history-item .history-title, .project-item .history-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    flex: 1;
}

/* Chatverlauf: Loeschknopf und Leerzustand. Der Knopf bleibt unsichtbar,
   bis die Zeile unter dem Zeiger liegt - auf dem Tablet zeigt ihn der
   erste Antipper. */
.hw-chat-weg {
    margin-left: auto;
    flex: 0 0 auto;
    border: 0;
    background: none;
    color: var(--text-tertiary);
    font-size: 1.05rem;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.history-item:hover .hw-chat-weg,
.history-item:focus-within .hw-chat-weg {
    opacity: 1;
}

.hw-chat-weg:hover {
    color: var(--danger, #dc2626);
}

.hw-chat-leer {
    padding: 8px 10px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-tertiary);
}

.history-item:hover, .project-item:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}

.chat-dot {
    width: 7px;
    height: 7px;
    min-width: 7px;
    min-height: 7px;
    border-radius: 50%;
    background-color: var(--text-muted);
    display: inline-block;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.chat-dot.current {
    background-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.22);
}

.history-item:hover .chat-dot:not(.current) {
    background-color: var(--text-tertiary);
}

/* Sidebar Footer: Settings, Profile & User Card */
.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(226, 232, 240, 0.75);
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: inherit;
    flex-shrink: 0;
}

.footer-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.sidebar-footer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.81rem;
    font-weight: 550;
    background: #FFFFFF;
    border: 1px solid rgba(226, 232, 240, 0.9);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #F8FAFC;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-footer-btn:hover {
    background: #FFFFFF;
    border-color: rgba(2, 132, 199, 0.35);
    color: var(--primary);
    box-shadow: 0 3px 10px -2px rgba(2, 132, 199, 0.12), 0 1px 3px rgba(15, 23, 42, 0.04);
    transform: translateY(-1.5px);
}

.sidebar-footer-btn:hover .btn-icon-wrap {
    background: #E0F2FE;
    color: var(--primary);
    transform: scale(1.08);
}

.sidebar-footer-btn:active {
    transform: scale(0.97);
}

/* User Card */
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border-radius: 14px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
    position: relative;
}

.sidebar-user-card:hover {
    background: #FFFFFF;
    border-color: rgba(2, 132, 199, 0.38);
    box-shadow: 0 6px 18px -4px rgba(2, 132, 199, 0.14), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    transform: translateY(-1.5px);
}

.sidebar-user-card:active {
    transform: scale(0.99);
}

.user-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 50%, #1E40AF 100%);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.28), inset 0 1px 1.5px rgba(255, 255, 255, 0.4);
    letter-spacing: 0.03em;
    font-family: var(--font-heading);
}

.avatar-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10B981;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
    animation: status-pulse 2.5s infinite;
}

@keyframes status-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    }
    70% {
        box-shadow: 0 0 0 4.5px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    gap: 2px;
}

.user-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-name {
    font-size: 0.86rem;
    font-weight: 650;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    font-family: var(--font-heading);
    letter-spacing: -0.01em;
}

.user-badge-pro {
    font-size: 0.6rem;
    font-weight: 800;
    color: #FFFFFF;
    background: linear-gradient(135deg, #0284C7 0%, #2563EB 100%);
    padding: 2px 6.5px;
    border-radius: 9999px;
    letter-spacing: 0.06em;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(2, 132, 199, 0.35);
    text-transform: uppercase;
}

.user-role {
    font-size: 0.73rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    font-weight: 450;
    display: flex;
    align-items: center;
    gap: 4px;
}

.role-icon {
    font-size: 0.68rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.user-card-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #F8FAFC;
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    cursor: pointer;
}

.sidebar-user-card:hover .user-card-badge {
    color: var(--primary);
    background: #E0F2FE;
    border-color: #BAE6FD;
}

.user-card-badge:hover {
    background: var(--primary) !important;
    color: #FFFFFF !important;
    border-color: var(--primary) !important;
    transform: rotate(90deg) scale(1.08);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

/* ===== 4. MAIN CHAT VIEWPORT & WELCOME SCREEN ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-body);
    min-width: 0;
    height: 100vh;
    /* Mobile Browser zählen ihre Adressleiste zu 100vh - unten angedocktes Eingabefeld wäre sonst halb verdeckt. */
    height: 100dvh;
}

.mm-kopfleiste {
    display: none;
}

.mobile-menu-btn {
    display: none;
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 60;
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.chat-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 32px clamp(20px, 4vw, 48px) 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    scroll-behavior: smooth;
    width: 100%;
}

.welcome-container {
    max-width: 1280px;
    width: 100%;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
    padding: 8px 12px;
}

.welcome-top-brand {
    margin-bottom: clamp(20px, 2.5vw, 32px);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.welcome-brand-logo {
    width: clamp(340px, 46vw, 640px);
    max-width: min(94vw, 640px);
    height: auto;
    display: block;
    filter: drop-shadow(0 6px 22px rgba(15, 23, 42, 0.06));
    transition: transform var(--transition-fast);
}

.welcome-brand-logo:hover {
    transform: scale(1.015);
}

.welcome-top-brand .brand-pill {
    padding: 10px 22px 10px 12px;
    font-size: 1.15rem;
    gap: 12px;
    border-width: 1.5px;
}

.welcome-top-brand .brand-pill i {
    width: 30px;
    height: 30px;
    font-size: 0.95rem;
}

.welcome-container h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.4rem, 4.4vw, 4rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: clamp(24px, 3vw, 40px);
    letter-spacing: -0.035em;
    line-height: 1.15;
}

/* Central Input Card on Welcome Screen */
.app-input-container {
    max-width: 1120px;
    width: 100%;
    margin: clamp(14px, 1.8vw, 22px) auto clamp(28px, 3.2vw, 42px);
}

.input-card {
    border: 1.5px solid var(--border-subtle);
    border-radius: clamp(20px, 2.2vw, 26px);
    background: #FFFFFF;
    padding: clamp(20px, 2.2vw, 28px) clamp(22px, 2.6vw, 34px) clamp(18px, 2vw, 24px);
    box-shadow: 0 14px 38px -6px rgba(15, 23, 42, 0.09), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 1.6vw, 20px);
    transition: all var(--transition-fast);
}

.input-card:focus-within {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg), 0 0 0 4px rgba(2, 132, 199, 0.16);
}

.input-card textarea {
    width: 100%;
    border: none;
    outline: none;
    font-size: clamp(1.22rem, 1.4vw, 1.48rem);
    line-height: 1.55;
    resize: none;
    padding: 4px 2px;
    min-height: clamp(62px, 7vw, 76px);
    font-family: inherit;
    color: var(--text-primary);
    background: transparent;
}

.input-card textarea::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: clamp(1.18rem, 1.35vw, 1.42rem);
}

/* Bottom Input Toolbar */
.input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: clamp(10px, 1.2vw, 16px);
    padding-top: 6px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 14px);
    min-width: 0;
    flex: 1;
}

.toolbar-pills-scroll {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 12px);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 2px;
}
.toolbar-pills-scroll::-webkit-scrollbar {
    display: none;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 12px);
    flex-shrink: 0;
}

.tool-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.35rem;
    transition: all var(--transition-fast);
}

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

.tool-btn.icon-circle-btn {
    border: 1.5px solid var(--border-subtle);
    background: #FFFFFF;
    color: var(--text-tertiary);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 1.12rem;
    flex-shrink: 0;
}

.tool-btn.icon-circle-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.tool-pill-btn {
    background: #FFFFFF;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: clamp(9px, 0.95vw, 11px) clamp(16px, 1.3vw, 22px);
    font-size: clamp(0.98rem, 1.05vw, 1.14rem);
    font-weight: 500;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.tool-pill-btn i {
    color: var(--text-tertiary);
    font-size: 1.08rem;
    transition: color var(--transition-fast);
}

.tool-pill-btn .pill-dropdown-arrow {
    font-size: 0.78rem;
    margin-left: 2px;
    color: var(--text-muted);
}

.tool-pill-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.tool-pill-btn.active {
    background: var(--bg-surface-hover);
    border-color: var(--text-primary);
    color: var(--text-primary);
    font-weight: 600;
}

.tool-pill-btn.active i {
    color: var(--text-primary);
}

.tool-btn.mic-btn {
    color: var(--text-tertiary);
    width: 46px;
    height: 46px;
    font-size: 1.32rem;
}

.tool-btn.mic-btn:hover {
    color: var(--text-primary);
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0F172A;
    color: #FFFFFF;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.22rem;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.22);
}

.send-btn:hover {
    background: #000000;
    transform: scale(1.05);
}

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

.send-btn.disabled,
.send-btn:disabled {
    background: #E2E8F0;
    color: var(--text-muted);
    cursor: default;
    box-shadow: none;
    transform: none;
}

/* Quick Action Suggestion Pills */
.quick-actions-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(10px, 1.2vw, 16px);
    max-width: 1200px;
    margin: 0 auto clamp(28px, 3.5vw, 44px);
}

.quick-action-pill {
    background: #FFFFFF;
    border: 1.5px solid var(--border-subtle);
    padding: clamp(13px, 1.25vw, 16px) clamp(22px, 1.8vw, 30px);
    border-radius: var(--radius-full);
    font-size: clamp(1.02rem, 1.1vw, 1.18rem);
    font-weight: 500;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
}

.quick-action-pill i {
    color: var(--primary);
    font-size: clamp(1.02rem, 1.1vw, 1.16rem);
    transition: transform var(--transition-fast);
}

.quick-action-pill:hover {
    background: var(--bg-surface);
    border-color: #93C5FD;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(2, 132, 199, 0.14);
}

.quick-action-pill:hover i {
    transform: scale(1.1);
}

.quick-action-pill:active {
    transform: translateY(0);
}

.default-disclaimer {
    margin-top: 28px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ===== 5. ACTIVE CHAT SCREEN & FLOATING INPUT ===== */
.chat-messages {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 32px clamp(16px, 4vw, 36px) 160px;
}

.chat-messages.active {
    display: flex;
}

.message {
    display: flex;
    gap: 0;
    width: 100%;
    align-items: flex-start;
    animation: fadeIn 0.25s ease-out;
}

.message-avatar {
    display: none !important;
}

.message-user {
    justify-content: flex-end;
    padding-right: 0;
}

.message + .message {
    margin-top: 32px;
}

.message-user + .message-ai {
    margin-top: 24px;
}

.message-ai + .message-user {
    margin-top: 36px;
}

.message-content {
    max-width: 100%;
    min-width: 0;
    line-height: 1.7;
    font-size: 1.08rem;
    display: flex;
    flex-direction: column;
}

.message-user .message-content {
    max-width: min(80%, 680px);
    justify-content: center;
    background-color: var(--bg-active-pill);
    color: var(--text-primary);
    border: 1px solid rgba(2, 132, 199, 0.15);
    padding: 12px 20px;
    border-radius: 22px;
    box-shadow: var(--shadow-xs);
}

.message-ai .message-content {
    width: 100%;
    max-width: 100%;
    background-color: transparent;
    color: var(--text-primary);
    border: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.message-text {
    min-width: 0;
    font-size: 1.08rem;
    line-height: 1.7;
    color: var(--text-primary);
    overflow-wrap: anywhere;
    letter-spacing: -0.005em;
}

.message-user .message-text {
    white-space: pre-wrap;
    line-height: 1.55;
    font-size: 1.04rem;
    color: var(--text-primary);
    letter-spacing: 0;
}

.message-content p {
    margin-bottom: 16px;
}
.message-content p:last-child {
    margin-bottom: 0;
}
.message-content strong,
.message-content b {
    font-weight: 600;
    color: #0F172A;
}
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 18px;
    margin-bottom: 8px;
    line-height: 1.35;
    letter-spacing: -0.015em;
}
.message-content h1 { font-size: 1.35rem; }
.message-content h2 { font-size: 1.2rem; }
.message-content h3 { font-size: 1.05rem; }
.message-content h4 { font-size: 0.95rem; }
.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child { margin-top: 0; }

.message-content ul,
.message-content ol {
    padding-left: 22px;
    margin: 6px 0 12px;
}
.message-content ul { list-style-type: disc; }
.message-content ol { list-style-type: decimal; }
.message-content li {
    margin-bottom: 4px;
    padding-left: 4px;
}

.message-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    padding: 1px 6px;
    color: #BE185D;
}
.message-content pre {
    background-color: #0F172A;
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-x: auto;
    margin: 14px 0;
}
.message-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #F8FAFC;
    font-size: 0.9em;
    line-height: 1.6;
}

/* Callouts & Blockquotes (Modernes, harmonisches Design) */
.message-content blockquote {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 0;
    padding: 10px 14px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 3.5px solid var(--primary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.message-content blockquote .hw-callout-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.92rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.message-content blockquote .hw-callout-content {
    flex: 1;
    min-width: 0;
}

.message-content blockquote p {
    margin: 0;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

.message-content blockquote p + p {
    margin-top: 6px;
}

.message-content blockquote.hw-callout-warn {
    background-color: rgba(245, 158, 11, 0.04);
    border-color: rgba(245, 158, 11, 0.22);
    border-left: 3.5px solid #F59E0B;
}

.message-content blockquote.hw-callout-warn .hw-callout-icon {
    color: #D97706;
}

.message-content blockquote.hw-callout-success {
    background-color: rgba(16, 185, 129, 0.04);
    border-color: rgba(16, 185, 129, 0.22);
    border-left: 3.5px solid var(--success);
}

.message-content blockquote.hw-callout-success .hw-callout-icon {
    color: var(--success);
}

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

.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    margin-top: 14px;
    padding: 0;
    border: 0;
    color: var(--text-muted);
}

.message-actions button,
.message-actions .msg-action-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.message-actions button:hover,
.message-actions .msg-action-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}

/* Floating Input Container for Active Chat */
.active-chat-input-container {
    position: relative;
    width: 100%;
    flex: 0 0 auto;
    padding: 14px clamp(16px, 4vw, 40px) 16px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 20;
}

.active-chat-input-container .input-card {
    width: 100%;
    max-width: 960px;
    gap: 8px;
    padding: 12px 18px 10px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.active-chat-input-container .input-card textarea {
    min-height: 40px;
    font-size: 1.05rem;
    line-height: 1.5;
}

.footer-disclaimer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.76rem;
    margin-top: 8px;
    font-weight: 400;
}

/* Wikipedia Person Card */
.wiki-person-card {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-top: 14px;
    width: min(100%, 520px);
    max-width: 100%;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.wiki-person-card img {
    width: 110px;
    min-height: 125px;
    object-fit: cover;
    object-position: top center;
    flex-shrink: 0;
    display: block;
    border-right: 1px solid var(--border-subtle);
}
.wiki-person-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    padding: 14px 16px;
}
.wiki-person-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}
.wiki-person-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.wiki-person-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.wiki-person-link:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

/* Tables in Markdown */
.message-content table,
.msg-table {
    width: 100%;
    max-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0;
    font-size: 0.92rem;
    background-color: #FFFFFF;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-xs);
}
.message-content table th,
.message-content table td,
.msg-table th,
.msg-table td {
    padding: 9px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}
.message-content table th,
.msg-table th {
    background-color: var(--primary-light);
    color: var(--primary-hover);
    font-weight: 700;
}
.message-content table tr:last-child td,
.msg-table tr:last-child td {
    border-bottom: none;
}
.message-content table tr:hover td,
.msg-table tr:hover td {
    background-color: var(--bg-surface);
}

/* Badges */
.web-search-badge,
.citation-badge,
.source-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 2px 8px;
    background: #F1F5F9;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    vertical-align: middle;
    transition: all var(--transition-fast);
    cursor: pointer;
}
.web-search-badge:hover,
.citation-badge:hover,
.source-pill:hover {
    background: #E2E8F0;
    color: var(--text-primary);
}

/* ===================================================
   CHAT SOURCES ATTACHMENT (Kompakter Quellen-Anhang)
   =================================================== */
.chat-sources-attachment {
    margin-top: 12px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.04);
    transition: all var(--transition-fast);
}
.chat-sources-attachment:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.06);
}
.chat-sources-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.chat-sources-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}
.chat-sources-title i {
    color: var(--primary);
    font-size: 0.78rem;
}
.chat-sources-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.chat-sources-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: #bae6fd;
}
.chat-sources-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}
.chat-source-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.75rem;
    min-width: 0;
    box-sizing: border-box;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.chat-source-chip:hover {
    border-color: #93c5fd;
    background: #f0f9ff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.08);
}
.chat-source-chip-nr {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-source-chip-favicon {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    object-fit: contain;
}
.chat-source-chip-fallback {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}
.chat-source-chip-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}
.chat-source-chip-domain {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.chat-source-chip-title {
    font-size: 0.71rem;
    font-weight: 400;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}
.chat-source-chip-ext {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}
.chat-source-chip:hover .chat-source-chip-ext {
    opacity: 1;
    color: var(--primary);
}
.chat-source-chip:hover .chat-source-chip-ext {
    opacity: 1;
    color: var(--primary);
}

/* Detailed expanded view */
.chat-sources-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-subtle);
}
.chat-source-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 10px;
    background: var(--bg-body);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}
.chat-source-detail-item:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.chat-source-detail-content {
    flex: 1;
    min-width: 0;
}
.chat-source-detail-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}
.chat-source-detail-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-source-detail-domain {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--primary);
    flex-shrink: 0;
}
.chat-source-detail-snippet {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.chat-source-detail-item > i {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 3px;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .chat-sources-chips {
        grid-template-columns: 1fr;
    }
}


/* ===================================================
   PREISKARTEN (Live-Produktpreise der Haendler)
   =================================================== */
.hw-preis-panel {
    margin-top: 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
    transition: box-shadow var(--transition-fast);
}

.hw-preis-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-subtle);
}

.hw-preis-kopf-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.hw-preis-icon-badge {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.15);
}

.hw-preis-kopf-titel {
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.hw-preis-term {
    color: var(--primary);
    font-weight: 700;
}

.hw-preis-kopf-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hw-preis-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-tertiary);
}

.hw-preis-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: hw-pulse 2s infinite;
}

@keyframes hw-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.hw-preis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
    gap: 12px;
    padding: 14px;
    background: var(--bg-surface);
}

.hw-preis-karte {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.hw-preis-karte:hover {
    transform: translateY(-3px);
    border-color: #93c5fd;
    box-shadow: 0 10px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
}

.hw-preis-bild {
    position: relative;
    height: 130px;
    background: #ffffff;
    border-bottom: 1px solid var(--bg-surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hw-preis-foto {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hw-preis-karte:hover .hw-preis-foto {
    transform: scale(1.06);
}

.hw-preis-platzhalter-box {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface-hover) 100%);
}

.hw-preis-platzhalter {
    font-size: 1.8rem;
    color: var(--border-strong);
}

.hw-preis-bild-leer {
    background: var(--bg-surface-hover);
}

.hw-preis-bild-leer .hw-preis-platzhalter-box {
    display: flex;
}

.hw-preis-shop {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: calc(100% - 16px);
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius-full);
    font-size: 0.67rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    z-index: 2;
}

.hw-preis-shop img {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
}

.hw-preis-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 11px 12px 12px;
    flex: 1;
}

.hw-preis-name {
    font-size: 0.79rem;
    font-weight: 600;
    line-height: 1.38;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.2rem;
}

.hw-preis-sub {
    font-size: 0.69rem;
    color: var(--text-tertiary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: -1px;
}

.hw-preis-pricing {
    margin-top: auto;
    padding-top: 6px;
}

.hw-preis-fuss {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: wrap;
}

.hw-preis-betrag {
    font-family: var(--font-heading);
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.hw-preis-einheit {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-tertiary);
}

.hw-preis-zweit {
    font-size: 0.66rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}

.hw-preis-lager {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.67rem;
    font-weight: 600;
    color: var(--success);
    margin-top: 4px;
    background: var(--success-bg);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    width: fit-content;
}

.hw-preis-lager i {
    font-size: 0.65rem;
}

.hw-preis-action {
    margin-top: 8px;
    padding-top: 4px;
}

.hw-preis-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.hw-preis-link i {
    font-size: 0.62rem;
    transition: transform 0.2s ease;
}

.hw-preis-karte:hover .hw-preis-link {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.28);
}

.hw-preis-karte:hover .hw-preis-link i {
    transform: translate(2px, -2px);
}

.hw-preis-hinweis {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #ffffff;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.71rem;
    line-height: 1.45;
    color: var(--text-tertiary);
}

.hw-preis-hinweis-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.72rem;
}

.hw-preis-warn-icon {
    background: var(--accent-light);
    color: var(--accent);
}

.hw-preis-hinweis-text {
    flex: 1;
}

.hw-preis-panel-leer {
    background: var(--bg-card);
}

.hw-preis-panel-leer .hw-preis-hinweis {
    border-top: none;
    padding: 14px 16px;
}

@media (max-width: 768px) {
    .hw-preis-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        padding: 10px;
    }
    .hw-preis-bild {
        height: 110px;
    }
}

@media (max-width: 480px) {
    .hw-preis-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
    }
    .hw-preis-kopf {
        padding: 10px 12px;
    }
    .hw-preis-hinweis {
        padding: 8px 12px;
    }
}

@media (max-width: 600px) {
    .hw-preis-grid {
        grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
        gap: 8px;
        padding: 9px;
    }
    .hw-preis-bild {
        height: 104px;
    }
}

@media print {
    .hw-preis-panel {
        break-inside: avoid;
    }
    .hw-preis-karte:hover {
        transform: none;
        box-shadow: none;
    }
    .hw-preis-link {
        display: none;
    }
}

/* Footnotes */
.ai-footnotes {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--bg-surface);
    border-top: 1px dashed var(--border-strong);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: 0.82rem;
    color: var(--text-tertiary);
}
.ai-footnotes-title {
    display: flex !important;
    align-items: center;
    gap: 6px;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    color: var(--text-secondary) !important;
    margin-bottom: 6px !important;
}
.ai-footnotes-title i {
    color: var(--primary);
    font-size: 0.85rem;
}
.ai-footnotes ol,
.ai-footnotes ul {
    padding-left: 20px;
    margin: 0;
}
.ai-footnotes li {
    margin-bottom: 4px;
    line-height: 1.45;
}
sup.fn-ref {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.72em;
    cursor: default;
    line-height: 0;
    vertical-align: super;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 45;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 6. RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    aside#sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 100;
    }
    /* Nur am offenen Menü: am geschlossenen fiel der Schatten als grauer Streifen an den linken Rand. */
    aside#sidebar.active {
        transform: translateX(0);
        box-shadow: var(--shadow-float);
    }

    .mm-kopfleiste {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex: 0 0 auto;
        padding: max(8px, env(safe-area-inset-top)) 12px 4px;
        background: var(--bg-body);
    }

    .mobile-menu-btn {
        display: flex;
        position: static;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 50%;
        background: var(--bg-surface-hover);
        box-shadow: none;
        font-size: 1.05rem;
    }

    .mm-profil-knopf {
        display: flex;
        padding: 0;
        border: none;
        border-radius: 50%;
        background: none;
        cursor: pointer;
    }

    .mm-profil-knopf .user-avatar {
        width: 40px;
        height: 40px;
        font-size: 0.8rem;
        box-shadow: none;
    }

    .mobile-menu-btn:focus-visible,
    .mm-profil-knopf:focus-visible {
        outline: 3px solid var(--primary);
        outline-offset: 2px;
    }

    /* Startansicht wie in einer App: Marke in der Mitte, Eingabe unten angedockt -
       an derselben Stelle wie später im laufenden Chat. */
    .welcome-container {
        flex: 1 0 auto;
        margin: 0;
        padding: 0 0 max(8px, env(safe-area-inset-bottom));
        justify-content: flex-start;
    }

    .welcome-top-brand {
        margin-top: auto;
        margin-bottom: 20px;
    }

    .welcome-brand-logo {
        width: 420px;
        max-width: 86vw;
    }

    .welcome-container h1 {
        font-size: clamp(1.8rem, 5.2vw, 2.3rem);
        margin-bottom: 24px;
    }

    .chat-viewport {
        padding: 0 12px;
    }

    .chat-messages {
        padding: 20px 12px 130px;
    }

    .app-input-container {
        margin: auto 0 0;
    }

    .default-disclaimer {
        margin-top: 8px;
    }

    .footer-disclaimer {
        font-size: 0.7rem;
        line-height: 1.4;
    }

    .input-card {
        padding: 18px 20px 16px;
        border-radius: 22px;
    }

    .input-card textarea {
        font-size: 1.15rem;
        min-height: 52px;
    }

    .input-card textarea::placeholder {
        font-size: 1.1rem;
    }

    .tool-btn.icon-circle-btn,
    .tool-btn.mic-btn {
        width: 40px;
        height: 40px;
    }

    .tool-btn.icon-circle-btn {
        font-size: 1rem;
    }

    .tool-btn.mic-btn {
        font-size: 1.18rem;
    }

    .send-btn {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .tool-pill-btn {
        padding: 8px 16px;
        font-size: 0.98rem;
    }

    .message-user .message-content {
        max-width: 88%;
        padding: 12px 18px;
        border-radius: 20px;
    }

    .active-chat-input-container {
        padding: 8px 12px max(8px, env(safe-area-inset-bottom));
    }

    .quick-actions-row {
        gap: 10px;
        margin-bottom: 26px;
    }

    .quick-action-pill {
        padding: 11px 20px;
        font-size: 0.98rem;
    }
}

@media (max-width: 520px) {
    .welcome-top-brand {
        margin-bottom: 16px;
    }

    .welcome-brand-logo {
        width: 310px;
        max-width: 90vw;
    }

    .welcome-container h1 {
        font-size: clamp(1.5rem, 5.8vw, 1.85rem);
        margin-bottom: 18px;
    }

    .input-card {
        padding: 14px 16px 12px;
        border-radius: 18px;
    }

    .input-card textarea {
        font-size: 1.05rem;
        min-height: 46px;
    }

    .input-card textarea::placeholder {
        font-size: 0.98rem;
    }

    .tool-btn.icon-circle-btn,
    .tool-btn.mic-btn {
        width: 36px;
        height: 36px;
    }

    .tool-btn.icon-circle-btn {
        font-size: 0.92rem;
    }

    .tool-btn.mic-btn {
        font-size: 1.1rem;
    }

    .send-btn {
        width: 38px;
        height: 38px;
        font-size: 1.02rem;
    }

    .tool-pill-btn {
        padding: 7px 13px;
        font-size: 0.88rem;
    }

    .quick-actions-row {
        gap: 8px;
        margin-bottom: 20px;
    }

    .quick-action-pill {
        padding: 9px 15px;
        font-size: 0.88rem;
    }

    .message-text {
        font-size: 1rem;
        line-height: 1.6;
    }

    .message-user .message-content {
        max-width: 92%;
        padding: 10px 15px;
    }
}

/* ===== HANDY: EINGABE ALS SCHLANKE PILLE =====
   Eine Zeile wie in Messenger-Apps: links "+" für Anhang und Werkzeuge
   (hwEingabeMehr in js/script.js), rechts ein blauer Knopf - Mikrofon,
   solange das Feld leer ist, sonst Senden. Gilt nur für den Hauptchat;
   das Bot-Studio nutzt dieselben Klassen mit eigenem Aufbau. */
@media (max-width: 768px) {
    :is(#welcome-screen, .active-chat-input-container) .input-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        align-items: end;
        gap: 8px 0;
        padding: 6px;
        border: 1px solid var(--border-subtle);
        border-radius: 28px;
        background: var(--bg-card);
        box-shadow: 0 8px 24px -10px rgba(15, 23, 42, 0.14), 0 1px 3px rgba(15, 23, 42, 0.05);
    }

    :is(#welcome-screen, .active-chat-input-container) .input-card:focus-within {
        border-color: #BFD4FB;
        box-shadow: 0 8px 24px -10px rgba(15, 23, 42, 0.14), 0 0 0 3px rgba(29, 107, 243, 0.12);
    }

    /* Fotos, Hinweise und Vorschläge liegen in voller Breite über der Eingabezeile. */
    :is(#welcome-screen, .active-chat-input-container) .input-card > * {
        grid-column: 1 / -1;
    }

    :is(#welcome-screen, .active-chat-input-container) :is(.input-toolbar, .toolbar-left, .toolbar-right) {
        display: contents;
    }

    :is(#welcome-screen, .active-chat-input-container) .toolbar-pills-scroll {
        display: none;
    }

    /* Reihenfolge statt Quelltext-Folge: sonst rutschen "+" und Knöpfe
       unter das Textfeld, weil es im HTML vor ihnen steht. */
    :is(#welcome-screen, .active-chat-input-container) .input-card textarea {
        grid-column: 2;
        order: 2;
        min-height: 40px;
        padding: 8px 6px;
        /* Unter 16px zoomt iOS beim Antippen in die Seite hinein. */
        font-size: 16px;
        line-height: 24px;
    }

    /* Auf schmalen Geräten endet der Hinweis mit "…" statt hart abgeschnitten.
       Die Pünktchen setzt Chrome nur, wenn auch das Feld selbst einzeilig ist -
       deshalb nur, solange es leer ist; getippter Text bricht normal um. */
    :is(#welcome-screen, .active-chat-input-container) .input-card textarea:placeholder-shown,
    :is(#welcome-screen, .active-chat-input-container) .input-card textarea::placeholder {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    :is(#welcome-screen, .active-chat-input-container) .input-card textarea::placeholder {
        font-size: 16px;
        color: var(--text-muted);
    }

    :is(#welcome-screen, .active-chat-input-container) .tool-btn.icon-circle-btn {
        grid-column: 1;
        order: 1;
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        color: var(--text-secondary);
        font-size: 1.1rem;
    }

    :is(#welcome-screen, .active-chat-input-container) .tool-btn.icon-circle-btn i {
        transition: transform var(--transition-fast);
    }

    :is(#welcome-screen, .active-chat-input-container) .tool-btn.icon-circle-btn[aria-expanded="true"] {
        background: var(--bg-surface-hover);
        color: var(--text-primary);
    }

    :is(#welcome-screen, .active-chat-input-container) .tool-btn.icon-circle-btn[aria-expanded="true"] i {
        transform: rotate(45deg);
    }

    :is(#welcome-screen, .active-chat-input-container) :is(.tool-btn.mic-btn, .send-btn) {
        order: 3;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #1D6BF3;
        color: #FFFFFF;
        font-size: 1rem;
        box-shadow: none;
    }

    :is(#welcome-screen, .active-chat-input-container) :is(.tool-btn.mic-btn, .send-btn):hover {
        background: #1859CF;
        color: #FFFFFF;
        transform: none;
    }

    :is(#welcome-screen, .active-chat-input-container) .tool-btn.mic-btn { grid-column: 3; }
    :is(#welcome-screen, .active-chat-input-container) .send-btn { grid-column: 4; }

    :is(#welcome-screen, .active-chat-input-container) .input-card:has(textarea:placeholder-shown) .send-btn,
    :is(#welcome-screen, .active-chat-input-container) .input-card:not(:has(textarea:placeholder-shown)) .tool-btn.mic-btn {
        display: none;
    }

    :is(#welcome-screen, .active-chat-input-container) :is(.tool-btn, .send-btn):focus-visible {
        outline: 3px solid #1D6BF3;
        outline-offset: 2px;
    }

    .active-chat-input-container {
        background: var(--bg-body);
        border-top: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .mm-mehr {
        position: absolute;
        left: 0;
        right: 0;
        bottom: calc(100% + 8px);
        z-index: 300;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2px;
        padding: 8px;
        background: var(--bg-card);
        border: 1px solid var(--border-subtle);
        border-radius: 22px;
        box-shadow: var(--shadow-float);
        animation: mm-mehr-auf 0.16s ease-out;
    }

    .mm-mehr button {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        min-height: 48px;
        padding: 6px 8px;
        border: none;
        border-radius: 14px;
        background: transparent;
        color: var(--text-primary);
        font: inherit;
        font-size: 0.92rem;
        font-weight: 500;
        text-align: left;
        cursor: pointer;
    }

    .mm-mehr button:hover,
    .mm-mehr button:focus-visible {
        background: var(--bg-surface-hover);
        outline: none;
    }

    .mm-mehr button i {
        display: grid;
        place-items: center;
        flex: none;
        width: 34px;
        height: 34px;
        border-radius: 11px;
        background: #EDF4FF;
        color: #1D6BF3;
        font-size: 0.9rem;
    }

    body.dark-mode .mm-mehr button i {
        background: rgba(29, 107, 243, 0.2);
        color: #8AB4FF;
    }

    .mm-mehr button.active i,
    body.dark-mode .mm-mehr button.active i {
        background: #1D6BF3;
        color: #FFFFFF;
    }

    .mm-mehr .mm-mehr-breit {
        grid-column: 1 / -1;
    }
}

@keyframes mm-mehr-auf {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 7. PRINT STYLES ===== */
@media print {
    body * {
        visibility: hidden;
    }
    #chat-screen, #chat-screen * {
        visibility: visible;
    }
    #chat-screen {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    .message-user {
        display: none !important;
    }
    .message-ai {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 20px;
    }
    .message-actions {
        display: none !important;
    }
    aside, .mm-kopfleiste, .active-chat-input-container, #welcome-screen {
        display: none !important;
    }
}

/* ===================================================
   SEITENLEISTE: EIN GEMEINSAMER SCROLLBEREICH
   ===================================================
   Vorher wuchs .primary-nav über die Fensterhöhe hinaus. Weil #sidebar
   overflow: hidden hat, waren die unteren Einträge samt Verlauf und
   Fußbereich abgeschnitten und gar nicht erreichbar.
   Jetzt scrollt genau ein Bereich; Marke oben und Fußbereich unten
   bleiben immer sichtbar. */

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
    margin-right: -4px;
    /* Platz nach unten, damit der letzte Eintrag nicht am Fußbereich klebt. */
    padding-bottom: 6px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.55) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 8px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.sidebar-scroll:hover::-webkit-scrollbar-thumb {
    background-color: rgba(100, 116, 139, 0.6);
}

/* Beide Blöcke scrollen jetzt gemeinsam im Elternbereich. */
.primary-nav,
.nav-scroll {
    flex: none;
    min-height: 0;
    overflow: visible;
}

/* Gruppen in der Hauptnavigation */
.nav-group {
    margin-top: 2px;
}

.nav-group + .nav-group {
    margin-top: 6px;
}

.nav-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Die Überschrift bleibt beim Scrollen stehen, damit immer klar ist,
   in welchem Bereich man sich gerade befindet. */
.nav-group .nav-section-title-row {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-sidebar);
}

.nav-group .nav-section-title span:first-child {
    text-transform: none;
    letter-spacing: 0.02em;
    font-size: 0.78rem;
}

.nav-group.collapsed .nav-section-title-row {
    position: static;
}

.nav-no-hits {
    margin: 6px 9px;
    font-size: 0.86rem;
    color: var(--text-muted);
}

/* Treffer der Suche hervorheben */
.nav-item.nav-hit {
    background-color: var(--accent-soft, #EFF6FF);
}
