.wcl-widget {
    --wcl-brand: #087f8c;
    --wcl-text: #17212b;
    --wcl-muted: #657486;
    --wcl-line: #e6edf2;
    --wcl-bg: #ffffff;
    --wcl-soft: #f5f9fb;
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 99998;
    font-family: inherit;
}

.wcl-widget * { box-sizing: border-box; }

.wcl-launcher {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 999px;
    background: var(--wcl-brand);
    color: #fff;
    box-shadow: 0 14px 36px rgba(7, 42, 55, .28);
    cursor: pointer;
    display: grid;
    place-items: center;
    position: relative;
    transition: transform .18s ease, box-shadow .18s ease;
}

.wcl-launcher:hover,
.wcl-launcher:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(7, 42, 55, .34);
    outline: none;
}

.wcl-launcher-icon,
.wcl-launcher-icon::before,
.wcl-launcher-icon::after {
    display: block;
    background: currentColor;
    border-radius: 999px;
}

.wcl-launcher-icon {
    width: 26px;
    height: 18px;
    position: relative;
    border-radius: 8px;
}

.wcl-launcher-icon::before {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    left: 4px;
    bottom: -4px;
    transform: rotate(45deg);
}

.wcl-launcher-icon::after {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    top: 7px;
    left: 6px;
    box-shadow: 7px 0 0 currentColor, 14px 0 0 currentColor;
    background: var(--wcl-brand);
}

.wcl-launcher-dot {
    width: 13px;
    height: 13px;
    background: #20d180;
    border: 2px solid #fff;
    border-radius: 999px;
    position: absolute;
    top: 4px;
    right: 4px;
}

.wcl-widget.is-offline .wcl-launcher-dot,
.wcl-widget.is-offline .wcl-heading i {
    background: #f5b544;
}

.wcl-panel {
    width: min(360px, calc(100vw - 28px));
    max-height: min(680px, calc(100vh - 100px));
    background: var(--wcl-bg);
    color: var(--wcl-text);
    border: 1px solid rgba(12, 35, 46, .08);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(8, 30, 44, .24);
    overflow: hidden;
    position: absolute;
    right: 0;
    bottom: 74px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(.98);
    transform-origin: bottom right;
    transition: opacity .18s ease, transform .18s ease;
}

.wcl-widget.is-open .wcl-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.wcl-header {
    background: linear-gradient(135deg, color-mix(in srgb, var(--wcl-brand) 92%, #000 8%), var(--wcl-brand));
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wcl-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .36);
    display: grid;
    place-items: center;
    overflow: hidden;
    flex: 0 0 auto;
    font-weight: 700;
    font-size: 18px;
}

.wcl-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wcl-heading {
    min-width: 0;
    flex: 1;
    display: grid;
    gap: 3px;
}

.wcl-heading strong {
    font-size: 16px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.wcl-heading span {
    font-size: 13px;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    opacity: .92;
}

.wcl-heading i {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #28e08f;
    flex: 0 0 auto;
}

.wcl-close {
    border: 0;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.wcl-body {
    padding: 16px;
    overflow: auto;
    max-height: calc(min(680px, 100vh - 100px) - 76px);
}

.wcl-welcome {
    margin: 0 0 14px;
    color: var(--wcl-text);
    font-size: 14px;
    line-height: 1.55;
}

.wcl-actions {
    display: grid;
    gap: 9px;
}

.wcl-action {
    min-height: 44px;
    width: 100%;
    border: 1px solid var(--wcl-line);
    border-radius: 8px;
    background: #fff;
    color: var(--wcl-text);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.wcl-action:hover,
.wcl-action:focus-visible {
    border-color: color-mix(in srgb, var(--wcl-brand) 42%, #dce8ee 58%);
    background: var(--wcl-soft);
    color: var(--wcl-text);
    transform: translateY(-1px);
    outline: none;
    text-decoration: none;
}

.wcl-action span {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: var(--wcl-brand);
    flex: 0 0 auto;
}

.wcl-action svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.wcl-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--wcl-line);
    display: grid;
    gap: 10px;
}

.wcl-form[hidden] { display: none; }

.wcl-form label {
    display: grid;
    gap: 5px;
    margin: 0;
    color: var(--wcl-text);
    font-size: 13px;
    font-weight: 650;
}

.wcl-form input,
.wcl-form textarea {
    width: 100%;
    border: 1px solid var(--wcl-line);
    border-radius: 8px;
    padding: 9px 10px;
    color: var(--wcl-text);
    background: #fff;
    font: inherit;
    font-size: 14px;
    min-height: 40px;
}

.wcl-form textarea { resize: vertical; }

.wcl-form input:focus,
.wcl-form textarea:focus {
    border-color: var(--wcl-brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wcl-brand) 16%, transparent);
    outline: none;
}

.wcl-form button[type="submit"] {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    background: var(--wcl-brand);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 14px;
}

.wcl-form button[disabled] {
    opacity: .65;
    cursor: wait;
}

.wcl-note,
.wcl-status {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--wcl-muted);
}

.wcl-status.is-success { color: #087a45; }
.wcl-status.is-error { color: #b42318; }
.wcl-hp { position: absolute !important; left: -9999px !important; }

@media (max-width: 480px) {
    .wcl-widget {
        right: max(14px, env(safe-area-inset-right));
        bottom: max(14px, env(safe-area-inset-bottom));
    }

    .wcl-launcher {
        width: 54px;
        height: 54px;
    }

    .wcl-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        max-height: min(82vh, calc(100vh - 74px));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -18px 50px rgba(8, 30, 44, .24);
        transform: translateY(100%);
        transform-origin: bottom center;
        transition: opacity .2s ease, transform .24s ease;
    }

    .wcl-widget.is-open .wcl-panel {
        transform: translateY(0);
    }

    .wcl-body {
        max-height: calc(min(82vh, 100vh - 74px) - 76px);
        padding-bottom: max(18px, env(safe-area-inset-bottom));
    }
}
