.gdm-hidden {
    display: none !important;
}

.gdm-dock {
    position: fixed;
    right: 18px;
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 3800;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.gdm-toggle {
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 999px;
    min-height: 46px;
    padding: 10px 15px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 58%, #0f766e 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: visible;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.gdm-toggle::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 9px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.28), 0 0 8px rgba(34, 197, 94, 0.42);
    pointer-events: none;
    animation: gdmBlinkDot 1.2s ease-in-out infinite;
}

.gdm-toggle::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.16) 50%, transparent 80%);
    transform: translateX(-120%);
    transition: transform 0.35s ease;
    pointer-events: none;
}

@keyframes gdmBlinkDot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.32;
        transform: scale(0.82);
    }
}

.gdm-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.38);
    filter: brightness(1.03);
}

.gdm-toggle:hover::after {
    transform: translateX(120%);
}

.gdm-toggle i {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.gdm-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 2;
    min-width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 6px;
    line-height: 1;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.3);
    pointer-events: none;
}

.gdm-window {
    width: min(680px, calc(100vw - 28px));
    min-width: 520px;
    height: min(680px, calc(100vh - 92px));
    background: #fff;
    border: 1px solid #d9e3ee;
    border-radius: 14px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gdm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e5edf7;
    background: #f8fbff;
}

.gdm-head strong {
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gdm-back {
    border: 0;
    background: transparent;
    color: #475569;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gdm-back:hover {
    background: #e2e8f0;
}

.gdm-close {
    border: 0;
    background: transparent;
    color: #475569;
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.gdm-close:hover {
    background: #e2e8f0;
}

.gdm-body {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    min-height: 0;
    flex: 1;
}

.gdm-threads {
    border-right: 1px solid #e5edf7;
    padding: 10px;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.gdm-thread {
    border: 1px solid #d9e3ee;
    border-radius: 9px;
    padding: 8px;
    margin-bottom: 7px;
    cursor: pointer;
    background: #fff;
}

.gdm-thread.active {
    border-color: #2dd4bf;
    background: #effdfa;
}

.gdm-thread-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.gdm-thread-peer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.gdm-thread-unread {
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    line-height: 18px;
    text-align: center;
    font-weight: 700;
    flex: 0 0 auto;
}

.gdm-thread strong {
    display: block;
    font-size: 13px;
    margin-bottom: 0;
}

.gdm-thread small {
    display: block;
    color: #64748b;
    line-height: 1.5;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.gdm-role {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 1px 7px;
    font-weight: 700;
    font-size: 11px;
    border: 1px solid transparent;
    line-height: 1.35;
}

.gdm-role.seller {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.gdm-role.buyer {
    background: #dcfce7;
    color: #15803d;
    border-color: #bbf7d0;
}

.gdm-view {
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.gdm-thread-head {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 8px;
}

.gdm-messages {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.gdm-msg {
    border: 1px solid #d9e3ee;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 7px;
    margin-right: auto;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    max-width: min(100%, 58ch);
}

.gdm-msg.me {
    border-color: #bfdbfe;
    background: #eff6ff;
    margin-left: auto;
    margin-right: 0;
}

.gdm-msg-meta {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.gdm-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 8px;
}

.gdm-form input {
    border: 1px solid #d9e3ee;
    border-radius: 999px;
    min-height: 46px;
    padding: 10px 12px;
    font-size: 15px;
}

.gdm-send {
    border: 0;
    border-radius: 999px;
    min-height: 46px;
    min-width: 76px;
    padding: 10px 12px;
    background: linear-gradient(120deg, #0f766e, #0ea5a5);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.gdm-empty {
    border: 1px dashed #d9e3ee;
    border-radius: 8px;
    padding: 9px;
    color: #64748b;
    font-size: 13px;
    background: #fbfdff;
}

.gdm-notice-text {
    margin: 10px 4px 14px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.gdm-toast {
    background: #0f172a;
    color: #fff;
    padding: 9px 11px;
    border-radius: 8px;
    font-size: 12px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.24);
}

@media (max-width: 1200px) {
    .gdm-window {
        width: min(640px, calc(100vw - 22px));
        min-width: 0;
        height: min(640px, calc(100vh - 90px));
    }

    .gdm-body {
        grid-template-columns: 190px minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .gdm-dock {
        left: auto;
        right: 14px;
        bottom: calc(var(--pm-ft-mobile-nav-offset, 14px) + env(safe-area-inset-bottom));
        align-items: flex-end;
        padding: 0;
    }

    .gdm-toggle {
        display: none !important;
    }

    .gdm-window {
        position: fixed;
        inset: 0;
        width: 100vw;
        min-width: 0;
        height: 100dvh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        box-shadow: none;
    }

    .gdm-body {
        display: block;
        min-height: 0;
        height: calc(100dvh - 50px - env(safe-area-inset-bottom));
    }

    .gdm-threads {
        display: block;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        white-space: normal;
        border-right: 0;
        border-bottom: 0;
        padding: 10px 10px calc(var(--pm-ft-mobile-nav-height, 72px) + 42px + env(safe-area-inset-bottom));
        scroll-padding-bottom: calc(var(--pm-ft-mobile-nav-height, 72px) + 42px + env(safe-area-inset-bottom));
    }

    .gdm-thread {
        min-width: 0;
        margin-bottom: 8px;
        flex: none;
    }

    .gdm-thread strong {
        font-size: 16.2px;
    }

    .gdm-thread small {
        font-size: 14.4px;
        line-height: 1.58;
    }

    .gdm-role {
        font-size: 11.7px;
    }

    .gdm-view {
        display: none;
        height: 100%;
        padding: 8px 8px calc(var(--pm-ft-mobile-nav-height, 72px) + 38px + env(safe-area-inset-bottom));
    }

    .gdm-window.gdm-mobile-chat-open .gdm-threads {
        display: none;
    }

    .gdm-window.gdm-mobile-chat-open .gdm-view {
        display: flex;
    }

    .gdm-thread-head {
        margin-bottom: 6px;
        font-size: 14.4px;
        line-height: 1.4;
    }

    .gdm-messages {
        padding-right: 2px;
        padding-bottom: 2px;
    }

    .gdm-msg {
        max-width: min(100%, 44ch);
        margin-bottom: 6px;
        padding: 8px 9px;
        font-size: 14.4px;
        line-height: 1.58;
    }

    .gdm-msg-meta {
        font-size: 12.6px;
        line-height: 1.5;
    }

    .gdm-notice-text {
        margin: 8px 2px 10px;
        font-size: 14.4px;
        line-height: 1.58;
    }

    .gdm-form {
        gap: 6px;
        margin-top: 6px;
        padding-top: 6px;
        border-top: 1px solid #eef2f7;
    }

    .gdm-form input {
        min-height: 56px;
        padding: 12px 14px;
        font-size: 16.2px;
        border-radius: 999px;
    }

    .gdm-send {
        min-width: 84px;
        min-height: 56px;
        font-size: 14.4px;
        border-radius: 999px;
    }
}
