/* ============================================================================
   HEY LSIP — Unified chatbot UI
   ============================================================================
   One stylesheet shared by all four AI widgets (NcsCareerGuidanceAi,
   Signposter, JobMatcher2, VacancyPage). Targets:
     • The new `.lsip-chat-*` skeleton classes added to each widget .razor
     • The legacy Tailwind utility classes the per-widget app.js still injects
       into chat-bubble markup, so messages render consistently without
       requiring a Tailwind build step.
   ============================================================================ */

:root {
    --chat-brand:        #14387a;
    --chat-brand-strong: #0f2a5c;
    --chat-accent:       #d77c1a;
    --chat-bg-soft:      #f6f7fb;
    --chat-bg-user:      #14387a;
    --chat-bg-bot:       #ffffff;
    --chat-ink:          #1c2230;
    --chat-ink-muted:    #6a6f78;
    --chat-radius:       16px;
    --chat-radius-sm:    10px;
    --chat-shadow:       0 30px 60px -20px rgba(15, 30, 60, 0.35),
                         0  6px 16px      rgba(15, 30, 60, 0.10);
    --chat-ease:         cubic-bezier(0.25, 0.85, 0.35, 1);
}

/* ── Launcher button (fixed bottom-right) ─────────────────────────────────── */

.lsip-chat-launcher {
    position: fixed;
    right: clamp(1rem, 2.5vw, 1.75rem);
    bottom: clamp(1rem, 2.5vw, 1.75rem);
    z-index: 9990;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.85rem 1.2rem 0.85rem 1rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--chat-brand) 0%, var(--chat-brand-strong) 100%);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow:
        0 12px 28px -10px rgba(20, 56, 122, 0.55),
        0 4px  10px       rgba(20, 56, 122, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: transform 0.18s var(--chat-ease),
                box-shadow 0.18s var(--chat-ease),
                background-color 0.18s var(--chat-ease);
}

.lsip-chat-launcher:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow:
        0 18px 36px -10px rgba(20, 56, 122, 0.6),
        0 6px  14px       rgba(20, 56, 122, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.lsip-chat-launcher:focus-visible {
    outline: 3px solid var(--chat-accent);
    outline-offset: 3px;
}

.lsip-chat-launcher__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
}

.lsip-chat-launcher__icon .material-symbols-outlined {
    font-size: 1.1rem;
    font-variation-settings: 'wght' 500;
}

/* A subtle pulse to draw attention on first paint — neutralised once opened. */
.lsip-chat-launcher::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: var(--chat-brand);
    z-index: -1;
    opacity: 0;
    animation: lsip-chat-pulse 2.8s ease-in-out infinite;
}

@keyframes lsip-chat-pulse {
    0%   { transform: scale(1);   opacity: 0.35; }
    70%  { transform: scale(1.15); opacity: 0;    }
    100% { transform: scale(1.15); opacity: 0;    }
}

@media (prefers-reduced-motion: reduce) {
    .lsip-chat-launcher::before { animation: none; }
}

/* Stacking two launchers on the same page (e.g. Signposter in nav is fine,
 * but if any page renders two fixed launchers they need to not overlap). */
