/* CamSentinel help chat. Colours come from the host page's tokens (app: --cs-*, marketing: bare names). */
#cs-assistant {
    --csa-bg: var(--cs-surface, var(--surface, #14181d));
    --csa-bg-soft: var(--cs-surface-subtle, #0a0c0f);
    --csa-text: var(--cs-text, var(--silver, #f2f3f5));
    --csa-muted: var(--cs-muted, var(--muted, #b8bec7));
    --csa-line: var(--cs-border, var(--line, #31353a));
    --csa-accent: var(--cs-sidebar-active, var(--red, #df3c3c));
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1035; /* above page content, below Bootstrap modals (1055) and the camera wall banners (1090) */
    font-family: inherit;
    font-size: 15px;
    line-height: 1.45;
    color: var(--csa-text);
}
#cs-assistant *, #cs-assistant *::before, #cs-assistant *::after { box-sizing: border-box; }
#cs-assistant [hidden] { display: none !important; }

.cs-assistant-launcher {
    display: flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; margin-left: auto; padding: 0;
    border: 0; border-radius: 50%;
    background: var(--csa-accent); color: #fff; cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.cs-assistant-launcher:hover { filter: brightness(1.08); }
.cs-assistant-launcher svg { width: 26px; height: 26px; fill: currentColor; }
#cs-assistant :focus-visible { outline: 2px solid var(--csa-accent); outline-offset: 2px; }
.cs-assistant-launcher:focus-visible { outline-color: #fff; box-shadow: 0 0 0 4px var(--csa-accent); }
#cs-assistant.is-open .cs-assistant-launcher { display: none; }

.cs-assistant-panel {
    display: flex; flex-direction: column;
    width: min(380px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 32px));
    height: min(560px, calc(100dvh - 32px));
    overflow: hidden;
    border: 1px solid var(--csa-line); border-radius: 14px;
    background: var(--csa-bg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
}
.cs-assistant-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 14px; border-bottom: 1px solid var(--csa-line); background: var(--csa-bg-soft);
}
.cs-assistant-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--csa-text); }
.cs-assistant-close {
    width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px;
    background: transparent; color: var(--csa-muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.cs-assistant-close:hover { color: var(--csa-text); }

.cs-assistant-messages {
    flex: 1; min-height: 0; overflow-y: auto; padding: 14px;
    display: flex; flex-direction: column; gap: 8px;
}
.cs-assistant-msg {
    max-width: 88%; padding: 8px 12px; border-radius: 12px;
    white-space: pre-wrap; overflow-wrap: anywhere;
}
.cs-assistant-msg-bot { align-self: flex-start; background: var(--csa-bg-soft); border: 1px solid var(--csa-line); }
.cs-assistant-msg-user { align-self: flex-end; background: var(--csa-accent); color: #fff; }
.cs-assistant-msg-typing { color: var(--csa-muted); font-style: italic; }
.cs-assistant-msg-notice { border-color: var(--csa-accent); }
.cs-assistant-contact {
    align-self: flex-start; display: inline-block; padding: 8px 14px;
    border: 1px solid var(--csa-accent); border-radius: 999px;
    background: transparent; color: var(--csa-text); font-weight: 600; font-size: 14px;
    text-decoration: none; cursor: pointer;
}
.cs-assistant-contact:hover { background: var(--csa-accent); color: #fff; }
.cs-assistant-actions { align-self: flex-start; display: flex; flex-wrap: wrap; gap: 6px; max-width: 94%; }
.cs-assistant-actions .cs-assistant-contact { padding: 6px 12px; }
.cs-assistant-chip {
    padding: 6px 12px; border: 1px solid var(--csa-line); border-radius: 999px;
    background: var(--csa-bg-soft); color: var(--csa-text); font-size: 13px; cursor: pointer; text-align: left;
}
.cs-assistant-chip:hover { border-color: var(--csa-accent); }

.cs-assistant-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--csa-line); }
.cs-assistant-form textarea {
    flex: 1; min-width: 0; height: 36px; max-height: 120px; resize: none; padding: 7px 10px; line-height: 20px; overflow: hidden;
    border: 1px solid var(--csa-line); border-radius: 10px;
    background: var(--csa-bg-soft); color: var(--csa-text); font-size: 16px; /* 16px stops iOS zoom */
}
@media (min-width: 768px) { .cs-assistant-form textarea { font-size: 14px; } }  /* phones keep 16px */
.cs-assistant-send {
    height: 36px; padding: 0 14px; border: 0; border-radius: 10px;
    background: var(--csa-accent); color: #fff; font-weight: 700; cursor: pointer;
}
.cs-assistant-send:disabled, .cs-assistant-form textarea:disabled { opacity: .6; cursor: not-allowed; }
.cs-assistant-privacy { margin: 0; padding: 0 14px 10px; font-size: 12px; color: var(--csa-muted); }
.cs-assistant-privacy a { color: var(--csa-text); text-decoration: underline; }

@media (prefers-reduced-motion: no-preference) {
    .cs-assistant-panel { animation: cs-assistant-in .15s ease-out; }
    @keyframes cs-assistant-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* The camera wall shows its own banners bottom-right: keep the chat bottom-left there. */
.cs-security-operations-page #cs-assistant { right: auto; left: 16px; }
.cs-security-operations-page .cs-assistant-launcher { margin-left: 0; margin-right: auto; }

/* While the marketing analytics-consent banner is open, sit above it. marketing.js
   sets --cs-consent-height to the banner's height (fallback covers phones). The open
   panel is too tall to lift, so it stays in place and is drawn over the banner. */
body.cs-consent-open #cs-assistant:not(.is-open) { bottom: calc(var(--cs-consent-height, 180px) + 28px); }
body.cs-consent-open #cs-assistant.is-open { z-index: 1045; }

.cs-assistant-launcher { position: relative; }
.cs-assistant-launcher.has-hint::after { content: ''; position: absolute; top: 2px; right: 2px; width: 13px; height: 13px; border-radius: 50%; background: #f59e0b; border: 2px solid #fff; }
