/* Split out of style.css — enqueued only where it is needed.
   Edit here, not in style.css. */

/* ═══════════════════════════════════════════════════════
   AI CHATBOT WIDGET
   The launcher sits opposite the WhatsApp float so the two
   never overlap, and mirrors with the page direction.
═══════════════════════════════════════════════════════ */
.tpc-chat-launcher {
    position: fixed;
    inset-block-end: 24px;
    inset-inline-start: 24px;
    z-index: 9998;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: var(--c-primary);
    color: var(--c-text-inverse);
    font-size: 1.4rem;
    box-shadow: var(--glow-primary);
    transition: transform .22s ease, box-shadow .22s ease;
}
.tpc-chat-launcher:hover { transform: translateY(-3px) scale(1.04); }
.tpc-chat-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* Swap the bubble for a cross while the panel is open. */
.tpc-chat-launcher__close { display: none; }
.tpc-chat-launcher.is-open > i { display: none; }
.tpc-chat-launcher.is-open .tpc-chat-launcher__close { display: block; }

.tpc-chat-panel {
    position: fixed;
    inset-block-end: 94px;
    inset-inline-start: 24px;
    z-index: 9999;
    width: min(380px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 140px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--r-lg, 16px);
    background: var(--c-surface, #0a0f1a);
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .75);
    animation: tpc-chat-in .22s cubic-bezier(.4, 0, .2, 1);
}
.tpc-chat-panel[hidden] { display: none; }
@keyframes tpc-chat-in {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .tpc-chat-panel { animation: none; }
    .tpc-chat-launcher { transition: none; }
}