.lsip-chat-launcher--secondary {
    bottom: calc(clamp(1rem, 2.5vw, 1.75rem) + 4.2rem);
    background: linear-gradient(135deg, var(--chat-accent) 0%, #b8651a 100%);
    box-shadow:
        0 12px 28px -10px rgba(215, 124, 26, 0.55),
        0 4px 10px rgba(215, 124, 26, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* ── Nav-mode Signposter (inside .lsip-nav__utilities) ───────────────────────
   When the Signposter is rendered into the header bar (next to the Translator)
   it should NOT behave as a floating launcher. Override positioning, drop the
   pulse/shimmer effects, and render a small circular icon button that matches
   the Translator (.lsip-translate__btn) sizing.

   First-paint greeting: JS adds `.is-launcher-greeting` for ~4.5s so a new
   visitor can read "Search site" before the button collapses to an icon-only
   dot. Hover / keyboard focus re-expand the pill, so the label is always
   discoverable on demand. */
.lsip-nav__utilities #signposter {
    display: inline-flex;
    align-items: center;
    list-style: none;
}
.lsip-nav__utilities #signposter #tw { display: inline-flex; align-items: center; }

.lsip-nav__utilities .lsip-chat-launcher--secondary {
    position: static;
    inset: auto;
    z-index: auto;
    padding: 0.45rem;
    gap: 0;
    height: 2.25rem;
    border-radius: 9999px;
    background: var(--lsip-brand-light, rgba(20, 56, 122, 0.10));
    color: var(--lsip-brand, #14387a);
    box-shadow: none;
    font-family: inherit;
    font-size: var(--lsip-fs-sm, 0.9rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
    overflow: hidden;
    isolation: isolate;
    transition: padding 0.3s var(--chat-ease),
                gap     0.3s var(--chat-ease),
                background 0.18s var(--chat-ease),
                color      0.18s var(--chat-ease);
    animation: none;
}

/* Kill the floating-mode pulse/shimmer pseudo-elements — too noisy at nav size. */
.lsip-nav__utilities .lsip-chat-launcher--secondary::before,
.lsip-nav__utilities .lsip-chat-launcher--secondary::after { display: none; }

.lsip-nav__utilities .lsip-chat-launcher--secondary .lsip-chat-launcher__icon {
    background: transparent;
    backdrop-filter: none;
    width: 1.5rem;
    height: 1.5rem;
}
.lsip-nav__utilities .lsip-chat-launcher--secondary .lsip-chat-launcher__icon .material-symbols-outlined {
    font-size: 1.15rem;
}

.lsip-nav__utilities .lsip-chat-launcher--secondary .lsip-chat-launcher__label {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.3s var(--chat-ease),
                opacity   0.22s var(--chat-ease);
}

.lsip-nav__utilities .lsip-chat-launcher--secondary.is-launcher-greeting,
.lsip-nav__utilities .lsip-chat-launcher--secondary:hover,
.lsip-nav__utilities .lsip-chat-launcher--secondary:focus-visible {
    padding: 0.45rem 0.85rem 0.45rem 0.55rem;
    gap: 0.35rem;
    background: var(--lsip-brand, #14387a);
    color: #fff;
}
.lsip-nav__utilities .lsip-chat-launcher--secondary.is-launcher-greeting .lsip-chat-launcher__label,
.lsip-nav__utilities .lsip-chat-launcher--secondary:hover .lsip-chat-launcher__label,
.lsip-nav__utilities .lsip-chat-launcher--secondary:focus-visible .lsip-chat-launcher__label {
    max-width: 8rem;
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .lsip-nav__utilities .lsip-chat-launcher--secondary,
    .lsip-nav__utilities .lsip-chat-launcher--secondary .lsip-chat-launcher__label {
        transition: none;
    }
}

/* ── JobMatcher floating launcher — greeting → idle → hover-expand ──────────
   On the Search page the Job Matcher should announce itself with the full
   "Job Matcher" pill so visitors notice the AI assistant, then collapse to an
   icon-only circle so it stops covering the job listings underneath. Hover or
   keyboard focus re-expand it. The `.is-launcher-greeting` class is toggled
   by /js/NCSCareerGuidanceAI_JobMatcher2/app.js on every mount, so the
   greeting fires every time the user lands on /Search. */
@media (min-width: 768px) {
    #openChat_JobMatcher2 {
        padding: 0.85rem;                  /* idle = icon-only padding */
        gap: 0;
        transition: padding         0.32s var(--chat-ease),
                    gap             0.32s var(--chat-ease),
                    transform       0.18s var(--chat-ease),
                    box-shadow      0.18s var(--chat-ease),
                    background-color 0.18s var(--chat-ease);
    }

    #openChat_JobMatcher2 .lsip-chat-launcher__label {
        display: inline-block;
        overflow: hidden;
        white-space: nowrap;
        max-width: 0;
        opacity: 0;
        transition: max-width 0.32s var(--chat-ease),
                    opacity   0.22s var(--chat-ease);
    }

    #openChat_JobMatcher2.is-launcher-greeting,
    #openChat_JobMatcher2:hover,
    #openChat_JobMatcher2:focus-visible {
        padding: 0.85rem 1.2rem 0.85rem 1rem;
        gap: 0.55rem;
    }
    #openChat_JobMatcher2.is-launcher-greeting .lsip-chat-launcher__label,
    #openChat_JobMatcher2:hover .lsip-chat-launcher__label,
    #openChat_JobMatcher2:focus-visible .lsip-chat-launcher__label {
        max-width: 12rem;
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    #openChat_JobMatcher2,
    #openChat_JobMatcher2 .lsip-chat-launcher__label { transition: none; }
}

/* ── Modal overlay ─────────────────────────────────────────────────────────── */

.lsip-chat-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;            /* the existing per-widget JS toggles "hidden" — see compatibility below */
    align-items: flex-end;
    justify-content: center;
    background: rgba(10, 18, 36, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 0;
    animation: lsip-chat-fade-in 0.2s var(--chat-ease);
}

@media (min-width: 768px) {
    .lsip-chat-modal {
        align-items: center;
        padding: 1.5rem;
    }
}

/* Compatibility with the existing JS that toggles `.hidden`. */
.lsip-chat-modal.hidden { display: none !important; }
.lsip-chat-modal:not(.hidden) { display: flex; }

@keyframes lsip-chat-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Modal card ────────────────────────────────────────────────────────────── */

.lsip-chat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: 100dvh;
    height: 100dvh;          /* mobile: full-screen sheet */
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    box-shadow: var(--chat-shadow);
    animation: lsip-chat-slide-in 0.28s var(--chat-ease);
}

@media (min-width: 768px) {
    .lsip-chat-card {
        max-height: 88vh;
        height: auto;
        min-height: 520px;
        border-radius: var(--chat-radius);
    }
}

.lsip-chat-card--wide {
    width: min(960px, 100%);
}

@keyframes lsip-chat-slide-in {
    from { opacity: 0; transform: translateY(28px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0)     scale(1);    }
}

/* ── Header ────────────────────────────────────────────────────────────────── */

.lsip-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.85rem 1.1rem;
    background: linear-gradient(135deg, var(--chat-brand) 0%, var(--chat-brand-strong) 100%);
    color: #fff;
    flex-shrink: 0;
}

.lsip-chat-header__title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.lsip-chat-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.lsip-chat-header__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lsip-chat-header__avatar .material-symbols-outlined {
    color: #fff;
    font-size: 1.25rem;
}

.lsip-chat-header__text {
    min-width: 0;
}

.lsip-chat-header h2 {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.15;
    letter-spacing: -0.005em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lsip-chat-header__status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1;
    margin-top: 0.2rem;
}

.lsip-chat-header__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #36d399;
    box-shadow: 0 0 0 3px rgba(54, 211, 153, 0.25);
    animation: lsip-chat-online 2.5s ease-in-out infinite;
}

@keyframes lsip-chat-online {
    0%, 100% { box-shadow: 0 0 0 3px rgba(54, 211, 153, 0.25); }
    50%      { box-shadow: 0 0 0 6px rgba(54, 211, 153, 0.10); }
}

.lsip-chat-header__close,
.lsip-chat-header button[id^="closeChat"] {
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.lsip-chat-header__close:hover,
.lsip-chat-header button[id^="closeChat"]:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.05);
}

.lsip-chat-header__close .material-symbols-outlined,
.lsip-chat-header button[id^="closeChat"] svg {
    width: 18px;
    height: 18px;
    font-size: 1.1rem;
}

/* ── Body (where the per-widget JS injects messages) ──────────────────────── */

.lsip-chat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    background: var(--chat-bg-soft);
    padding: 1.1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar — soft and unobtrusive */
.lsip-chat-body::-webkit-scrollbar { width: 8px; }
.lsip-chat-body::-webkit-scrollbar-track { background: transparent; }
.lsip-chat-body::-webkit-scrollbar-thumb {
    background: rgba(15, 30, 60, 0.18);
    border-radius: 999px;
}
.lsip-chat-body::-webkit-scrollbar-thumb:hover { background: rgba(15, 30, 60, 0.32); }

/* ── Override the legacy Tailwind utility classes the JS still injects ────
 * These rules style the JS-generated message markup without needing a
 * Tailwind build. They're scoped to the chat body / widget-container so they
 * don't leak elsewhere. */

.lsip-chat-body [class*="flex"],
[id^="widget-container"] [class*="flex"] { display: flex; }

