/* Chatvolution v2.9 — kontras untuk hal yang harus terbaca sekilas:
   mode composer, alur chat, emosi pelanggan, prioritas, stabilo resume AI, 2FA, bahasa.
   Warna memakai variabel tema (terang/gelap otomatis); warna "keras" hanya untuk emosi negatif & prioritas tinggi. */

/* ── Composer: tiap mode punya warna sendiri, termasuk bingkai area ketik ── */
.composer-tabs { gap: 6px; flex-wrap: wrap; }
.ctab { border: 1.5px solid var(--line); background: var(--card); color: var(--ink-2); padding: 6px 12px; border-radius: 8px; font-weight: 650; }
.ctab[data-mode="reply"] { border-color: var(--peri-b); color: var(--peri-i); }
.ctab[data-mode="assist"] { border-color: var(--aqua-b); color: var(--aqua-i); }
.ctab[data-mode="whisper"] { border-color: var(--lilac-b); color: var(--lilac-i); }
.ctab[data-mode="note"] { border-color: var(--butter-b); color: var(--butter-i); }
.ctab[data-mode="reply"]::before { content: "💬 "; }
.ctab[data-mode="assist"]::before { content: "🤝 "; }
.ctab[data-mode="whisper"]::before { content: "🤫 "; }
.ctab[data-mode="note"]::before { content: "🔒 "; }
.ctab.active[data-mode="reply"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.ctab.active[data-mode="assist"] { background: #0f7c8c; border-color: #0f7c8c; color: #fff; }
.ctab.active[data-mode="whisper"] { background: #7a4cc2; border-color: #7a4cc2; color: #fff; }
.ctab.active[data-mode="note"], .composer.note-mode .ctab.active[data-mode="note"] { background: #f2c230; border-color: #d9a90f; color: #3a2c00; }
.composer[data-mode] textarea#msg-input { border-width: 2px; border-left-width: 6px; }
.composer[data-mode="reply"] textarea#msg-input { border-color: var(--peri-b); border-left-color: var(--brand); }
.composer[data-mode="assist"] textarea#msg-input { border-color: var(--aqua-b); border-left-color: #0f7c8c; background: var(--aqua); }
.composer[data-mode="whisper"] textarea#msg-input { border-color: var(--lilac-b); border-left-color: #7a4cc2; background: var(--lilac); }
.composer[data-mode="note"] textarea#msg-input { border-color: var(--butter-b); border-left-color: #d9a90f; background: var(--note); }
html[data-theme="dark"] .ctab.active[data-mode="reply"] { color: #161826; }
html[data-theme="dark"] .ctab.active[data-mode="assist"] { background: #4cc3d1; border-color: #4cc3d1; color: #0e2226; }
html[data-theme="dark"] .ctab.active[data-mode="whisper"] { background: #b892ff; border-color: #b892ff; color: #1d1230; }
html[data-theme="dark"] .ctab.active[data-mode="note"] { background: #f2c94c; color: #2a2100; }

/* Gelembung pesan internal juga dibedakan */
.msg.k-whisper .bubble { background: var(--lilac); border: 1.5px dashed var(--lilac-b); color: var(--lilac-i); }
.msg.note .bubble { border-left: 4px solid #d9a90f; }
.msg.k-assist .bubble { border-left: 4px solid #0f7c8c; }

/* ── Alur chat: selesai = hijau tegas, belum = abu terbaca, berikutnya = biru bergaris ── */
.pb-strip { gap: 4px; }
.pb-lbl { color: var(--ink-2); font-weight: 750; }
.pb-chip { background: var(--card); border: 1.5px solid var(--line); color: var(--ink-2); font-weight: 600; padding: 3px 10px; }
.pb-chip.done { background: #1f8a55; border-color: #1f8a55; color: #fff; font-weight: 700; }
.pb-chip:not(.done) ~ .pb-chip:not(.done) { opacity: .75; }
.pb-chip.done + i + .pb-chip:not(.done), .pb-lbl + .pb-chip:not(.done) { border-color: var(--brand); color: var(--brand); border-style: dashed; opacity: 1; }
.pb-strip > i { color: var(--faint); font-style: normal; font-weight: 700; }
html[data-theme="dark"] .pb-chip.done { background: #4fcf8e; border-color: #4fcf8e; color: #0f2a1d; }

/* ── Emosi pelanggan: emoji + warna kontras ── */
.emo-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 5px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 18px; border: 1.5px solid transparent; vertical-align: middle; }
.emo-chip i { font-style: normal; font-size: 15px; line-height: 1; }
.emo-chip.emo-big { font-size: 13px; padding: 3px 11px 3px 6px; }
.emo-chip.emo-big i { font-size: 18px; }
.emo-senang  { background: #d8f5e3; color: #0f5c34; border-color: #8fd9ae; }
.emo-puas    { background: #e3f5d8; color: #2c5c12; border-color: #a9d98f; }
.emo-netral  { background: var(--line-2); color: var(--ink-2); border-color: var(--line); }
.emo-bingung { background: #fff2bf; color: #6b5100; border-color: #e8c95a; }
.emo-cemas   { background: #ffe3c7; color: #8a3d00; border-color: #f3a766; }
.emo-kesal   { background: #ff8a5c; color: #fff; border-color: #e5652f; }
.emo-marah   { background: #d92d4a; color: #fff; border-color: #b01c37; animation: emoPulse 1.6s ease-in-out 3; }
@keyframes emoPulse { 50% { box-shadow: 0 0 0 4px rgba(217, 45, 74, .25); } }
@media (prefers-reduced-motion: reduce) { .emo-marah { animation: none; } }
html[data-theme="dark"] .emo-senang  { background: #1b3d2a; color: #9fe8bf; border-color: #2e6b49; }
html[data-theme="dark"] .emo-puas    { background: #243b1a; color: #c1e8a6; border-color: #446b2e; }
html[data-theme="dark"] .emo-bingung { background: #3d3418; color: #f5dc85; border-color: #6b5a28; }
html[data-theme="dark"] .emo-cemas   { background: #45291a; color: #ffc69c; border-color: #7a4a2c; }
html[data-theme="dark"] .emo-kesal   { background: #ff8a5c; color: #2a1105; }
html[data-theme="dark"] .emo-marah   { background: #ff5c78; color: #2a0710; }
/* Daftar chat: chat dengan pelanggan marah/kesal diberi tepi merah */
.conv-item:has(.emo-marah) { box-shadow: inset 4px 0 0 #d92d4a; }
.conv-item:has(.emo-kesal) { box-shadow: inset 4px 0 0 #ff8a5c; }

/* Resume AI: wajah emosi besar + saran sikap */
.emo-hero { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; margin-bottom: 10px; border: 1.5px solid transparent; }
.emo-hero .emo-face { font-size: 30px; line-height: 1; }
.emo-hero small { opacity: .8; font-weight: 600; }
.emo-hero .emo-tip { font-size: 12px; font-weight: 600; }
.emo-hero.emo-marah, .emo-hero.emo-kesal { animation: none; }

/* ── Stabilo kuning di resume AI ── */
mark.stabilo { background: linear-gradient(transparent 12%, #fff176 12%, #fff176 88%, transparent 88%); color: inherit; padding: 0 2px; border-radius: 2px; font-weight: 650; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
html[data-theme="dark"] mark.stabilo { background: #6b5a00; color: #fff6c2; }
.insight-sum { line-height: 1.6; }
.insight-hl li { margin: 3px 0; }

/* ── Prioritas 5 tingkat ── */
.prio-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 750; border: 1.5px solid transparent; vertical-align: middle; }
.prio-rendah { background: var(--aqua); color: var(--aqua-i); border-color: var(--aqua-b); }
.prio-sedang { background: #fff2bf; color: #6b5100; border-color: #e8c95a; }
.prio-tinggi { background: #ff9a3c; color: #fff; border-color: #e57d1a; }
.prio-urgent { background: #d92d4a; color: #fff; border-color: #b01c37; }
html[data-theme="dark"] .prio-sedang { background: #3d3418; color: #f5dc85; border-color: #6b5a28; }
html[data-theme="dark"] .prio-tinggi { background: #ffa95c; color: #2a1405; }
html[data-theme="dark"] .prio-urgent { background: #ff5c78; color: #2a0710; }

/* ── Alert "butuh operator": opsi lanjutkan AI / tunda ── */
.handoff-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; font-weight: 600; }
.act.act-ai { background: var(--lilac); border: 1.5px solid var(--lilac-b); color: var(--lilac-i); font-weight: 700; }
.act.act-ai:hover { background: var(--lilac-b); }

/* ── Login: langkah 2FA & pilihan bahasa ── */
.login-2fa-note { font-size: 13.5px; color: var(--ink-2); margin: 4px 0 10px; }
#login-code { font-size: 22px; letter-spacing: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.login-lang { display: flex; justify-content: center; gap: 6px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.login-lang button, .me-lang button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; font: inherit; }
.login-lang button.on, .me-lang button.on { color: var(--brand); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.me-lang { display: flex; align-items: center; gap: 4px; padding: 6px 10px; font-size: 13px; }

/* ── 2FA ── */
.tf-steps { margin: 6px 0 10px 18px; font-size: 13.5px; line-height: 1.6; }
.tf-qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 6px 0 12px; }
.tf-qr-img { width: 168px; height: 168px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.tf-qr-img svg { width: 100%; height: 100%; display: block; stroke: none; stroke-width: 1; stroke-linecap: butt; stroke-linejoin: miter; fill: none; shape-rendering: crispEdges; }
/* Ikon global memakai stroke 1.8 & ujung bulat; kode QR butuh garis tegas 1 unit agar bisa dipindai */
.tf-secret { display: block; margin-top: 4px; font-size: 14px; letter-spacing: 1px; word-break: break-all; background: var(--line-2); padding: 6px 8px; border-radius: 6px; }
.tf-codes { background: var(--line-2); padding: 12px 16px; border-radius: 8px; font-size: 15px; line-height: 1.9; letter-spacing: 1px; columns: 2; }
.ok-line { color: var(--ok); font-weight: 700; }
.tf-badge { margin: 3px 4px 0 0; font-size: 11px; }
#modal.locked { cursor: default; }