/* ── Header ───────────────────────────────────────────── */
.tpc-chat-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.1rem;
    background: rgba(255, 255, 255, .03);
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.tpc-chat-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--c-surface-2, #111827);
    padding: 5px;
    flex-shrink: 0;
}
.tpc-chat-head strong { display: block; color: #fff; font-size: .92rem; }
.tpc-chat-status {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .74rem;
    color: var(--c-text-muted, #94a3b8);
}
.tpc-chat-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, .6);
    animation: tpc-chat-pulse 2.2s infinite;
}
@keyframes tpc-chat-pulse {
    70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.tpc-chat-close {
    margin-inline-start: auto;
    background: none;
    border: 0;
    color: var(--c-text-muted, #94a3b8);
    font-size: 1.05rem;
    cursor: pointer;
    padding: .35rem;
    border-radius: 6px;
}
.tpc-chat-close:hover { color: #fff; }

/* ── Message log ──────────────────────────────────────── */
.tpc-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .7rem;
    scroll-behavior: smooth;
}

.tpc-chat-msg { display: flex; }
.tpc-chat-msg p {
    margin: 0;
    padding: .7rem 1rem;
    border-radius: 14px;
    font-size: .88rem;
    line-height: 1.65;
    max-width: 85%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.tpc-chat-msg.is-bot  { justify-content: flex-start; }
.tpc-chat-msg.is-user { justify-content: flex-end; }

.tpc-chat-msg.is-bot p {
    background: var(--c-surface-2, #111827);
    color: var(--c-text, #f1f5f9);
    border-start-start-radius: 4px;
}
.tpc-chat-msg.is-user p {
    background: var(--c-primary, #3b82f6);
    color: #fff;
    border-start-end-radius: 4px;
}

/* Three dots while the model is thinking. */
.tpc-chat-msg.is-typing p { display: flex; gap: 4px; padding: .85rem 1rem; }
.tpc-chat-msg.is-typing span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--c-text-muted, #94a3b8);
    animation: tpc-chat-bounce 1.1s infinite;
}
.tpc-chat-msg.is-typing span:nth-child(2) { animation-delay: .15s; }
.tpc-chat-msg.is-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes tpc-chat-bounce {
    0%, 60%, 100% { transform: translateY(0);   opacity: .45; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Quick replies ────────────────────────────────────── */
.tpc-chat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: 0 1.1rem .85rem;
}
/* A `display` declaration in a class rule outranks the browser's own
   [hidden] { display: none }, so hiding these from script needs saying. */
.tpc-chat-pills[hidden],
.tpc-chat-wa[hidden] { display: none !important; }
.tpc-chat-pill {
    padding: .4rem .85rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, .1);
    border: 1px solid rgba(59, 130, 246, .28);
    color: var(--c-primary-2, #60a5fa);
    font-family: inherit;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.tpc-chat-pill:hover { background: var(--c-primary, #3b82f6); color: #fff; }

/* ── WhatsApp escalation ──────────────────────────────── */
.tpc-chat-wa {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: 0 1.1rem .85rem;
    padding: .65rem;
    border-radius: var(--r-md, 12px);
    background: rgba(34, 197, 94, .12);
    border: 1px solid rgba(34, 197, 94, .3);
    color: #4ade80;
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
}
.tpc-chat-wa:hover { background: rgba(34, 197, 94, .2); }

/* ── Composer ─────────────────────────────────────────── */
.tpc-chat-form {
    display: flex;
    gap: .5rem;
    padding: .85rem 1.1rem 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
}
.tpc-chat-form input {
    flex: 1;
    min-width: 0;
    padding: .7rem 1rem;
    border-radius: 999px;
    background: var(--c-surface-2, #111827);
    border: 1px solid rgba(255, 255, 255, .1);
    color: var(--c-text, #f1f5f9);
    font-family: inherit;
    font-size: .88rem;
    outline: none;
}
.tpc-chat-form input:focus { border-color: var(--c-primary, #3b82f6); }
.tpc-chat-form input:disabled { opacity: .55; }

.tpc-chat-form button {
    width: 42px; height: 42px;
    flex-shrink: 0;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--c-primary, #3b82f6);
    color: #fff;
    cursor: pointer;
    transition: filter .16s ease;
}
.tpc-chat-form button:hover:not(:disabled) { filter: brightness(1.12); }
.tpc-chat-form button:disabled { opacity: .5; cursor: default; }
/* The paper plane points right; mirror it in Arabic. */
[dir="rtl"] .tpc-chat-form button i { transform: scaleX(-1); }

@media (max-width: 480px) {
    .tpc-chat-panel {
        inset-inline: 12px;
        width: auto;
        inset-block-end: 88px;
    }
    .tpc-chat-launcher { inset-inline-start: 16px; inset-block-end: 16px; }
}

@media print {
    .tpc-chat-launcher, .tpc-chat-panel { display: none !important; }
}

/* Voice input button — revealed by script only where dictation is supported. */
.tpc-chat-mic {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--c-surface-2, #111827);
    color: var(--c-text-muted, #94a3b8);
    cursor: pointer;
    transition: color .16s ease, border-color .16s ease;
}
.tpc-chat-mic[hidden] { display: none !important; }
.tpc-chat-mic:hover { color: var(--c-text, #f1f5f9); border-color: rgba(255, 255, 255, .25); }
.tpc-chat-mic.is-listening {
    color: #ef4444;
    border-color: rgba(239, 68, 68, .5);
    animation: tpc-mic-pulse 1.3s infinite;
}
@keyframes tpc-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .45); }
    60%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .tpc-chat-mic.is-listening { animation: none; }
}

/* In-Chat Lead Qualification Card & Quick Actions */
.tpc-chat-lead-card {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 8px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    color: #fff;
    font-size: 0.82rem;
}
.tpc-chat-lead-card h4 {
    margin: 0 0 4px;
    font-size: 0.88rem;
    color: #60a5fa;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tpc-chat-lead-card p {
    margin: 0 0 10px;
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.4;
}
.tpc-chat-lead-card input {
    width: 100%;
    background: #090d16;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    padding: 6px 10px;
    color: #fff;
    font-size: 0.8rem;
    margin-bottom: 8px;
    box-sizing: border-box;
    outline: none;
}
.tpc-chat-lead-card input:focus {
    border-color: #3b82f6;
}
.tpc-chat-lead-card button {
    width: 100%;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border: none;
    border-radius: 6px;
    color: #fff;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.tpc-chat-lead-card button:hover {
    opacity: 0.9;
}

/* ── Model Selector & Header Submeta ─────────────────── */
.tpc-chat-submeta {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: 2px;
}
.tpc-chat-model-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #60a5fa;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 6px;
    outline: none;
    max-width: 140px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.tpc-chat-model-select:hover,
.tpc-chat-model-select:focus {
    background: rgba(37, 99, 235, 0.2);
    border-color: #3b82f6;
    color: #fff;
}
.tpc-chat-model-select option {
    background: #0f172a;
    color: #f8fafc;
}
.tpc-chat-active-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 1px 6px;
    border-radius: 6px;
}

/* ── Vision Attachment Button & Preview ─────────────── */
.tpc-chat-attach {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--c-surface-2, #111827);
    color: var(--c-text-muted, #94a3b8);
    cursor: pointer;
    transition: color .16s ease, border-color .16s ease;
}
.tpc-chat-attach:hover {
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.4);
    background: rgba(59, 130, 246, 0.1);
}

.tpc-chat-preview {
    padding: 8px 1.1rem;
    background: rgba(15, 23, 42, 0.85);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}
.tpc-chat-preview[hidden] {
    display: none !important;
}
.tpc-chat-preview-wrap {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #3b82f6;
    flex-shrink: 0;
}
.tpc-chat-preview-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tpc-chat-preview-wrap button {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    border: none;
    width: 16px;
    height: 16px;
    line-height: 14px;
    font-size: 11px;
    border-bottom-left-radius: 4px;
    cursor: pointer;
    padding: 0;
}
.tpc-chat-preview-text {
    font-size: 0.75rem;
    color: #93c5fd;
    font-weight: 600;
}

/* ── Image in Chat Bubbles ───────────────────────────── */
.tpc-chat-msg-img {
    max-width: 220px;
    max-height: 160px;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 6px;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ── Bot Response Footer (Speak & Provider Tag) ─────── */
.tpc-chat-bubble-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
}
.tpc-msg-speak {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: color 0.15s, background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.tpc-msg-speak:hover {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}
.tpc-msg-speak.is-speaking {
    color: #22c55e;
    animation: tpc-pulse-speak 1s infinite;
}
@keyframes tpc-pulse-speak {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}
.tpc-chat-provider-tag {
    font-size: 0.68rem;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.tpc-chat-provider-tag.is-failover {
    color: #f59e0b;
    font-weight: 700;
}


/* ═══════════════════════════════════════════════════════
   Homepage "Ask Raied" section — the panel rendered inline
═══════════════════════════════════════════════════════ */
.tpc-raied-section { position: relative; }
.tpc-raied-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center;
}
.tpc-raied-badge {
    display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .9rem;
    border-radius: 999px; font-size: .8rem; font-weight: 700;
    background: rgba(59,130,246,.12); color: #60a5fa; border: 1px solid rgba(59,130,246,.3);
}
.tpc-raied-copy h2 { margin: 1rem 0 .75rem; font-size: clamp(1.7rem, 3.2vw, 2.4rem); line-height: 1.25; }
.tpc-raied-copy p { color: var(--c-text-muted, #94a3b8); line-height: 1.8; margin-bottom: 1.25rem; }
.tpc-raied-points { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.tpc-raied-points li { display: flex; align-items: center; gap: .6rem; color: var(--c-text, #e2e8f0); font-size: .95rem; }
.tpc-raied-points i { color: #22c55e; }

.tpc-chat-panel.is-embedded {
    position: relative; inset: auto; width: 100%; max-height: none; height: 560px;
    z-index: 1; animation: none;
    box-shadow: 0 30px 80px -20px rgba(59,130,246,.35), 0 0 0 1px rgba(255,255,255,.06);
}
.tpc-chat-panel.is-embedded .tpc-chat-close,
.tpc-chat-panel.is-embedded .tpc-chat-model-select { display: none; }
.tpc-chat-panel.is-embedded .tpc-chat-log { min-height: 0; }

@media (max-width: 900px) {
    .tpc-raied-grid { grid-template-columns: 1fr; }
    .tpc-chat-panel.is-embedded { height: 520px; inset-inline: auto; }
}
@media print { .tpc-raied-section { display: none !important; } }

/* ═══════════════════════════════════════════════════════
   AI look & feel — orb, aurora, glowing border, motion
═══════════════════════════════════════════════════════ */
/* Brand palette — follows TPC Dashboard → Site Settings → colours. */
.tpc-raied-section {
    --tpc-b1:  var(--c-primary, #3b82f6);
    --tpc-b2:  var(--c-secondary, #8b5cf6);
    --tpc-b3:  var(--c-accent, #06b6d4);
    --tpc-mid: color-mix(in srgb, var(--tpc-b1) 50%, var(--tpc-b2));
    --tpc-b1l: color-mix(in srgb, var(--tpc-b1) 55%, #fff);
    --tpc-b2l: color-mix(in srgb, var(--tpc-b2) 55%, #fff);
    --tpc-midl: color-mix(in srgb, var(--tpc-mid) 45%, #fff);
}
@property --tpc-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* Aurora background behind the section */
.tpc-raied-section { overflow: hidden; isolation: isolate; }
.tpc-raied-aurora { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.tpc-raied-aurora i {
    position: absolute; width: 46vw; max-width: 620px; aspect-ratio: 1; border-radius: 50%;
    filter: blur(90px); opacity: .32; animation: tpc-aurora 18s ease-in-out infinite alternate;
}
.tpc-raied-aurora i:nth-child(1) { background: var(--tpc-b1); inset-block-start: -15%; inset-inline-start: -8%; }
.tpc-raied-aurora i:nth-child(2) { background: var(--tpc-b2); inset-block-end: -20%; inset-inline-end: -6%; animation-delay: -6s; }
.tpc-raied-aurora i:nth-child(3) { background: var(--tpc-b3); inset-block-start: 30%; inset-inline-start: 38%; width: 28vw; opacity: .18; animation-delay: -11s; }
@keyframes tpc-aurora {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(6%, 8%, 0) scale(1.18); }
}

/* The AI orb */
.tpc-orb { position: relative; display: inline-grid; place-items: center; width: 92px; height: 92px; margin-bottom: 1.1rem; }
.tpc-orb__core {
    position: relative; z-index: 2; width: 58%; height: 58%; border-radius: 50%;
    background: radial-gradient(circle at 30% 28%, #fff 0, var(--tpc-b1l) 18%, var(--tpc-b1) 48%, var(--tpc-b2) 100%);
    box-shadow: 0 0 28px 4px color-mix(in srgb, var(--tpc-mid) 65%, transparent), inset 0 -6px 14px rgba(0,0,0,.35);
    animation: tpc-orb-breathe 3.6s ease-in-out infinite;
}
.tpc-orb__core::after { /* glossy highlight that drifts */
    content: ''; position: absolute; inset: 12% 22% 55% 18%; border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255,255,255,.85), transparent 70%);
    animation: tpc-orb-shine 5s ease-in-out infinite alternate;
}
.tpc-orb__ring {
    position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--tpc-b1l) 45%, transparent);
    animation: tpc-orb-ring 3.6s ease-out infinite;
}
.tpc-orb__ring.r2 { animation-delay: 1.8s; border-color: color-mix(in srgb, var(--tpc-b2l) 45%, transparent); }
@keyframes tpc-orb-breathe { 50% { transform: scale(1.09); box-shadow: 0 0 40px 8px color-mix(in srgb, var(--tpc-mid) 80%, transparent), inset 0 -6px 14px rgba(0,0,0,.35); } }
@keyframes tpc-orb-shine { to { transform: translate(14%, 18%); opacity: .6; } }
@keyframes tpc-orb-ring { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.25); opacity: 0; } }

.tpc-orb--sm { width: 40px; height: 40px; margin: 0; flex-shrink: 0; }
.tpc-orb--sm .tpc-orb__core { width: 78%; height: 78%; box-shadow: 0 0 14px 2px color-mix(in srgb, var(--tpc-mid) 60%, transparent), inset 0 -3px 7px rgba(0,0,0,.35); }
.tpc-chat-panel.is-busy .tpc-orb__core { animation-duration: .9s; }

/* Headline gets the same gradient as the glow */
.tpc-raied-copy h2 {
    color: var(--c-text);
}

/* Glowing animated border around the chat */
.tpc-raied-chat { position: relative; padding: 2px; border-radius: 22px; }
.tpc-raied-chat::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: 0;
    background: conic-gradient(from var(--tpc-a), var(--tpc-b1), var(--tpc-b2), var(--tpc-b3), var(--tpc-b1));
    animation: tpc-spin 7s linear infinite;
}
.tpc-raied-chat::after { /* soft outer glow */
    content: ''; position: absolute; inset: -14px; border-radius: 34px; z-index: -1;
    background: conic-gradient(from var(--tpc-a), color-mix(in srgb, var(--tpc-b1) 35%, transparent), color-mix(in srgb, var(--tpc-b2) 35%, transparent), color-mix(in srgb, var(--tpc-b3) 30%, transparent), color-mix(in srgb, var(--tpc-b1) 35%, transparent));
    filter: blur(28px); animation: tpc-spin 7s linear infinite;
}
.tpc-raied-section .tpc-raied-aurora,
.tpc-raied-section .tpc-raied-copy > .tpc-orb,
.tpc-raied-chat::before,
.tpc-raied-chat::after { display: none; }
@keyframes tpc-spin { to { --tpc-a: 360deg; } }

.tpc-chat-panel.is-embedded {
    z-index: 1; border: 1px solid var(--c-border-hover); border-radius: 16px;
    background: var(--c-surface);
    box-shadow: var(--shadow-card);
}
.tpc-chat-panel.is-embedded .tpc-chat-head {
    background: linear-gradient(90deg, color-mix(in srgb, var(--tpc-b1) 16%, transparent), color-mix(in srgb, var(--tpc-b2) 12%, transparent), transparent);
    border-bottom-color: rgba(255,255,255,.08); padding: 1rem 1.25rem;
}
.tpc-chat-panel.is-embedded .tpc-chat-head strong { font-size: 1rem; }
.tpc-chat-panel.is-embedded .tpc-chat-active-badge {
    background: linear-gradient(90deg, color-mix(in srgb, var(--tpc-b1) 20%, transparent), color-mix(in srgb, var(--tpc-b2) 20%, transparent));
    border: 1px solid color-mix(in srgb, var(--tpc-b2) 30%, transparent); border-radius: 999px; padding: 1px 8px; font-size: .68rem; color: var(--tpc-b2l);
}

/* Messages glide in; bot replies get a subtle luminous edge */
.tpc-chat-panel.is-embedded .tpc-chat-msg { animation: tpc-msg-in .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes tpc-msg-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.tpc-chat-panel.is-embedded .tpc-chat-msg.is-bot p {
    background: linear-gradient(145deg, rgba(30,41,59,.85), rgba(17,24,39,.85));
    border: 1px solid color-mix(in srgb, var(--tpc-mid) 28%, transparent);
    box-shadow: 0 6px 20px -10px color-mix(in srgb, var(--tpc-mid) 55%, transparent);
}
.tpc-chat-panel.is-embedded .tpc-chat-msg.is-user p {
    background: linear-gradient(135deg, var(--tpc-b1), var(--tpc-b2));
    box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--tpc-mid) 70%, transparent);
}

/* "Thinking" dots become a glowing wave */
.tpc-chat-panel.is-embedded .tpc-chat-msg.is-typing span {
    background: linear-gradient(135deg, var(--tpc-b1l), var(--tpc-b2l)); box-shadow: 0 0 8px color-mix(in srgb, var(--tpc-b2) 80%, transparent);
}

/* Suggestion chips */
.tpc-chat-panel.is-embedded .tpc-chat-pill {
    background: color-mix(in srgb, var(--tpc-mid) 10%, transparent); border-color: color-mix(in srgb, var(--tpc-midl) 35%, transparent); color: var(--tpc-midl);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.tpc-chat-panel.is-embedded .tpc-chat-pill:hover {
    background: linear-gradient(135deg, var(--tpc-b1), var(--tpc-b2)); color: #fff;
    transform: translateY(-2px); box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--tpc-mid) 80%, transparent);
}

/* Composer */
.tpc-chat-panel.is-embedded .tpc-chat-form { background: rgba(255,255,255,.02); }
.tpc-chat-panel.is-embedded .tpc-chat-form input { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }
.tpc-chat-panel.is-embedded .tpc-chat-form input:focus {
    border-color: var(--tpc-mid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tpc-mid) 22%, transparent), 0 0 22px -4px color-mix(in srgb, var(--tpc-mid) 60%, transparent);
}
.tpc-chat-panel.is-embedded #tpc-chat-send {
    background: linear-gradient(135deg, var(--tpc-b1), var(--tpc-b2)); box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--tpc-mid) 80%, transparent);
}
.tpc-chat-panel.is-embedded.is-busy #tpc-chat-send { animation: tpc-send-pulse 1s ease-in-out infinite; }
@keyframes tpc-send-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--tpc-mid) 0%, transparent), 0 6px 18px -4px color-mix(in srgb, var(--tpc-mid) 90%, transparent); transform: scale(.94); } }

@media (prefers-reduced-motion: reduce) {
    .tpc-raied-aurora i, .tpc-orb__core, .tpc-orb__core::after, .tpc-orb__ring,
    .tpc-raied-chat::before, .tpc-raied-chat::after,
    .tpc-chat-panel.is-embedded .tpc-chat-msg, .tpc-chat-panel.is-embedded.is-busy #tpc-chat-send { animation: none !important; }
}

/* ═══════════════════════════════════════════════════════
   Mobile polish for the homepage assistant
═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .tpc-raied-copy { text-align: center; }
    .tpc-raied-copy .tpc-orb { margin-inline: auto; }
    .tpc-raied-points { justify-items: center; text-align: start; }
    /* Dynamic viewport units keep the composer visible above the on-screen keyboard. */
    .tpc-chat-panel.is-embedded { height: min(560px, 78vh); height: min(560px, 78dvh); min-height: 420px; }
}
@media (max-width: 600px) {
    .tpc-raied-grid { gap: 1.5rem; }
    .tpc-raied-chat { border-radius: 18px; }
    .tpc-chat-panel.is-embedded { border-radius: 16px; }
    .tpc-orb { width: 72px; height: 72px; margin-bottom: .75rem; }
    .tpc-raied-copy h2 { font-size: 1.55rem; }
    .tpc-raied-copy p { font-size: .92rem; }
    .tpc-raied-points li { font-size: .88rem; }
    /* Blur is the costly part on phones — shrink and soften it. */
    .tpc-raied-aurora i { filter: blur(60px); opacity: .22; }
    .tpc-raied-chat::after { inset: -8px; filter: blur(18px); }
    .tpc-chat-panel.is-embedded .tpc-chat-head { padding: .8rem .95rem; }
    .tpc-chat-panel.is-embedded .tpc-chat-log { padding: .9rem; }
    .tpc-chat-panel.is-embedded .tpc-chat-msg p { max-width: 92%; }
    .tpc-chat-panel.is-embedded .tpc-chat-pills { padding-inline: .9rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .tpc-chat-panel.is-embedded .tpc-chat-pills::-webkit-scrollbar { display: none; }
    .tpc-chat-panel.is-embedded .tpc-chat-pill { flex-shrink: 0; }
    .tpc-chat-panel.is-embedded .tpc-chat-form { padding: .7rem .8rem .9rem; gap: .4rem; }
    /* 16px stops iOS Safari zooming the page when the field is focused. */
    .tpc-chat-panel.is-embedded .tpc-chat-form input { font-size: 16px; padding-inline: .85rem; }
}
/* Floating button steps aside while the inline chat is on screen. */
.tpc-chat-launcher.is-hidden { opacity: 0; pointer-events: none; transform: scale(.6); }

/* Orb sits on its own line above the badge; dark, slim scrollbar inside the chat. */
.tpc-raied-copy > .tpc-orb { display: grid; }
.tpc-chat-panel.is-embedded .tpc-chat-log { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.tpc-chat-panel.is-embedded .tpc-chat-log::-webkit-scrollbar { width: 6px; }
.tpc-chat-panel.is-embedded .tpc-chat-log::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 6px; }
.tpc-chat-panel.is-embedded .tpc-chat-log::-webkit-scrollbar-track { background: transparent; }

/* ═══════════════════════════════════════════════════════
   Rich replies, follow-up chips, message actions
═══════════════════════════════════════════════════════ */
/* Formatted bot text: real paragraphs and lists instead of raw asterisks. */
.tpc-chat-msg p .tpc-md { display: block; white-space: normal; }
.tpc-chat-msg p .tpc-md.is-streaming { white-space: pre-wrap; }
.tpc-chat-msg p .tpc-md.is-streaming::after {
    content: ''; display: inline-block; width: .5em; height: 1em; margin-inline-start: 2px;
    vertical-align: -2px; border-radius: 2px; background: currentColor; opacity: .7;
    animation: tpc-caret .8s steps(2) infinite;
}
@keyframes tpc-caret { 50% { opacity: 0; } }
.tpc-md .tpc-md-p + .tpc-md-p { margin-top: .45rem; }
.tpc-md .tpc-md-gap { height: .45rem; }
.tpc-md .tpc-md-h { font-weight: 800; margin-top: .3rem; }
.tpc-md ul, .tpc-md ol { margin: .35rem 0; padding-inline-start: 1.15rem; display: grid; gap: .25rem; }
.tpc-md li::marker { color: var(--c-primary, #3b82f6); }
.tpc-md strong { font-weight: 800; color: #fff; }
.tpc-md a {
    color: var(--c-primary-2, #93c5fd); text-decoration: underline; text-underline-offset: 3px;
    overflow-wrap: anywhere;
}
.tpc-md a:hover { color: #fff; }
.tpc-md code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82em;
    padding: .1em .35em; border-radius: 5px; background: rgba(255,255,255,.08);
}

/* Footer actions on bot replies */
.tpc-chat-bubble-footer { display: flex; align-items: center; gap: .35rem; margin-top: .55rem; flex-wrap: wrap; }
.tpc-msg-copy, .tpc-msg-speak {
    width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.04); color: var(--c-text-muted, #94a3b8);
    display: inline-grid; place-items: center; cursor: pointer; font-size: .75rem;
    transition: color .15s, background .15s, border-color .15s;
}
.tpc-msg-copy:hover, .tpc-msg-speak:hover { color: #fff; background: rgba(255,255,255,.1); }
.tpc-msg-copy.is-done { color: #22c55e; border-color: rgba(34,197,94,.4); }
.tpc-chat-provider-tag { font-size: .68rem; color: var(--c-text-muted, #94a3b8); opacity: .8; }

/* Follow-up suggestions under the latest reply */
.tpc-chat-suggest { display: flex; flex-wrap: wrap; gap: .4rem; padding-inline-start: .25rem; animation: tpc-msg-in .35s ease both; }
.tpc-chat-suggest .tpc-chat-pill { font-size: .76rem; }

/* New-conversation button in the header */
.tpc-chat-reset {
    margin-inline-start: auto; width: 32px; height: 32px; border-radius: 9px;
    border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04);
    color: var(--c-text-muted, #94a3b8); cursor: pointer; display: grid; place-items: center;
    transition: color .15s, background .15s, transform .3s;
}
.tpc-chat-reset:hover { color: #fff; background: rgba(255,255,255,.1); transform: rotate(-90deg); }
.tpc-chat-reset + .tpc-chat-close { margin-inline-start: .25rem; }

@media (prefers-reduced-motion: reduce) {
    .tpc-chat-msg p .tpc-md.is-streaming::after, .tpc-chat-suggest { animation: none; }
}