.lsip-chat-body [class*="flex-col"],
[id^="widget-container"] [class*="flex-col"] { flex-direction: column; }

.lsip-chat-body [class*="flex-wrap"],
[id^="widget-container"] [class*="flex-wrap"] { flex-wrap: wrap; }

.lsip-chat-body [class*="items-center"],
[id^="widget-container"] [class*="items-center"] { align-items: center; }

.lsip-chat-body [class*="items-start"],
[id^="widget-container"] [class*="items-start"] { align-items: flex-start; }

.lsip-chat-body [class*="items-end"],
[id^="widget-container"] [class*="items-end"] { align-items: flex-end; }

.lsip-chat-body [class*="justify-end"],
[id^="widget-container"] [class*="justify-end"] { justify-content: flex-end; }

.lsip-chat-body [class*="justify-between"],
[id^="widget-container"] [class*="justify-between"] { justify-content: space-between; }

.lsip-chat-body [class*="justify-center"],
[id^="widget-container"] [class*="justify-center"] { justify-content: center; }

/* Avatars the legacy JS renders as rounded images */
[id^="widget-container"] img.rounded-full,
[id^="widget-container"] .rounded-full > img {
    border-radius: 50%;
    width: 38px !important;
    height: 38px !important;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(20, 56, 122, 0.12);
}

/* The user "account_circle" emoji fallback the legacy JS still spits out */
[id^="widget-container"] .material-symbols-outlined.text-primary-500 {
    font-size: 28px !important;
    color: var(--chat-brand) !important;
    background: #e7ecf6;
    border-radius: 50%;
    padding: 6px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Message bubble — user-side (bg-primary-500 is the JS-injected class). */
[id^="widget-container"] .bg-primary-500,
[id^="widget-container"] [class*="bg-primary-500"] {
    background: var(--chat-bg-user) !important;
    color: #fff !important;
}

/* Bot bubble — the JS renders this without a background. Add one ourselves
 * by targeting the meta container directly. */
[id^="widget-container"] > .flex.gap-1,
[id^="widget-container"] > .flex.gap-3,
[id^="widget-container"] > div > .flex.gap-3 {
    background: transparent;
    align-items: flex-start !important;
}

/* Generic "message text" paragraph — the JS gives it
 *   text-base font-normal leading-normal
 * with conditional bg-primary-500 for the user. We give bot text a card and
 * user text a coloured bubble. */
[id^="widget-container"] p.text-base.font-normal {
    background: var(--chat-bg-bot);
    border: 1px solid #e6e6e6;
    border-radius: var(--chat-radius);
    padding: 0.7rem 0.95rem;
    line-height: 1.5;
    color: var(--chat-ink);
    margin: 0;
    box-shadow: 0 1px 2px rgba(20, 56, 122, 0.04);
    max-width: min(100%, 32rem);
    word-wrap: break-word;
}

/* User bubble — the JS adds bg-primary-500 to the same paragraph */
[id^="widget-container"] p.text-base.font-normal.bg-primary-500,
[id^="widget-container"] p.bg-primary-500 {
    background: var(--chat-bg-user) !important;
    color: #fff !important;
    border-color: transparent !important;
    border-bottom-right-radius: 4px !important;
}

/* Name + timestamp meta line */
[id^="widget-container"] .text-gray-900.text-base.font-bold {
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    color: var(--chat-ink) !important;
    line-height: 1.1 !important;
    margin: 0 !important;
}

[id^="widget-container"] .text-primary-700.text-sm,
[id^="widget-container"] p.text-primary-700 {
    font-size: 0.72rem !important;
    color: var(--chat-ink-muted) !important;
    line-height: 1.1 !important;
    margin: 0 !important;
}

/* Option pills the legacy JS injects (h-8 border-2 border-primary-500 rounded-lg). */
[id^="widget-container"] [class*="border-primary-500"] {
    border: 1.5px solid var(--chat-brand) !important;
    background: #fff !important;
    color: var(--chat-brand) !important;
    border-radius: 999px !important;
    padding: 0.45rem 0.95rem !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease !important;
}

[id^="widget-container"] [class*="border-primary-500"]:hover {
    background: rgba(20, 56, 122, 0.08) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(20, 56, 122, 0.15);
}

/* Active / selected pill — JS swaps to bg-primary-500 text-white */
[id^="widget-container"] [class*="bg-primary-500"][class*="text-white"] {
    background: var(--chat-brand) !important;
    color: #fff !important;
    border-color: var(--chat-brand) !important;
}

/* "Next" button (bg-gray-800 text-white) */
[id^="widget-container"] [class*="bg-gray-800"] {
    background: var(--chat-brand) !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 999px !important;
    padding: 0.55rem 1.15rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: background 0.15s ease, transform 0.12s ease;
}
[id^="widget-container"] [class*="bg-gray-800"]:hover {
    background: var(--chat-brand-strong) !important;
    transform: translateY(-1px);
}

/* Option-selected interim state (bg-gray-200 / bg-gray-600) */
[id^="widget-container"] [class*="bg-gray-200"] {
    background: rgba(20, 56, 122, 0.08) !important;
    color: var(--chat-ink) !important;
    border: 1px solid #d8def0 !important;
    border-radius: 999px !important;
    padding: 0.4rem 0.85rem !important;
    cursor: pointer !important;
}

[id^="widget-container"] [class*="bg-gray-600"] {
    background: var(--chat-brand) !important;
    color: #fff !important;
}

/* "More info" / utility chips with bg-gray-200 */
[id^="widget-container"] button[class*="bg-gray-200"]:hover {
    background: rgba(20, 56, 122, 0.14) !important;
}

/* ── Footer (input + send) ─────────────────────────────────────────────────── */

.lsip-chat-footer {
    flex-shrink: 0;
    border-top: 1px solid #e9ecf3;
    background: #fff;
    padding: 0.7rem 0.9rem 0.85rem;
}

/* Style the JS-injected input box (#message-box-container is created later) */
[id^="widget-container"] #message-box-container,
[id^="widget-container"] [id*="message-box-container"] {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem 0.45rem 1rem;
    background: #fff !important;
    border: 1.5px solid #d8def0 !important;
    border-radius: 999px !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

[id^="widget-container"] #message-box-container:focus-within {
    border-color: var(--chat-brand) !important;
    box-shadow: 0 0 0 4px rgba(20, 56, 122, 0.12);
}

[id^="widget-container"] #message-box-container input {
    flex: 1;
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;
    color: var(--chat-ink) !important;
    padding: 0.5rem 0 !important;
    font-size: 0.95rem !important;
    box-shadow: none !important;
}

