:root {
    --cta-accent: #6366f1;
    --cta-accent-2: #22c55e;
    --cta-surface: rgba(15, 23, 42, 0.9);
    --cta-border: rgba(148, 163, 184, 0.35);
    --cta-text: #f8fafc;
    --cta-muted: #cbd5e1;
}

.cta-shell {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1500;
    display: flex;
    justify-content: center;
    padding: 0 12px 12px;
    pointer-events: none;
}

.cta-shell.custom-pos {
    left: auto;
    right: auto;
    bottom: auto;
    top: var(--cta-top, 0px);
    left: var(--cta-left, 0px);
    padding: 0;
}

.cta-shell.incoming {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    background: radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.14), transparent 35%), radial-gradient(circle at 80% 80%, rgba(34, 197, 94, 0.14), transparent 38%), rgba(2, 6, 23, 0.94);
    pointer-events: auto;
}

.cta-surface {
    position: relative;
    width: min(1040px, 92vw);
    pointer-events: auto;
    filter: drop-shadow(0 -10px 36px rgba(15, 23, 42, 0.45));
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.cta-shell.custom-pos .cta-surface {
    width: min(1040px, 92vw);
}

.cta-shell.incoming .cta-surface {
    width: 100%;
    height: 100vh;
    max-width: none;
    filter: none;
    display: grid;
    place-items: center;
}

.cta-shell[data-state="toast"] {
    width: 100%;
    justify-content: flex-end;
    padding-right: 20px;
}

.cta-shell.toast-top {
    top: 0;
    bottom: auto;
    padding: 12px 12px 0;
}

.cta-shell.toast-bottom {
    bottom: 0;
    top: auto;
    padding: 0 12px 12px;
}

.cta-shell[data-state="toast"] .cta-surface {
    width: 420px;
    transform: translateY(0);
}

.cta-shell[data-state="toast"] .cta-surface-inner {
    position: relative;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(150deg, rgba(99, 102, 241, 0.25), rgba(34, 197, 94, 0.22)), rgba(8, 12, 24, 0.95);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.cta-shell[data-state="toast"] .cta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px 16px 12px;
}

.cta-shell[data-state="toast"] .cta-avatar {
    width: 52px;
    height: 52px;
    position: relative;
}

.cta-shell[data-state="toast"] .cta-bar-text {
    gap: 2px;
}

.cta-shell[data-state="toast"] .cta-bar-title {
    font-size: 15px;
}

.cta-shell[data-state="toast"] .cta-bar-sub {
    font-size: 12px;
}

.cta-shell[data-state="toast"] .cta-bar-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.cta-shell[data-state="toast"] .cta-btn.primary {
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.55);
}

.cta-shell[data-state="toast"] .cta-panel {
    display: none;
}

.cta-shell[data-state="toast"] .cta-close {
    display: none;
}

.cta-shell[data-state="toast"] .cta-minimize,
.cta-shell[data-state="bar"] .cta-minimize {
    display: none;
}

.cta-toast-controls {
    position: absolute;
    top: 8px;
    right: 10px;
    display: none;
    gap: 6px;
    align-items: center;
    z-index: 4;
}

.cta-shell[data-state="toast"] .cta-toast-controls {
    display: flex;
}

.cta-toast-move {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
    font-size: 14px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.cta-toast-expand {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
    font-size: 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.cta-shell[data-state="toast"] .cta-toast-expand {
    display: inline-flex;
}

.cta-shell.incoming {
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.cta-shell.incoming .cta-surface {
    width: 100% !important;
    max-width: none;
}

.cta-shell.incoming .cta-surface-inner,
.cta-shell.incoming .cta-idle-progress {
    display: none;
}

.cta-surface-inner {
    position: relative;
    background: linear-gradient(140deg, rgba(15, 23, 42, 0.95), rgba(3, 7, 18, 0.92));
    border: 1px solid var(--cta-border);
    border-radius: 14px 14px 10px 10px;
    overflow: hidden;
    color: var(--cta-text);
}

.cta-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    min-height: 56px;
    background: rgba(3, 7, 18, 0.9);
    backdrop-filter: blur(10px);
    touch-action: none;
}

.cta-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(34, 197, 94, 0.28), 0 0 18px rgba(34, 197, 94, 0.22);
    flex-shrink: 0;
    position: relative;
    animation: avatar-glow 2.2s ease-in-out infinite;
}

.cta-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cta-status-dot {
    position: absolute;
    width: 13px;
    height: 13px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #bbf7d0, #22c55e);
    border: 2px solid rgba(3, 7, 18, 0.92);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.24), 0 0 18px rgba(34, 197, 94, 0.35);
    right: -4px;
    top: -4px;
    animation: status-pulse 1.8s ease-in-out infinite;
}

.cta-shell:not(.incoming) .cta-status-dot {
    display: none;
}

.cta-status-dot.incoming {
    border-color: rgba(15, 23, 42, 0.9);
}

