.scu-widget,
.scu-widget * {
    box-sizing: border-box;
}

.scu-widget {
    --scu-button-color: #25d366;
    --scu-header-color: #00695c;
    --scu-phone-color: #22b24c;
    position: fixed;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 99999;
    max-width: calc(100vw - 24px);
    font-family: inherit;
    direction: rtl;
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
}

.scu-widget.scu-right { right: 18px; }
.scu-widget.scu-left { left: 18px; }

.smart-modal-grid-opened .scu-widget {
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.scu-panel {
    width: 372px;
    max-width: calc(100vw - 28px);
    margin-bottom: 14px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 24px;
    box-shadow: 0 22px 65px rgba(15, 23, 42, .22), 0 4px 14px rgba(15, 23, 42, .08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(16px) scale(.975);
    transform-origin: bottom right;
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}

.scu-left .scu-panel { transform-origin: bottom left; }

.scu-panel.scu-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.scu-head {
    position: relative;
    padding: 18px 18px 16px;
    overflow: hidden;
    color: #fff;
    background: var(--scu-header-color);
    isolation: isolate;
}

.scu-head::before,
.scu-head::after {
    content: '';
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
}

.scu-head::before {
    width: 160px;
    height: 160px;
    top: -96px;
    left: -45px;
    background: rgba(255, 255, 255, .10);
}

.scu-head::after {
    width: 92px;
    height: 92px;
    right: -38px;
    bottom: -48px;
    background: rgba(0, 0, 0, .08);
}

.scu-head-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 42px;
}

.scu-head-mark {
    display: inline-flex;
    flex: 0 0 48px;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 15px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
}

.scu-head-mark svg {
    width: 25px;
    height: 25px;
}

.scu-head-copy {
    flex: 1;
    min-width: 0;
}

.scu-close {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    color: #fff;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    cursor: pointer;
    appearance: none;
    transition: background .16s ease, transform .16s ease;
}

.scu-close:hover,
.scu-close:focus-visible {
    background: rgba(255, 255, 255, .22);
    outline: none;
    transform: scale(1.03);
}

.scu-title,
.scu-subtitle {
    padding: 0;
    border: 0;
}

.scu-title {
    margin: 0 0 2px;
    color: #fff;
    font-size: 17px;
    font-weight: 850;
    line-height: 1.7;
}

.scu-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, .86);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.75;
}

.scu-online {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    padding: 5px 9px;
    color: rgba(255, 255, 255, .92);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
}

.scu-online > span {
    width: 7px;
    height: 7px;
    background: #86efac;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(134, 239, 172, .16);
}

.scu-body {
    padding: 15px;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 30%);
}

.scu-greeting {
    position: relative;
    margin-bottom: 12px;
    padding: 11px 13px 11px 34px;
    color: #334155;
    font-size: 12.5px;
    font-weight: 550;
    line-height: 1.85;
    background: #f8fafc;
    border: 1px solid #e8edf3;
    border-radius: 14px;
}

.scu-greeting::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 13px;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .10);
    transform: translateY(-50%);
}

.scu-contact-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.scu-contact-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 66px;
    padding: 10px 11px;
    overflow: hidden;
    color: #0f172a !important;
    text-decoration: none !important;
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 15px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .045);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.scu-contact-btn::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 0;
    bottom: 10px;
    width: 3px;
    background: var(--scu-contact-color, #25d366);
    border-radius: 3px 0 0 3px;
}

.scu-contact-btn:hover,
.scu-contact-btn:focus-visible {
    color: #0f172a !important;
    border-color: var(--scu-contact-color, #25d366);
    outline: none;
    box-shadow: 0 10px 25px rgba(15, 23, 42, .09);
    transform: translateY(-1px);
}

.scu-avatar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    overflow: hidden;
    color: var(--scu-contact-color, #25d366);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    font-size: 22px;
}

.scu-avatar > img:not(.scu-icon-img) {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scu-contact-content {
    flex: 1;
    min-width: 0;
    padding-right: 1px;
}

.scu-contact-name,
.scu-contact-meta {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.scu-contact-name {
    margin-bottom: 2px;
    color: #111827;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.55;
}

.scu-contact-meta {
    color: #64748b;
    font-size: 10.8px;
    font-weight: 550;
    line-height: 1.6;
}

.scu-contact-icon {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #94a3b8;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 9px;
    transition: color .16s ease, background .16s ease, transform .16s ease;
}

.scu-contact-icon svg {
    width: 16px;
    height: 16px;
}

.scu-contact-btn:hover .scu-contact-icon {
    color: var(--scu-contact-color, #25d366);
    background: #f8fafc;
    transform: translateX(-2px);
}

.scu-footer-note {
    margin: 12px 2px 0;
    padding-top: 10px;
    color: #94a3b8;
    font-size: 10.5px;
    font-weight: 550;
    line-height: 1.8;
    text-align: center;
    border-top: 1px dashed #e7ebf0;
}

.scu-trigger-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    direction: ltr;
    pointer-events: none;
}

.scu-left .scu-trigger-wrap {
    direction: rtl;
    justify-content: flex-start;
}

.scu-trigger-label {
    padding: 7px 12px;
    color: #1f2937;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.5;
    white-space: nowrap;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 999px;
    box-shadow: 0 7px 20px rgba(15, 23, 42, .14);
    pointer-events: auto;
}

.scu-phone-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 12px 6px 7px;
    overflow: hidden;
    color: #fff !important;
    text-decoration: none !important;
    white-space: nowrap;
    direction: ltr;
    background: var(--scu-phone-color);
    background-image: linear-gradient(135deg, rgba(255,255,255,.10), rgba(0,0,0,.08));
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    box-shadow: 0 9px 24px rgba(15, 23, 42, .20), inset 0 1px 0 rgba(255,255,255,.12);
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1);
    transform-origin: right center;
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease, box-shadow .18s ease, filter .18s ease;
}

.scu-left .scu-phone-pill { transform-origin: left center; }

.scu-phone-pill:hover,
.scu-phone-pill:focus-visible {
    color: #fff !important;
    outline: none;
    filter: brightness(1.03);
    box-shadow: 0 11px 27px rgba(15, 23, 42, .24), inset 0 1px 0 rgba(255,255,255,.14);
    transform: translateY(-1px);
}

.scu-phone-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: #fff;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
}