[id^="widget-container"] #message-box-container input::placeholder {
    color: #97a0b3 !important;
}

[id^="widget-container"] #message-box-container button {
    background: var(--chat-brand) !important;
    color: #fff !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    border: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    cursor: pointer !important;
    transition: background 0.15s ease, transform 0.15s ease;
}

[id^="widget-container"] #message-box-container button:hover {
    background: var(--chat-brand-strong) !important;
    transform: scale(1.05);
}

[id^="widget-container"] #message-box-container button svg {
    width: 18px;
    height: 18px;
}

/* The follow-up suggestion chips (#job-prompt-buttons) */
[id^="widget-container"] #job-prompt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-bottom: 0.65rem;
}

/* The searchbox container — give it some breathing room */
[id^="widget-container"] .searchbox {
    background: transparent !important;
    padding: 0.5rem 0 0 !important;
    border-radius: 0 !important;
}

/* ── Typing indicator (replaces the loading.gif) ──────────────────────────── */

.lsip-chat-typing,
[id^="widget-container"] .loadingIndicator {
    display: flex !important;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 0.95rem;
    background: var(--chat-bg-bot);
    border: 1px solid #e6e6e6;
    border-radius: var(--chat-radius);
    width: fit-content;
    margin: 0.25rem 0;
    color: var(--chat-ink-muted);
    font-size: 0.85rem;
}

[id^="widget-container"] .loadingIndicator img { display: none !important; }
[id^="widget-container"] .loadingIndicator p { margin: 0 !important; font-size: 0.85rem; color: var(--chat-ink-muted); }
[id^="widget-container"] .loadingIndicator .flex-col,
[id^="widget-container"] .loadingIndicator > div { flex-direction: row !important; gap: 0.5rem; }

/* Visual dots — injected before the loadingIndicator text via ::before */
[id^="widget-container"] .loadingIndicator::before {
    content: "";
    width: 36px;
    height: 12px;
    background-image:
        radial-gradient(circle at 6px 50%,  var(--chat-brand) 0 3px, transparent 3.5px),
        radial-gradient(circle at 18px 50%, var(--chat-brand) 0 3px, transparent 3.5px),
        radial-gradient(circle at 30px 50%, var(--chat-brand) 0 3px, transparent 3.5px);
    background-repeat: no-repeat;
    animation: lsip-chat-dots 1.1s infinite ease-in-out;
    flex-shrink: 0;
}

@keyframes lsip-chat-dots {
    0%, 100% { opacity: 0.35; transform: translateY(0); }
    50%      { opacity: 1;    transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
    [id^="widget-container"] .loadingIndicator::before { animation: none; opacity: 0.75; }
}

/* ── Body wrapper for the per-widget content (#widget-container*) ──────────
 * The existing JS injects everything inside `#widget-container*`, which lives
 * inside our `.lsip-chat-body`. Style the wrapper so JS-injected things flow
 * vertically and inherit our typography. */

[id^="widget-container"] {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    color: var(--chat-ink);
    line-height: 1.5;
    font-size: 0.95rem;
    width: 100%;
}

[id^="widget-container"] p { margin: 0 0 0.5rem; }
[id^="widget-container"] h3 {
    margin: 0.4rem 0 0.4rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--chat-brand);
}
[id^="widget-container"] h4 {
    margin: 0.4rem 0 0.3rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--chat-brand);
}

[id^="widget-container"] ul { margin: 0.2rem 0 0.6rem; padding-left: 1.1rem; }
[id^="widget-container"] li { margin-bottom: 0.2rem; }
[id^="widget-container"] a {
    color: var(--chat-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}
[id^="widget-container"] a:hover { color: var(--chat-accent); }

/* Intro paragraph the chat scripts inject — give it a friendly callout look */
[id^="widget-container"] > div:first-of-type p.font-normal {
    background: linear-gradient(135deg, rgba(20, 56, 122, 0.07), rgba(20, 56, 122, 0.02));
    border-left: 3px solid var(--chat-brand);
    padding: 0.7rem 0.95rem;
    border-radius: 0 var(--chat-radius-sm) var(--chat-radius-sm) 0;
    color: var(--chat-ink);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

/* Summary container — bg-primary-500 the JS still renders at the end */
[id^="widget-container"] [class*="bg-primary-500"][class*="rounded"] {
    background: var(--chat-brand) !important;
    color: #fff !important;
    padding: 0.85rem 1rem !important;
    border-radius: var(--chat-radius) !important;
    font-size: 0.88rem;
    line-height: 1.5;
}

[id^="widget-container"] [class*="bg-primary-500"][class*="rounded"] p { color: #fff !important; }
[id^="widget-container"] [class*="bg-primary-500"][class*="rounded"] p.font-bold {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.85;
    margin-bottom: 0.2rem;
}

/* ── Signposter trigger sits in the navbar — not a fixed launcher ─────────── */

#signposter .lsip-chat-navtrigger {
    background: transparent;
    border: 0;
    color: var(--chat-brand);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}

#signposter .lsip-chat-navtrigger:hover {
    background: rgba(20, 56, 122, 0.08);
    color: var(--chat-brand-strong);
}

#signposter .lsip-chat-navtrigger .material-symbols-outlined {
    font-size: 1.1rem;
}

/* ── Mobile fullscreen polish ─────────────────────────────────────────────── */

@media (max-width: 767px) {
    .lsip-chat-card { border-radius: 0; height: 100dvh; max-height: 100dvh; }
    .lsip-chat-modal { padding: 0; }
    /* Floating-mode launchers: collapse to icon-only on phones. The :not()
       targets only labels, not the .lsip-chat-launcher__icon wrapper (which
       carries no material-symbols-outlined class itself — switched the
       selector to the explicit __label class to avoid hiding the icon too). */
    .lsip-chat-launcher .lsip-chat-launcher__label { display: none; }
    .lsip-chat-launcher { padding: 0.85rem; }
    .lsip-chat-launcher__icon { width: 26px; height: 26px; }

    /* Nav-mode (Signposter inside .lsip-nav__utilities) keeps the max-width
       transition so the greeting + hover expansion still works on touch. */
    .lsip-nav__utilities .lsip-chat-launcher .lsip-chat-launcher__label {
        display: inline-block;
    }
}

