/* Pikaxiong Smart Support Widget (CSP-safe, light theme aligned) */
.jj-support-root {
    --sup-bg: var(--jj-surface, #ffffff);
    --sup-soft: var(--jj-soft, #f6f6f8);
    --sup-ink: var(--jj-ink, #15171c);
    --sup-muted: var(--jj-muted, #68707e);
    --sup-line: var(--jj-line, #e1e2e8);
    --sup-action: var(--jj-action, #111318);
    --sup-focus: var(--jj-focus, #315bc7);
    --sup-green: #16a34a;
    --sup-warn-bg: #fffbeb;
    --sup-warn-border: #fde68a;
    --sup-warn-ink: #92400e;
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--sup-ink);
}

.jj-support-root [hidden] {
    display: none !important;
}

.jj-support-root *,
.jj-support-root *::before,
.jj-support-root *::after {
    box-sizing: border-box;
}

.jj-sup-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1950;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 46px;
    padding: 0 18px 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: var(--sup-action);
    color: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(17, 19, 24, 0.24), 0 2px 6px rgba(17, 19, 24, 0.12);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.jj-sup-launcher:hover {
    background: #232732;
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(17, 19, 24, 0.28);
}

.jj-sup-launcher:focus-visible {
    outline: 3px solid var(--sup-focus);
    outline-offset: 3px;
}

.jj-sup-launcher__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
    flex-shrink: 0;
}

.jj-sup-launcher__icon {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

.jj-sup-launcher__label {
    white-space: nowrap;
}

.jj-sup-panel {
    position: fixed;
    right: 20px;
    bottom: 78px;
    z-index: 1960;
    width: 392px;
    max-width: calc(100vw - 28px);
    height: min(580px, calc(100vh - 104px));
    display: flex;
    flex-direction: column;
    background: var(--sup-bg);
    border: 1px solid var(--sup-line);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2), 0 4px 16px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.jj-sup-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 16px;
    background: var(--sup-action);
    color: #ffffff;
    flex-shrink: 0;
}

.jj-sup-head__info {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    flex: 1;
}

.jj-sup-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.jj-sup-avatar svg {
    width: 20px;
    height: 20px;
    color: #ffffff;
}

.jj-sup-avatar__online {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--sup-action);
}

.jj-sup-titles {
    min-width: 0;
    flex: 1;
}

.jj-sup-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jj-sup-hours {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.76);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jj-sup-head__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.jj-sup-handoff-btn {
    height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.jj-sup-handoff-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.jj-sup-icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.84);
    cursor: pointer;
    font-size: 16px;
}

.jj-sup-icon-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.jj-sup-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px;
    background: #f5f6f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
}

.jj-sup-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
}

.jj-sup-msg--bot {
    align-self: flex-start;
}

.jj-sup-msg--user {
    align-self: flex-end;
}

.jj-sup-msg--full {
    max-width: 100%;
    width: 100%;
}

.jj-sup-bubble {
    padding: 10px 13px;
    border-radius: 15px;
    font-size: 13.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.jj-sup-msg--bot .jj-sup-bubble {
    background: var(--sup-bg);
    color: var(--sup-ink);
    border: 1px solid var(--sup-line);
    border-top-left-radius: 5px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.jj-sup-msg--user .jj-sup-bubble {
    background: var(--sup-action);
    color: #ffffff;
    border-top-right-radius: 5px;
}

.jj-sup-bubble__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
}

.jj-sup-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--sup-action);
    color: #ffffff !important;
    border: 1px solid var(--sup-action);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.jj-sup-action-btn:hover {
    background: #282d38;
}

.jj-sup-bubble__foot {
    margin-top: 8px;
    padding-top: 7px;
    border-top: 1px dashed var(--sup-line);
}

.jj-sup-link-btn {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--sup-focus);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.jj-sup-link-btn:hover {
    color: #1d4ed8;
}

.jj-sup-faq-box {
    background: var(--sup-bg);
    border: 1px solid var(--sup-line);
    border-radius: 16px;
    padding: 11px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jj-sup-faq-box__label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--sup-muted);
    letter-spacing: 0.03em;
    padding: 0 2px 2px;
}

