/* ShopGlowsy Phase 1 — community + floating store chat */
.sg-store-community-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    margin: 0 0 16px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.sg-store-community-stats {
    font-size: 0.9rem;
    color: #475569;
}
.sg-store-followers-count strong {
    color: #111827;
    font-weight: 700;
}
.sg-store-community-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sg-btn-follow-store,
.sg-btn-message-store {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    color: #111827;
    transition: background 0.15s, border-color 0.15s;
}
.sg-btn-follow-store:hover,
.sg-btn-message-store:hover {
    background: #f8fafc;
}
.sg-btn-follow-store.is-following {
    background: #111827;
    color: #fff;
    border-color: #111827;
}
.sg-btn-message-store {
    background: #111827;
    color: #fff;
    border-color: #111827;
}
.sg-btn-message-store:hover {
    background: #1f2937;
    color: #fff;
}
.sg-btn-follow-store:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Floating chat on storefront — rich, minimal */
.sg-store-chat-fab {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 9990;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 14px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 8px 28px rgba(17, 24, 39, 0.35), 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s, box-shadow 0.2s;
}
.sg-store-chat-fab:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(17, 24, 39, 0.4);
}
.sg-store-chat-fab-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
@media (max-width: 480px) {
    .sg-store-chat-fab-label { display: none; }
    .sg-store-chat-fab { padding: 14px; border-radius: 50%; }
}

/* TikTok-style seller inbox — full screen list ↔ thread */
body.sg-inbox-full,
html.sg-inbox-root {
    overflow: hidden;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    touch-action: pan-y;
    overscroll-behavior: none;
}
.sg-inbox-mobile {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: #fff;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    overscroll-behavior: none;
}
@media (min-width: 481px) {
    .sg-inbox-mobile {
        border-left: 1px solid #f0f0f0;
        border-right: 1px solid #f0f0f0;
        box-shadow: 0 0 40px rgba(0,0,0,.06);
    }
}
.sg-inbox-screen {
    display: none;
    flex-direction: column;
    height: 100dvh;
    height: 100vh;
    width: 100%;
    max-width: 100%;
    background: #fff;
    overflow: hidden;
    overscroll-behavior: none;
}
.sg-inbox-screen.is-active { display: flex; }
.sg-inbox-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 52px;
    padding: env(safe-area-inset-top, 0) 12px 0;
    padding-top: max(8px, env(safe-area-inset-top));
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}
.sg-inbox-topbar-title {
    flex: 1;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #111;
    text-align: center;
    letter-spacing: -0.02em;
}
.sg-inbox-topbar-btn {
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #111;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
}
.sg-inbox-topbar-btn:active { background: #f3f4f6; }
.sg-inbox-topbar-thread .sg-inbox-topbar-center {
    flex: 1;
    min-width: 0;
    text-align: center;
}
.sg-inbox-topbar-thread h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sg-inbox-thread-sub {
    margin: 2px 0 0;
    font-size: 0.72rem;
    color: #94a3b8;
}
.sg-inbox-topbar-actions { display: flex; gap: 2px; }
.sg-inbox-search-wrap {
    flex-shrink: 0;
    padding: 8px 16px 12px;
    border-bottom: 1px solid #f5f5f5;
}
.sg-inbox-search {
    width: 100%;
    border: none;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 16px;
    outline: none;
    touch-action: manipulation;
}
.sg-inbox-search:focus { background: #ebecef; }
.sg-inbox-list-full {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
.sg-inbox-row-full {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 0;
    background: #fff;
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background .12s;
}
.sg-inbox-row-full:active,
.sg-inbox-row-full.is-active { background: #fafafa; }
.sg-inbox-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C08497, #a06878);
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sg-inbox-row-body { flex: 1; min-width: 0; }
.sg-inbox-row-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 3px;
}
.sg-inbox-row-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #111;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sg-inbox-row-time { font-size: 0.72rem; color: #94a3b8; flex-shrink: 0; }
.sg-inbox-row-preview {
    font-size: 0.84rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sg-inbox-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #fe2c55;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sg-inbox-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 16px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sg-inbox-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-align: center;
    padding: 48px 24px;
    gap: 8px;
}
.sg-inbox-empty i { font-size: 2.5rem; opacity: .35; }
.sg-inbox-empty p { margin: 0; font-weight: 700; color: #64748b; font-size: 0.95rem; }
.sg-inbox-empty span { font-size: 0.82rem; }
.sg-inbox-msg { display: flex; flex-direction: column; max-width: 82%; }
.sg-inbox-msg.is-mine { align-self: flex-end; align-items: flex-end; }
.sg-inbox-msg.is-theirs { align-self: flex-start; align-items: flex-start; }
.sg-inbox-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.45;
    word-break: break-word;
}
.sg-inbox-msg.is-mine .sg-inbox-bubble {
    background: #111;
    color: #fff;
    border-bottom-right-radius: 6px;
}
.sg-inbox-msg.is-theirs .sg-inbox-bubble {
    background: #f3f4f6;
    color: #111;
    border-bottom-left-radius: 6px;
}
.sg-inbox-msg-time { font-size: 0.68rem; color: #94a3b8; margin-top: 4px; padding: 0 4px; }
.sg-inbox-product-card {
    display: flex;
    gap: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 14px;
    overflow: hidden;
    max-width: 260px;
}
.sg-inbox-product-card img { width: 72px; height: 72px; object-fit: cover; flex-shrink: 0; }
.sg-inbox-product-body { padding: 10px 10px 10px 0; min-width: 0; }
.sg-inbox-product-name { font-weight: 700; font-size: 0.82rem; color: #111; margin-bottom: 4px; }
.sg-inbox-product-price { font-weight: 800; font-size: 0.88rem; color: #fe2c55; }
.sg-inbox-product-old { font-size: 0.75rem; color: #94a3b8; text-decoration: line-through; margin-left: 6px; font-weight: 500; }
.sg-inbox-compose {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid #f0f0f0;
    background: #fff;
}
.sg-inbox-compose-icon,
.sg-inbox-compose-send {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.sg-inbox-compose-icon {
    background: #f3f4f6;
    color: #64748b;
}
.sg-inbox-compose-icon:disabled { opacity: .4; cursor: not-allowed; }
.sg-inbox-compose-send {
    background: #fe2c55;
    color: #fff;
}
.sg-inbox-compose-send:disabled { opacity: .4; cursor: not-allowed; }
.sg-inbox-compose textarea {
    flex: 1;
    border: none;
    background: #f3f4f6;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    outline: none;
    line-height: 1.4;
    touch-action: manipulation;
}
.sg-inbox-compose textarea:disabled { opacity: .5; }
.sg-inbox-picker {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.sg-inbox-picker[hidden] { display: none !important; }
.sg-inbox-picker-sheet {
    width: 100%;
    max-width: 480px;
    max-height: 70vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sg-inbox-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}
.sg-inbox-picker-head h3 { margin: 0; font-size: 1rem; font-weight: 800; }
.sg-inbox-picker-grid {
    overflow-y: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.sg-inbox-picker-item {
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fff;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #111;
}
.sg-inbox-picker-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; margin-bottom: 6px; display: block; }

/* Legacy split inbox (unused) */
.sg-inbox-app { max-width: 1100px; margin: 0 auto; padding: 16px; }
.sg-inbox-shell { display: none; }

/* Dashboard quick inbox pill */
.sg-dash-inbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    transition: background .15s;
}
.sg-dash-inbox-pill:hover { background: #1f2937; color: #fff; }
.sg-dash-inbox-pill .sg-inbox-dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #fe2c55; font-size: 0.65rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