/* ── Engine-rendered UI (lsip-chat-engine.js) ─────────────────────────────── */

[id^="widget-container"] {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.lsip-chat-stream {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding-bottom: 0.5rem;
    overflow-y: visible;
}

/* Starter chips above the input */
.lsip-chat-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.lsip-chat-starter {
    background: #fff;
    border: 1.5px solid #d8def0;
    color: var(--chat-brand);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
    line-height: 1.2;
    font-family: inherit;
}

.lsip-chat-starter:hover {
    background: rgba(20, 56, 122, 0.08);
    border-color: var(--chat-brand);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(20, 56, 122, 0.12);
}

/* ── Chat bubble ──────────────────────────────────────────────────────────── */

.lsip-chat-bubble {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    animation: lsip-chat-bubble-in 0.22s var(--chat-ease);
}

@keyframes lsip-chat-bubble-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lsip-chat-bubble--user {
    flex-direction: row-reverse;
}

.lsip-chat-bubble__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #e7ecf6;
    color: var(--chat-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(20, 56, 122, 0.10);
}

.lsip-chat-bubble--user .lsip-chat-bubble__avatar {
    background: var(--chat-brand);
    color: #fff;
}

.lsip-chat-bubble__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lsip-chat-bubble__avatar .material-symbols-outlined { font-size: 18px; }

.lsip-chat-bubble__card {
    max-width: min(85%, 32rem);
    background: var(--chat-bg-bot);
    border: 1px solid #e7e9f1;
    border-radius: var(--chat-radius);
    padding: 0.65rem 0.9rem 0.75rem;
    box-shadow: 0 1px 2px rgba(20, 56, 122, 0.04);
}

.lsip-chat-bubble--user .lsip-chat-bubble__card {
    background: var(--chat-bg-user);
    color: #fff;
    border-color: transparent;
    border-bottom-right-radius: 4px;
}

.lsip-chat-bubble--assistant .lsip-chat-bubble__card {
    border-bottom-left-radius: 4px;
}

.lsip-chat-bubble__meta {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin-bottom: 0.2rem;
    flex-wrap: wrap;
}

.lsip-chat-bubble__name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--chat-ink);
    letter-spacing: 0.005em;
    line-height: 1.1;
}

.lsip-chat-bubble--user .lsip-chat-bubble__name {
    color: rgba(255, 255, 255, 0.95);
}

.lsip-chat-bubble__time {
    font-size: 0.7rem;
    color: var(--chat-ink-muted);
    line-height: 1.1;
}

.lsip-chat-bubble--user .lsip-chat-bubble__time {
    color: rgba(255, 255, 255, 0.75);
}

.lsip-chat-bubble__body {
    font-size: 0.93rem;
    line-height: 1.5;
    color: var(--chat-ink);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.lsip-chat-bubble--user .lsip-chat-bubble__body { color: #fff; }

.lsip-chat-bubble__body p { margin: 0 0 0.5rem; }
.lsip-chat-bubble__body p:last-child { margin-bottom: 0; }
.lsip-chat-bubble__body h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--chat-brand);
    margin: 0.4rem 0 0.3rem;
}
.lsip-chat-bubble__body h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--chat-brand);
    margin: 0.4rem 0 0.3rem;
}
.lsip-chat-bubble__body ul,
.lsip-chat-bubble__body ol {
    margin: 0.25rem 0 0.5rem;
    padding-left: 1.2rem;
}
.lsip-chat-bubble__body li { margin-bottom: 0.15rem; }
.lsip-chat-bubble__body a {
    color: var(--chat-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}
.lsip-chat-bubble--user .lsip-chat-bubble__body a {
    color: #ffd9a8;
}
.lsip-chat-bubble__body code {
    background: rgba(20, 56, 122, 0.06);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.lsip-chat-bubble.is-greeting .lsip-chat-bubble__card {
    background: linear-gradient(135deg, rgba(20, 56, 122, 0.06) 0%, rgba(20, 56, 122, 0.01) 100%);
    border-color: rgba(20, 56, 122, 0.2);
}

/* ── Typing dots ──────────────────────────────────────────────────────────── */

.lsip-chat-bubble.is-typing .lsip-chat-bubble__card {
    padding: 0.7rem 0.95rem;
}

.lsip-chat-typing-dots {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
    height: 1rem;
}

.lsip-chat-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-brand);
    opacity: 0.4;
    animation: lsip-chat-dot-bounce 1s infinite ease-in-out;
}

.lsip-chat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.lsip-chat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes lsip-chat-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .lsip-chat-typing-dots span { animation: none; opacity: 0.7; }
}

/* ── Inline error ─────────────────────────────────────────────────────────── */

.lsip-chat-error {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    background: #fef0ee;
    border: 1px solid #f5c2c0;
    border-radius: var(--chat-radius-sm);
    color: #8a1f15;
    font-size: 0.88rem;
    animation: lsip-chat-bubble-in 0.2s var(--chat-ease);
}

.lsip-chat-error .material-symbols-outlined { font-size: 1.1rem; }

.lsip-chat-error__text { flex: 1; }

.lsip-chat-error__retry {
    background: #8a1f15;
    color: #fff;
    border: 0;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}
.lsip-chat-error__retry:hover { background: #6d1810; }

/* ── Composer (footer) ────────────────────────────────────────────────────── */

.lsip-chat-composer {
    margin-top: auto;
    padding-top: 0.7rem;
    border-top: 1px solid #e9ecf3;
    background: #fff;
    position: sticky;
    bottom: 0;
}

.lsip-chat-composer__row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.55rem 0.4rem 1rem;
    background: #fff;
    border: 1.5px solid #d8def0;
    border-radius: 999px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lsip-chat-composer__row:focus-within {
    border-color: var(--chat-brand);
    box-shadow: 0 0 0 4px rgba(20, 56, 122, 0.12);
}

.lsip-chat-composer__input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--chat-ink);
    padding: 0.45rem 0;
    font-size: 0.95rem;
    font-family: inherit;
    min-width: 0;
    /* Textarea-specific — single-line by default, auto-grows via JS. */
    resize: none;
    line-height: 1.45;
    max-height: 130px;
    overflow-y: hidden;
}