.incoming-wave {
    position: relative;
}

@keyframes status-pulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.8; }
}

@keyframes avatar-glow {
    0% { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(34, 197, 94, 0.32), 0 0 18px rgba(34, 197, 94, 0.26); }
    50% { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35), 0 0 0 10px rgba(34, 197, 94, 0.18), 0 0 24px rgba(34, 197, 94, 0.32); }
    100% { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(34, 197, 94, 0.32), 0 0 18px rgba(34, 197, 94, 0.26); }
}

.cta-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.16);
    color: #bbf7d0;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid rgba(22, 163, 74, 0.45);
    box-shadow: 0 0 12px rgba(22, 163, 74, 0.25);
}

.avatar-pill {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translate(10px, -50%);
    white-space: nowrap;
    padding: 2px 10px;
}

.inline-pill {
    vertical-align: middle;
}

.cta-sparkles {
    position: absolute;
    inset: -8px;
    pointer-events: none;
    opacity: 0;
    filter: drop-shadow(0 6px 16px rgba(99, 102, 241, 0.32));
}

.cta-sparkles span {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #c7d2fe, #6366f1);
    opacity: 0;
}

.cta-sparkles .sp1 { top: 12%; left: 22%; }
.cta-sparkles .sp2 { top: 26%; left: 68%; width: 10px; height: 10px; }
.cta-sparkles .sp3 { top: 62%; left: 18%; width: 7px; height: 7px; }
.cta-sparkles .sp4 { top: 58%; left: 72%; width: 9px; height: 9px; }
.cta-sparkles .sp5 { top: 38%; left: 50%; width: 8px; height: 8px; }
.cta-sparkles .sp6 { top: 78%; left: 42%; width: 7px; height: 7px; }

.cta-shell.cta-animate .cta-bar {
    animation: cta-float 1.6s ease;
}

.cta-shell.cta-animate .cta-btn.primary {
    animation: cta-shimmer 1.6s ease;
}

.cta-shell.cta-animate .cta-surface-inner {
    position: relative;
    animation: cta-parallax 1.6s ease;
}

.cta-shell.cta-animate .cta-sparkles {
    animation: cta-sparkle-pop 1.6s ease;
}

.cta-shell.cta-animate .cta-sparkles span {
    animation: cta-sparkle 1.2s ease forwards;
}

.cta-shell.cta-animate .cta-sparkles .sp1 { animation-delay: 0.05s; }
.cta-shell.cta-animate .cta-sparkles .sp2 { animation-delay: 0.12s; }
.cta-shell.cta-animate .cta-sparkles .sp3 { animation-delay: 0.18s; }
.cta-shell.cta-animate .cta-sparkles .sp4 { animation-delay: 0.08s; }
.cta-shell.cta-animate .cta-sparkles .sp5 { animation-delay: 0.22s; }
.cta-shell.cta-animate .cta-sparkles .sp6 { animation-delay: 0.28s; }

.cta-incoming-overlay {
    position: relative;
    display: none;
    width: min(540px, 92vw);
    margin: 0 auto;
    padding: 32px 26px;
    background: linear-gradient(145deg, rgba(8, 12, 24, 0.92), rgba(12, 19, 34, 0.88));
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    color: #f8fafc;
    text-align: center;
    overflow: hidden;
}

.cta-shell.incoming .cta-incoming-overlay {
    display: grid;
    gap: 18px;
    align-items: center;
    justify-items: center;
    position: relative;
}

.incoming-wave {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #c7d2fe, #6366f1);
    box-shadow: 0 0 0 14px rgba(99, 102, 241, 0.12), 0 0 0 28px rgba(34, 197, 94, 0.08);
    display: grid;
    place-items: center;
    position: relative;
}

.incoming-wave::after,
.incoming-wave::before {
    content: '';
    position: absolute;
    inset: -12px;
    border: 2px solid rgba(99, 102, 241, 0.4);
    border-radius: 50%;
    animation: incoming-pulse 2s ease infinite;
}

.incoming-wave::before {
    animation-delay: 0.4s;
}

.incoming-photo {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.incoming-kicker {
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 11px;
    color: #cbd5e1;
}

.incoming-title {
    font-size: 22px;
    font-weight: 700;
}

.incoming-sub {
    color: #cbd5e1;
    font-size: 14px;
    margin: 0;
}

.incoming-actions {
    display: grid;
    gap: 10px;
    width: 100%;
}

.incoming-actions .cta-btn {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
}

.incoming-actions .cta-btn.ghost {
    background: rgba(255, 255, 255, 0.06);
}

.incoming-mute {
    position: absolute;
    top: 12px;
    right: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.35);
    color: #f8fafc;
    border-radius: 999px;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    font-size: 18px;
}

.cta-idle-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 16px;
    pointer-events: auto;
    overflow: visible;
    border-radius: 0 0 10px 10px;
    background: rgba(255, 255, 255, 0.06);
}

