/* ============================================================
   COMMUNICATION CENTER – Unified Inbox
   ============================================================ */

/* ── Shell ── */
.inbox-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px);
    background: #f1f5f9;
    overflow: hidden;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Top Bar ── */
.inbox-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 52px;
    min-height: 52px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    z-index: 10;
}

.inbox-topbar-left {
    display: flex;
    align-items: center;
    gap: .625rem;
}

.inbox-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.inbox-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    letter-spacing: -.02em;
}

.inbox-topbar-right {
    flex-shrink: 0;
}

.inbox-user {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    font-size: .8125rem;
    font-weight: 500;
    color: #64748b;
    padding: .375rem .75rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

/* ── Body: Split Layout ── */
.inbox-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR (Left Panel)
   ============================================================ */

.inbox-sidebar {
    width: 360px;
    min-width: 360px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e2e8f0;
}

/* ── Sidebar Header with Search ── */
.inbox-sidebar-header {
    padding: .875rem 1rem .625rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    background: #fff;
}

.inbox-sidebar-title-row {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.inbox-sidebar-label {
    font-size: .8125rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.inbox-total-badge {
    font-size: .625rem;
    font-weight: 700;
    color: #6366f1;
    background: rgba(99,102,241,.08);
    padding: 2px 7px;
    border-radius: 10px;
    line-height: 1.3;
}

/* ── Search ── */
.inbox-search {
    position: relative;
    width: 100%;
}

.inbox-search-icon {
    position: absolute;
    left: .625rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 1.1rem !important;
}

.inbox-search-input {
    width: 100%;
    height: 34px;
    padding: 0 2rem 0 2.125rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #1e293b;
    font-size: .8125rem;
    font-family: inherit;
    transition: all .15s;
}

.inbox-search-input::placeholder { color: #94a3b8; }

.inbox-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.08);
    background: #fff;
}

.inbox-search-clear {
    position: absolute;
    right: .375rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #94a3b8;
    border-radius: 4px;
    display: flex;
    line-height: 0;
}

.inbox-search-clear:hover { color: #475569; }

/* ── Channel Filter Chips ── */
.inbox-filters {
    display: flex;
    gap: 5px;
    padding: .5rem 1rem .625rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.inbox-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: transparent;
    color: #64748b;
    font-size: .6875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
}

.inbox-chip:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

.inbox-chip-active {
    background: #1e293b;
    color: #fff;
    border-color: #1e293b;
}

.inbox-chip-active:hover {
    background: #334155;
    color: #fff;
    border-color: #334155;
}

.inbox-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ch-sms   { background: #3b82f6; }
.ch-wa    { background: #22c55e; }
.ch-voice { background: #8b5cf6; }

/* ── Contact Scroll Area ── */
.inbox-contacts-scroll {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.inbox-contacts-scroll::-webkit-scrollbar { width: 4px; }
.inbox-contacts-scroll::-webkit-scrollbar-track { background: transparent; }
.inbox-contacts-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* ── Contact Card ── */
.inbox-contact {
    display: flex;
    gap: .625rem;
    padding: .625rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    border-left: 3px solid transparent;
    transition: all .1s ease;
}

.inbox-contact:hover {
    background: #f8fafc;
}

.inbox-contact-active {
    background: rgba(99, 102, 241, .05);
    border-left-color: #6366f1;
}

.inbox-contact-active:hover {
    background: rgba(99, 102, 241, .07);
}

.inbox-contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.av-blue    { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.av-emerald { background: linear-gradient(135deg, #10b981, #059669); }
.av-violet  { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.av-amber   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.av-rose    { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.av-cyan    { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.av-indigo  { background: linear-gradient(135deg, #6366f1, #4f46e5); }

.inbox-contact-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inbox-contact-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inbox-contact-phone {
    font-size: .8125rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inbox-contact-time {
    font-size: .625rem;
    color: #94a3b8;
    flex-shrink: 0;
    margin-left: .5rem;
    font-weight: 500;
}

.inbox-contact-row2 {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

.inbox-channel-tag {
    font-size: .5625rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: .04em;
    line-height: 1.5;
}

.inbox-channel-tag.ch-sms {
    background: rgba(59,130,246,.08);
    color: #3b82f6;
}

.inbox-channel-tag.ch-wa {
    background: rgba(34,197,94,.08);
    color: #16a34a;
}

.inbox-channel-tag.ch-voice {
    background: rgba(139,92,246,.08);
    color: #7c3aed;
}

.inbox-contact-stat {
    font-size: .5625rem;
    font-weight: 600;
    color: #94a3b8;
    margin-left: 2px;
}

.inbox-contact-row3 {
    display: flex;
}

.inbox-contact-preview {
    font-size: .75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* ── Skeleton ── */
.inbox-contact-skeleton {
    display: flex;
    gap: .625rem;
    padding: .625rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.inbox-contact-skeleton-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 2px;
}

/* ── Empty Sidebar ── */
.inbox-empty-sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    flex: 1;
}

.inbox-empty-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .625rem;
    color: #94a3b8;
}

.inbox-empty-title {
    font-weight: 600;
    font-size: .875rem;
    color: #1e293b;
    margin: 0 0 .25rem;
}

.inbox-empty-desc {
    font-size: .75rem;
    color: #64748b;
    margin: 0 0 .75rem;
    line-height: 1.4;
}

.inbox-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: .375rem .75rem;
    font-size: .75rem;
    font-weight: 500;
    color: #6366f1;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}

.inbox-empty-btn:hover {
    background: rgba(99,102,241,.05);
    border-color: #6366f1;
}

/* ── Pagination ── */
.inbox-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .5rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.inbox-page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all .12s;
}

.inbox-page-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: #1e293b;
}

.inbox-page-btn:disabled {
    opacity: .3;
    cursor: default;
}

.inbox-page-info {
    font-size: .6875rem;
    color: #64748b;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

/* ============================================================
   DETAIL PANEL (Right Side)
   ============================================================ */

.inbox-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    min-width: 0;
    overflow: hidden;
}

/* ── Placeholder ── */
.inbox-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .625rem;
    text-align: center;
    padding: 2rem;
}

.inbox-placeholder-visual {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .375rem;
}

.inbox-placeholder-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px dashed #cbd5e1;
    animation: inbox-spin 20s linear infinite;
}

@keyframes inbox-spin {
    to { transform: rotate(360deg); }
}

.inbox-placeholder-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.inbox-placeholder-desc {
    margin: 0;
    font-size: .8125rem;
    color: #64748b;
    max-width: 280px;
    line-height: 1.5;
}

/* ── Detail Header ── */
.inbox-detail-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .625rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    min-height: 56px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.inbox-back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #475569;
    cursor: pointer;
    transition: background .12s;
}

.inbox-back-btn:hover { background: #f1f5f9; }

.inbox-detail-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.inbox-detail-info {
    flex: 1;
    min-width: 0;
}

.inbox-detail-phone {
    font-size: .9375rem;
    font-weight: 600;
    color: #1e293b;
}

.inbox-detail-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 1px;
    flex-wrap: wrap;
}

.inbox-detail-stats {
    display: flex;
    gap: 8px;
    font-size: .6875rem;
    color: #94a3b8;
}

.inbox-detail-stats span {
    display: inline;
}

/* ── Refresh Button ── */
.inbox-refresh-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    flex-shrink: 0;
}

.inbox-refresh-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

.inbox-refresh-btn:disabled {
    opacity: .5;
    cursor: default;
}

.inbox-refresh-spinning {
    animation: spin-refresh .8s linear infinite;
}

@keyframes spin-refresh {
    to { transform: rotate(360deg); }
}

/* ── Detail Channel Tabs ── */
.detail-tabs {
    display: flex;
    gap: 0;
    background: #fff;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 1.25rem;
}

.detail-tab {
    display: flex;
    align-items: center;
    gap: .375rem;
    padding: .625rem 1.125rem;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .15s;
    white-space: nowrap;
    position: relative;
    bottom: -2px;
    font-family: inherit;
}

.detail-tab:hover {
    color: #475569;
}

.detail-tab-active {
    color: #1e293b;
}

.detail-tab-active.detail-tab-sms {
    border-bottom-color: #3b82f6;
    color: #2563eb;
}

.detail-tab-active.detail-tab-wa {
    border-bottom-color: #22c55e;
    color: #16a34a;
}

.detail-tab-active.detail-tab-voice {
    border-bottom-color: #8b5cf6;
    color: #7c3aed;
}

.detail-tab-count {
    font-size: .625rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #94a3b8;
    line-height: 1.3;
}

.detail-tab-active .detail-tab-count {
    color: inherit;
}

.detail-tab-active.detail-tab-sms .detail-tab-count {
    background: rgba(59,130,246,.08);
}

.detail-tab-active.detail-tab-wa .detail-tab-count {
    background: rgba(34,197,94,.08);
}

.detail-tab-active.detail-tab-voice .detail-tab-count {
    background: rgba(139,92,246,.08);
}

/* ============================================================
   TIMELINE
   ============================================================ */

.inbox-timeline {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    background: #f8fafc;
}

.inbox-timeline::-webkit-scrollbar { width: 4px; }
.inbox-timeline::-webkit-scrollbar-track { background: transparent; }
.inbox-timeline::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Lazy-load indicators */
.tl-loading-older {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .625rem 0;
    font-size: .75rem;
    color: #6366f1;
    font-weight: 500;
}

.tl-load-more-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    padding: .375rem 0;
    font-size: .6875rem;
    color: #94a3b8;
    font-weight: 500;
}

/* Loading */
.inbox-timeline-loading {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem 0;
}

.tl-skeleton-left   { display: flex; justify-content: flex-start; }
.tl-skeleton-right  { display: flex; justify-content: flex-end; }
.tl-skeleton-center { display: flex; justify-content: center; }

/* Empty */
.inbox-timeline-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: #94a3b8;
    font-size: .8125rem;
}

.inbox-timeline-empty p { margin: 0; }

/* ── Date Separator ── */
.tl-date-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .625rem 0 .375rem;
}

.tl-date-sep span {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 3px .75rem;
    border-radius: 12px;
    font-size: .625rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .05em;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

/* ============================================================
   MESSAGE ROW — LiveChat-inspired layout
   Each row: [avatar-col] [content-col]
   Inbound: avatar left, bubble left-aligned
   Outbound: bubble right-aligned, avatar right
   ============================================================ */

.tl-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 75%;
    margin-bottom: 1px;
}

.tl-msg-row.tl-msg-in  { align-self: flex-start; flex-direction: row; }
.tl-msg-row.tl-msg-out { align-self: flex-end; flex-direction: row-reverse; }

/* Extra spacing before a new message group */
.tl-msg-row.tl-msg-first { margin-top: 12px; }
/* Extra spacing after last message in group */
.tl-msg-row.tl-msg-last  { margin-bottom: 4px; }

/* ── Avatar Column ── */
.tl-msg-avatar-col {
    width: 32px;
    min-width: 32px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
}

.tl-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6875rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    transition: transform .15s;
}

.tl-msg-avatar:hover { transform: scale(1.08); }

.tl-avatar-bot {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #fff;
}

.tl-avatar-customer {
    /* Color from GetAvatarColor helper */
}

.tl-avatar-agent {
    /* Color from GetAvatarColor helper */
}

/* ── Content Column ── */
.tl-msg-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
}

/* ── Sender Label ── */
.tl-msg-sender {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    padding: 0 4px;
}

.tl-msg-in .tl-msg-sender { justify-content: flex-start; }
.tl-msg-out .tl-msg-sender { justify-content: flex-end; }

.tl-msg-sender-name {
    font-size: .6875rem;
    font-weight: 600;
    color: #475569;
}

.tl-msg-sender-time {
    font-size: .5625rem;
    color: #94a3b8;
    font-weight: 500;
}

/* ── Bubble ── */
.tl-msg-bubble {
    padding: .5rem .875rem;
    border-radius: 18px;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* Inbound bubble — first/middle/last radius logic */
.tl-msg-in .tl-msg-bubble {
    background: #fff;
    border: 1px solid #e8ecf1;
    color: #1e293b;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 6px;
}

.tl-msg-in.tl-msg-first .tl-msg-bubble {
    border-top-left-radius: 18px;
}

.tl-msg-in:not(.tl-msg-first) .tl-msg-bubble {
    border-top-left-radius: 6px;
}

.tl-msg-in.tl-msg-last .tl-msg-bubble {
    border-bottom-left-radius: 4px;
}

/* Outbound bubble */
.tl-msg-out .tl-msg-bubble {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
    border: none;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 6px;
}

.tl-msg-out.tl-msg-first .tl-msg-bubble {
    border-top-right-radius: 18px;
}

.tl-msg-out:not(.tl-msg-first) .tl-msg-bubble {
    border-top-right-radius: 6px;
}

.tl-msg-out.tl-msg-last .tl-msg-bubble {
    border-bottom-right-radius: 4px;
}

.tl-msg-text {
    font-size: .8125rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.tl-msg-time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 3px;
    font-size: .5625rem;
    opacity: .5;
}

/* ── Media ── */
.tl-msg-img-wrap {
    margin-bottom: 6px;
    border-radius: 12px;
    overflow: hidden;
}

.tl-msg-img {
    max-width: 260px;
    max-height: 200px;
    display: block;
    object-fit: cover;
}

.tl-msg-file {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .375rem .625rem;
    border-radius: 8px;
    font-size: .75rem;
    text-decoration: none;
    margin-bottom: 4px;
    transition: opacity .12s;
}

.tl-msg-in .tl-msg-file {
    background: #f1f5f9;
    color: #6366f1;
}

.tl-msg-out .tl-msg-file {
    background: rgba(255,255,255,.15);
    color: #fff;
}

.tl-msg-file:hover { opacity: .8; }

.tl-msg-fsize {
    font-size: .625rem;
    opacity: .7;
}

/* ============================================================
   CALL EVENT CARD
   ============================================================ */

.tl-call {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    align-self: center;
    max-width: 480px;
    width: 100%;
    margin: .25rem 0;
    transition: box-shadow .12s;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.tl-call:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.tl-call-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.call-completed .tl-call-icon { background: rgba(34,197,94,.1); color: #16a34a; }
.call-failed    .tl-call-icon { background: rgba(239,68,68,.1); color: #dc2626; }
.call-busy      .tl-call-icon { background: rgba(245,158,11,.1); color: #d97706; }
.call-active    .tl-call-icon { background: rgba(59,130,246,.1); color: #2563eb; }
.call-default   .tl-call-icon { background: rgba(107,114,128,.1); color: #6b7280; }

.tl-call-body {
    flex: 1;
    min-width: 0;
}

.tl-call-row1 {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.tl-call-label {
    font-size: .8125rem;
    font-weight: 600;
    color: #1e293b;
}

.tl-call-status {
    font-size: .625rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    text-transform: capitalize;
}

.call-completed .tl-call-status { background: rgba(34,197,94,.08); color: #16a34a; }
.call-failed    .tl-call-status { background: rgba(239,68,68,.08); color: #dc2626; }
.call-busy      .tl-call-status { background: rgba(245,158,11,.08); color: #d97706; }
.call-active    .tl-call-status { background: rgba(59,130,246,.08); color: #2563eb; }
.call-default   .tl-call-status { background: rgba(107,114,128,.08); color: #6b7280; }

.tl-call-row2 {
    display: flex;
    align-items: center;
    gap: .625rem;
    margin-top: 3px;
}

.tl-call-dur {
    display: flex;
    align-items: center;
    gap: .25rem;
    font-size: .6875rem;
    color: #64748b;
    font-weight: 500;
}

.tl-call-time {
    font-size: .6875rem;
    color: #94a3b8;
}

.tl-call-expand {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    flex-shrink: 0;
}

.tl-call-expand:hover {
    background: #f1f5f9;
    color: #475569;
}

/* ── Call Events Timeline ── */
.tl-call-events {
    align-self: center;
    max-width: 480px;
    width: 100%;
    padding: .5rem 1rem .5rem 3.75rem;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    background: #fff;
    margin-top: -6px;
    margin-bottom: .25rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.tl-call-evt {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem 0;
    position: relative;
    padding-left: 1rem;
}

.tl-call-evt::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 0;
    bottom: 0;
    width: 1.5px;
    background: #e2e8f0;
}

.tl-call-evt:last-child::before { display: none; }

.tl-call-evt-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6366f1;
    position: absolute;
    left: 0;
    z-index: 1;
}

.tl-call-evt-type {
    font-size: .75rem;
    font-weight: 500;
    color: #1e293b;
}

.tl-call-evt-status {
    font-size: .625rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
}

.tl-call-evt-time {
    font-size: .625rem;
    color: #94a3b8;
    margin-left: auto;
}

/* ============================================================
   COMPOSE BAR
   ============================================================ */

.inbox-compose {
    padding: .625rem 1.25rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.inbox-compose-inner {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: .375rem .5rem .375rem 1rem;
    transition: border-color .15s, box-shadow .15s;
}

.inbox-compose-inner:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.08);
    background: #fff;
}

.inbox-compose-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: .8125rem;
    font-family: inherit;
    color: #1e293b;
    min-width: 0;
    padding: .25rem 0;
}

.inbox-compose-input::placeholder {
    color: #94a3b8;
}

.inbox-compose-input:disabled {
    opacity: .5;
}

.inbox-compose-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #e2e8f0;
    color: #94a3b8;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .15s;
}

.inbox-compose-send-active {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99,102,241,.3);
}

.inbox-compose-send-active:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(99,102,241,.4);
}

.inbox-compose-send:disabled {
    opacity: .6;
    cursor: default;
    transform: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .inbox-sidebar {
        width: 100%;
        min-width: unset;
    }

    .inbox-sidebar-hidden-mobile {
        display: none;
    }

    .inbox-back-btn {
        display: flex;
    }

    .tl-msg-row {
        max-width: 90%;
    }

    .inbox-topbar .inbox-title {
        font-size: .875rem;
    }

    .tl-call {
        max-width: 100%;
    }

    .tl-call-events {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .inbox-topbar {
        padding: 0 .75rem;
    }

    .inbox-contact {
        padding: .5rem .75rem;
    }

    .inbox-timeline {
        padding: .75rem;
    }

    .detail-tabs {
        padding: 0 .75rem;
    }

    .detail-tab {
        padding: .5rem .75rem;
        font-size: .75rem;
    }
}

/* ── Loan View Additions ── */

.inbox-section-header {
    padding: .5rem 1rem .25rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: #94a3b8;
    text-transform: uppercase;
}

.inbox-section-unassigned {
    margin-top: .5rem;
    border-top: 1px solid #e2e8f0;
    padding-top: .75rem;
    color: #f59e0b;
}

.inbox-loan-type {
    font-size: .65rem;
    font-weight: 500;
    color: #6366f1;
    background: #eef2ff;
    border-radius: 4px;
    padding: 1px 6px;
    margin-right: 4px;
}

.inbox-phone-select {
    font-size: .75rem;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px 8px;
    outline: none;
    cursor: pointer;
    max-width: 280px;
}

.inbox-phone-select:focus {
    border-color: #6366f1;
}

.inbox-unassigned-badge {
    font-size: .65rem;
    font-weight: 600;
    color: #f59e0b;
    background: #fffbeb;
    border-radius: 4px;
    padding: 1px 6px;
}

/* ── Calls Section ── */
.inbox-section-calls {
    margin-top: .5rem;
    border-top: 1px solid #e2e8f0;
    padding-top: .75rem;
    color: #8b5cf6;
}

.inbox-call-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.inbox-call-avatar.call-completed { background: linear-gradient(135deg, #22c55e, #16a34a); }
.inbox-call-avatar.call-failed    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.inbox-call-avatar.call-busy      { background: linear-gradient(135deg, #f59e0b, #d97706); }
.inbox-call-avatar.call-active    { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.inbox-call-avatar.call-default   { background: linear-gradient(135deg, #94a3b8, #64748b); }

.inbox-call-avatar-lg {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.inbox-call-avatar-lg.call-completed { background: linear-gradient(135deg, #22c55e, #16a34a); }
.inbox-call-avatar-lg.call-failed    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.inbox-call-avatar-lg.call-busy      { background: linear-gradient(135deg, #f59e0b, #d97706); }
.inbox-call-avatar-lg.call-active    { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.inbox-call-avatar-lg.call-default   { background: linear-gradient(135deg, #94a3b8, #64748b); }

.inbox-call-direction {
    font-size: .625rem;
    font-weight: 600;
    color: #64748b;
}

.inbox-call-status-tag {
    font-size: .5625rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: capitalize;
}

.inbox-call-status-tag.call-completed { background: rgba(34,197,94,.08); color: #16a34a; }
.inbox-call-status-tag.call-failed    { background: rgba(239,68,68,.08); color: #dc2626; }
.inbox-call-status-tag.call-busy      { background: rgba(245,158,11,.08); color: #d97706; }
.inbox-call-status-tag.call-active    { background: rgba(59,130,246,.08); color: #2563eb; }
.inbox-call-status-tag.call-default   { background: rgba(107,114,128,.08); color: #6b7280; }

/* ============================================================
   EMBEDDED MODE (Form1003 Communication Panel)
   ============================================================ */
.inbox-shell-embedded {
    height: calc(100vh - 220px);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.inbox-shell-embedded .inbox-detail {
    max-width: 100%;
}