.scu-phone-icon svg { width: 16px; height: 16px; }

.scu-phone-number {
    display: inline-block;
    min-width: 0;
    font-size: 15px;
    font-weight: 850;
    line-height: 1;
    letter-spacing: .1px;
    unicode-bidi: isolate;
}

.scu-is-open .scu-phone-pill {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(9px) scale(.94);
}

.scu-left.scu-is-open .scu-phone-pill { transform: translateX(-9px) scale(.94); }

.scu-trigger {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    color: #fff;
    font: inherit;
    background: var(--scu-button-color);
    background-image: linear-gradient(145deg, rgba(255,255,255,.12), rgba(0,0,0,.08));
    border: 0;
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .25), inset 0 0 0 1px rgba(255,255,255,.18);
    cursor: pointer;
    appearance: none;
    isolation: isolate;
    pointer-events: auto;
    animation: scuFloat 3s ease-in-out infinite;
}

.scu-trigger::after {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: inherit;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, .28);
    animation: scuPulse 2.5s ease-out infinite;
}

.scu-trigger:hover { filter: brightness(1.03); }

.scu-trigger:focus-visible {
    outline: 3px solid rgba(15, 23, 42, .18);
    outline-offset: 3px;
}

.scu-main-icon,
.scu-avatar .scu-icon-stack,
.scu-avatar .scu-built-in-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.scu-main-icon {
    width: 30px;
    height: 30px;
    font-size: 24px;
}

.scu-main-icon svg { width: 27px; height: 27px; }
.scu-avatar svg { width: 22px; height: 22px; }

/* Resilient icon loader: fallback SVG is visible until JS verifies the custom icon. */
.scu-icon-stack {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.scu-icon-stack .scu-custom-icon,
.scu-icon-stack .scu-fallback-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scu-icon-stack .scu-custom-icon {
    opacity: 0;
    visibility: hidden;
}

.scu-icon-stack .scu-fallback-icon {
    opacity: 1;
    visibility: visible;
}

.scu-icon-stack.scu-icon-ready .scu-custom-icon {
    opacity: 1;
    visibility: visible;
}

.scu-icon-stack.scu-icon-ready .scu-fallback-icon {
    opacity: 0;
    visibility: hidden;
}

.scu-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 0;
}

.scu-main-icon .scu-icon-img { width: 28px; height: 28px; }

.scu-icon-stack i {
    display: inline-block;
    font-style: normal;
    line-height: 1;
}

.scu-built-in-icon {
    width: 100%;
    height: 100%;
}

@keyframes scuPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,.28); }
    70% { transform: scale(1.06); box-shadow: 0 0 0 15px rgba(255,255,255,0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

@keyframes scuFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@media (max-width: 480px) {
    .scu-widget {
        bottom: calc(12px + env(safe-area-inset-bottom));
        max-width: calc(100vw - 18px);
    }

    .scu-widget.scu-right { right: 9px; }
    .scu-widget.scu-left { left: 9px; }

    .scu-panel {
        width: min(340px, calc(100vw - 18px));
        max-width: calc(100vw - 18px);
        border-radius: 20px;
    }

    .scu-head { padding: 15px; }
    .scu-head-main { gap: 10px; padding-left: 38px; }
    .scu-head-mark { flex-basis: 44px; width: 44px; height: 44px; border-radius: 13px; }
    .scu-title { font-size: 15px; }
    .scu-subtitle { font-size: 10.8px; }
    .scu-body { padding: 12px; }
    .scu-contact-btn { min-height: 62px; border-radius: 14px; }
    .scu-trigger-wrap { gap: 5px; }
    .scu-trigger { width: 52px; height: 52px; border-radius: 16px; }
    .scu-trigger-label { display: none; }
    .scu-phone-pill { min-height: 41px; gap: 7px; padding: 5px 10px 5px 6px; }
    .scu-phone-icon { width: 28px; height: 28px; }
    .scu-phone-icon svg { width: 15px; height: 15px; }
    .scu-phone-number { font-size: 14px; }
}

@media (max-width: 360px) {
    .scu-head-mark { display: none; }
    .scu-head-main { padding-left: 36px; }
    .scu-phone-pill { gap: 5px; padding-right: 8px; }
    .scu-phone-number { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .scu-panel,
    .scu-phone-pill,
    .scu-contact-btn,
    .scu-trigger,
    .scu-close,
    .scu-contact-icon {
        transition: none !important;
        animation: none !important;
    }

    .scu-trigger::after { animation: none !important; }
}
