/* 公共浮动咨询模块：视觉以首页原实现为基准。 */
.float-chat {
    --float-chat-brand: var(--brand, var(--primary, #7b292b));
    --float-chat-text: var(--text, var(--ink, #1a1e2b));
    position: fixed;
    inset-inline-end: 32px;
    bottom: 220px;
    z-index: 800;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.float-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--float-chat-brand);
    color: #fff;
    box-shadow: 0 8px 24px rgba(123, 41, 43, 0.35);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.float-chat-btn:hover {
    transform: scale(1.1);
}

.float-chat-btn:focus-visible {
    outline: 3px solid rgba(123, 41, 43, 0.28);
    outline-offset: 4px;
}

.float-chat-btn svg {
    width: 24px;
    height: 24px;
}

.float-chat-menu {
    display: none;
    min-width: 180px;
    padding: 12px;
    flex-direction: column;
    gap: 8px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.float-chat-menu.show {
    display: flex;
}

.float-chat-menu a,
.float-chat-menu > button {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--float-chat-text);
    font-family: inherit;
    font-size: 13px;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.float-chat-menu a:hover,
.float-chat-menu a:focus-visible,
.float-chat-menu > button:hover,
.float-chat-menu > button:focus-visible {
    background: #f5f6fa;
    color: var(--float-chat-brand);
}

.float-chat-menu a:focus-visible,
.float-chat-menu > button:focus-visible {
    outline: 2px solid rgba(123, 41, 43, 0.24);
    outline-offset: 1px;
}

.float-chat-menu a svg,
.float-chat-menu a img,
.float-chat-menu > button svg,
.float-chat-menu > button img {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.float-chat-menu a svg {
    color: var(--float-chat-brand);
}

.float-contact-backdrop[hidden],
.float-contact-panel[hidden] {
    display: none;
}

.float-contact-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(21, 25, 30, 0.36);
}

.float-contact-panel {
    box-sizing: border-box;
    width: min(360px, calc(100vw - 32px));
    max-height: calc(100vh - 320px);
    max-height: calc(100dvh - 320px);
    overflow-y: auto;
    padding: 22px;
    border: 1px solid #d5dbdf;
    border-radius: 14px;
    background: #fff;
    color: #15191e;
    box-shadow: 0 18px 48px rgba(37, 45, 53, 0.18);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.float-contact-panel *,
.float-contact-panel *::before,
.float-contact-panel *::after {
    box-sizing: border-box;
}

.float-contact-panel.is-open {
    opacity: 1;
    transform: translateY(0);
}

.float-contact-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e3e8eb;
}

.float-contact-head h2 {
    margin: 0;
    color: #15191e;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
}

.float-contact-head p {
    max-width: 30ch;
    margin: 7px 0 0;
    color: #59636d;
    font-size: 13px;
    line-height: 1.65;
}

.float-contact-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    padding: 0;
    border: 1px solid #d5dbdf;
    border-radius: 8px;
    background: #fff;
    color: #4e5863;
    font: 400 22px/1 system-ui, sans-serif;
    cursor: pointer;
}

.float-contact-close:hover,
.float-contact-close:focus-visible {
    border-color: var(--float-chat-brand);
    color: var(--float-chat-brand);
}

.float-contact-close:focus-visible,
.float-contact-item:focus-visible,
.float-contact-message:focus-visible {
    outline: 2px solid rgba(123, 41, 43, 0.28);
    outline-offset: 2px;
}

.float-contact-status {
    padding: 18px 0 4px;
    color: #59636d;
    font-size: 13px;
    line-height: 1.65;
}

.float-contact-status:empty {
    display: none;
}

.float-contact-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.float-contact-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 62px;
    padding: 9px 12px;
    border: 1px solid #e3e8eb;
    border-radius: 10px;
    background: #fff;
    color: #20262c;
    font-family: inherit;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.float-contact-item:hover {
    border-color: rgba(123, 41, 43, 0.46);
    background: #fbf8f8;
    color: var(--float-chat-brand);
    transform: translateY(-1px);
}

.float-contact-item:active {
    transform: translateY(1px);
}

.float-contact-item__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border-radius: 8px;
    background: #eef1f3;
    color: var(--float-chat-brand);
    font-size: 15px;
    font-weight: 650;
}

.float-contact-item__icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.float-contact-item__name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
    font-weight: 560;
    line-height: 1.45;
}

.float-contact-item__action {
    color: #7b858f;
    font-size: 20px;
    line-height: 1;
}

.float-contact-qr {
    display: none;
    grid-column: 1 / -1;
    justify-items: center;
    gap: 10px;
    padding: 12px 0 4px;
    border-top: 1px solid #e3e8eb;
}

.float-contact-item.is-expanded .float-contact-qr {
    display: grid;
}

.float-contact-qr img {
    width: min(190px, 65vw);
    aspect-ratio: 1;
    object-fit: contain;
    background: #fff;
}

.float-contact-qr span {
    color: #59636d;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.float-contact-message {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin-top: 16px;
    padding: 0 18px;
    border-radius: 8px;
    background: var(--float-chat-brand);
    color: #fff;
    font-size: 13px;
    font-weight: 560;
    text-decoration: none;
}

.float-contact-message:hover {
    background: #a33a3c;
    color: #fff;
}

@media (max-width: 1024px) {
    .float-chat {
        inset-inline-end: 24px;
    }
}

@media (max-width: 768px) {
    .float-chat {
        inset-inline-end: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .float-contact-backdrop {
        display: block;
        z-index: 0;
    }

    .float-contact-panel {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: 1;
        width: 100%;
        max-height: min(78dvh, 680px);
        overflow-y: auto;
        padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
        border-width: 1px 0 0;
        border-radius: 16px 16px 0 0;
        transform: translateY(24px);
    }

    .float-chat-btn {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .float-chat-btn,
    .float-chat-btn:active,
    .float-chat-btn:focus {
        background: var(--float-chat-brand) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .float-chat-btn,
    .float-chat-menu a,
    .float-chat-menu > button,
    .float-contact-panel,
    .float-contact-item {
        transition: none;
    }
}
