#ai-rag-chat-root {
    --arc-branding-title: #7A4706;
    --arc-branding-text: #333333;
    --arc-ink: var(--arc-branding-text);
    --arc-muted: #5e6168;
    --arc-bg: #f5f2ee;
    --arc-panel: #ffffff;
    --arc-accent: #1c6e5e;
    --arc-icon-fill: var(--arc-branding-title);
    --arc-accent-soft: #e0f2ec;
    --arc-shadow: 0 24px 60px rgba(17, 20, 28, 0.18);
    --arc-radius-lg: 24px;
    --arc-radius-md: 16px;
    --arc-radius-sm: 12px;
    --arc-border: 1px solid rgba(19, 19, 22, 0.08);
    --arc-font: "Iowan Old Style", "Charter", "Palatino Linotype", "Book Antiqua", Palatino, serif;

    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 9999;
    font-family: var(--arc-font);
    color: var(--arc-ink);
}

#ai-rag-chat-root * {
    box-sizing: border-box;
    text-transform: initial;
}

#ai-rag-chat-root .arc-launcher {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: radial-gradient(circle at 30% 30%, #fff3e8, #f4f6f7);
    box-shadow: var(--arc-shadow);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    padding: 0;
}

#ai-rag-chat-root .arc-launcher.is-visible {
    display: inline-flex;
    animation: arc-pop 0.35s ease;
}

#ai-rag-chat-root .arc-launcher:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 18px 40px rgba(17, 20, 28, 0.2);
}

#ai-rag-chat-root .arc-launcher__icon {
    width: 28px;
    height: 28px;
    display: block;
    color: var(--arc-ink);
}

#ai-rag-chat-root .arc-launcher__icon svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: var(--arc-icon-fill);
    transition: fill .3s ease;
}

#ai-rag-chat-root .arc-launcher:hover .arc-launcher__icon svg {
    fill: white;
}

#ai-rag-chat-root .arc-welcome {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(380px, 90vw);
    background: linear-gradient(155deg, #ffffff, #f6f3ef 70%);
    border-radius: var(--arc-radius-lg);
    padding: 1.1rem 1.1rem 1.25rem;
    box-shadow: var(--arc-shadow);
    border: var(--arc-border);
    display: none;
    animation: arc-rise 0.35s ease;
}

#ai-rag-chat-root .arc-welcome.is-visible {
    display: block;
}

#ai-rag-chat-root .arc-welcome__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

#ai-rag-chat-root .arc-kicker {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--arc-muted);
    display: block;
}

#ai-rag-chat-root .arc-welcome__title h3 {
    margin: 0.25rem 0 0;
    font-size: 1.1rem;
    font-weight: 600;
}

#ai-rag-chat-root .arc-welcome-close,
#ai-rag-chat-root .arc-modal-close {
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1ede7;
    color: var(--arc-ink);
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.3s ease;
    padding: 0;
}


#ai-rag-chat-root .arc-welcome-close:hover,
#ai-rag-chat-root .arc-modal-close:hover {
    color: white;
}

#ai-rag-chat-root .arc-welcome-close:hover,
#ai-rag-chat-root .arc-modal-close:hover {
    background: #e6e0d8;
    transform: scale(1.05);
}

#ai-rag-chat-root .arc-welcome__copy {
    margin: 0.75rem 0 1rem;
    color: var(--arc-muted);
    font-size: 0.95rem;
    line-height: 1.4;
}

#ai-rag-chat-root .arc-welcome__faq {
    display: grid;
    gap: 0.5rem;
}

#ai-rag-chat-root .arc-faq {
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-radius: var(--arc-radius-sm);
    border: 1px solid rgba(19, 19, 22, 0.08);
    background: #fffaf5;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s ease, border 0.2s ease, box-shadow 0.2s ease, color 0.3s ease;
    opacity: 0;
    animation: arc-fade 0.4s ease forwards;
    color: var(--arc-ink);
}

#ai-rag-chat-root .arc-faq:hover {
    color: white;
}

#ai-rag-chat-root .arc-faq:nth-child(1) {
    animation-delay: 0.08s;
}

#ai-rag-chat-root .arc-faq:nth-child(2) {
    animation-delay: 0.16s;
}

#ai-rag-chat-root .arc-faq:nth-child(3) {
    animation-delay: 0.24s;
}

#ai-rag-chat-root .arc-faq:nth-child(4) {
    animation-delay: 0.32s;
}

