body:not(.is-loaded) #smchat-root { display: none; }

#smchat-root {
    position: relative;
    z-index: 100000;
}

.smchat-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 60px;
    height: 60px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    isolation: isolate;
    z-index: 100001;
    transition: transform 0.25s ease;
}

.smchat-launcher svg {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 4px rgba(90, 40, 200, 0.9));
}

.smchat-launcher:hover { transform: translateY(-2px) scale(1.06); }
.smchat-launcher:active { transform: scale(0.95); }

.smchat-orb-anim {
    position: absolute;
    inset: -30px;
    pointer-events: none;
    z-index: -1;
}

.smchat-orb-anim svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
    filter: none;
}

.smchat-launcher--pulse::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1.5px solid rgba(150, 130, 255, 0.6);
    animation: smchat-pulse 1.8s ease-out infinite;
}

.smchat-launcher-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #050505;
}

.smchat-launcher--active .smchat-icon-person { display: none; }
.smchat-launcher--active .smchat-icon-close { display: block; }
.smchat-icon-close { display: none; }

@keyframes smchat-pulse {
    0% { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(1.5); opacity: 0; }
}

.smchat-teaser {
    position: fixed;
    right: 20px;
    bottom: 92px;
    max-width: 260px;
    padding: 14px 16px 14px 16px;
    border-radius: 18px 18px 4px 18px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.85));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    z-index: 100000;
    cursor: pointer;
    animation: smchat-fade-up 0.35s ease both;
    font-family: "Inter", sans-serif;
}

@keyframes smchat-fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.smchat-teaser-close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.smchat-teaser-close:hover { color: #fff; }

.smchat-teaser-text {
    margin: 0 10px 10px 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13.5px;
    line-height: 1.5;
}

.smchat-teaser-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: #26E1D1;
    color: #041a17;
    font-weight: 700;
    font-size: 12.5px;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
}
.smchat-teaser-cta:hover { filter: brightness(1.08); }

.smchat-panel {
    position: fixed;
    right: 20px;
    bottom: 96px;
    width: 380px;
    max-width: calc(100vw - 24px);
    height: 600px;
    max-height: calc(100vh / var(--sm-z, 1) - 120px);
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.7) 40%, rgba(0, 0, 0, 0.92));
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65);
    z-index: 100002;
    font-family: "Inter", sans-serif;
    animation: smchat-panel-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes smchat-panel-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 480px) {
    .smchat-panel {
        right: 12px;
        left: 12px;
        bottom: 88px;
        width: auto;
        height: min(640px, calc(100vh / var(--sm-z, 1) - 108px));
    }
    .smchat-teaser { right: 12px; bottom: 76px; max-width: calc(100vw - 24px); }
    .smchat-launcher { right: 16px; bottom: 16px; width: 46px; height: 46px; }
    .smchat-input { font-size: 16px; }
    .smchat-icon-person, .smchat-icon-close { width: 20px; height: 20px; }
    .smchat-orb-anim { inset: -22px; }
    .smchat-launcher-dot { top: 3px; right: 3px; width: 9px; height: 9px; }
}

html.sm-menu-open .smchat-launcher,
html.sm-menu-open .smchat-teaser,
html.sm-menu-open .smchat-panel { display: none !important; }

.smchat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.smchat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(38, 225, 209, 0.12);
    border: 1px solid rgba(38, 225, 209, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    overflow: hidden;
}

.smchat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.smchat-header-text { flex: 1; min-width: 0; }

.smchat-header-name {
    font-family: "Manrope", sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smchat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 2px;
}

.smchat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
    flex-shrink: 0;
}

.smchat-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.smchat-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.smchat-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.smchat-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #26E1D1, #6df5e8);
    transition: width 0.4s ease;
}

.smchat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.smchat-body::-webkit-scrollbar { width: 6px; }
.smchat-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 999px; }

.smchat-msg {
    display: flex;
    max-width: 88%;
    animation: smchat-msg-in 0.25s ease both;
}
@keyframes smchat-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.smchat-msg--bot { align-self: flex-start; }
.smchat-msg--user { align-self: flex-end; }

.smchat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-line;
    word-break: break-word;
}

.smchat-msg--bot .smchat-bubble {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.92);
    border-bottom-left-radius: 4px;
}

.smchat-msg--user .smchat-bubble {
    background: #26E1D1;
    color: #04201d;
    font-weight: 500;
    border-bottom-right-radius: 4px;
}

.smchat-typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 13px 16px;
}
.smchat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    animation: smchat-bounce 1.1s infinite ease-in-out;
}
.smchat-dot:nth-child(2) { animation-delay: 0.15s; }
.smchat-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes smchat-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.smchat-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}
.smchat-summary-row {
    display: flex;
    gap: 8px;
    font-size: 12.5px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    padding-bottom: 6px;
}
.smchat-summary-label {
    color: #26E1D1;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 64px;
}
.smchat-summary-value {
    color: rgba(255, 255, 255, 0.8);
    overflow-wrap: anywhere;
}

.smchat-footer {
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.smchat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.smchat-chips[hidden] { display: none; }

.smchat-chip {
    border: 1px solid rgba(38, 225, 209, 0.35);
    background: rgba(38, 225, 209, 0.08);
    color: #26E1D1;
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 13px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.smchat-chip:hover { background: rgba(38, 225, 209, 0.18); transform: translateY(-1px); }
.smchat-chip--primary {
    display: inline-flex;
    align-items: center;
    background: #26E1D1;
    border-color: #26E1D1;
    color: #04201d;
    text-decoration: none;
}
.smchat-chip--primary:hover { background: #4ff0e2; }

.smchat-link {
    flex-basis: 100%;
    align-self: flex-start;
    background: none;
    border: none;
    padding: 2px 0 0;
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
    font-family: inherit;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.smchat-link:hover { color: rgba(255, 255, 255, 0.75); }

.smchat-input-row[hidden] { display: none; }
.smchat-footer--no-input .smchat-chips { margin-bottom: 0; }

.smchat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 5px 6px 5px 16px;
}

.smchat-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 13.5px;
    font-family: inherit;
}
.smchat-input::placeholder { color: rgba(255, 255, 255, 0.35); }
.smchat-input:disabled { opacity: 0.5; }

.smchat-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #26E1D1;
    color: #04201d;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.smchat-send:hover { transform: scale(1.06); }
.smchat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .smchat-launcher--pulse::before,
    .smchat-dot,
    .smchat-teaser,
    .smchat-panel,
    .smchat-msg { animation: none !important; }
}