.cta-idle-toggle {
    position: absolute;
    right: 10px;
    bottom: 6px;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.12);
    color: #e5e7eb;
    font-size: 11px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    pointer-events: auto;
    z-index: 3;
}

.cta-shell[data-state="toast"]:hover .cta-idle-toggle,
.cta-shell[data-state="bar"]:hover .cta-idle-toggle,
.cta-shell[data-state="open"]:hover .cta-idle-toggle {
    display: inline-flex;
}

.cta-idle-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #22c55e);
    transform-origin: left;
    transform: scaleX(1);
}

.cta-idle-fill.running {
    animation: cta-idle-count linear forwards;
}

@keyframes cta-float {
    0% { transform: translateY(0px); }
    35% { transform: translateY(-4px) scale(1.02); }
    70% { transform: translateY(-2px) scale(1.01); }
    100% { transform: translateY(0px) scale(1); }
}

@keyframes cta-shimmer {
    0% { box-shadow: 0 10px 30px rgba(99, 102, 241, 0.45); }
    35% { box-shadow: 0 16px 40px rgba(99, 102, 241, 0.65); }
    70% { box-shadow: 0 12px 32px rgba(99, 102, 241, 0.5); }
    100% { box-shadow: 0 10px 30px rgba(99, 102, 241, 0.45); }
}

@keyframes cta-parallax {
    0% { background-position: 0% 0%; }
    50% { background-position: 60% 40%; }
    100% { background-position: 0% 0%; }
}

@keyframes cta-sparkle-pop {
    0% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes cta-sparkle {
    0% { transform: scale(0.4) translateY(4px); opacity: 0; }
    30% { transform: scale(1) translateY(-6px); opacity: 1; }
    100% { transform: scale(0.6) translateY(-12px); opacity: 0; }
}

@keyframes incoming-pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    60% { transform: scale(1.1); opacity: 0; }
    100% { transform: scale(1.2); opacity: 0; }
}

@keyframes cta-idle-count {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0); }
}

.cta-bar-text {
    flex: 1;
    display: grid;
    gap: 2px;
}

.cta-kicker {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cta-muted);
}

.cta-bar-title {
    font-size: 14px;
    font-weight: 600;
}

.cta-bar-sub {
    font-size: 12px;
    color: var(--cta-muted);
}

.cta-bar-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    align-self: flex-start;
}

.cta-btn {
    border: none;
    cursor: pointer;
    border-radius: 999px;
    font-weight: 600;
    padding: 9px 14px;
    font-size: 13px;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
    text-decoration: none;
}

.cta-btn.primary {
    background: linear-gradient(135deg, var(--cta-accent), var(--cta-accent-2));
    color: #0b1220;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.45);
}

.cta-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 40px rgba(99, 102, 241, 0.55);
}

.cta-btn.ghost {
    border: 1px solid var(--cta-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--cta-text);
}

.cta-btn.ghost:hover {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.08);
}

.cta-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--cta-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--cta-text);
    cursor: pointer;
}

.cta-panel {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    padding: 16px 14px 12px;
    align-items: center;
    border-top: 1px solid rgba(99, 102, 241, 0.25);
    background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.08), transparent 45%), radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.08), transparent 40%), rgba(6, 11, 25, 0.96);
}

.cta-panel-copy {
    display: grid;
    gap: 6px;
}

.cta-title {
    font-size: 15px;
    font-weight: 700;
}

.cta-body {
    font-size: 13px;
    color: var(--cta-muted);
    margin: 0;
}

.cta-highlight {
    color: #c7d2fe;
}

.cta-panel-actions {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cta-shell[data-state="bar"] .cta-panel {
    display: none;
}

.cta-shell[data-state="open"] .cta-panel {
    display: grid;
}

.cta-shell[data-state="open"] .cta-bar {
    border-bottom: 1px solid var(--cta-border);
}

@media (max-width: 900px) {
    .cta-panel {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .cta-panel-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .cta-shell {
        padding: 0 8px 8px;
    }

    .cta-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .cta-bar-actions {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
        align-self: stretch;
    }

    .cta-panel {
        padding-bottom: 16px;
    }
}

@media (max-width: 720px) {
    .cta-shell {
        width: 100%;
        justify-content: flex-end;
        padding: 0 12px 10px;
    }

    .cta-surface {
        width: min(88vw, 420px);
    }

    .cta-shell[data-state="bar"],
    .cta-shell[data-state="open"] {
        pointer-events: none;
    }

    .cta-shell[data-state="bar"] .cta-panel,
    .cta-shell[data-state="open"] .cta-panel {
        display: none;
    }

    .cta-shell[data-state="bar"] .cta-bar,
    .cta-shell[data-state="open"] .cta-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .cta-shell[data-state="bar"] {
        display: flex;
    }

    .cta-shell {
        justify-content: flex-end;
    }

    .cta-toast-expand {
        display: none !important;
    }
}