#ai-rag-chat-root .arc-faq:hover {
    border-color: rgba(28, 110, 94, 0.3);
    box-shadow: 0 10px 20px rgba(20, 23, 30, 0.08);
    transform: translateY(-1px);
}

#ai-rag-chat-root .arc-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#ai-rag-chat-root .arc-modal.is-visible {
    display: flex;
}

#ai-rag-chat-root .arc-overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 10, 12, 0.55);
    backdrop-filter: blur(6px);
}

#ai-rag-chat-root .arc-panel {
    position: relative;
    width: min(700px, 100%);
    height: calc(100svh - 4rem);
    max-height: calc(100svh - 4rem);
    background: linear-gradient(160deg, #ffffff 0%, #f8f5f0 80%);
    border-radius: var(--arc-radius-lg);
    box-shadow: var(--arc-shadow);
    border: var(--arc-border);
    display: flex;
    flex-direction: column;
    z-index: 1;
    overflow: hidden;
    animation: arc-pop 0.35s ease;
}

#ai-rag-chat-root .arc-panel__header {
    padding: 1.25rem 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(19, 19, 22, 0.08);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

#ai-rag-chat-root .arc-panel__title {
    margin: 0.2rem 0 0;
    font-size: 1.3rem;
}

#ai-rag-chat-root .arc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background-image: radial-gradient(circle at top left, rgba(28, 110, 94, 0.08), transparent 55%),
    radial-gradient(circle at bottom right, rgba(240, 199, 152, 0.2), transparent 55%);
}

#ai-rag-chat-root .arc-message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.98rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

#ai-rag-chat-root .arc-message__text {
    white-space: pre-wrap;
}

#ai-rag-chat-root .arc-message--assistant {
    background: #ffffff;
    border: 1px solid rgba(19, 19, 22, 0.08);
    align-self: flex-start;
    box-shadow: 0 12px 30px rgba(20, 23, 30, 0.06);
}

#ai-rag-chat-root .arc-message--user {
    background: var(--arc-ink);
    color: #ffffff;
    align-self: flex-end;
}

#ai-rag-chat-root .arc-message--system {
    background: #f0ede7;
    border-color: rgba(19, 19, 22, 0.05);
    color: var(--arc-muted);
}

#ai-rag-chat-root .arc-message--loading {
    color: var(--arc-muted);
    font-style: italic;
}

#ai-rag-chat-root .arc-message--error {
    border-color: rgba(166, 40, 40, 0.2);
    background: #fff1f1;
    color: #7a1b1b;
    align-self: center;
}

#ai-rag-chat-root .arc-link-card {
    border-radius: 14px;
    border: 1px solid rgba(19, 19, 22, 0.08);
    background: #fdfaf6;
    box-shadow: 0 10px 20px rgba(20, 23, 30, 0.08);
    overflow: hidden;
    display: inline-flex;
}

#ai-rag-chat-root .arc-link-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 0.7rem 0.9rem 0.8rem;
    white-space: normal;
}

#ai-rag-chat-root .arc-link-card__title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

#ai-rag-chat-root .arc-link-card__url {
    font-size: 0.8rem;
    color: var(--arc-muted);
    word-break: break-all;
}

#ai-rag-chat-root .arc-form {
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid rgba(19, 19, 22, 0.08);
    background: #ffffff;
}

#ai-rag-chat-root .arc-input-wrap {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    background: #f6f4f0;
    border-radius: 18px;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(19, 19, 22, 0.08);
}

#ai-rag-chat-root .arc-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--arc-ink);
    outline: none;
    min-height: 24px;
    max-height: 120px;
}

#ai-rag-chat-root .arc-send {
    border: none;
    background: var(--arc-branding-title);
    color: white;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#ai-rag-chat-root .arc-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(28, 110, 94, 0.25);
}

#ai-rag-chat-root .arc-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#ai-rag-chat-root .arc-hint {
    margin-top: 0.6rem;
    color: var(--arc-muted);
    font-size: 0.75rem;
}

@keyframes arc-pop {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes arc-rise {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes arc-fade {
    0% {
        opacity: 0;
        transform: translateY(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    #ai-rag-chat-root {
        right: 1rem;
        bottom: 1rem;
    }

    #ai-rag-chat-root .arc-panel {
        width: 100%;
        height: 100svh;
        max-height: 100svh;
        border-radius: 0;
    }

    #ai-rag-chat-root .arc-modal {
        padding: 0;
    }

    #ai-rag-chat-root .arc-panel__header,
    #ai-rag-chat-root .arc-form,
    #ai-rag-chat-root .arc-messages {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
