/* Kişi kartı → Yazışmalar sekmesi ve WhatsApp bağlantısı (messages.js) */
.cd-last-interaction { margin: 6px 0 0 !important; color: #5e6277; font-size: 12px; border-radius: 6px; }
.cd-last-interaction b { color: #303449; }
.cd-li-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #a0a4b3; vertical-align: 1px; }
.cd-li-dot.recent { background: #24966a; }
.cd-li-dot.none { background: #dfe2ea; }
.cd-last-interaction.flash { animation: cd-li-flash 2s ease-out; }
@keyframes cd-li-flash { 0% { background: #dcf8c6; } 100% { background: transparent; } }
.contact-dialog.wide { width: min(880px, calc(100vw - 32px)); }
.cd-tabs { display: flex; gap: 4px; margin: 6px 0 14px; border-bottom: 1px solid var(--line); }
.cd-tab { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: #74788c; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.cd-tab:hover { color: var(--purple); }
.cd-tab.active { color: var(--purple); border-bottom-color: var(--purple); }
.cd-tab .nav-count:empty { display: none; }

.msg-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.msg-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-toolbar-right { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.msg-updated { color: #9a9db0; font-size: 11px; white-space: nowrap; }
.msg-updated::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #24966a; vertical-align: 1px; }
.msg-updated:empty::before { display: none; }
.msg-updated.busy::before { background: #6857df; animation: msg-pulse .8s ease-in-out infinite; }
.msg-updated.fresh { color: #24966a; font-weight: 600; }
.msg-updated.error { color: #9c2f3d; }
.msg-updated.error::before { background: #c0392b; }
@keyframes msg-pulse { 50% { opacity: .3; } }
.msg-filter { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid #e6e8f0; border-radius: 999px; background: #fff; color: #5e6277; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.msg-filter span { color: #a0a4b3; font-weight: 600; }
.msg-filter.active { border-color: var(--purple); background: #f0efff; color: var(--purple); }

.msg-timeline { height: min(46vh, 460px); overflow-y: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7f8fb; }
.msg-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 13px; text-align: center; }
.msg-empty.error { color: #9c2f3d; }
.msg-day { display: flex; justify-content: center; margin: 12px 0 8px; }
.msg-day span { padding: 3px 10px; border-radius: 999px; background: #e9ebf2; color: #6b6f82; font-size: 11px; font-weight: 600; }
.msg-system { margin: 6px auto; max-width: 85%; padding: 6px 12px; border-radius: 8px; background: #fff; border: 1px dashed #dfe2ea; color: #5e6277; font-size: 12px; text-align: center; }
.msg-system a { color: var(--purple); }
.msg-system-icon { color: #a0a4b3; }

.msg-row { display: flex; margin: 6px 0; }
.msg-row.out { justify-content: flex-end; }
.msg-bubble { max-width: 78%; padding: 8px 11px 6px; border-radius: 12px; background: #fff; border: 1px solid #e6e8f0; box-shadow: 0 1px 2px #1f23330d; font-size: 13px; color: #303449; }
.msg-row.in .msg-bubble { border-top-left-radius: 4px; }
.msg-row.out .msg-bubble { border-top-right-radius: 4px; }
.msg-bubble.out.email { background: #f0efff; border-color: #ddd9fb; }
.msg-bubble.out.whatsapp { background: #dcf8c6; border-color: #c5ecab; }
.msg-bubble.out.linkedin { background: #e7f0fa; border-color: #c7dcf3; }
.msg-bubble.pending { border-style: dashed; border-color: #0a66c2; }
.msg-bubble.failed { border-color: #e7a6ae; }
.msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 4px; color: #6b6f82; font-size: 11.5px; }
.msg-head b { color: #303449; }
.msg-by { margin-left: auto; padding: 1px 7px; border-radius: 10px; background: rgba(48, 52, 73, .07); color: #303449; font-size: 11px; font-weight: 600; white-space: nowrap; }
.msg-by.in { font-weight: 500; color: #6b6f82; }
.msg-src {padding: 1px 6px; border-radius: 4px; background: #eaf3ff; color: #3976b8; font-size: 10px; font-weight: 700; }
.msg-ch { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; color: #fff; background: var(--purple); font: 700 10px/1 Arial, sans-serif; }
.msg-ch.whatsapp { background: #25d366; }
.msg-ch.linkedin { background: #0a66c2; }
.msg-text { white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.msg-mail-head { margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid #e6e8f0; color: #6b6f82; font-size: 11.5px; word-break: break-word; }
.msg-note { margin-top: 4px; color: #6b6f82; font-size: 12px; }
.msg-note.error { color: #9c2f3d; }
.msg-actions { margin-top: 6px; font-size: 12px; }
.msg-actions a { color: var(--purple); text-decoration: none; }
.msg-meta { margin-top: 4px; color: #9a9db0; font-size: 10.5px; text-align: right; }
.msg-status.read { color: #34b7f1; font-weight: 600; }
.msg-status.failed { color: #c0392b; font-weight: 600; }
.link-button { padding: 0; border: 0; background: none; color: var(--purple); font: inherit; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.link-button.danger { color: #9c2f3d; }

.msg-composer { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.msg-channels { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-channel { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid #e6e8f0; border-radius: 8px; background: #fff; color: #5e6277; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.msg-channel.active { border-color: var(--purple); background: #f0efff; color: var(--purple); }
.msg-channel.whatsapp.active { border-color: #25d366; background: #eafaf0; color: #128c4a; }
.msg-channel.linkedin.active { border-color: #0a66c2; background: #e7f0fa; color: #0a66c2; }
.msg-channel.unavailable { opacity: .55; }
.msg-channel-info { margin: 8px 0; color: #6b6f82; font-size: 12px; line-height: 1.5; }
.msg-problem { color: #8a5a00; }
.msg-composer input, .msg-composer select { width: 100%; height: 36px; margin-bottom: 8px; padding: 0 10px; border: 1px solid #e7e8ef; border-radius: 7px; color: #44485e; font-size: 13px; }
.msg-composer textarea { width: 100%; box-sizing: border-box; min-height: 74px; padding: 8px 10px; border: 1px solid #e7e8ef; border-radius: 7px; outline: 0; resize: vertical; color: #44485e; font: inherit; font-size: 13px; line-height: 1.45; }
.msg-composer textarea:focus, .msg-composer input:focus { border-color: #988ef0; box-shadow: 0 0 0 3px #7162df14; }
.msg-composer textarea:disabled { background: #f7f8fb; }
.msg-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.msg-composer-actions .form-error { margin: 0; color: #9c2f3d; font-size: 12px; }
.msg-composer-actions .button { margin-left: auto; }

/* WhatsApp görselleri */
.msg-images { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.msg-images a { display: block; line-height: 0; }
.msg-img { max-width: 260px; max-height: 260px; border-radius: 8px; object-fit: cover; background: #eef0f5; cursor: zoom-in; }
.msg-image-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 6px 8px; border: 1px solid #c5ecab; border-radius: 8px; background: #f3fcec; font-size: 12px; color: #4b4f63; }
.msg-image-preview img { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; }
.msg-image-preview span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-image-preview .msg-file-icon { flex: none; min-width: 56px; height: 56px; }
.msg-file-list .msg-image-preview { margin-bottom: 6px; }
.msg-file-list { margin-bottom: 2px; }
.msg-file-note { margin: -2px 0 8px; font-size: 12px; color: #7a7f93; }
.msg-file { display: flex; align-items: center; gap: 10px; max-width: 320px; margin: 2px 0 4px; padding: 8px 10px; border: 1px solid rgba(0,0,0,.08); border-radius: 8px; background: rgba(255,255,255,.7); color: inherit; text-decoration: none; }
.msg-file:hover { background: #fff; border-color: rgba(0,0,0,.16); }
.msg-file-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 4px; border-radius: 6px; background: #e6f4ea; color: #1b7f43; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.msg-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.msg-file-name small { display: block; color: #7a7f93; font-size: 11px; }
.msg-file-dl { flex: none; font-size: 16px; color: #4b4f63; }
.msg-audio { display: block; width: 280px; max-width: 100%; margin: 2px 0 4px; }
.msg-video { display: block; max-width: 300px; max-height: 300px; border-radius: 8px; background: #000; margin: 2px 0 4px; }
.msg-composer-actions #msgAttach { margin-left: 0; }
.msg-composer-actions .form-error { flex: 1; }
.msg-composer.dragover { border-color: #25d366; background: #f3fcec; }

/* WhatsApp üst çubuk düğmesi ve bağlantı penceresi */
.wa-chip:not(.hidden) + .ext-chip { margin-left: 0; }
.ext-chip.wa-chip:hover { border-color: #25d366; color: #128c4a; }
.ext-chip.wa-chip.connected { color: #128c4a; background: #eafaf0; border-color: #bfe9cf; }
.wa-qr { display: grid; place-items: center; margin: 4px 0 8px; }
/* QR doğal boyutunda gösterilir (ölçekleme modül kaybına ve okunamamaya yol açar). */
.wa-qr img { display: block; width: auto; height: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
#whatsappDialog .dialog { width: min(500px, 100%); max-height: calc(100vh - 40px); overflow: auto; }
.wa-pair { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.wa-pair-row { display: flex; gap: 8px; margin-top: 8px; }
.wa-pair-row input { flex: 1; }
.wa-pair-code { margin-top: 10px; padding: 10px; border-radius: 8px; background: #eafaf0; color: #128c4a; text-align: center; font: 700 26px/1.2 Consolas, monospace; letter-spacing: 4px; }

/* Bugün → "AI ile yaz" taslağı uyarısı (messages.js applyDraft) */
.msg-ai-note { margin-top: 6px; padding: 6px 9px; border-radius: 7px; background: #f3f1fe; color: #5545c8; font-size: 12px; }