.lsip-chat-composer__input::placeholder { color: #97a0b3; }

.lsip-chat-composer__input:disabled {
    color: #97a0b3;
    cursor: not-allowed;
}

.lsip-chat-composer__send {
    background: var(--chat-brand);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.lsip-chat-composer__send:hover:not(:disabled) {
    background: var(--chat-brand-strong);
    transform: scale(1.05);
}

.lsip-chat-composer__send:disabled {
    background: #c2c8d6;
    cursor: not-allowed;
}

.lsip-chat-composer__send .material-symbols-outlined { font-size: 1.15rem; }

.lsip-chat-composer__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.4rem;
    padding: 0 0.5rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.lsip-chat-composer__counter {
    font-size: 0.72rem;
    color: var(--chat-ink-muted);
    font-variant-numeric: tabular-nums;
}

.lsip-chat-composer__stop,
.lsip-chat-composer__clear {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    border: 0;
    color: var(--chat-ink-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: inherit;
}

.lsip-chat-composer__stop {
    color: #8a1f15;
}

.lsip-chat-composer__stop:hover { background: rgba(138, 31, 21, 0.08); }
.lsip-chat-composer__clear:hover { background: rgba(20, 56, 122, 0.08); color: var(--chat-brand); }

.lsip-chat-composer__stop .material-symbols-outlined,
.lsip-chat-composer__clear .material-symbols-outlined { font-size: 1rem; }

@media (max-width: 600px) {
    .lsip-chat-composer__meta { font-size: 0.72rem; }
    .lsip-chat-bubble__card { max-width: 90%; }
}

/* ── Avatar pulse while assistant is streaming ────────────────────────────── */

.lsip-chat-bubble__avatar--pulsing {
    position: relative;
}

.lsip-chat-bubble__avatar--pulsing::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 56, 122, 0.35) 0%, transparent 70%);
    animation: lsip-chat-avatar-pulse 1.6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes lsip-chat-avatar-pulse {
    0%, 100% { transform: scale(1);   opacity: 0.4; }
    50%      { transform: scale(1.3); opacity: 0;   }
}

/* ── Skeleton placeholder for the very first reply ────────────────────────── */

.lsip-chat-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.35rem 0;
}

.lsip-chat-skeleton__line {
    height: 0.85rem;
    border-radius: 6px;
    background: linear-gradient(90deg,
        rgba(20, 56, 122, 0.06) 0%,
        rgba(20, 56, 122, 0.13) 50%,
        rgba(20, 56, 122, 0.06) 100%);
    background-size: 200% 100%;
    animation: lsip-chat-skeleton-shimmer 1.4s linear infinite;
    width: 100%;
}

.lsip-chat-skeleton__line--short { width: 60%; }

@keyframes lsip-chat-skeleton-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ── Send-button kick ─────────────────────────────────────────────────────── */

.lsip-chat-composer__send.is-kicked {
    animation: lsip-chat-send-kick 0.32s var(--chat-ease);
}

@keyframes lsip-chat-send-kick {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.18) rotate(-10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* ── Per-message toolbar (copy / 👍 / 👎) ──────────────────────────────────── */

.lsip-chat-bubble__tools {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding-top: 0.45rem;
    border-top: 1px dashed rgba(20, 56, 122, 0.12);
    flex-wrap: wrap;
}

.lsip-chat-bubble--user .lsip-chat-bubble__tools { display: none; }

.lsip-chat-bubble__tool {
    background: transparent;
    border: 0;
    color: var(--chat-ink-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    letter-spacing: 0.01em;
}

.lsip-chat-bubble__tool .material-symbols-outlined {
    font-size: 0.95rem;
    font-variation-settings: 'wght' 500;
}

.lsip-chat-bubble__tool-label {
    line-height: 1;
}

.lsip-chat-bubble__tool:hover {
    background: rgba(20, 56, 122, 0.08);
    color: var(--chat-brand);
}

.lsip-chat-bubble__tool.is-confirmed {
    background: rgba(46, 125, 79, 0.14);
    color: #1f6d3e;
}

.lsip-chat-bubble__tool.is-failed {
    background: rgba(138, 31, 21, 0.12);
    color: #8a1f15;
}

/* ── Follow-up suggestion chips after each AI reply ──────────────────────── */

.lsip-chat-followups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.3rem 0 0;
    padding-left: 2.4rem;       /* aligns under the bubble card, past the avatar */
    animation: lsip-chat-bubble-in 0.25s var(--chat-ease) 0.15s backwards;
}

.lsip-chat-followup {
    background: rgba(20, 56, 122, 0.06);
    border: 1px solid rgba(20, 56, 122, 0.18);
    color: var(--chat-brand);
    border-radius: 999px;
    padding: 0.32rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
    line-height: 1.2;
}

.lsip-chat-followup:hover {
    background: rgba(20, 56, 122, 0.14);
    border-color: var(--chat-brand);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(20, 56, 122, 0.14);
}

/* ── Phase-aware status indicator ─────────────────────────────────────────── */

.lsip-chat-header__status[data-phase="thinking"]  .lsip-chat-header__status-dot,
.lsip-chat-header__status[data-phase="searching"] .lsip-chat-header__status-dot,
.lsip-chat-header__status[data-phase="drafting"]  .lsip-chat-header__status-dot {
    background: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(215, 124, 26, 0.25);
}

.lsip-chat-header__status[data-phase="error"] .lsip-chat-header__status-dot {
    background: #ef5454;
    box-shadow: 0 0 0 3px rgba(239, 84, 84, 0.25);
    animation: none;
}

/* ── Export button ───────────────────────────────────────────────────────── */

.lsip-chat-composer__action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    border: 0;
    color: var(--chat-ink-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: inherit;
}

.lsip-chat-composer__action:hover {
    background: rgba(20, 56, 122, 0.08);
    color: var(--chat-brand);
}

.lsip-chat-composer__action .material-symbols-outlined { font-size: 1rem; }

/* ── Launcher refinements (breathing + subtle shimmer) ────────────────────── */

.lsip-chat-launcher {
    overflow: hidden;
    isolation: isolate;
}

.lsip-chat-launcher::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
        transparent 30%,
        rgba(255, 255, 255, 0.28) 50%,
        transparent 70%);
    background-size: 220% 100%;
    background-position: -50% 0;
    pointer-events: none;
    animation: lsip-chat-launcher-shimmer 4.2s ease-in-out infinite;
    border-radius: inherit;
    mix-blend-mode: overlay;
}