.jj-sup-faq-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--sup-line);
    border-radius: 11px;
    background: var(--sup-soft);
    color: var(--sup-ink);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease;
}

.jj-sup-faq-btn:hover {
    background: #ffffff;
    border-color: #b7becb;
}

.jj-sup-faq-btn--human {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.jj-sup-faq-btn--human:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}

.jj-sup-faq-btn__arrow {
    color: var(--sup-muted);
    font-size: 12px;
    flex-shrink: 0;
}

.jj-sup-card {
    background: var(--sup-bg);
    border: 1px solid var(--sup-line);
    border-radius: 16px;
    padding: 13px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.jj-sup-card__title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 750;
    color: var(--sup-ink);
}

.jj-sup-card__tip {
    padding: 9px 11px;
    border-radius: 10px;
    background: var(--sup-warn-bg);
    border: 1px solid var(--sup-warn-border);
    color: var(--sup-warn-ink);
    font-size: 12.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.jj-sup-channel {
    padding: 10px 11px;
    border: 1px solid var(--sup-line);
    border-radius: 12px;
    background: var(--sup-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.jj-sup-channel__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.jj-sup-channel__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 7px;
    min-width: 0;
    font-size: 13px;
}

.jj-sup-channel__tag {
    display: inline-block;
    max-width: 100%;
    padding: 1px 7px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--sup-line);
    font-size: 11px;
    font-weight: 700;
    color: var(--sup-muted);
    overflow-wrap: anywhere;
}

.jj-sup-channel__val {
    font-weight: 700;
    color: var(--sup-ink);
    overflow-wrap: anywhere;
}

.jj-sup-channel__btns {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.jj-sup-chip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid #d5d7e0;
    background: #ffffff;
    color: var(--sup-ink) !important;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.jj-sup-chip-btn:hover {
    background: #eff1f5;
    border-color: #aeb5c2;
}

.jj-sup-chip-btn--primary {
    background: var(--sup-action);
    border-color: var(--sup-action);
    color: #ffffff !important;
}

.jj-sup-chip-btn--primary:hover {
    background: #282d38;
}

.jj-sup-qr-wrap {
    padding-top: 4px;
    text-align: center;
}

.jj-sup-qr-img {
    max-width: 170px;
    max-height: 170px;
    border-radius: 10px;
    border: 1px solid var(--sup-line);
    background: #ffffff;
}

.jj-sup-card__empty {
    font-size: 12.5px;
    color: var(--sup-muted);
    line-height: 1.55;
}

.jj-sup-card__ticket {
    padding-top: 6px;
    border-top: 1px dashed var(--sup-line);
    display: flex;
    justify-content: flex-end;
}

.jj-sup-card__ticket a {
    font-size: 12px;
    font-weight: 600;
    color: var(--sup-focus);
    text-decoration: none;
}

.jj-sup-card__ticket a:hover {
    text-decoration: underline;
}

.jj-sup-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--sup-bg);
    border-top: 1px solid var(--sup-line);
    flex-shrink: 0;
}

.jj-sup-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 38px;
    padding: 0 13px;
    border: 1px solid #d5d7e0;
    border-radius: 999px;
    background: var(--sup-soft);
    color: var(--sup-ink);
    font: inherit;
    font-size: 13.5px;
}

.jj-sup-input:focus {
    outline: none;
    border-color: var(--sup-focus);
    background: #ffffff;
}

.jj-sup-send {
    height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: var(--sup-action);
    color: #ffffff;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    flex-shrink: 0;
}

.jj-sup-send:hover {
    background: #282d38;
}

@media (max-width: 600px) {
    .jj-sup-launcher {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        width: 46px;
        height: 46px;
        padding: 0;
        justify-content: center;
    }

    .jj-sup-launcher__label {
        display: none;
    }

    .jj-sup-launcher__dot {
        position: absolute;
        top: 6px;
        right: 6px;
    }

    .jj-sup-panel {
        left: 10px;
        right: 10px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: none;
        height: min(76vh, 560px);
        border-radius: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .jj-sup-launcher,
    .jj-sup-faq-btn {
        transition: none !important;
    }
}
