#rovik-chat {
    --rovik-blue: #1852a1;
    --rovik-ink: #142638;
    --rovik-line: #d6e3ee;
    --rovik-soft: #eef4fc;
    position: fixed;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    /* The chat sits above storefront and third-party interface layers. */
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    width: min(350px, calc(100% - 32px));
    pointer-events: none;
    color: var(--rovik-ink);
    font: 400 15px/1.4 system-ui, sans-serif;
    text-align: left;
}

#rovik-chat *, #rovik-chat *::before, #rovik-chat *::after { box-sizing: border-box; }
#rovik-chat > * { pointer-events: auto; }
#rovik-chat[hidden], #rovik-chat [hidden] { display: none !important; }
#rovik-chat :focus-visible { outline: 2px solid #3076cb; outline-offset: 2px; }
#rovik-chat button, #rovik-chat input, #rovik-chat textarea { font: inherit; }

#rovik-chat .rovik-chat-invitation, #rovik-chat .rovik-chat-options, #rovik-chat .rovik-chat-panel {
    width: min(350px, 100%);
    border: 1px solid var(--rovik-line);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 8px 24px rgb(20 38 56 / 20%);
}
#rovik-chat .rovik-chat-invitation, #rovik-chat .rovik-chat-options { position: relative; padding: 15px; }
#rovik-chat .rovik-chat-invitation strong, #rovik-chat .rovik-chat-options strong { display: block; padding-right: 42px; font-size: 16px; }
#rovik-chat .rovik-chat-options-actions { display: grid; gap: 8px; margin-top: 12px; }
#rovik-chat .rovik-chat-invitation p { margin: 7px 0 12px; }
#rovik-chat .rovik-chat-panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    overflow: hidden;
}
#rovik-chat .rovik-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 6px 4px 14px;
    background: var(--rovik-blue);
    color: #fff;
}

#rovik-chat .rovik-chat-content { display: grid; min-height: 0; gap: 8px; padding: 11px; overflow: auto; }
#rovik-chat .rovik-chat-log { display: flex; flex-direction: column; gap: 8px; max-height: 235px; overflow-y: auto; }
#rovik-chat .rovik-chat-bubble {
    align-self: flex-start;
    max-width: 94%;
    background: var(--rovik-soft);
    padding: 8px 11px;
    border-radius: 11px 11px 11px 4px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
#rovik-chat .rovik-chat-bubble p { margin: 0; }
#rovik-chat .rovik-chat-bubble-out { align-self: flex-end; background: #dceaff; border-radius: 11px 11px 4px 11px; }
#rovik-chat .rovik-chat-fields { display: flex; align-items: flex-end; gap: 7px; margin: 0; }
#rovik-chat .rovik-chat-contact { margin: 0; padding: 9px; background: var(--rovik-soft); border-radius: 9px; }
#rovik-chat .rovik-chat-contact label { display: block; margin-bottom: 6px; font-weight: 600; }
#rovik-chat .rovik-chat-fields input, #rovik-chat .rovik-chat-fields textarea {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 8px;
    border: 1px solid var(--rovik-line);
    border-radius: 8px;
    background: #fff;
    color: var(--rovik-ink);
    font-size: 16px;
}
#rovik-chat .rovik-chat-fields textarea { resize: vertical; }
#rovik-chat .rovik-chat-primary, #rovik-chat .rovik-chat-launcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 11px;
    border: 0;
    border-radius: 8px;
    background: var(--rovik-blue);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
#rovik-chat .rovik-chat-primary:hover, #rovik-chat .rovik-chat-launcher:hover { background: #103d7b; }
#rovik-chat .rovik-chat-secondary {
    border: 1px solid var(--rovik-blue);
    background: #fff;
    color: var(--rovik-blue);
    text-decoration: none;
}
#rovik-chat .rovik-chat-secondary:hover { background: var(--rovik-soft); }
#rovik-chat button:disabled { opacity: .7; cursor: wait; }
#rovik-chat .rovik-chat-launcher { position: relative; width: 54px; height: 54px; border-radius: 50%; box-shadow: 0 6px 18px rgb(24 82 161 / 38%); }
#rovik-chat .rovik-chat-close {
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 24px;
    cursor: pointer;
}
#rovik-chat .rovik-chat-dismiss { position: absolute; right: 4px; top: 2px; }
#rovik-chat .rovik-chat-error, #rovik-chat .rovik-chat-status { margin: 0; color: #962f38; font-size: 13px; }
#rovik-chat .rovik-chat-status:empty { display: none; }
#rovik-chat .rovik-chat-file {
    display: block;
    max-width: 100%;
    padding: 5px 0;
    border: 0;
    background: transparent;
    color: var(--rovik-blue);
    text-align: left;
    text-decoration: underline;
    overflow-wrap: anywhere;
    cursor: pointer;
}

#rovik-chat .rovik-chat-launcher[data-chat-reply-waiting]::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #d9384f;
}