@keyframes lsip-chat-launcher-shimmer {
    0%   { background-position: -50% 0; }
    50%  { background-position: 150% 0; }
    100% { background-position: 150% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .lsip-chat-launcher::after { animation: none; }
}

/* ── Phase tint on the header (subtle, only during work) ─────────────────── */

.lsip-chat-modal .lsip-chat-header__phase { display: inline; }

/* ── Streaming bubble subtle highlight ───────────────────────────────────── */

.lsip-chat-bubble.is-streaming .lsip-chat-bubble__card {
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
    border-color: rgba(20, 56, 122, 0.22);
    box-shadow: 0 2px 10px rgba(20, 56, 122, 0.06);
}

/* ── Quick-action greeting cards ──────────────────────────────────────────── */
/*
 * When a chat is empty, the starters config may be a list of objects
 * (icon + title + subtitle + prompt) → render as prominent cards in a
 * 2-column grid. Plain-string starters keep rendering as chips above.
 */

.lsip-chat-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.6rem;
    margin: 0.2rem 0 0.5rem;
    animation: lsip-chat-bubble-in 0.25s var(--chat-ease);
}

.lsip-chat-action {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 0.8rem;
    background: #fff;
    border: 1.5px solid rgba(20, 56, 122, 0.14);
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.18s ease;
    box-shadow: 0 1px 2px rgba(20, 56, 122, 0.04);
}

.lsip-chat-action:hover {
    background: linear-gradient(135deg, #fff 0%, #f4f7fc 100%);
    border-color: var(--chat-brand);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(20, 56, 122, 0.14);
}

.lsip-chat-action__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(20, 56, 122, 0.12) 0%, rgba(20, 56, 122, 0.04) 100%);
    color: var(--chat-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lsip-chat-action:hover .lsip-chat-action__icon {
    background: linear-gradient(135deg, var(--chat-brand) 0%, var(--chat-brand-strong) 100%);
    color: #fff;
}

.lsip-chat-action__icon .material-symbols-outlined {
    font-size: 1.2rem;
    font-variation-settings: 'wght' 500;
}

.lsip-chat-action__text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.lsip-chat-action__title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--chat-ink);
    line-height: 1.2;
    letter-spacing: -0.005em;
}

.lsip-chat-action__subtitle {
    font-size: 0.75rem;
    color: var(--chat-ink-muted);
    line-height: 1.3;
}

@media (max-width: 480px) {
    .lsip-chat-actions { grid-template-columns: 1fr; }
}

/* ── Citation source cards beneath an AI reply ────────────────────────────── */
/*
 * Each card matches one cited page from the live link index — visual
 * confirmation that what the AI mentioned actually exists. Per-type accent
 * tint (page / sector / event / news) keeps the visual hierarchy useful.
 */

.lsip-chat-sources {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding-top: 0.55rem;
    border-top: 1px dashed rgba(20, 56, 122, 0.12);
    animation: lsip-chat-bubble-in 0.3s var(--chat-ease) 0.1s backwards;
}

.lsip-chat-sources__label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--chat-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.lsip-chat-source {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    background: rgba(20, 56, 122, 0.05);
    border: 1px solid rgba(20, 56, 122, 0.16);
    border-radius: 10px;
    text-decoration: none;
    color: var(--chat-ink);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.lsip-chat-source:hover {
    background: rgba(20, 56, 122, 0.10);
    border-color: var(--chat-brand);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(20, 56, 122, 0.12);
    color: inherit;
    text-decoration: none;
}

.lsip-chat-source__icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(20, 56, 122, 0.18) 0%, rgba(20, 56, 122, 0.06) 100%);
    color: var(--chat-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.lsip-chat-source__icon .material-symbols-outlined { font-size: 1rem; font-variation-settings: 'wght' 500; }

.lsip-chat-source__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.lsip-chat-source__title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--chat-ink);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lsip-chat-source__meta {
    font-size: 0.7rem;
    color: var(--chat-ink-muted);
    line-height: 1.2;
}

.lsip-chat-source__arrow {
    flex-shrink: 0;
    color: var(--chat-brand);
    font-weight: 700;
    transition: transform 0.15s ease;
}

.lsip-chat-source:hover .lsip-chat-source__arrow { transform: translateX(3px); }

