/* ── Chat system styles ─────────────────────────────────────────────────── */

/* ── chats.php outer container ──────────────────────────────────────────── */
#ath-chats-page {
    height: calc(100vh - 200px); /* fallback — overridden by JS */
}

/* ── Chat list items ─────────────────────────────────────────────────────── */
.ath-chat-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
    transition: background .12s;
    text-decoration: none;
    color: inherit;
}
.ath-chat-item:hover  { background: #f8f9fa; }
.ath-chat-item.active { background: #cfe2ff; }

.ath-chat-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
}
.ath-chat-item-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.ath-chat-item-body   { flex: 1; min-width: 0; }
.ath-chat-item-name   { font-weight: 600; font-size: .88rem; color: #212529; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ath-chat-item-preview{ font-size: .78rem; color: #6c757d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ath-chat-item-meta   { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.ath-chat-item-time   { font-size: .7rem; color: #adb5bd; }
.ath-chat-item-badge  { background: #007bff; color: #fff; font-size: .65rem; font-weight: 700; border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center; }

/* ── Notification status bar ─────────────────────────────────────────────── */
#notif-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: .78rem;
    font-weight: 600;
    flex-shrink: 0;
    border-radius: 0;
    border-bottom: 1px solid transparent;
    transition: background .2s;
}
#notif-status-bar span { flex: 1; }
#notif-status-bar .btn { border-radius: 0; font-size: .72rem; padding: 2px 10px; font-weight: 600; }

/* ON — green */
#notif-status-bar.notif-status-on {
    background: #d4edda;
    border-bottom-color: #b8dacc;
    color: #155724;
}
#notif-status-bar.notif-status-on .btn { background: transparent; border-color: #155724; color: #155724; }
#notif-status-bar.notif-status-on .btn:hover { background: #b8dacc; }
/* OFF — amber */
#notif-status-bar.notif-status-off {
    background: #fff3cd;
    border-bottom-color: #ffc107;
    color: #856404;
}
#notif-status-bar.notif-status-off .btn { background: #856404; border-color: #856404; color: #fff; }
#notif-status-bar.notif-status-off .btn:hover { background: #6b5003; border-color: #6b5003; }
/* ERROR — orange */
#notif-status-bar.notif-status-error {
    background: #ffe5d0;
    border-bottom-color: #fd7e14;
    color: #7c3a00;
}
#notif-status-bar.notif-status-error .btn { background: #fd7e14; border-color: #fd7e14; color: #fff; }
#notif-status-bar.notif-status-error .btn:hover { background: #e06c00; border-color: #e06c00; }
/* BLOCKED — red/muted */
#notif-status-bar.notif-status-blocked {
    background: #f8d7da;
    border-bottom-color: #f5c6cb;
    color: #721c24;
}

/* ── Chat filter tabs ────────────────────────────────────────────────────── */
.ath-chat-filter-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}
.ath-chat-filter-tab {
    flex: 1;
    text-align: center;
    padding: 7px 4px;
    font-size: .78rem;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .12s, border-color .12s;
    user-select: none;
}
.ath-chat-filter-tab:hover { color: #007bff; }
.ath-chat-filter-tab.active { color: #007bff; border-bottom-color: #007bff; }

/* ── Message area ────────────────────────────────────────────────────────── */
.ath-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 8px;
    background: #fff;
    /* No scroll-behavior:smooth — it creates visible "jumping" on Android when
       new messages arrive or the address bar changes height. All scroll-to-bottom
       calls are instant by design (WhatsApp-style). */
    overflow-anchor: none; /* prevent Chrome adjusting scrollTop when DOM changes */
}

/* Date divider */
.ath-msg-row.ath-msg-highlight .ath-msg-bubble {
    outline: 2px solid #0d6efd;
    transition: outline .3s;
}

.ath-msg-date-divider {
    text-align: center;
    margin: 12px 0;
    position: relative;
}
.ath-msg-date-divider::before {
    content: '';
    position: absolute;
    top: 50%; left: 0; right: 0;
    height: 1px;
    background: #dee2e6;
}
.ath-msg-date-divider span {
    position: relative;
    background: #fff;
    padding: 0 10px;
    font-size: .72rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Message row */
.ath-msg-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}
.ath-msg-row.mine { flex-direction: row-reverse; }

.ath-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ath-msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
}
.ath-msg-avatar.spacer { background: transparent !important; }

/* Online presence dot */
.ath-presence-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.ath-presence-dot {
    position: absolute;
    bottom: 1px; right: 1px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #28a745;
    border: 2px solid #fff;
    display: none;
}
.ath-presence-dot.online { display: block; }

.ath-msg-col { display: flex; flex-direction: column; max-width: 72%; }
@media (max-width: 767px) {
    .ath-msg-col { max-width: 86%; }
    .ath-msg-row.mine .ath-msg-avatar.spacer { display: none; }
    .ath-msg-row.mine .ath-msg-col { max-width: 96%; }
}
.ath-msg-row.mine .ath-msg-col { align-items: flex-end; }

