#minervaWidget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.minerva-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    position: relative;
}

.minerva-fab:hover {
    background: #1f2937;
    transform: scale(1.05);
}

.minerva-panel {
    width: 350px;
    max-height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: minervaOpen 0.2s ease-out;
}

@keyframes minervaOpen {
    from { opacity: 0; transform: scale(0.85) translateY(16px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.minerva-header {
    background: #111827;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.minerva-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
}

.minerva-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.minerva-header-sub {
    font-size: 0.7rem;
    opacity: 0.75;
    margin-top: 1px;
}

.minerva-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.8;
    line-height: 0;
    transition: opacity 0.15s;
}

.minerva-close:hover { opacity: 1; }

.minerva-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.minerva-msg {
    max-width: 88%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.45;
    word-wrap: break-word;
}

.minerva-msg-bot {
    align-self: flex-start;
    background: #f3f4f6;
    color: #111827;
    border-bottom-left-radius: 3px;
}

.minerva-msg-user {
    align-self: flex-end;
    background: #111827;
    color: #fff;
    border-bottom-right-radius: 3px;
}

.minerva-typing {
    align-self: flex-start;
    background: #f3f4f6;
    padding: 10px 14px;
    border-radius: 12px;
    border-bottom-left-radius: 3px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.minerva-typing span {
    width: 7px;
    height: 7px;
    background: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    animation: minervaBounce 1.1s infinite ease-in-out;
}

.minerva-typing span:nth-child(2) { animation-delay: 0.18s; }
.minerva-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes minervaBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-6px); opacity: 1; }
}

.minerva-qr {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 12px 8px;
}

.minerva-qr-btn {
    background: #fff;
    border: 1px solid #111827;
    color: #111827;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.minerva-qr-btn:hover {
    background: #111827;
    color: #fff;
}

.minerva-input-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px 10px;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
    background: #fff;
}

.minerva-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s;
}

.minerva-input:focus { border-color: #111827; }

.minerva-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.minerva-send:hover { background: #1f2937; }

.minerva-link {
    display: inline-block;
    margin-top: 6px;
    background: #111827;
    color: #fff !important;
    text-decoration: none;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: background 0.15s;
}

.minerva-link:hover { background: #1f2937; }

@media (max-width: 576px) {
    #minervaWidget {
        bottom: 12px;
        right: 12px;
        left: 12px;
        align-items: flex-end;
    }
    .minerva-panel {
        width: 100%;
        max-height: 420px;
    }
}
