.chat-ui.imessage {
    --chat-bg: #000000;
    --header-bg: rgba(22, 22, 24, 0.92);
    --bubble-sent: #0a84ff;
    --bubble-received: #26262a;
    --accent: #0a84ff;
    --status-seen: #93c5fd;
    --bubble-radius: 18px;

    font-family: -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
}

/* ----- Header: blue back chevron left, centered avatar + name, FaceTime right ----- */
.chat-ui.imessage .chat-header {
    position: relative;
    justify-content: center;
    height: 60px;
    padding: 4px 12px;
    background: var(--header-bg);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-ui.imessage .chat-header-main {
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.chat-ui.imessage .chat-back-arrow {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #0a84ff;
}

.chat-ui.imessage .wa-back-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: #0a84ff;
}

.chat-ui.imessage .chat-avatar {
    width: 2.05rem;
    height: 2.05rem;
    background: #3a3a3c;
    font-size: 0.62rem;
}

.chat-ui.imessage .chat-title {
    font-size: 0.68rem;
    font-weight: 500;
    color: #f5f5f7;
}

.chat-ui.imessage .chat-subtitle {
    display: none;
}

.chat-ui.imessage .chat-header-actions {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #0a84ff;
}

.chat-ui.imessage .chat-header-action {
    color: #0a84ff;
}

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

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

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

.chat-ui.imessage .bubble-row {
    margin-bottom: 0.5rem;
}

.chat-ui.imessage .bubble-row-grouped {
    margin-bottom: 0.14rem;
}

.chat-ui.imessage .bubble {
    max-width: 72%;
    padding: 0.42rem 0.7rem;
    box-shadow: none;
    border: none;
    border-radius: 18px;
}

.chat-ui.imessage .bubble.sent {
    background: #0a84ff;
    border-bottom-right-radius: 18px;
}

.chat-ui.imessage .bubble.received {
    background: #26262a;
    border: none;
    border-bottom-left-radius: 18px;
}

/* Tail on the last bubble of a run (next row is a different sender / none). */
.chat-ui.imessage .bubble-row-sent:not(:has(+ .bubble-row-sent)) .bubble.sent {
    border-bottom-right-radius: 5px;
}

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

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

/* iMessage: show a small gray time, but no delivery ticks. */
.chat-ui.imessage .bubble-meta {
    margin-top: 3px;
    justify-content: flex-end;
    gap: 4px;
}

.chat-ui.imessage .bubble-time {
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.5);
}

.chat-ui.imessage .bubble-status {
    display: none;
}

.chat-ui.imessage .bubble-sender {
    color: #8e8e93;
}

/* ----- Footer: apps "+" + rounded iMessage field with trailing mic ----- */
.chat-ui.imessage .chat-footer {
    padding: 6px 8px 10px;
    background: rgba(0, 0, 0, 0.96);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    gap: 0;
}

.chat-ui.imessage .imsg-footer {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    width: 100%;
}

.chat-ui.imessage .imsg-apps {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 9999px;
    background: #1c1c1e;
    color: #9a9a9f;
    cursor: pointer;
}

.chat-ui.imessage .imsg-apps svg {
    width: 16px;
    height: 16px;
}

.chat-ui.imessage .imsg-field {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 30px;
    padding: 0 33px 0 12px;
    border: 1px solid #38383a;
    border-radius: 16px;
    background: transparent;
}

.chat-ui.imessage .imsg-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.9rem;
    line-height: 1.2;
    padding: 6px 0;
}

.chat-ui.imessage .imsg-input::placeholder,
.chat-ui.imessage .imsg-input.composer-empty {
    color: #8e8e93;
}

.chat-ui.imessage .imsg-send {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: #8e8e93;
    cursor: pointer;
}

.chat-ui.imessage .imsg-send svg {
    width: 15px;
    height: 15px;
}

.chat-ui.imessage .system-note {
    color: #8e8e93;
    background: transparent;
    font-size: 0.66rem;
}