.ath-msg-name { font-size: .75rem; font-weight: 600; color: #6c757d; margin-bottom: 2px; margin-left: 4px; }
.ath-msg-group-name { font-size: .78rem; font-weight: 700; margin-bottom: 3px; line-height: 1.2; }

/* Bubbles */
.ath-msg-bubble {
    padding: 8px 12px;
    border-radius: 20px;
    line-height: 1.45;
    word-break: break-word;
    font-size: .92rem;
}
.ath-msg-bubble-body {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    font-weight: 600;
    font-size: 1rem;
    font-weight: 600;
}
.ath-msg-bubble.mine {
    background: #007bff;
    color: #fff;
    border-bottom-right-radius: 3px;
}
.ath-msg-bubble.mine .ath-msg-time { color: #dee2e6; }
.ath-msg-bubble.theirs {
    background: #343a40;
    color: #f8f9fa;
    border-bottom-left-radius: 3px;
}
.ath-msg-bubble.theirs .ath-msg-name { color: #adb5bd; }
.ath-msg-bubble.theirs .ath-msg-time { color: #adb5bd; }
.ath-msg-bubble.deleted {
    background: #f8f9fa;
    color: #6c757d;
    font-style: italic;
    border: 1px solid #dee2e6;
}

/* Reply quote inside bubble */
.ath-msg-reply-quote {
    border-left: 3px solid rgba(255,255,255,.5);
    padding: 4px 8px;
    margin-bottom: 6px;
    font-size: .78rem;
    opacity: .85;
    border-radius: 2px;
    background: rgba(0,0,0,.08);
}
.ath-msg-bubble.theirs .ath-msg-reply-quote {
    border-left-color: rgba(255,255,255,.4);
    background: rgba(255,255,255,.08);
}

/* Images / files */
.ath-msg-img-wrap { position: relative; display: inline-block; margin-bottom: 4px; }
.ath-msg-img  { max-width: 240px; border-radius: 8px; cursor: pointer; display: block; margin-bottom: 0; }
.ath-img-copy-btn {
    position: absolute; bottom: 6px; right: 6px;
    background: rgba(0,0,0,.55); color: #fff;
    border: none; border-radius: 5px;
    padding: 5px 9px; font-size: .75rem;
    cursor: pointer; opacity: 0;
    transition: opacity .15s;
    line-height: 1;
}
.ath-msg-img-wrap:hover .ath-img-copy-btn { opacity: 1; }
/* Send error inline message */
.ath-send-error-msg {
    text-align: center; margin: 6px 12px;
    font-size: .78rem; color: #dc3545;
    background: #fff5f5; border: 1px solid #f5c6cb;
    border-radius: 6px; padding: 6px 12px;
}
.ath-msg-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: .82rem;
    background: rgba(0,0,0,.08);
}
.ath-msg-bubble.mine   .ath-msg-file { color: #fff; }
.ath-msg-bubble.theirs .ath-msg-file { color: #f8f9fa; }

/* Meta / actions */
.ath-msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    padding: 0 4px;
}
.ath-msg-time   { font-size: .65rem; color: #adb5bd; }
.ath-msg-edited { font-size: .65rem; color: #adb5bd; font-style: italic; }
.ath-msg-actions { display: none; }
.ath-msg-act-btn {
    background: none;
    border: none;
    color: #adb5bd;
    padding: 2px 4px;
    font-size: .7rem;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s, color .15s;
}
.ath-msg-row:hover .ath-msg-act-btn { opacity: 1; }
.ath-msg-act-btn:hover { color: #495057; }
/* ── Message context popup (shared base) ─────────────────────────────────── */
#ath-msg-ctx-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1055;
    cursor: pointer;
}
#ath-msg-ctx-popup {
    display: none;
    position: fixed;
    background: #fff;
    z-index: 1056;
}
.ath-ctx-reactions {
    display: flex;
    justify-content: space-around;
    padding: 18px 12px 14px;
    border-bottom: 1px solid #f0f0f0;
}
.ath-ctx-react-btn {
    font-size: 1.9rem;
    background: none; border: none;
    padding: 4px 10px;
    border-radius: 50%;
    line-height: 1;
    transition: transform .1s;
    cursor: pointer;
}
.ath-ctx-react-btn:active { transform: scale(1.35); }
.ath-ctx-action {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    background: none; border: none;
    border-bottom: 1px solid #f5f5f5;
    padding: 15px 20px;
    font-size: .95rem;
    color: #212529;
    text-align: left;
    cursor: pointer;
}
.ath-ctx-action i          { width: 20px; text-align: center; color: #6c757d; }
.ath-ctx-action.danger     { color: #dc3545; }
.ath-ctx-action.danger i   { color: #dc3545; }
.ath-ctx-action:last-child { border-bottom: none; }

/* Desktop: popup appears centered */
@media (min-width: 768px) {
    #ath-msg-ctx-backdrop { background: rgba(0,0,0,.3); }
    #ath-msg-ctx-popup.show {
        display: block;
        left: 50%; top: 50%;
        transform: translate(-50%, -50%);
        width: 300px;
        border-radius: 12px;
        box-shadow: 0 8px 32px rgba(0,0,0,.2);
        border: 1px solid rgba(0,0,0,.08);
    }
    .ath-ctx-action:hover { background: #f8f9fa; }
}

/* Mobile: popup slides up from bottom */
@media (max-width: 767px) {
    #ath-msg-ctx-backdrop { background: rgba(0,0,0,.45); }
    #ath-msg-ctx-popup {
        display: block;
        left: 0; right: 0;
        bottom: -500px;
        border-radius: 20px 20px 0 0;
        transition: bottom .26s cubic-bezier(.4,0,.2,1);
        padding-bottom: max(env(safe-area-inset-bottom, 8px), 8px);
    }
    #ath-msg-ctx-popup.show { bottom: 0; }
}

/* Read receipts */
.ath-msg-reads { display: flex; justify-content: flex-end; gap: 2px; margin-top: 2px; min-height: 0; }
.ath-read-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: #fff;
    font-size: .5rem;
    font-weight: 700;
    flex-shrink: 0;
    cursor: default;
}

/* Reactions */
.ath-msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; cursor: pointer; }
.ath-reactor-group { margin-bottom: 10px; }
.ath-reactor-group:last-child { margin-bottom: 0; }
.ath-reactor-emoji { font-size: 1.1rem; margin-bottom: 5px; }
.ath-reactor-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: .875rem; }
.ath-reactor-avatar { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: #6c757d; color: #fff; font-size: .65rem; font-weight: 700; flex-shrink: 0; }
.ath-reaction-btn {
    background: #fff;
    border: 1.5px solid #dee2e6;
    border-radius: 14px;
    padding: 3px 9px;
    font-size: .82rem;
    line-height: 1.3;
    cursor: pointer;
    transition: background .12s, border-color .12s;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.ath-reaction-btn:hover       { background: #f0f4ff; border-color: #b0c4f8; }
.ath-reaction-btn.mine-react  { background: #cfe2ff; border-color: #007bff; font-weight: 600; }

@media (max-width: 767px) {
    .ath-msg-bubble {
        -webkit-user-select: none;
        user-select: none;
    }
    .ath-msg-bubble.pressing {
        transform: scale(0.96);
        transition: transform .12s ease;
    }
}

/* ── Presence bar ────────────────────────────────────────────────────────── */
.ath-chat-presence {
    padding: 4px 16px;
    font-size: .75rem;
    color: #6c757d;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    min-height: 26px;
    flex-shrink: 0;
}

/* ── Reply preview ───────────────────────────────────────────────────────── */
.ath-reply-preview {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    background: #e7f0ff;
    border-top: 1px solid #b8d0ff;
    gap: 8px;
    font-size: .82rem;
    flex-shrink: 0;
}
.ath-reply-preview-body        { flex: 1; min-width: 0; color: #333; }
.ath-reply-preview-body strong { color: #007bff; margin-right: 6px; }

/* ── Attachment preview ──────────────────────────────────────────────────── */
.ath-att-preview {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    gap: 8px;
    font-size: .82rem;
    color: #333;
    flex-shrink: 0;
}

/* ── Paste preview ───────────────────────────────────────────────────────── */
#paste-preview {
    display: none;
    padding: 8px 12px;
    background: #f0f4ff;
    border-top: 1px solid #c5d5f0;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
#paste-preview img { height: 52px; width: 52px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
#paste-preview-label { font-size: .8rem; color: #495057; flex: 1; }
#paste-cancel-btn { background: none; border: none; color: #6c757d; font-size: 1.3rem; line-height: 1; cursor: pointer; flex-shrink: 0; }

/* ── Input area ──────────────────────────────────────────────────────────── */
.ath-chat-input-wrap.drag-over {
    border: 2px dashed #007bff;
    background: rgba(0,123,255,.05);
}
.ath-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 6px 6px;
    /* Safe area: lifts input above iPhone home bar, like WhatsApp */
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
    position: relative;
}
/* When keyboard is open, home bar is hidden — no safe-area gap needed */
.keyboard-open .ath-chat-input-wrap {
    padding-bottom: 6px;
}
.ath-chat-input-wrap textarea {
    flex: 1;
    resize: none;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 10px 12px;
    font-size: .92rem;
    max-height: 120px;
    overflow-y: auto;
    font-family: inherit;
}
.ath-chat-input-wrap textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,.2);
}
.ath-chat-input-actions { display: flex; flex-direction: row; gap: 8px; align-items: stretch; }
.ath-chat-input-actions .btn { height: 42px; }
@media (max-width: 575px) {
    .ath-chat-input-actions { flex-direction: column; gap: 4px; }
    .ath-chat-input-actions .btn { height: 36px; }
    .ath-send-label { display: none; }
}

/* ── Group info side panel ───────────────────────────────────────────────── */
.ath-group-info-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 280px;
    background: #fff;
    border-left: 1px solid #dee2e6;
    transform: translateX(100%);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .2s ease;
    z-index: 10;
    overflow: hidden;
    border-radius: 0 6px 6px 0;
}
.ath-group-info-panel.open { transform: translateX(0); }

/* ── Group photo picker ──────────────────────────────────────────────────── */
.ath-group-photo-picker {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #e9ecef;
    border: 2px dashed #adb5bd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s;
}
.ath-group-photo-picker:hover { border-color: #007bff; }
.ath-group-photo-picker img   { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Modal user list ─────────────────────────────────────────────────────── */
.ath-modal-user-list { max-height: 300px; overflow-y: auto; }
.user-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background .12s;
}
.user-option:hover    { background: #f8f9fa; }
.user-option.selected { background: #cfe2ff; }
.user-option .ml-auto { margin-left: auto; }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.ath-img-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    cursor: default;
    overflow: hidden;
}
.ath-img-lightbox.open     { display: flex; }
.ath-img-lightbox.lb-zoomed  { cursor: grab; }
.ath-img-lightbox.lb-dragging { cursor: grabbing !important; }
.ath-img-lightbox img {
    max-width: 90vw; max-height: 85vh; border-radius: 4px;
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
}
.ath-lb-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,.5);
    border: none; color: #fff;
    width: 48px; height: 48px; border-radius: 50%;
    font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
    z-index: 1;
}
.ath-lb-nav:hover { background: rgba(0,0,0,.8); }
.ath-lb-prev { left: 16px; }
.ath-lb-next { right: 16px; }
.ath-lb-counter {
    position: absolute;
    bottom: 16px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,.75);
    font-size: .85rem;
    background: rgba(0,0,0,.4);
    padding: 3px 12px; border-radius: 20px;
    pointer-events: none;
}
.ath-lb-zoom-hint {
    position: absolute;
    top: 14px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,.9);
    font-size: .82rem;
    background: rgba(0,0,0,.55);
    padding: 3px 14px; border-radius: 20px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
    white-space: nowrap;
    z-index: 2;
}
.ath-lb-zoom-hint.show { opacity: 1; }
.ath-lb-close {
    position: absolute;
    top: 14px; right: 16px;
    background: rgba(0,0,0,.5);
    border: none; color: #fff;
    width: 38px; height: 38px; border-radius: 50%;
    font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
    z-index: 3;
}
.ath-lb-close:hover { background: rgba(0,0,0,.8); }

.ath-msg-video-preview {
    position: relative;
    display: inline-block;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    max-width: 240px;
    margin-bottom: 4px;
    background: #000;
    vertical-align: top;
}
.ath-msg-video-preview video {
    display: block;
    width: 240px;
    max-height: 160px;
    object-fit: cover;
    pointer-events: none;
}
.ath-msg-video-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.32);
    transition: background .15s;
}
.ath-msg-video-preview:hover .ath-msg-video-play { background: rgba(0,0,0,.52); }
.ath-video-dl {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    font-size: .75rem;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ath-video-dl:hover { color: #fff; text-decoration: underline; }
.ath-msg-bubble.theirs .ath-video-dl { color: rgba(248,249,250,.7); }
.ath-msg-bubble.theirs .ath-video-dl:hover { color: #f8f9fa; }
.ath-msg-video-play i {
    font-size: 2.8rem;
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
}

/* ── chat.php standalone (mobile) ────────────────────────────────────────── */
.ath-chat-standalone {
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    height: calc(100vh - 200px);
    background: #fff;
}
.ath-chat-standalone .ath-chat-messages { flex: 1; overflow-y: auto; padding: 8px 4px; background: #fff; }

/* On mobile: go edge-to-edge, no border/radius */
@media (max-width: 767px) {
    .ath-chat-standalone {
        border: none;
        border-radius: 0;
    }
    .ath-chat-standalone .ath-chat-messages { padding: 6px 4px; }
}

/* Prevent iOS auto-zoom on input focus (triggered when font-size < 16px) */
.ath-chat-standalone input,
.ath-chat-standalone textarea,
.ath-chat-standalone select { font-size: 16px !important; }

/* Panel header (dark bar at top of chat.php) */
.ath-chat-panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: #343a40;
    color: #fff;
    flex-shrink: 0;
}
.ath-chat-panel-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.ath-chat-panel-title strong {
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    line-height: 1.25;
}
.ath-chat-panel-title span {
    font-size: .73rem;
    opacity: .65;
    line-height: 1.3;
}
.ath-chat-icon-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.75);
    font-size: .8rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .12s, color .12s;
    padding: 0;
    text-decoration: none;
}
.ath-chat-icon-btn:hover,
.ath-chat-icon-btn.active { background: rgba(255,255,255,.18); color: #fff; }
.ath-chat-icon-btn.borderless { border-color: transparent; }

/* Mobile action buttons (New Chat / New Group) in the panel header */
.ath-mob-action-btn {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 6px;
    color: #fff;
    font-size: .75rem;
    padding: 4px 8px;
    white-space: nowrap;
    cursor: pointer;
    height: 32px;
    display: flex;
    align-items: center;
    transition: background .12s;
}
.ath-mob-action-btn:hover { background: rgba(255,255,255,.25); }

/* Project info bar (below header on project-linked chats) */
.ath-chat-project-bar {
    display: none;
    background: #454d55;
    color: #fff;
    border-bottom: 1px solid rgba(0,0,0,.2);
    padding: 5px 12px;
    font-size: .78rem;
    line-height: 1.8;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 4px;
}
.ath-chat-project-bar.visible { display: flex; align-items: center; }
.ath-chat-project-bar .badge { font-size: .7rem; }
.ath-bar-doc-link { color: rgba(255,255,255,.9); text-decoration: none; font-weight: 500; transition: color .12s; }
.ath-bar-doc-link:hover { color: #fff; text-decoration: underline; }
/* On mobile, doc links wrap to their own line in the project bar */
.ath-bar-docs-row { width: 100%; display: flex; gap: 12px; padding-top: 3px; flex-wrap: wrap; }

/* In-chat search bar */
.ath-chat-search-bar {
    display: none;
    flex-direction: column;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}
.ath-chat-search-bar.open { display: flex; }
.ath-chat-search-bar-input { padding: 8px 10px; }
.ath-chat-search-results {
    max-height: 200px;
    overflow-y: auto;
}

/* ── Floating chat widget ────────────────────────────────────────────────── */
/* #chat-float-btn positioning handled by #chat-float-btn-group wrapper in footer.php */

#chat-float-panel {
    position: fixed;
    bottom: 80px;
    left: 24px;
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    height: 320px;
    min-height: 320px;
    max-height: 320px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0;
    box-shadow: 0 4px 24px rgba(0,0,0,.15);
    z-index: 1050;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
#chat-float-panel.open { display: flex; }

.chat-float-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #17a2b8;
    color: #fff;
    font-weight: 600;
    font-size: .88rem;
}
.chat-float-list { flex: 1; overflow-y: auto; }
.chat-float-panel-footer {
    padding: 8px 14px;
    border-top: 1px solid #dee2e6;
    text-align: center;
    font-size: .82rem;
}
.chat-float-panel-footer a { color: #17a2b8; text-decoration: none; }

.chat-float-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    text-decoration: none;
    color: #212529;
    border-bottom: 1px solid #f0f0f0;
    transition: background .12s;
}
.chat-float-item:hover { background: #f8f9fa; text-decoration: none; color: #212529; }

.chat-float-item-info    { flex: 1; min-width: 0; }
.chat-float-item-name    { font-size: .85rem; font-weight: 600; color: #212529; display: flex; align-items: center; }
.chat-float-item-preview { font-size: .75rem; color: #6c757d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    #chat-float-panel  { width: calc(100vw - 40px); }
}

/* ── @mention highlight ──────────────────────────────────────────────────── */
.ath-mention {
    color: #0d6efd;
    font-weight: 600;
    background: rgba(13,110,253,.08);
    padding: 0 2px;
    border-radius: 3px;
}
.ath-msg-bubble.mine .ath-mention {
    color: #fff;
    background: rgba(255,255,255,.25);
}

/* ── @mention autocomplete dropdown ─────────────────────────────────────── */
.ath-mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 -4px 16px rgba(0,0,0,.1);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 4px;
}
.ath-mention-opt {
    padding: 8px 12px;
    font-size: .85rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.ath-mention-opt:last-child { border-bottom: none; }
.ath-mention-opt:hover { background: #f0f4ff; }

/* Slash command options inside the mention dropdown */
.ath-cmd-opt  { display: flex; align-items: center; gap: 8px; }
.ath-cmd-icon { width: 16px; text-align: center; color: #6c757d; flex-shrink: 0; }
.ath-cmd-name { font-weight: 600; font-size: .85rem; flex-shrink: 0; }
.ath-cmd-desc { color: #6c757d; font-size: .78rem; }
body.ath-chats-dark .ath-cmd-desc { color: #94a3b8; }
body.ath-chats-dark .ath-cmd-icon { color: #94a3b8; }

/* ── Athena record inline links ──────────────────────────────────────────── */
.ath-link-ref {
    display: inline-flex;
    align-items: center;
    background: #e9f0ff;
    color: #2c5fcd;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #c4d4f5;
}
.ath-link-ref:hover { background: #d0e0ff; color: #1a3fa0; text-decoration: none; }

/* ── Linked record badge in chat header ──────────────────────────────────── */
.ath-linked-ref-badge {
    display: inline-flex;
    align-items: center;
    font-size: .72rem;
    font-weight: 600;
    background: rgba(255,255,255,.2);
    color: rgba(255,255,255,.9);
    padding: 1px 7px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.3);
    text-decoration: none;
    margin-top: 2px;
}
.ath-linked-ref-badge:hover { background: rgba(255,255,255,.3); color: #fff; text-decoration: none; }

/* ── Message search panel ────────────────────────────────────────────────── */
#chat-search-toggle.active { background: rgba(255,255,255,.3); }
.ath-search-result {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}
.ath-search-result:hover { background: #f8f9fa; }
.ath-search-result-chat  { font-size: .75rem; font-weight: 700; color: #007bff; }
.ath-search-result-body  { font-size: .82rem; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ath-search-result-date  { font-size: .7rem; color: #adb5bd; }

.ath-search-section-hdr {
    padding: 4px 12px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #6c757d;
    background: #f0f2f5;
    border-bottom: 1px solid #e9ecef;
}
.ath-search-chat-result .ath-search-result-chat { color: #17a2b8; }

/* ── System messages (member added, etc.) ────────────────────────────────── */
.ath-msg-system-row { text-align: center; margin: 8px 0; }
.ath-msg-system-text {
    display: inline-block;
    background: #e9ecef;
    color: #6c757d;
    font-size: .75rem;
    padding: 3px 14px;
    border-radius: 12px;
    font-style: italic;
}
.ath-msg-system-text.sys-add    { background: #d1e7dd; color: #0a5c36; font-style: normal; }
.ath-msg-system-text.sys-remove { background: #f8d7da; color: #842029; font-style: normal; }

/* ── Bot (Athena AI) message styles ──────────────────────────────────────── */
.ath-bot-avatar { font-size: .8rem !important; }
.ath-bot-name   { color: #6f42c1 !important; font-style: italic; }
.ath-msg-bubble.theirs.bot-bubble {
    background: #6f42c1;
    border: none;
}
.ath-msg-bubble.theirs.bot-bubble .ath-msg-bubble-body { color: #fff; }
.ath-msg-bubble.theirs.bot-bubble .ath-msg-time { color: rgba(255,255,255,.6); }
.ath-msg-bubble.theirs.bot-bubble .ath-msg-name { color: rgba(255,255,255,.75); }

/* AI thinking animation */
.ath-bot-thinking {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px;
}
.ath-bot-thinking span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,.8);
    animation: bot-bounce 1.2s infinite ease-in-out;
}
.ath-bot-thinking span:nth-child(2) { animation-delay: .2s; }
.ath-bot-thinking span:nth-child(3) { animation-delay: .4s; }
@keyframes bot-bounce {
    0%, 80%, 100% { transform: scale(.6); opacity: .4; }
    40%           { transform: scale(1);  opacity: 1; }
}

/* ── Swipe to archive (mobile only) ─────────────────────────────────────── */
.ath-swipe-action { display: none; }

@media (max-width: 767px) {
    .ath-swipe-wrap { position: relative; overflow: hidden; }

    .ath-swipe-action {
        position: absolute;
        right: 0; top: 0; bottom: 0;
        width: 80px;
        background: #e67e22;
        color: #fff;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: .72rem;
        font-weight: 700;
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    .ath-swipe-action i { font-size: 1.3rem; }
    .ath-swipe-action.unarchive { background: #28a745; }

    .ath-swipe-wrap .ath-chat-item {
        position: relative;
        z-index: 1;
        background: #fff;
        will-change: transform;
        -webkit-tap-highlight-color: transparent;
    }
    .ath-swipe-wrap .ath-chat-item:hover  { background: #f8f9fa; }
    .ath-swipe-wrap .ath-chat-item.active { background: #cfe2ff; }
}

/* ── @mention (current user) highlight ──────────────────────────────────── */
.ath-mention.me {
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    font-weight: 700;
    padding: 0 3px;
    border-radius: 3px;
}
.ath-msg-bubble.mine .ath-mention.me {
    color: #fff;
    background: rgba(255,255,255,.35);
    border-color: rgba(255,255,255,.5);
}

/* ── Pinned message bar ───────────────────────────────────────────────────── */
#chat-pinned-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #fff8e1;
    border-bottom: 1px solid #ffe082;
    font-size: .8rem;
    color: #555;
    flex-shrink: 0;
    cursor: pointer;
}
#chat-pinned-bar.visible { display: flex; }
#chat-pinned-bar i.fa-thumbtack { color: #e09800; font-size: .85rem; flex-shrink: 0; }
#chat-pinned-bar .ath-pinned-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
#chat-pinned-bar .ath-pinned-dismiss { background: none; border: none; color: #aaa; font-size: .9rem; padding: 0 4px; cursor: pointer; flex-shrink: 0; }
#chat-pinned-bar .ath-pinned-dismiss:hover { color: #555; }

/* ── Unread divider ──────────────────────────────────────────────────────── */
.ath-unread-divider {
    text-align: center;
    margin: 12px 0;
    position: relative;
}
.ath-unread-divider::before {
    content: '';
    position: absolute;
    top: 50%; left: 0; right: 0;
    height: 1px;
    background: #007bff;
    opacity: .4;
}
.ath-unread-divider span {
    position: relative;
    background: #e7f0ff;
    color: #007bff;
    padding: 2px 14px;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    border: 1px solid #b8d0ff;
}

/* ── Unread jump button ───────────────────────────────────────────────────── */
#chat-unread-jump {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 18px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,123,255,.4);
    z-index: 20;
    white-space: nowrap;
    display: none;
    animation: unread-jump-in .2s ease;
}
@keyframes unread-jump-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#chat-unread-jump:hover { background: #0069d9; }

/* ── Muted icon in chat list ────────────────────────────────────────────── */
.ath-muted-icon {
    color: #adb5bd;
    font-size: .7rem;
    margin-left: 4px;
}

/* ── Sound button active state ──────────────────────────────────────────── */
#chat-sound-btn.active { color: #fff; background: rgba(255,255,255,.2); }

/* ── Read list popover ───────────────────────────────────────────────────── */
.ath-read-popover {
    position: absolute;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    padding: 10px 14px;
    min-width: 160px;
    max-width: 240px;
    z-index: 200;
    font-size: .8rem;
}
.ath-read-popover h6 { font-size: .76rem; font-weight: 700; color: #6c757d; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.ath-read-popover-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.ath-read-popover-item span { color: #333; }
.ath-read-popover-close { position: absolute; top: 6px; right: 8px; background: none; border: none; color: #adb5bd; font-size: .9rem; cursor: pointer; padding: 0; }
.ath-read-popover-close:hover { color: #495057; }

/* ── Message highlight flash (scroll-to) ────────────────────────────────── */
@keyframes msg-highlight-flash {
    0%, 100% { background: transparent; }
    30%      { background: rgba(255, 193, 7, .35); }
}
.ath-msg-row.ath-msg-highlight .ath-msg-bubble {
    animation: msg-highlight-flash .8s ease 1;
}

/* ── Link preview card ───────────────────────────────────────────────────── */
.ath-link-preview {
    display: block;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 6px;
    text-decoration: none;
    background: #f8f9fa;
    max-width: 280px;
    transition: box-shadow .15s;
}
.ath-link-preview:hover { box-shadow: 0 2px 10px rgba(0,0,0,.12); text-decoration: none; }
.ath-link-preview img {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    display: block;
}
.ath-link-preview-body { padding: 8px 10px; }
.ath-link-preview-title {
    font-size: .8rem;
    font-weight: 700;
    color: #212529;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    margin-bottom: 3px;
}
.ath-link-preview-desc {
    font-size: .72rem;
    color: #6c757d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    margin-bottom: 4px;
}
.ath-link-preview-host {
    font-size: .68rem;
    color: #adb5bd;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ath-msg-bubble.mine .ath-link-preview { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }
.ath-msg-bubble.mine .ath-link-preview-title { color: #fff; }
.ath-msg-bubble.mine .ath-link-preview-desc  { color: rgba(255,255,255,.7); }
.ath-msg-bubble.mine .ath-link-preview-host  { color: rgba(255,255,255,.5); }

/* ── User/company section header (inside modals) ────────────────────────── */
.ath-user-section-hdr {
    padding: 5px 10px 3px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6c757d;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

/* ── Dark mode — mobile only (toggled via body.ath-chats-dark) ──────────── */
@media (max-width: 767px) {

/* Page shell & Bootstrap overrides */
body.ath-chats-dark { background: #141618 !important; color: #e2e8f0 !important; }
body.ath-chats-dark #ath-chats-title h1 { color: #e2e8f0 !important; }
body.ath-chats-dark .breadcrumb         { background: transparent !important; }
body.ath-chats-dark .breadcrumb-item a  { color: #94a3b8 !important; }
body.ath-chats-dark .breadcrumb-item.active,
body.ath-chats-dark .breadcrumb-item + .breadcrumb-item::before { color: #64748b !important; }

/* Cards */
body.ath-chats-dark #chats-sidebar      { background: #1e2226 !important; border-color: #2e3338 !important; }
body.ath-chats-dark #chats-panel > .card { background: #1e2226 !important; border-color: #2e3338 !important; }
body.ath-chats-dark #chats-sidebar .card-header { background: #161b22 !important; border-color: #2e3338 !important; }
body.ath-chats-dark #chat-header        { background: #161b22 !important; border-color: #2e3338 !important; }

/* White inline areas */
body.ath-chats-dark #chats-sidebar-body,
body.ath-chats-dark #chat-content-wrap,
body.ath-chats-dark #chat-empty,
body.ath-chats-dark #chat-not-found    { background: #141618 !important; color: #e2e8f0 !important; }

/* Forms */
body.ath-chats-dark .form-control          { background: #2c3136 !important; border-color: #3a4048 !important; color: #e2e8f0 !important; }
body.ath-chats-dark .form-control::placeholder { color: #64748b !important; }
body.ath-chats-dark .input-group-text      { background: #22272e !important; border-color: #3a4048 !important; color: #94a3b8 !important; }

/* Modals */
body.ath-chats-dark .modal-content        { background: #1e2226 !important; border-color: #2e3338 !important; color: #e2e8f0 !important; }
body.ath-chats-dark .modal-header,
body.ath-chats-dark .modal-footer         { border-color: #2e3338 !important; }
body.ath-chats-dark .close                { color: #94a3b8 !important; }
body.ath-chats-dark .list-group-item      { background: #1e2226 !important; border-color: #2e3338 !important; color: #e2e8f0 !important; }
body.ath-chats-dark .ath-group-photo-picker { background: #2c3136; border-color: #4a5160; }

/* Notification prompt bar */
body.ath-chats-dark #notif-status-bar.notif-status-on      { background: #0d2e18; border-bottom-color: #1a4d2e; color: #75e09a; }
body.ath-chats-dark #notif-status-bar.notif-status-off     { background: #2e2200; border-bottom-color: #5c4400; color: #ffc107; }
body.ath-chats-dark #notif-status-bar.notif-status-error   { background: #2e1500; border-bottom-color: #7c3a00; color: #fd9d56; }
body.ath-chats-dark #notif-status-bar.notif-status-blocked { background: #2e0d0f; border-bottom-color: #721c24; color: #f5a8ae; }

/* Chat list sidebar */
body.ath-chats-dark .ath-chat-filter-tabs  { background: #1a1d20; border-bottom-color: #2e3338; }
body.ath-chats-dark .ath-chat-filter-tab   { color: #94a3b8; }
body.ath-chats-dark .ath-chat-filter-tab:hover  { color: #60a5fa; }
body.ath-chats-dark .ath-chat-filter-tab.active { color: #60a5fa; border-bottom-color: #60a5fa; }

body.ath-chats-dark .ath-chat-item         { border-bottom-color: #2e3338; color: #e2e8f0; }
body.ath-chats-dark .ath-chat-item:hover   { background: #22272e; }
body.ath-chats-dark .ath-chat-item.active  { background: #1c3a5e; }
body.ath-chats-dark .ath-chat-item-name    { color: #e2e8f0; }
body.ath-chats-dark .ath-chat-item-preview { color: #94a3b8; }
body.ath-chats-dark .ath-chat-item-time    { color: #64748b; }

/* Message area */
body.ath-chats-dark .ath-chat-messages { background: #141618; }
body.ath-chats-dark .ath-msg-date-divider::before { background: #2e3338; }
body.ath-chats-dark .ath-msg-date-divider span    { background: #141618; color: #64748b; }
body.ath-chats-dark .ath-msg-name { color: #94a3b8; }

/* Bubbles */
body.ath-chats-dark .ath-msg-bubble.theirs        { background: #2c3136; color: #e2e8f0; }
body.ath-chats-dark .ath-msg-bubble.theirs .ath-msg-name { color: #94a3b8; }
body.ath-chats-dark .ath-msg-bubble.theirs .ath-msg-time { color: #64748b; }
body.ath-chats-dark .ath-msg-bubble.deleted       { background: #22272e; color: #64748b; border-color: #2e3338; }
body.ath-chats-dark .ath-msg-time   { color: #64748b; }
body.ath-chats-dark .ath-msg-edited { color: #64748b; }
body.ath-chats-dark .ath-msg-act-btn { color: #64748b; }
body.ath-chats-dark .ath-msg-act-btn:hover { color: #94a3b8; }

/* Reactions */
body.ath-chats-dark .ath-reaction-btn           { background: #22272e; border-color: #3a4048; color: #e2e8f0; box-shadow: none; }
body.ath-chats-dark .ath-reaction-btn:hover     { background: #2c3136; border-color: #4a5568; }
body.ath-chats-dark .ath-reaction-btn.mine-react { background: #1c3a5e; border-color: #3b82f6; }

/* Presence bar */
body.ath-chats-dark .ath-chat-presence { background: #1a1d20; border-top-color: #2e3338; color: #94a3b8; }

/* Reply & attachment previews */
body.ath-chats-dark .ath-reply-preview      { background: #1c2c42; border-top-color: #1e3a5f; }
body.ath-chats-dark .ath-reply-preview-body { color: #e2e8f0; }
body.ath-chats-dark .ath-att-preview        { background: #22272e; border-top-color: #2e3338; color: #e2e8f0; }
body.ath-chats-dark #paste-preview          { background: #1c2433; border-top-color: #2e3e54; }
body.ath-chats-dark #paste-preview-label    { color: #94a3b8; }
body.ath-chats-dark #paste-cancel-btn       { color: #64748b; }

/* Input area */
body.ath-chats-dark .ath-chat-input-wrap          { background: #1e2226; border-top-color: #2e3338; }
body.ath-chats-dark .ath-chat-input-wrap textarea  { background: #2c3136; border-color: #3a4048; color: #e2e8f0; }
body.ath-chats-dark .ath-chat-input-wrap textarea::placeholder { color: #64748b; }
body.ath-chats-dark .ath-chat-input-wrap textarea:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.25); }

/* Group info panel */
body.ath-chats-dark .ath-group-info-panel { background: #1e2226; border-left-color: #2e3338; }

/* Modal user list */
body.ath-chats-dark .user-option:hover    { background: #22272e; }
body.ath-chats-dark .user-option.selected { background: #1c3a5e; }

/* Search bar */
body.ath-chats-dark .ath-chat-search-bar { background: #1e2226; border-bottom-color: #2e3338; }

/* @mention dropdown */
body.ath-chats-dark .ath-mention-dropdown { background: #22272e; border-color: #2e3338; }
body.ath-chats-dark .ath-mention-opt      { border-bottom-color: #2e3338; color: #e2e8f0; }
body.ath-chats-dark .ath-mention-opt:hover { background: #1c3a5e; }

/* Athena record links */
body.ath-chats-dark .ath-link-ref       { background: #1c2c42; color: #93c5fd; border-color: #1e3a5f; }
body.ath-chats-dark .ath-link-ref:hover { background: #1e3a5f; color: #bfdbfe; }

/* Search results */
body.ath-chats-dark .ath-search-result       { border-bottom-color: #2e3338; }
body.ath-chats-dark .ath-search-result:hover { background: #22272e; }
body.ath-chats-dark .ath-search-result-body  { color: #e2e8f0; }
body.ath-chats-dark .ath-search-section-hdr  { background: #1a1d20; color: #64748b; border-bottom-color: #2e3338; }

/* System messages */
body.ath-chats-dark .ath-msg-system-text           { background: #22272e; color: #94a3b8; }
body.ath-chats-dark .ath-msg-system-text.sys-add   { background: #14302a; color: #6ee7b7; }
body.ath-chats-dark .ath-msg-system-text.sys-remove { background: #3b1a1f; color: #fca5a5; }

/* Bot bubbles */
body.ath-chats-dark .ath-msg-bubble.theirs.bot-bubble { background: #5a32a3 !important; color: #fff !important; }
body.ath-chats-dark .ath-msg-bubble.theirs.bot-bubble .ath-msg-bubble-body { color: #fff !important; }
body.ath-chats-dark .ath-msg-bubble.theirs.bot-bubble .ath-msg-time { color: rgba(255,255,255,.55) !important; }
body.ath-chats-dark .ath-bot-name { color: #a78bfa !important; }
body.ath-chats-dark .ath-bot-thinking span { background: rgba(255,255,255,.8); }

/* Standalone chat */
body.ath-chats-dark .ath-chat-standalone { background: #1a1d20 !important; border-color: #2e3338 !important; }
body.ath-chats-dark .ath-chat-standalone .ath-chat-messages { background: #141618 !important; }

/* Swipe action dark overrides */
body.ath-chats-dark .ath-swipe-action            { background: #c0632a; }
body.ath-chats-dark .ath-swipe-action.unarchive  { background: #1a7d34; }
body.ath-chats-dark .ath-swipe-wrap .ath-chat-item        { background: #1e2226; }
body.ath-chats-dark .ath-swipe-wrap .ath-chat-item:hover  { background: #22272e; }
body.ath-chats-dark .ath-swipe-wrap .ath-chat-item.active { background: #1c3a5e; }

/* Context popup dark overrides */
body.ath-chats-dark #ath-msg-ctx-popup       { background: #1e2226; }
body.ath-chats-dark .ath-ctx-reactions       { border-bottom-color: #2e3338; }
body.ath-chats-dark .ath-ctx-action          { border-bottom-color: #2e3338; color: #e2e8f0; }
body.ath-chats-dark .ath-ctx-action i        { color: #94a3b8; }
body.ath-chats-dark .ath-ctx-action:hover    { background: #22272e; }
body.ath-chats-dark .ath-ctx-action.danger   { color: #f87171; }
body.ath-chats-dark .ath-ctx-action.danger i { color: #f87171; }

/* @mention (current user) in dark mode */
body.ath-chats-dark .ath-mention.me { color: #fde68a; background: #44380a; border-color: #7a5e0e; }
body.ath-chats-dark .ath-msg-bubble.mine .ath-mention.me { color: #fff; background: rgba(255,255,255,.3); border-color: rgba(255,255,255,.45); }

/* Pinned bar dark */
body.ath-chats-dark #chat-pinned-bar { background: #27220a; border-bottom-color: #5c4700; color: #e2e8f0; }
body.ath-chats-dark #chat-pinned-bar i.fa-thumbtack { color: #fbbf24; }
body.ath-chats-dark #chat-pinned-bar .ath-pinned-dismiss { color: #64748b; }
body.ath-chats-dark #chat-pinned-bar .ath-pinned-dismiss:hover { color: #94a3b8; }

/* Unread divider dark */
body.ath-chats-dark .ath-unread-divider span { background: #1c3a5e; color: #60a5fa; border-color: #1e4a7e; }
body.ath-chats-dark .ath-unread-divider::before { background: #3b82f6; }

/* Read popover dark */
body.ath-chats-dark .ath-read-popover { background: #22272e; border-color: #2e3338; color: #e2e8f0; }
body.ath-chats-dark .ath-read-popover h6 { color: #64748b; }
body.ath-chats-dark .ath-read-popover-item span { color: #e2e8f0; }
body.ath-chats-dark .ath-read-popover-close { color: #64748b; }
body.ath-chats-dark .ath-read-popover-close:hover { color: #94a3b8; }

/* Link preview dark */
body.ath-chats-dark .ath-link-preview { background: #22272e; border-color: #2e3338; }
body.ath-chats-dark .ath-link-preview-title { color: #e2e8f0; }
body.ath-chats-dark .ath-link-preview-desc  { color: #94a3b8; }
body.ath-chats-dark .ath-link-preview-host  { color: #64748b; }

body.ath-chats-dark .ath-user-section-hdr { background: #1a1d20 !important; color: #64748b !important; border-top-color: #2e3338 !important; border-bottom-color: #2e3338 !important; }

} /* end @media (max-width: 767px) dark mode */
