.chat-ui.instagram {
    --chat-bg: #000000;
    --header-bg: #000000;
    --bubble-sent: linear-gradient(150deg, #5167f6 0%, #8b34d8 100%);
    --bubble-received: #262626;
    --accent: #e1306c;
    --status-seen: #f9a8d4;
    --bubble-radius: 20px;

    font-family: "Helvetica Neue", -apple-system, Roboto, sans-serif;
}

/* ----- Header ----- */
.chat-ui.instagram .chat-header {
    height: 54px;
    padding: 6px 10px;
    background: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-ui.instagram .chat-header-main {
    gap: 0.6rem;
}

.chat-ui.instagram .chat-avatar {
    width: 1.9rem;
    height: 1.9rem;
    background: linear-gradient(135deg, #5167f6, #8b34d8);
    font-size: 0.6rem;
}

.chat-ui.instagram .chat-title {
    font-size: 0.84rem;
    font-weight: 600;
    color: #ffffff;
}

.chat-ui.instagram .chat-subtitle {
    color: #a8a8a8;
    font-size: 0.66rem;
}

.chat-ui.instagram .wa-back-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: #ffffff;
}

.chat-ui.instagram .chat-header-actions {
    color: #ffffff;
    gap: 0.85rem;
}

.chat-ui.instagram .chat-header-action {
    color: #ffffff;
}

.chat-ui.instagram .chat-header-action-icon,
.chat-ui.instagram .chat-header-action-icon-video {
    width: 1.4rem;
    height: 1.4rem;
}

/* ----- Body + bubbles ----- */
.chat-ui.instagram .chat-body {
    background: #000000;
}

.chat-ui.instagram .chat-messages {
    padding: 0.7rem 0.7rem 5rem;
}

.chat-ui.instagram .bubble-row {
    margin-bottom: 0.42rem;
    align-items: flex-end;
}

.chat-ui.instagram .bubble-row-grouped {
    margin-bottom: 0.13rem;
}

.chat-ui.instagram .bubble {
    max-width: 70%;
    padding: 0.45rem 0.75rem;
    box-shadow: none;
    border: none;
    border-radius: 20px;
}

.chat-ui.instagram .bubble.sent {
    background: var(--bubble-sent);
}

.chat-ui.instagram .bubble.received {
    background: #262626;
    border: none;
}

/* Grouped bubbles: flatten the corners between same-sender messages. */
.chat-ui.instagram .bubble-row-sent:has(+ .bubble-row-sent) .bubble.sent {
    border-bottom-right-radius: 5px;
}

.chat-ui.instagram .bubble-row-grouped.bubble-row-sent .bubble.sent {
    border-top-right-radius: 5px;
}

.chat-ui.instagram .bubble-row-received:has(+ .bubble-row-received) .bubble.received {
    border-bottom-left-radius: 5px;
}

.chat-ui.instagram .bubble-row-grouped.bubble-row-received .bubble.received {
    border-top-left-radius: 5px;
}

.chat-ui.instagram .bubble-content {
    font-size: 0.86rem;
    line-height: 1.3;
    color: #ffffff;
}

/* Instagram DMs show no per-bubble time/ticks or sender names. */
.chat-ui.instagram .bubble-meta {
    display: none;
}

.chat-ui.instagram .bubble-sender {
    display: none;
}

/* ----- Sender avatar to the left of the last received bubble in a run ----- */
.chat-ui.instagram .row-avatar {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    margin-right: 7px;
}

.chat-ui.instagram .row-avatar-img {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    object-fit: cover;
}

.chat-ui.instagram .row-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: #3a3a3a;
    color: #ffffff;
    font-size: 0.56rem;
    font-weight: 600;
}

.chat-ui.instagram .bubble-row-received:has(+ .bubble-row-received) .row-avatar {
    visibility: hidden;
}

.chat-ui.instagram .bubble-row-received .bubble-reaction {
    left: 2.4rem;
}

/* ----- Voice note play buttons ----- */
.chat-ui.instagram .bubble.received .voice-play {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.chat-ui.instagram .bubble.sent .voice-play {
    background: rgba(0, 0, 0, 0.25);
    color: #ffffff;
}

/* ----- Footer: gradient camera + "Message..." field with mic/image/sticker ----- */
.chat-ui.instagram .chat-footer {
    padding: 7px 8px 9px;
    background: #000000;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    gap: 0;
}

.chat-ui.instagram .ig-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.chat-ui.instagram .ig-camera {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 9999px;
    background: linear-gradient(135deg, #5167f6, #8b34d8);
    color: #ffffff;
    cursor: pointer;
}

.chat-ui.instagram .ig-camera svg {
    width: 18px;
    height: 18px;
}

.chat-ui.instagram .ig-field {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 10px 0 14px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 9999px;
}

.chat-ui.instagram .ig-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.9rem;
    padding: 7px 0;
}

.chat-ui.instagram .ig-input::placeholder,
.chat-ui.instagram .ig-input.composer-empty {
    color: #a8a8a8;
}

.chat-ui.instagram .ig-field-icons {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}

.chat-ui.instagram .ig-fi {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    padding: 0;
}

.chat-ui.instagram .ig-fi svg {
    width: 20px;
    height: 20px;
}

.chat-ui.instagram .system-note {
    color: #a8a8a8;
    background: transparent;
    font-size: 0.66rem;
}