/* Per-type accent tint */
.lsip-chat-source--event  .lsip-chat-source__icon { background: linear-gradient(135deg, rgba(215, 124, 26, 0.18), rgba(215, 124, 26, 0.06)); color: var(--chat-accent); }
.lsip-chat-source--news   .lsip-chat-source__icon { background: linear-gradient(135deg, rgba(46, 125, 79, 0.18),  rgba(46, 125, 79, 0.06));  color: #2e7d4f; }
.lsip-chat-source--sector .lsip-chat-source__icon { background: linear-gradient(135deg, rgba(20, 56, 122, 0.20),  rgba(20, 56, 122, 0.06));  color: var(--chat-brand); }

/* Dark-mode tints (additive on the @media block below) */
@media (prefers-color-scheme: dark) {
    .lsip-chat-source {
        background: rgba(44, 92, 184, 0.10);
        border-color: rgba(44, 92, 184, 0.30);
        color: var(--chat-ink);
    }
    .lsip-chat-source:hover { background: rgba(44, 92, 184, 0.22); color: #fff; }
    .lsip-chat-source__title { color: var(--chat-ink); }
    .lsip-chat-source__meta { color: var(--chat-ink-muted); }
    .lsip-chat-source__icon { background: linear-gradient(135deg, rgba(44, 92, 184, 0.25), rgba(44, 92, 184, 0.08)); color: #9bb6ff; }
    .lsip-chat-source__arrow { color: #9bb6ff; }
}

/* ── First-time-visitor tour callout ─────────────────────────────────────── */
/*
 * A one-shot coachmark anchored above the launcher. localStorage flag
 * suppresses repeat appearances. Auto-hides after 12s.
 */

.lsip-chat-tour {
    position: fixed;
    z-index: 9991;
    max-width: 280px;
    background: linear-gradient(135deg, #14387a 0%, #0f2a5c 100%);
    color: #fff;
    border-radius: 14px;
    padding: 0.9rem 1rem 0.85rem;
    box-shadow:
        0 24px 50px -18px rgba(15, 30, 60, 0.55),
        0 8px 18px rgba(15, 30, 60, 0.20);
    animation: lsip-chat-tour-in 0.28s var(--chat-ease);
}

@keyframes lsip-chat-tour-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.lsip-chat-tour.is-leaving {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.22s, transform 0.22s;
}

.lsip-chat-tour__beak {
    position: absolute;
    bottom: -8px;
    right: 28px;
    width: 16px;
    height: 16px;
    background: inherit;
    transform: rotate(45deg);
    border-radius: 3px;
}

.lsip-chat-tour__title {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.005em;
    margin-bottom: 0.2rem;
}

.lsip-chat-tour__text {
    margin: 0 0 0.6rem;
    font-size: 0.85rem;
    line-height: 1.45;
    opacity: 0.92;
}

.lsip-chat-tour__close {
    background: rgba(255, 255, 255, 0.18);
    border: 0;
    color: #fff;
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
}
.lsip-chat-tour__close:hover { background: rgba(255, 255, 255, 0.3); }

/* ── Dark mode ────────────────────────────────────────────────────────────── */
/*
 * Auto-detect via prefers-color-scheme. Inverts surfaces, deepens the header
 * (keeps the brand gradient but darker), softens the action card backgrounds
 * so they don't glare. We only override colours — layout stays identical.
 */
@media (prefers-color-scheme: dark) {
    :root {
        --chat-brand:        #2c5cb8;          /* slightly lighter brand for dark surface */
        --chat-brand-strong: #1d3e83;
        --chat-bg-soft:      #161a23;          /* chat body */
        --chat-bg-user:      #2c5cb8;
        --chat-bg-bot:       #20242e;          /* bot bubble */
        --chat-ink:          #e8ebf2;
        --chat-ink-muted:    #98a0b3;
    }

    .lsip-chat-card { background: #1b1f29; }
    .lsip-chat-bubble__card { background: var(--chat-bg-bot); border-color: #2a2f3b; }
    .lsip-chat-bubble--user .lsip-chat-bubble__card { background: var(--chat-bg-user); border-color: transparent; }
    .lsip-chat-bubble.is-greeting .lsip-chat-bubble__card {
        background: linear-gradient(135deg, rgba(44, 92, 184, 0.18) 0%, rgba(44, 92, 184, 0.04) 100%);
        border-color: rgba(44, 92, 184, 0.4);
    }
    .lsip-chat-bubble__avatar { background: #2a2f3b; color: var(--chat-brand); }
    .lsip-chat-bubble--user .lsip-chat-bubble__avatar { background: var(--chat-brand); color: #fff; }
    .lsip-chat-bubble__name { color: var(--chat-ink); }
    .lsip-chat-bubble__time { color: var(--chat-ink-muted); }

    .lsip-chat-composer { background: #1b1f29; border-top-color: #2a2f3b; }
    .lsip-chat-composer__row { background: #20242e; border-color: #2e3344; }
    .lsip-chat-composer__row:focus-within {
        border-color: var(--chat-brand);
        box-shadow: 0 0 0 4px rgba(44, 92, 184, 0.22);
    }
    .lsip-chat-composer__input { color: var(--chat-ink); }
    .lsip-chat-composer__input::placeholder { color: #7b8295; }

    .lsip-chat-starter,
    .lsip-chat-followup {
        background: #20242e;
        border-color: #2e3344;
        color: #cdd5e8;
    }
    .lsip-chat-followup { background: rgba(44, 92, 184, 0.12); border-color: rgba(44, 92, 184, 0.3); color: #cdd5e8; }
    .lsip-chat-starter:hover,
    .lsip-chat-followup:hover { background: rgba(44, 92, 184, 0.22); border-color: var(--chat-brand); }

    .lsip-chat-action {
        background: #20242e;
        border-color: #2e3344;
    }
    .lsip-chat-action:hover {
        background: linear-gradient(135deg, #232838 0%, #1d2230 100%);
        border-color: var(--chat-brand);
    }
    .lsip-chat-action__title { color: var(--chat-ink); }
    .lsip-chat-action__subtitle { color: var(--chat-ink-muted); }
    .lsip-chat-action__icon { background: linear-gradient(135deg, rgba(44, 92, 184, 0.25) 0%, rgba(44, 92, 184, 0.08) 100%); color: #9bb6ff; }

    .lsip-chat-bubble__body { color: var(--chat-ink); }
    .lsip-chat-bubble__body code { background: rgba(44, 92, 184, 0.18); }
    .lsip-chat-bubble__body a { color: #9bb6ff; }
    .lsip-chat-bubble--user .lsip-chat-bubble__body a { color: #ffd9a8; }

    .lsip-chat-error { background: #2b1614; border-color: #5a2b25; color: #ffb1a6; }
    .lsip-chat-error__retry { background: #c2392c; }
    .lsip-chat-error__retry:hover { background: #9b2c22; }

    .lsip-chat-skeleton__line {
        background: linear-gradient(90deg,
            rgba(44, 92, 184, 0.10) 0%,
            rgba(44, 92, 184, 0.22) 50%,
            rgba(44, 92, 184, 0.10) 100%);
        background-size: 200% 100%;
    }

    .lsip-chat-bubble.is-streaming .lsip-chat-bubble__card {
        background: linear-gradient(135deg, #20242e 0%, #232b3d 100%);
        border-color: rgba(44, 92, 184, 0.4);
    }
}

/* ── Reduced-motion friendly fallback ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .lsip-chat-modal,
    .lsip-chat-card,
    .lsip-chat-launcher,
    .lsip-chat-launcher:hover,
    .lsip-chat-bubble,
    .lsip-chat-skeleton__line,
    .lsip-chat-followups,
    .lsip-chat-composer__send.is-kicked,
    .lsip-chat-bubble__avatar--pulsing::after,
    .lsip-chat-tour { animation: none; transition: none; transform: none; }
}
