/* Live support chat: floating widget (company users) + inbox (platform administrators). Logical properties keep it correct in RTL. */
.chat-toggle { position: fixed; inset-block-end: 1.25rem; inset-inline-end: 1.25rem; z-index: 1050; width: 3.4rem; height: 3.4rem; border: 0; border-radius: 50%;
    background: var(--bs-primary, #2563eb); color: #fff; font-size: 1.4rem; box-shadow: 0 6px 20px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.chat-toggle:hover { color: #fff; filter: brightness(1.08); }
.chat-badge { position: absolute; inset-block-start: -4px; inset-inline-end: -4px; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem; border-radius: 1rem; background: #dc3545; color: #fff; font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.chat-badge.d-none { display: none !important; }

.chat-panel { position: fixed; inset-block-end: 5.5rem; inset-inline-end: 1.25rem; z-index: 1050; width: min(380px, calc(100vw - 2rem)); height: min(540px, calc(100vh - 8rem));
    display: flex; flex-direction: column; background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #212529); border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .9rem; box-shadow: 0 12px 40px rgba(0,0,0,.28); overflow: hidden; }
.chat-panel.d-none { display: none !important; }
.chat-head { background: var(--bs-primary, #2563eb); color: #fff; padding: .75rem 1rem; display: flex; justify-content: space-between; align-items: flex-start; }

.chat-messages { flex: 1; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .5rem; background: var(--bs-tertiary-bg, #f4f6f9); min-height: 0; }
.chat-msg { display: flex; }
.chat-msg.mine { justify-content: flex-end; }
.chat-bubble { max-width: 82%; padding: .45rem .7rem; border-radius: .8rem; background: var(--bs-body-bg, #fff); border: 1px solid var(--bs-border-color, #dee2e6); word-wrap: break-word; overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { background: var(--bs-primary, #2563eb); color: #fff; border-color: transparent; }
.chat-sender { font-size: .72rem; font-weight: 600; opacity: .75; }
.chat-text { white-space: pre-wrap; }
.chat-time { font-size: .68rem; opacity: .65; text-align: end; margin-top: .15rem; }
.chat-img { max-width: 100%; max-height: 220px; border-radius: .5rem; display: block; margin: .25rem 0; }
.chat-file { display: inline-block; margin: .2rem 0; font-size: .85rem; color: inherit; text-decoration: underline; }
.chat-note { padding: .4rem .75rem; font-size: .8rem; background: #fff3cd; color: #664d03; }

.chat-form { padding: .6rem; border-top: 1px solid var(--bs-border-color, #dee2e6); background: var(--bs-body-bg, #fff); }
.chat-form textarea { resize: none; max-height: 7rem; }
.chat-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--bs-tertiary-bg, #eef1f5); border-radius: 1rem; padding: .15rem .6rem; font-size: .8rem; margin-bottom: .35rem; }
.chat-error:empty { display: none; }

/* Inbox */
.inbox { display: flex; height: calc(100vh - 11rem); min-height: 420px; overflow: hidden; }
.inbox-list { width: 320px; max-width: 40%; overflow-y: auto; border-inline-end: 1px solid var(--bs-border-color, #dee2e6); flex-shrink: 0; }
.conv-item { display: block; width: 100%; text-align: start; padding: .65rem .85rem; border: 0; border-bottom: 1px solid var(--bs-border-color, #eee); background: transparent; color: inherit; }
.conv-item:hover { background: var(--bs-tertiary-bg, #f4f6f9); }
.conv-item.active { background: var(--bs-primary-bg-subtle, #e7efff); }
.conv-item.closed { opacity: .6; }
.inbox-thread { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.inbox-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.inbox-pane.d-none { display: none !important; }
.inbox-head { display: flex; justify-content: space-between; align-items: center; padding: .65rem 1rem; border-bottom: 1px solid var(--bs-border-color, #dee2e6); }
@media (max-width: 768px) { .inbox { flex-direction: column; height: auto; } .inbox-list { width: 100%; max-width: none; max-height: 220px; border-inline-end: 0; border-bottom: 1px solid var(--bs-border-color, #dee2e6); } .inbox-pane { min-height: 480px; } }
