/* 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; overflow-anchor: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7f8fb; }
/* Gelecekteki toplantılar: zaman akışının en altını işgal etmesin diye akışın üstünde ayrı şerit. */
.msg-upcoming { margin-bottom: 8px; padding: 6px 10px; border: 1px solid #e3dcf5; border-radius: 10px; background: #faf8ff; font-size: 12px; color: #4d5166; }
.msg-upcoming-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; color: #5b4b8a; margin-bottom: 2px; }
.msg-upcoming-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 3px 0; border-top: 1px dashed #ebe6f7; }
.msg-upcoming-item:first-of-type { border-top: 0; }
.msg-upcoming-when { flex: none; font-weight: 600; color: #3f3566; }
.msg-upcoming-item.cancelled .msg-upcoming-subject { text-decoration: line-through; color: #9a9db0; }
.msg-upcoming a { color: var(--purple); }
.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-older { display: flex; justify-content: center; margin: 4px 0 2px; }
.msg-older button { padding: 4px 12px; border: 1px solid #dfe2ea; border-radius: 999px; background: #fff; color: var(--purple); font-size: 12px; font-weight: 600; cursor: pointer; }
.msg-older button:hover { background: #f4f2fd; }
.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-ch.note { background: #c99a06; }
/* Kişi notu (kişiye gönderilmez): ortada, sarı not kâğıdı */
.msg-row.note { justify-content: center; }
.msg-note-card { width: min(86%, 560px); padding: 8px 11px 6px; border-radius: 8px; background: #fff8db; border: 1px solid #f0dc8c; border-left: 3px solid #e0b400; box-shadow: 0 1px 2px #1f23330d; font-size: 13px; color: #303449; }
.msg-note-card .msg-src { background: #fdecb0; color: #8a6500; }
.msg-note-card .msg-meta .link-button { font-size: inherit; }
.msg-card-photo { display: block; margin: 6px 0 4px; }
.msg-card-photo img { display: block; max-width: 100%; max-height: 220px; border-radius: 6px; border: 1px solid #f0dc8c; background: #fff; }
.msg-channel.note.active { border-color: #e0b400; background: #fff8db; color: #8a6500; }
.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; }

/* Biçimli metin düzenleyici (rich-text.js): e-posta yazma alanı ve e-posta şablonları */
.rt-editor { border: 1px solid #e7e8ef; border-radius: 7px; background: #fff; }
.rt-editor:focus-within { border-color: #988ef0; box-shadow: 0 0 0 3px #7162df14; }
.rt-editor.disabled { background: #f7f8fb; }
.rt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 3px 4px; border-bottom: 1px solid #eef0f5; }
.rt-btn { min-width: 28px; height: 26px; padding: 0 6px; border: 1px solid transparent; border-radius: 5px; background: none; color: #4b4f66; font: 13px/1 Arial, sans-serif; cursor: pointer; }
.rt-btn:hover:not(:disabled) { background: #f1f2f7; }
.rt-btn.active { border-color: #d9d5fb; background: #f0efff; color: var(--purple); }
.rt-btn:disabled { opacity: .45; cursor: default; }
.rt-clear sub { font-size: 9px; }
.rt-sep { width: 1px; height: 16px; margin: 0 3px; background: #e6e8f0; }
.rt-content { min-height: 74px; max-height: 340px; overflow-y: auto; padding: 8px 10px; outline: 0; color: #44485e; font-size: 13px; line-height: 1.45; word-break: break-word; resize: vertical; }
.rt-content:empty::before { content: attr(data-placeholder); color: #9a9db0; white-space: pre-line; pointer-events: none; }
.rt-content a, .msg-text.msg-html a { color: var(--purple); }
.rt-content ul, .rt-content ol, .msg-text.msg-html ul, .msg-text.msg-html ol { margin: 4px 0; padding-left: 22px; }
.rt-content p, .msg-text.msg-html p { margin: 0 0 8px; }
.rt-content blockquote, .msg-text.msg-html blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid #e1e3ec; color: #6b6f82; }
.msg-composer .rt-editor { margin: 0; }
.msg-view.in-chat .msg-composer .rt-content { min-height: 56px; }
.msg-text.msg-html { white-space: normal; }

/* E-posta: bilgi (CC) alıcıları */
.msg-subject-row { display: flex; align-items: flex-start; gap: 8px; }
.msg-subject-row input { flex: 1; min-width: 0; }
.msg-cc-toggle { flex: none; height: 36px; white-space: nowrap; font-size: 12px; }
.msg-cc-toggle.active { color: var(--purple); font-weight: 600; }
.msg-cc-field { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 36px; margin-bottom: 8px; padding: 3px 8px;
  border: 1px solid #e7e8ef; border-radius: 7px; background: #fff; box-sizing: border-box; cursor: text; }
.msg-cc-field:focus-within { border-color: #988ef0; box-shadow: 0 0 0 3px #7162df14; }
.msg-cc-label { color: #8a8ea3; font-size: 12px; }
.msg-cc-chips { display: contents; }
.msg-cc-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 260px; padding: 2px 4px 2px 8px; border-radius: 12px; background: #f0efff; color: #4b44a8; font-size: 12px; }
.msg-cc-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-cc-chip button { border: 0; background: none; color: inherit; font-size: 13px; line-height: 1; cursor: pointer; padding: 0 3px; border-radius: 50%; }
.msg-cc-chip button:hover { background: #ddd9ff; }
.msg-composer .msg-cc-input { flex: 1; min-width: 140px; width: auto; height: 28px; margin: 0; padding: 0 4px; border: 0; box-shadow: none; outline: 0; }
.msg-composer .msg-cc-input:focus { box-shadow: none; }
.msg-cc-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 280px; overflow-y: auto; padding: 4px 0;
  border: 1px solid #e3e5ee; border-radius: 8px; background: #fff; box-shadow: 0 8px 24px #1d1f3a1f; }
.msg-cc-section { padding: 6px 12px 3px; color: #8a8ea3; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.msg-cc-item { display: flex; flex-direction: column; width: 100%; padding: 6px 12px; border: 0; background: none; text-align: left; font: inherit; cursor: pointer; }
.msg-cc-item b { color: #2f3247; font-size: 13px; font-weight: 600; }
.msg-cc-item small { color: #7d8196; font-size: 12px; }
.msg-cc-item.active, .msg-cc-item:hover { background: #f3f2ff; }
.msg-cc-empty { padding: 8px 12px; color: #8a8ea3; font-size: 12px; }
/* E-posta şablonu seçici (yazma alanı) */
.msg-email-fields { position: relative; }
.msg-composer .msg-tpl-toggle { flex: none; height: 36px; white-space: nowrap; }
.msg-tpl-toggle.active { border-color: var(--purple); color: var(--purple); background: #f0efff; }
.msg-tpl-menu { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 40; width: min(420px, 100%); padding: 6px 0 0;
  border: 1px solid #e3e5ee; border-radius: 10px; background: #fff; box-shadow: 0 10px 28px #1d1f3a26; }
.msg-tpl-search { padding: 0 8px 6px; border-bottom: 1px solid #eef0f5; }
.msg-composer .msg-tpl-search input { height: 32px; margin: 0; }
.msg-tpl-list { max-height: 300px; overflow-y: auto; padding: 4px 0; }
.msg-tpl-extras { margin-left: 4px; color: #7d8196; font-size: 11px; font-weight: 500; }
.msg-tpl-manage { display: block; padding: 8px 12px; border-top: 1px solid #eef0f5; color: var(--purple); font-size: 12px; text-decoration: none; }
.msg-tpl-manage:hover { background: #f7f6ff; }

/* Ayarlar → Mesaj şablonları → E-posta (mail-templates.js) */
.mtpl-table td { vertical-align: top; }
.mtpl-subject { max-width: 320px; color: #5e6277; }
.mtpl-inactive td { opacity: .6; }
/* Kişisel / ortak şablon rozeti (mail-templates.js, messages.js seçici). */
.mtpl-kind { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 9px; color: #5b5f73; background: #eef0f6; font-size: 10.5px; font-weight: 600; vertical-align: 1px; }
.mtpl-kind.shared { color: #4b44a8; background: #efedff; }
.mtpl-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; }
.mtpl-dialog textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; line-height: 1.5; resize: vertical; }
.mtpl-placeholders { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 2px 0 6px; }
.mtpl-ph { padding: 2px 8px; border: 1px solid #dcd8ff; border-radius: 12px; background: #f6f5ff; color: #4b44a8; font: 12px/1.6 ui-monospace, Consolas, monospace; cursor: pointer; }
.mtpl-ph:hover { background: #ebe8ff; }
.mtpl-ph-hint { margin-left: 4px; color: #8a8ea3; font-size: 11px; }
.mtpl-attach-row { display: flex; gap: 6px; margin-bottom: 6px; }
.mtpl-attachments { margin-bottom: 8px; }
.mtpl-broken { border-style: dashed; opacity: .7; }

.msg-head .msg-cc-line { display: block; margin-top: 2px; color: #7d8196; font-size: 11px; font-weight: 400; }
.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; }
/* WhatsApp sesli mesajının yazıya dökümü (messages.js transcriptHtml; sohbet odaları da kullanır). */
.voice-transcript { margin: 2px 0 6px; padding: 6px 9px; border-left: 3px solid #a99ff3; border-radius: 6px; background: #f6f5fd;
  color: #2f3142; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.voice-transcript-label { display: block; margin-bottom: 2px; color: #6d64c4; font-size: 11px; font-weight: 600; }
.voice-transcript.pending, .voice-transcript.muted { border-left-color: #d6d8e3; background: transparent; color: #8a8ea3; font-size: 12px;
  font-style: italic; }
.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; }
