:root {
    --isa-primary: #6366f1;
    --isa-primary-dark: #4f46e5;
    --isa-accent-pink: #ec4899;
    --isa-accent-cyan: #06b6d4;
    --isa-accent-emerald: #10b981;
    --isa-accent-amber: #f59e0b;
    --isa-accent-violet: #8b5cf6;
    --isa-sidebar-bg: rgba(255, 255, 255, 0.72);
    --isa-card-shadow: 0 10px 30px rgba(79, 70, 229, 0.08);
}
[data-bs-theme="light"] {
    --bs-primary: var(--isa-primary);
    --bs-primary-rgb: 79, 70, 229;
}

[data-bs-theme="dark"] {
    --bs-primary: #818cf8;
    --bs-primary-rgb: 129, 140, 248;
    --isa-sidebar-bg: rgba(15, 23, 42, 0.88);
    --isa-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ── Admin shell & layout ── */
.admin-shell {
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(236, 72, 153, 0.08), transparent 24%),
        linear-gradient(180deg, #f8fafc 0%, #eef2ff 45%, #fdf4ff 100%);
    min-height: 100vh;
}

[data-bs-theme="dark"] .admin-shell {
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(139, 92, 246, 0.12), transparent 24%),
        linear-gradient(180deg, #0b1220 0%, #111827 50%, #0f172a 100%);
}

.admin-shell .sidebar {
    background: var(--isa-sidebar-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid rgba(99, 102, 241, 0.12) !important;
}

.sidebar-brand-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

.sidebar .nav-link {
    color: var(--bs-body-color);
    border-radius: 0.75rem;
    padding: 0.7rem 0.875rem;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    font-weight: 500;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.nav-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.nav-icon-dashboard { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.nav-icon-clients { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }
.nav-icon-websites { background: linear-gradient(135deg, #10b981, #14b8a6); }
.nav-icon-visitors { background: linear-gradient(135deg, #f97316, #f59e0b); }
.nav-icon-chat { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.nav-icon-analytics { background: linear-gradient(135deg, #8b5cf6, #a855f7); }
.nav-icon-reports { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.nav-icon-notifications { background: linear-gradient(135deg, #64748b, #475569); }

.sidebar .nav-link:hover:not(.disabled) {
    background: rgba(99, 102, 241, 0.08);
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(139, 92, 246, 0.12));
    color: var(--isa-primary-dark);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.18);
}

[data-bs-theme="dark"] .sidebar .nav-link.active {
    color: #c7d2fe;
}

/* ── Page headers ── */
.page-header {
    border-radius: 1.25rem;
    padding: 1.5rem 1.75rem;
    border: 1px solid rgba(99, 102, 241, 0.12);
    box-shadow: var(--isa-card-shadow);
}

.page-header-indigo {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.08));
}

.page-header-violet {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(236, 72, 153, 0.08));
}

.page-header .breadcrumb {
    margin-bottom: 0.75rem;
}

.page-header .breadcrumb-item a {
    text-decoration: none;
}

.visitor-avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

/* ── Cards ── */
.isa-card {
    border-radius: 1.125rem !important;
    box-shadow: var(--isa-card-shadow);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.isa-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(79, 70, 229, 0.12);
}

.isa-card-header {
    background: transparent;
    padding: 1.25rem 1.5rem 0.75rem;
}

.isa-card-accent-indigo { border-top: 4px solid #6366f1; }
.isa-card-accent-cyan { border-top: 4px solid #06b6d4; }
.isa-card-accent-emerald { border-top: 4px solid #10b981; }
.isa-card-accent-violet { border-top: 4px solid #8b5cf6; }

.stat-card {
    border: none;
    border-radius: 1.125rem;
    box-shadow: var(--isa-card-shadow);
    overflow: hidden;
    position: relative;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 42px rgba(79, 70, 229, 0.14);
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: var(--stat-accent, var(--isa-primary));
}

.stat-card-indigo { --stat-accent: #6366f1; }
.stat-card-emerald { --stat-accent: #10b981; }
.stat-card-amber { --stat-accent: #f59e0b; }
.stat-card-cyan { --stat-accent: #06b6d4; }
.stat-card-rose { --stat-accent: #f43f5e; }
.stat-card-violet { --stat-accent: #8b5cf6; }

.stat-icon-gradient {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.stat-icon-gradient-indigo { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.stat-icon-gradient-emerald { background: linear-gradient(135deg, #10b981, #14b8a6); }
.stat-icon-gradient-amber { background: linear-gradient(135deg, #f59e0b, #f97316); }
.stat-icon-gradient-cyan { background: linear-gradient(135deg, #06b6d4, #0ea5e9); }

.profile-dl dt {
    font-weight: 600;
}

.visited-url-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.visited-url-item {
    padding: 0.875rem 1rem;
    border-radius: 0.875rem;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

[data-bs-theme="dark"] .visited-url-item {
    background: rgba(99, 102, 241, 0.08);
}

/* ── Pagination ── */
.isa-pagination .page-link {
    border-radius: 0.625rem;
    margin: 0 0.125rem;
    border: none;
    color: var(--bs-body-color);
    background: rgba(99, 102, 241, 0.08);
}

.isa-pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.isa-pagination .page-link:hover {
    background: rgba(99, 102, 241, 0.16);
}

/* ── Navbar ── */
.navbar.bg-primary {
    background: linear-gradient(90deg, #4338ca 0%, #6366f1 45%, #8b5cf6 100%) !important;
    box-shadow: 0 4px 24px rgba(79, 70, 229, 0.35);
}

.auth-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    min-height: 100vh;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    border-radius: 1rem;
    background: var(--bs-body-bg);
}

.auth-card .brand-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--isa-primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.card {
    border-radius: 1rem;
}

.form-control:focus {
    border-color: var(--isa-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.btn-primary {
    background: var(--isa-primary);
    border-color: var(--isa-primary);
}

.btn-primary:hover {
    background: var(--isa-primary-dark);
    border-color: var(--isa-primary-dark);
}

@media (max-width: 767.98px) {
    .sidebar {
        min-height: auto !important;
    }
}

.rename-visitor-box {
    padding: 1rem;
    border-radius: 0.875rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.14);
}

[data-bs-theme="dark"] .rename-visitor-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.08));
}

/* ── Status badges & indicators ── */
.online-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.online-indicator.is-online {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
    animation: isa-pulse 2s ease-in-out infinite;
}

.online-indicator.is-offline {
    background: var(--bs-secondary-color);
}

@keyframes isa-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
    50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.1); }
}

.ai-score-badge {
    font-variant-numeric: tabular-nums;
    min-width: 2.5rem;
    text-align: center;
}

.ai-score-high { background: rgba(34, 197, 94, 0.15) !important; color: #16a34a !important; }
.ai-score-medium { background: rgba(234, 179, 8, 0.15) !important; color: #ca8a04 !important; }
.ai-score-low { background: rgba(107, 114, 128, 0.15) !important; color: var(--bs-secondary-color) !important; }

[data-bs-theme="dark"] .ai-score-high { color: #4ade80 !important; }
[data-bs-theme="dark"] .ai-score-medium { color: #facc15 !important; }

/* ── Embed code snippet ── */
.embed-snippet {
    font-family: var(--bs-font-monospace);
    font-size: 0.8125rem;
    background: var(--bs-secondary-bg);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    word-break: break-all;
    white-space: pre-wrap;
}

/* ── Event timeline ── */
.event-timeline {
    position: relative;
    padding-left: 0;
}

.event-timeline-rich::before {
    display: none;
}

.event-timeline-item {
    position: relative;
    padding: 1rem 1.125rem 1rem 3rem;
    margin-bottom: 0.875rem;
    border-radius: 1rem;
    border: 1px solid rgba(99, 102, 241, 0.1);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

[data-bs-theme="dark"] .event-timeline-item {
    background: rgba(15, 23, 42, 0.72);
}

.event-timeline-item:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
}

.event-timeline-item:last-child {
    margin-bottom: 0;
}

.event-timeline-dot {
    position: absolute;
    left: 1.125rem;
    top: 1.25rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid var(--bs-body-bg);
    box-shadow: 0 0 0 2px currentColor;
}

.dot-indigo { background: #6366f1; color: #6366f1; }
.dot-rose { background: #f43f5e; color: #f43f5e; }
.dot-cyan { background: #06b6d4; color: #06b6d4; }
.dot-amber { background: #f59e0b; color: #f59e0b; }
.dot-violet { background: #8b5cf6; color: #8b5cf6; }
.dot-emerald { background: #10b981; color: #10b981; }
.dot-orange { background: #f97316; color: #f97316; }
.dot-slate { background: #64748b; color: #64748b; }

.event-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.event-tone-indigo .event-type-badge { background: rgba(99, 102, 241, 0.14); color: #4f46e5; }
.event-tone-rose .event-type-badge { background: rgba(244, 63, 94, 0.14); color: #e11d48; }
.event-tone-cyan .event-type-badge { background: rgba(6, 182, 212, 0.14); color: #0891b2; }
.event-tone-amber .event-type-badge { background: rgba(245, 158, 11, 0.16); color: #d97706; }
.event-tone-violet .event-type-badge { background: rgba(139, 92, 246, 0.14); color: #7c3aed; }
.event-tone-emerald .event-type-badge { background: rgba(16, 185, 129, 0.14); color: #059669; }
.event-tone-orange .event-type-badge { background: rgba(249, 115, 22, 0.14); color: #ea580c; }
.event-tone-slate .event-type-badge { background: rgba(100, 116, 139, 0.14); color: #475569; }

[data-bs-theme="dark"] .event-tone-indigo .event-type-badge { color: #a5b4fc; }
[data-bs-theme="dark"] .event-tone-rose .event-type-badge { color: #fda4af; }
[data-bs-theme="dark"] .event-tone-cyan .event-type-badge { color: #67e8f9; }

.event-url-link {
    color: var(--isa-primary);
    text-decoration: none;
    word-break: break-all;
}

.event-url-link:hover {
    text-decoration: underline;
}

.event-payload {
    font-family: var(--bs-font-monospace);
    background: rgba(15, 23, 42, 0.04);
    border-radius: 0.625rem;
    padding: 0.5rem 0.75rem;
    word-break: break-all;
}

[data-bs-theme="dark"] .event-payload {
    background: rgba(255, 255, 255, 0.05);
}

.event-time {
    color: var(--bs-secondary-color);
    font-weight: 500;
}

.timeline-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #6366f1;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.1));
}

/* ── Chat messenger (agent) ── */
.isa-chat-layout {
    overflow: hidden;
}

.isa-chat-layout .isa-chat-shell-outer {
    height: calc(100vh - 56px);
    overflow: hidden;
    padding: 0;
}

.isa-chat-layout .isa-chat-shell-outer > .row {
    height: 100%;
    margin: 0;
}

.isa-chat-layout .sidebar {
    min-height: 0 !important;
    height: 100%;
    overflow-y: auto;
}

.isa-chat-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.isa-chat-main .alert {
    margin: 0.75rem 1rem 0;
    flex-shrink: 0;
}

.chat-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-shell {
    flex: 1;
    min-height: 0;
    height: 100%;
    width: 100%;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    background: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
}

.chat-panel-thread {
    border-right: none;
}

.chat-panel-info {
    border-right: none;
    border-left: 1px solid var(--bs-border-color);
}

.chat-panel-header {
    flex-shrink: 0;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.chat-conversation-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.chat-conversation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.chat-conversation-item:hover,
.chat-conversation-item.active {
    background: var(--bs-secondary-bg);
}

.chat-conversation-item.active {
    border-left: 3px solid var(--bs-primary);
    padding-left: calc(1rem - 3px);
}

.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    background: var(--bs-tertiary-bg);
}

.chat-thread {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.06), transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05), transparent 40%),
        var(--bs-tertiary-bg);
    -webkit-overflow-scrolling: touch;
}

.chat-message-row {
    display: flex;
    width: 100%;
}

.chat-message-row-agent {
    justify-content: flex-end;
}

.chat-message-row-visitor {
    justify-content: flex-start;
}

.chat-message-row-system {
    justify-content: center;
}

.chat-bubble-agent,
.chat-bubble-visitor {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: min(78%, 440px);
    font-size: 0.9375rem;
    line-height: 1.5;
    word-break: break-word;
    animation: chatBubbleIn 0.2s ease-out;
}

@keyframes chatBubbleIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble-body {
    padding: 0.65rem 0.95rem;
    border-radius: 1.125rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.chat-bubble-agent {
    flex-direction: row-reverse;
}

.chat-bubble-agent .chat-bubble-body {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-bottom-right-radius: 0.35rem;
}

.chat-bubble-visitor .chat-bubble-body {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-bottom-left-radius: 0.35rem;
}

.chat-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.chat-link:hover {
    opacity: 0.85;
}

.chat-bubble-agent .chat-link {
    color: #fff;
}

.chat-bubble-visitor .chat-link {
    color: var(--bs-primary);
}

.chat-bubble-system .chat-link {
    color: var(--bs-primary);
}

.chat-bubble-avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.chat-bubble-avatar-agent {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.chat-bubble-avatar-visitor {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

.chat-bubble-system {
    align-self: center;
    background: rgba(var(--bs-secondary-rgb), 0.08);
    color: var(--bs-secondary-color);
    font-size: 0.8125rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    text-align: center;
}

.chat-bubble-time {
    font-size: 0.68rem;
    opacity: 0.72;
    margin-top: 0.3rem;
}

.chat-compose {
    flex-shrink: 0;
    padding: 0.875rem 1rem 1rem;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.chat-compose-form {
    position: relative;
}

.chat-compose-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem 0.35rem 0.65rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 999px;
    background: var(--bs-tertiary-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-compose-inner:focus-within {
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.chat-message-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0.4rem 0.25rem;
}

.chat-message-input:focus {
    outline: none;
}

.chat-emoji-btn {
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.chat-emoji-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    border: none !important;
}

.chat-send-btn:hover {
    filter: brightness(1.05);
}

.chat-emoji-picker {
    display: none;
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    z-index: 20;
    width: min(280px, 100%);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    grid-template-columns: repeat(8, 1fr);
    gap: 0.15rem;
}

.chat-emoji-picker.is-open {
    display: grid;
}

.chat-emoji-item {
    border: none;
    background: transparent;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.35rem;
    border-radius: 8px;
    cursor: pointer;
}

.chat-emoji-item:hover {
    background: var(--bs-secondary-bg);
}

.chat-compose-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.45rem;
    padding: 0 0.5rem;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}

.chat-compose-hint kbd {
    font-size: 0.68rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
}

.chat-live-dot {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #22c55e;
    font-weight: 500;
}

.chat-live-dot .bi-circle-fill {
    font-size: 0.45rem;
    animation: chatLivePulse 1.5s ease-in-out infinite;
}

@keyframes chatLivePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.chat-conversation-item.has-unread {
    background: rgba(99, 102, 241, 0.06);
}

.chat-conversation-item.has-unread:not(.active) {
    border-left: 3px solid #6366f1;
    padding-left: calc(1rem - 3px);
}

.chat-load-older-wrap {
    flex-shrink: 0;
}

.isa-pagination {
    flex-shrink: 0;
}

/* Typing indicator (WhatsApp-style) */
.chat-typing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 0.45rem;
    padding: 0.25rem 0;
    animation: chatBubbleIn 0.2s ease-out;
}

.chat-typing-avatar {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.chat-typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 1.125rem;
    border-bottom-left-radius: 0.35rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.chat-typing-label {
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}

.chat-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 14px;
}

.chat-typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: chatTypingDot 1.2s ease-in-out infinite;
}

.chat-typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chatTypingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

[data-bs-theme="dark"] .chat-thread,
[data-bs-theme="dark"] .chat-empty-state {
    background:
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.08), transparent 45%),
        rgba(0, 0, 0, 0.25);
}

.chat-visitor-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
}

.chat-visitor-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(var(--bs-primary-rgb), 0.12);
    color: var(--bs-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.min-w-0 {
    min-width: 0;
}

/* Mobile: show list OR thread */
@media (max-width: 767.98px) {
    .chat-page.has-active .chat-panel-list {
        display: none !important;
    }

    .chat-page:not(.has-active) .chat-panel-thread {
        display: none !important;
    }

    .chat-panel-thread,
    .chat-panel-list {
        max-width: 100%;
        flex: 0 0 100%;
    }
}

/* Tablet: list + thread, hide info column */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .chat-panel-list {
        max-width: 38%;
        flex: 0 0 38%;
    }

    .chat-panel-thread {
        max-width: 62%;
        flex: 0 0 62%;
    }
}

@media (min-width: 1200px) {
    .chat-panel-list {
        max-width: 25%;
        flex: 0 0 25%;
    }

    .chat-panel-thread {
        max-width: 50%;
        flex: 0 0 50%;
    }

    .chat-panel-info {
        max-width: 25%;
        flex: 0 0 25%;
    }
}

/* ── Visitor widget (embed) ── */
.isa-widget-body {
    margin: 0;
    padding: 0;
    background: transparent;
    min-height: 100vh;
}

.isa-widget-launcher {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--isa-primary), #7c3aed);
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.45);
    cursor: pointer;
    z-index: 9998;
    transition: transform 0.2s ease;
}

.isa-widget-launcher:hover {
    transform: scale(1.05);
}

.isa-widget-window {
    position: fixed;
    bottom: 5.5rem;
    right: 1.25rem;
    width: min(380px, calc(100vw - 2rem));
    height: min(520px, calc(100vh - 7rem));
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    background: var(--bs-body-bg);
}

.isa-widget-header {
    background: linear-gradient(90deg, var(--isa-primary-dark), var(--isa-primary));
    color: #fff;
    padding: 1rem 1.125rem;
    flex-shrink: 0;
}

.isa-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    background: var(--bs-tertiary-bg);
}

.isa-widget-input {
    flex-shrink: 0;
    padding: 0.75rem;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

/* ── Session replay player ── */
.replay-player {
    background: #0f172a;
    border-radius: 0.75rem;
    overflow: hidden;
    min-height: 480px;
}

.replay-viewport {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.replay-controls {
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.875rem 1.25rem;
}

.replay-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    cursor: pointer;
}

.replay-progress-bar {
    height: 100%;
    background: var(--isa-primary);
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* ── Analytics charts ── */
.chart-card canvas {
    width: 100% !important;
    max-height: 280px;
}

/* ── Notification list ── */
.notification-item.unread {
    background: rgba(var(--bs-primary-rgb), 0.06);
    border-left: 3px solid var(--bs-primary);
}

.notification-item .notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.visitors-list-panel {
    position: relative;
    transition: opacity 0.15s ease;
}

.visitors-list-panel.is-loading,
.visitor-detail-panel.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.visitor-detail-panel .isa-pagination {
    margin-top: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bs-border-color-translucent);
}

.visited-url-list + .isa-pagination {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 1rem;
}

.visitor-row-starred {
    background: rgba(255, 193, 7, 0.08);
}

.visitor-row-starred:hover {
    background: rgba(255, 193, 7, 0.14);
}

.js-visitor-star-toggle {
    flex-shrink: 0;
    line-height: 1;
}

.js-visitor-star-toggle .bi-star-fill {
    color: #f59e0b;
}

.visitor-row-chat-waiting {
    background: rgba(220, 53, 69, 0.08);
    box-shadow: inset 3px 0 0 #dc3545;
}

.visitor-row-chat-waiting:hover {
    background: rgba(220, 53, 69, 0.12);
}

.visitor-chat-unread-badge {
    animation: visitor-chat-badge-pulse 1.6s ease-in-out infinite;
}

.visitor-chat-alert-pulse {
    animation: visitor-chat-badge-pulse 1.6s ease-in-out infinite;
}

.visitor-chat-alert-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
    min-width: 280px;
    max-width: 360px;
}

@keyframes visitor-chat-badge-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.04);
        opacity: 0.92;
    }
}

