.nw-ai {
    --nw-ai-bg: #0b1220;
    --nw-ai-panel: #111827;
    --nw-ai-accent: #0EA5E9;
    --nw-ai-text: #f8fafc;
    --nw-ai-muted: #94a3b8;
    position: relative;
    z-index: 1200;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
}

.nw-ai__fab {
    position: fixed;
    right: 1.1rem;
    bottom: 5.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #0EA5E9, #0284c7);
    color: #fff;
    padding: 0.85rem 1.15rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.35);
}

.nw-ai__fab:hover {
    filter: brightness(1.05);
}

.nw-ai__fab-label {
    font-size: 0.92rem;
}

.nw-ai__panel {
    position: fixed;
    right: 1.1rem;
    bottom: 9.5rem;
    width: min(380px, calc(100vw - 1.5rem));
    max-height: min(70vh, 620px);
    display: flex;
    flex-direction: column;
    background: var(--nw-ai-panel);
    color: var(--nw-ai-text);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.nw-ai__panel[hidden] {
    display: none !important;
}

.nw-ai__header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.95rem 1rem 0.7rem;
    background: var(--nw-ai-bg);
}

.nw-ai__header p {
    margin: 0.2rem 0 0;
    color: var(--nw-ai-muted);
    font-size: 0.82rem;
}

.nw-ai__close {
    border: 0;
    background: transparent;
    color: var(--nw-ai-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.nw-ai__modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    background: rgba(15, 23, 42, 0.7);
}

.nw-ai__mode {
    border: 1px solid transparent;
    background: transparent;
    color: var(--nw-ai-muted);
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
    font-weight: 600;
    cursor: pointer;
}

.nw-ai__mode.is-active {
    color: #fff;
    background: rgba(14, 165, 233, 0.2);
    border-color: rgba(14, 165, 233, 0.45);
}

.nw-ai__body {
    display: flex;
    flex-direction: column;
    min-height: 280px;
    flex: 1;
}

.nw-ai__messages,
.nw-ai__transcript {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.nw-ai__msg {
    max-width: 92%;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.nw-ai__msg--user {
    align-self: flex-end;
    background: rgba(14, 165, 233, 0.25);
}

.nw-ai__msg--assistant,
.nw-ai__msg--system {
    align-self: flex-start;
    background: rgba(148, 163, 184, 0.12);
}

.nw-ai__form {
    display: flex;
    gap: 0.45rem;
    padding: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.nw-ai__form input {
    flex: 1;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: #0b1220;
    color: #fff;
    padding: 0.65rem 0.75rem;
}

.nw-ai__form button,
.nw-ai__voice-btn {
    border: 0;
    border-radius: 10px;
    background: var(--nw-ai-accent);
    color: #fff;
    font-weight: 700;
    padding: 0.65rem 0.9rem;
    cursor: pointer;
}

.nw-ai__voice-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nw-ai__voice-btn--stop {
    background: #b91c1c;
}

.nw-ai__body--voice {
    padding-bottom: 0.75rem;
}

.nw-ai__voice-status {
    margin: 0.85rem 1rem 0.35rem;
    color: var(--nw-ai-muted);
    font-size: 0.9rem;
}

.nw-ai__voice-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0 0.75rem 0.25rem;
}

.nw-ai__footer {
    display: flex;
    gap: 0.85rem;
    justify-content: center;
    padding: 0.65rem;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.65);
}

.nw-ai__footer a {
    color: var(--nw-ai-accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 900px) {
    .nw-ai__fab {
        bottom: 5.75rem;
        right: 0.85rem;
        padding: 0.8rem 0.95rem;
    }

    .nw-ai__fab-label {
        display: none;
    }

    .nw-ai__panel {
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
        bottom: 9rem;
    }
}
