/* ==========================================================================
   Chat Customer Service — widget kanan bawah, halaman penuh & inbox CS.
   Murni CSS (tanpa Tailwind) supaya markup yang dibuat JS ikut ter-style
   tanpa perlu build ulang Vite.
   ========================================================================== */
:root {
    --cs-blue: #1453c2;
    --cs-blue-dark: #0f3f96;
    --cs-blue-soft: #edf5ff;
    --cs-ink: #173766;
    --cs-muted: #7d97b6;
    --cs-line: #e0ebf8;
    --cs-bg: #eef3f9;
    --cs-green: #12a150;
}

/* ───────── Tombol mengambang ───────── */
.cs-fab {
    position: fixed; right: 16px; bottom: 24px; z-index: 55;
    width: 58px; height: 58px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
    display: grid; place-items: center; color: #fff; text-decoration: none;
    background: linear-gradient(135deg, #1b6ee0, var(--cs-blue-dark));
    box-shadow: 0 10px 28px rgba(20, 83, 194, .38), 0 2px 6px rgba(20, 83, 194, .25);
    transition: transform .18s ease, box-shadow .18s ease;
}
.cs-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 34px rgba(20, 83, 194, .45); }
.cs-fab:focus-visible { outline: 3px solid #9ec5ff; outline-offset: 3px; }
.cs-fab svg { width: 28px; height: 28px; }
.cs-fab .cs-fab-close { display: none; }
.cs-fab.is-open .cs-fab-icon { display: none; }
.cs-fab.is-open .cs-fab-close { display: block; }
.cs-fab::after { /* cincin denyut agar ikon mudah ditemukan */
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(27, 110, 224, .45); animation: cs-ring 2.8s ease-out infinite; pointer-events: none;
}
.cs-fab.is-open::after { animation: none; }
@keyframes cs-ring { 0% { box-shadow: 0 0 0 0 rgba(27, 110, 224, .45); } 70%, 100% { box-shadow: 0 0 0 16px rgba(27, 110, 224, 0); } }
.cs-badge {
    position: absolute; top: -3px; right: -3px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
    background: #ef4444; color: #fff; font: 800 11px/22px 'Roboto', ui-sans-serif, system-ui, sans-serif; text-align: center;
    border: 2px solid #fff; box-sizing: border-box;
}
.cs-badge[hidden] { display: none; }
@media (max-width: 1023px) { .cs-fab--nav { bottom: calc(5.6rem + env(safe-area-inset-bottom, 0px)); } }
/* Jangan tutupi bar checkout / beli yang menempel di atas navigasi bawah (mobile). */
@media (max-width: 1023px) {
    body:has(.product-buybar, .dp-sticky-bar, [data-sticky-bar]:not([style*="display: none"])) .cs-fab--nav { bottom: calc(9.6rem + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .cs-fab::after { animation: none; } .cs-fab { transition: none; } }

/* ───────── Panel widget ───────── */
.cs-panel {
    position: fixed; right: 16px; bottom: 96px; z-index: 56;
    width: 390px; height: min(620px, calc(100dvh - 124px));
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border-radius: 22px; border: 1px solid var(--cs-line);
    box-shadow: 0 24px 60px rgba(23, 55, 102, .28);
    opacity: 0; transform: translateY(14px) scale(.98); transform-origin: bottom right;
    visibility: hidden; pointer-events: none; transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.cs-panel.is-open { opacity: 1; transform: none; visibility: visible; pointer-events: auto; }
.cs-panel-head {
    display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; color: #fff;
    background: linear-gradient(135deg, #1b6ee0 0%, var(--cs-blue-dark) 100%);
}
.cs-avatar {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; position: relative;
    background: rgba(255, 255, 255, .18); color: #fff;
}
.cs-avatar svg { width: 22px; height: 22px; }
.cs-avatar::after { content: ""; position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: #35d07f; border: 2px solid #1453c2; }
.cs-panel-title { min-width: 0; flex: 1; }
.cs-panel-title strong { display: block; font: 800 15px/1.2 'Roboto', ui-sans-serif, system-ui, sans-serif; }
.cs-panel-title span { display: block; margin-top: 3px; font: 500 12px/1.3 'Roboto', ui-sans-serif, system-ui, sans-serif; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-panel-actions { display: flex; gap: 4px; }
.cs-headbtn {
    width: 36px; height: 36px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer;
    display: grid; place-items: center; text-decoration: none;
}
.cs-headbtn:hover { background: rgba(255, 255, 255, .26); }
.cs-headbtn svg { width: 18px; height: 18px; }
.cs-panel .cs-thread { flex: 1; min-height: 0; }

@media (min-width: 640px) and (max-width: 1023px) { .cs-panel--nav { bottom: calc(5.6rem + 76px + env(safe-area-inset-bottom, 0px)); } }
@media (max-width: 639px) {
    .cs-panel { inset: 0; right: 0; bottom: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; z-index: 90; transform: translateY(24px); }
    .cs-panel.is-open { transform: none; }
    .cs-panel-head { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
    .cs-fab.is-open { display: none; }
}
html.cs-lock, html.cs-lock body { overflow: hidden !important; }

/* ───────── Thread (dipakai widget, halaman penuh, inbox) ───────── */
.cs-thread { display: flex; flex-direction: column; min-height: 0; height: 100%; position: relative; background: var(--cs-bg); font-family: 'Roboto', ui-sans-serif, system-ui, sans-serif; }
.cs-messages {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 10px;
    display: flex; flex-direction: column; gap: 3px; scroll-behavior: auto;
    background-image: radial-gradient(rgba(20, 83, 194, .05) 1px, transparent 1px); background-size: 18px 18px;
}
.cs-day { align-self: center; margin: 12px 0 8px; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: #6b86a8; font: 700 11px/1.4 'Roboto', ui-sans-serif, system-ui, sans-serif; box-shadow: 0 1px 2px rgba(23, 55, 102, .08); }
.cs-row { display: flex; align-items: flex-end; }
.cs-row--mine { justify-content: flex-end; }
.cs-row + .cs-row--gap { margin-top: 8px; }
.cs-bubble {
    position: relative; max-width: min(80%, 480px); padding: 7px 10px 6px; border-radius: 16px; font-size: 14px; line-height: 1.45; color: var(--cs-ink);
    background: #fff; border: 1px solid #dfe9f6; box-shadow: 0 1px 2px rgba(23, 55, 102, .06); min-width: 0;
}
.cs-row--mine .cs-bubble { background: var(--cs-blue); border-color: var(--cs-blue); color: #fff; border-bottom-right-radius: 5px; }
.cs-row:not(.cs-row--mine) .cs-bubble { border-bottom-left-radius: 5px; }
.cs-label { display: block; margin-bottom: 2px; font: 800 11.5px/1.3 'Roboto', ui-sans-serif, system-ui, sans-serif; color: #2f7be0; }
.cs-text { white-space: pre-wrap; margin: 0; word-break: break-word; overflow-wrap: anywhere; }
.cs-meta { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 4px; font: 600 10.5px/1 'Roboto', ui-sans-serif, system-ui, sans-serif; letter-spacing: 0; white-space: nowrap; color: #98aec9; }
.cs-meta > * { flex: 0 0 auto; }
.cs-time { font-variant-numeric: tabular-nums; }
.cs-row--mine .cs-meta { color: rgba(255, 255, 255, .72); }
/* Centang + keterangan "Terkirim" / "Dilihat" */
.cs-tick { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.cs-tick-mark { display: block; flex: 0 0 auto; }
.cs-tick-label { font-size: 10px; font-weight: 600; letter-spacing: 0; }
.cs-tick.is-read { color: #8fe0ff; }
.cs-media { display: block; margin: 2px 0 4px; padding: 0; border: 0; background: #dbe6f4; border-radius: 11px; overflow: hidden; max-width: 100%; cursor: zoom-in; position: relative; }
.cs-media img, .cs-media video { display: block; max-width: 100%; width: auto; max-height: 300px; min-width: 120px; min-height: 80px; object-fit: cover; }
.cs-media video { cursor: default; background: #000; width: 100%; min-width: 220px; }
.cs-row--media .cs-bubble { padding: 4px 4px 5px; }
.cs-row--media .cs-text, .cs-row--media .cs-meta { padding-left: 6px; padding-right: 6px; }
.cs-row--media .cs-label { padding: 3px 6px 0; }

/* pesan yang sedang diunggah */
.cs-row--pending .cs-bubble { opacity: .82; }
.cs-progress { position: absolute; left: 4px; right: 4px; bottom: 4px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.cs-progress i { display: block; height: 100%; width: 0; background: #fff; transition: width .15s linear; }
.cs-uploading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 63, 150, .35); color: #fff; font: 800 12px 'Roboto', ui-sans-serif, system-ui, sans-serif; }

.cs-empty { margin: auto; max-width: 270px; text-align: center; padding: 24px 12px; }
.cs-empty-ico { width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; background: #fff; color: var(--cs-blue); box-shadow: 0 6px 18px rgba(20, 83, 194, .12); }
.cs-empty-ico svg { width: 30px; height: 30px; }
.cs-empty h4 { margin: 0; font: 800 15px/1.3 'Roboto', ui-sans-serif, system-ui, sans-serif; color: var(--cs-ink); }
.cs-empty p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--cs-muted); }
.cs-loading { margin: auto; display: flex; gap: 6px; }
.cs-loading i { width: 8px; height: 8px; border-radius: 50%; background: #9db8dc; animation: cs-bounce 1s infinite ease-in-out; }
.cs-loading i:nth-child(2) { animation-delay: .15s; } .cs-loading i:nth-child(3) { animation-delay: .3s; }
@keyframes cs-bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

.cs-jump {
    position: absolute; right: 14px; bottom: 84px; z-index: 3; display: none; align-items: center; gap: 6px;
    padding: 7px 12px; border: 0; border-radius: 999px; background: var(--cs-blue); color: #fff; cursor: pointer;
    font: 800 12px 'Roboto', ui-sans-serif, system-ui, sans-serif; box-shadow: 0 6px 16px rgba(20, 83, 194, .35);
}
.cs-jump.is-visible { display: inline-flex; }

/* ───────── Composer ───────── */
.cs-compose { background: #fff; border-top: 1px solid var(--cs-line); padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
.cs-quick { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.cs-quick::-webkit-scrollbar { display: none; }
.cs-quick[hidden] { display: none; }
.cs-quick button { flex: 0 0 auto; border: 1px solid #cfe0f6; background: #fff; color: #315b91; border-radius: 999px; padding: 7px 12px; font: 700 12px 'Roboto', ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.cs-quick button:hover { background: var(--cs-blue-soft); border-color: #9fbee7; }
.cs-preview { display: flex; align-items: center; gap: 10px; margin: 0 2px 8px; padding: 8px; border: 1px solid var(--cs-line); border-radius: 14px; background: #f7faff; }
.cs-preview[hidden] { display: none; }
.cs-preview-thumb { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: #dbe6f4; display: grid; place-items: center; }
.cs-preview-thumb img, .cs-preview-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-preview-info { min-width: 0; flex: 1; }
.cs-preview-info strong { display: block; font: 700 13px/1.3 'Roboto', ui-sans-serif, system-ui, sans-serif; color: var(--cs-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-preview-info span { font: 500 11.5px 'Roboto', ui-sans-serif, system-ui, sans-serif; color: var(--cs-muted); }
.cs-preview-x { flex: 0 0 auto; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #e5eefa; color: #4a6a93; cursor: pointer; display: grid; place-items: center; }
.cs-preview-x:hover { background: #d3e2f6; }
.cs-error { margin: 0 2px 8px; padding: 8px 12px; border-radius: 12px; background: #fff1f1; color: #c0392b; font: 600 12.5px/1.4 'Roboto', ui-sans-serif, system-ui, sans-serif; border: 1px solid #ffd5d5; }
.cs-error[hidden] { display: none; }
.cs-form { display: flex; align-items: flex-end; gap: 8px; }
.cs-iconbtn { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--cs-blue-soft); color: var(--cs-blue); cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.cs-iconbtn:hover { background: #dbeaff; }
.cs-iconbtn svg { width: 22px; height: 22px; }
.cs-input {
    flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 120px; padding: 11px 16px; border: 1.5px solid #d3e2f5; border-radius: 22px;
    background: #f7faff; color: var(--cs-ink); font: 500 14px/1.45 'Roboto', ui-sans-serif, system-ui, sans-serif; outline: none; box-sizing: border-box; display: block;
}
.cs-input:focus { border-color: var(--cs-blue); background: #fff; box-shadow: 0 0 0 3px rgba(20, 83, 194, .1); }
.cs-send { flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--cs-blue); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .15s, transform .1s, opacity .15s; }
.cs-send:hover:not(:disabled) { background: var(--cs-blue-dark); }
.cs-send:active:not(:disabled) { transform: scale(.94); }
.cs-send:disabled { opacity: .45; cursor: not-allowed; }
.cs-send svg { width: 20px; height: 20px; }
.cs-hint { margin: 6px 4px 0; font: 500 11px 'Roboto', ui-sans-serif, system-ui, sans-serif; color: #9fb2cb; }
.cs-thread.is-drop::after { content: "Lepaskan foto/video di sini"; position: absolute; inset: 8px; z-index: 5; display: grid; place-items: center; border: 2px dashed var(--cs-blue); border-radius: 18px; background: rgba(237, 245, 255, .94); color: var(--cs-blue); font: 800 14px 'Roboto', ui-sans-serif, system-ui, sans-serif; }
@media (max-width: 639px) { .cs-hint { display: none; } }

/* ───────── Lightbox ───────── */
.cs-lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(8, 18, 36, .9); padding: 24px; cursor: zoom-out; }
.cs-lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.cs-lightbox button { position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-size: 22px; cursor: pointer; }

/* ───────── Halaman penuh pengguna ───────── */
.cs-page { max-width: 820px; margin: 0 auto; }
.cs-page-card { display: flex; flex-direction: column; height: min(720px, calc(100dvh - 230px)); min-height: 480px; overflow: hidden; border: 1px solid var(--cs-line); border-radius: 22px; background: #fff; box-shadow: 0 12px 35px rgba(39, 81, 132, .08); }
.cs-page-card .cs-panel-head { flex: 0 0 auto; }
.cs-page-card .cs-thread { flex: 1; min-height: 0; }
.cs-page-card .cs-avatar::after { border-color: #1453c2; }

/* ───────── Inbox CS ───────── */
.cs-inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: min(720px, calc(100dvh - 250px)); min-height: 520px; overflow: hidden; border: 1px solid var(--cs-line); border-radius: 22px; background: #fff; box-shadow: 0 12px 35px rgba(39, 81, 132, .08); }
.cs-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--cs-line); background: #fbfdff; }
.cs-side-head { padding: 14px; border-bottom: 1px solid var(--cs-line); }
.cs-search { position: relative; }
.cs-search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: #88a0bd; pointer-events: none; }
.cs-search input { width: 100%; height: 42px; padding: 0 12px 0 36px; border: 1.5px solid #dce8f8; border-radius: 12px; background: #fff; font: 600 13px 'Roboto', ui-sans-serif, system-ui, sans-serif; color: var(--cs-ink); outline: none; box-sizing: border-box; }
.cs-search input:focus { border-color: var(--cs-blue); }
.cs-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 10px; }
.cs-tab { border: 1px solid #dce8f8; background: #fff; color: #58769d; border-radius: 9px; padding: 7px 2px; font: 800 11px/1.1 'Roboto', ui-sans-serif, system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.cs-tab:hover { background: #f4f8ff; }
.cs-tab.is-active { background: var(--cs-blue); border-color: var(--cs-blue); color: #fff; }
.cs-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.cs-conv { display: flex; gap: 11px; align-items: center; padding: 12px 14px; border-bottom: 1px solid #edf3fa; text-decoration: none; background: #fff; transition: background .12s; }
.cs-conv:hover { background: #f6faff; }
.cs-conv.is-active { background: var(--cs-blue-soft); }
.cs-conv[hidden] { display: none; }
.cs-ava { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #5b9cf0, var(--cs-blue)); color: #fff; font: 800 16px 'Roboto', ui-sans-serif, system-ui, sans-serif; }
.cs-conv-body { min-width: 0; flex: 1; }
.cs-conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cs-conv-top strong { min-width: 0; font: 800 13.5px/1.3 'Roboto', ui-sans-serif, system-ui, sans-serif; color: var(--cs-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-conv-top time { flex: 0 0 auto; font: 600 11px 'Roboto', ui-sans-serif, system-ui, sans-serif; color: #9bb0ca; }
.cs-conv.has-unread .cs-conv-top time { color: var(--cs-blue); }
.cs-conv-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; }
.cs-conv-bottom p { margin: 0; min-width: 0; font: 500 12.5px/1.4 'Roboto', ui-sans-serif, system-ui, sans-serif; color: #7f98b7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-conv.has-unread .cs-conv-bottom p { color: var(--cs-ink); font-weight: 700; }
.cs-unread { flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--cs-blue); color: #fff; font: 800 11px/20px 'Roboto', ui-sans-serif, system-ui, sans-serif; text-align: center; box-sizing: border-box; }
.cs-conv-tags { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.cs-tag { padding: 2px 8px; border-radius: 999px; font: 800 10px/1.5 'Roboto', ui-sans-serif, system-ui, sans-serif; background: #eef3fa; color: #5a7799; }
.cs-tag--open { background: #e6f7ee; color: #0e7a3d; }
.cs-tag--waiting { background: #fff4de; color: #a8670a; }
.cs-tag--closed { background: #eceff3; color: #5d6773; }
.cs-list-empty { padding: 34px 20px; text-align: center; font-size: 13px; line-height: 1.6; color: var(--cs-muted); }
.cs-list-empty strong { display: block; margin-bottom: 4px; color: #315b91; font: 800 14px 'Roboto', ui-sans-serif, system-ui, sans-serif; }

.cs-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cs-main-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--cs-line); background: #fff; flex-wrap: wrap; }
.cs-back { display: none; width: 38px; height: 38px; border-radius: 12px; background: #f1f6ff; color: #315b91; place-items: center; text-decoration: none; flex: 0 0 auto; }
.cs-back svg { width: 20px; height: 20px; }
.cs-who { min-width: 0; flex: 1; }
.cs-who strong { display: block; font: 800 15px/1.3 'Roboto', ui-sans-serif, system-ui, sans-serif; color: var(--cs-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-who span { display: block; font: 500 12px/1.4 'Roboto', ui-sans-serif, system-ui, sans-serif; color: var(--cs-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-head-tools { display: flex; align-items: center; gap: 8px; }
.cs-select { height: 36px; padding: 0 10px; border: 1.5px solid #d3e2f5; border-radius: 10px; background: #fff; color: var(--cs-ink); font: 700 12px 'Roboto', ui-sans-serif, system-ui, sans-serif; }
.cs-btn { height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--cs-blue); color: #fff; font: 800 12px 'Roboto', ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.cs-btn:hover { background: var(--cs-blue-dark); }
.cs-btn--ghost { background: var(--cs-blue-soft); color: var(--cs-blue); }
.cs-btn--ghost:hover { background: #dbeaff; }
.cs-main .cs-thread { flex: 1; min-height: 0; }
.cs-placeholder { margin: auto; max-width: 320px; padding: 24px; text-align: center; }
.cs-main--empty { background: #f8fbff; }

@media (max-width: 1023px) {
    .cs-inbox { grid-template-columns: 1fr; height: calc(100dvh - 200px); min-height: 480px; border-radius: 18px; }
    .cs-inbox.has-selected .cs-side { display: none; }
    .cs-inbox:not(.has-selected) .cs-main { display: none; }
    .cs-back { display: grid; }
    .cs-side { border-right: 0; }
}
@media (max-width: 639px) {
    .cs-page-card { height: calc(100dvh - 190px); border-radius: 18px; }
    .cs-bubble { max-width: 86%; }
    .cs-head-tools { width: 100%; }
    .cs-head-tools form { flex: 1; display: flex; gap: 8px; }
    .cs-head-tools .cs-select { flex: 1; }
}


/* Emoji picker + mobile composer reliability */
.cs-emoji-toggle { font-size: 21px; line-height: 1; }
.cs-emoji-picker { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; max-height: 150px; overflow-y: auto; padding: 8px; margin: 0 2px 8px; border: 1px solid var(--cs-line); border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(23,55,102,.12); }
.cs-emoji-picker[hidden] { display: none; }
.cs-emoji { min-width: 0; min-height: 34px; border: 0; border-radius: 8px; background: transparent; font-size: 21px; cursor: pointer; }
.cs-emoji:hover, .cs-emoji:focus-visible { background: var(--cs-blue-soft); outline: 2px solid #b9d2f7; }
.cs-compose { flex: 0 0 auto; position: relative; z-index: 2; }
.cs-form { min-width: 0; }
.cs-input { width: 100%; max-width: 100%; min-width: 0; font-size: 16px; }
.cs-messages { -webkit-overflow-scrolling: touch; }
@media (max-width: 639px) {
  .cs-panel { height: 100vh; height: 100dvh; max-height: 100dvh; }
  .cs-panel-head { flex-shrink: 0; }
  .cs-thread { min-height: 0; }
  .cs-messages { padding: 12px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .cs-compose { padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .cs-form { gap: 6px; }
  .cs-iconbtn, .cs-send { width: 40px; height: 40px; flex-basis: 40px; }
  .cs-input { min-height: 40px; max-height: 96px; padding: 9px 12px; }
  .cs-emoji-picker { grid-template-columns: repeat(7, minmax(0, 1fr)); max-height: 125px; }
  .cs-panel-actions { flex: 0 0 auto; }
  .cs-headbtn { width: 38px; height: 38px; }
}


/* FIX mobile: composer must stay visible above the fixed storefront bottom navigation.
   Keep the message list as the only scrollable region; never let it push the composer
   below the viewport. Applies to the floating widget and the full chat page. */
@media (max-width: 639px) {
  .cs-panel {
    z-index: 10050 !important;
    top: 0 !important;
    right: 0 !important;
    left: 0 !important;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .cs-panel .cs-thread,
  .cs-page-card .cs-thread,
  .cs-main .cs-thread {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }
  .cs-panel .cs-messages,
  .cs-page-card .cs-messages,
  .cs-main .cs-messages {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
  .cs-panel .cs-compose,
  .cs-page-card .cs-compose,
  .cs-main .cs-compose {
    display: block !important;
    flex: 0 0 auto !important;
    position: relative !important;
    z-index: 5 !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    margin-bottom: 4px !important;
    background: #fff !important;
  }
  .cs-panel .cs-form,
  .cs-page-card .cs-form,
  .cs-main .cs-form {
    display: flex !important;
    align-items: flex-end !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .cs-panel .cs-input,
  .cs-page-card .cs-input,
  .cs-main .cs-input {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
  }
  .cs-panel .cs-send,
  .cs-panel .cs-iconbtn,
  .cs-page-card .cs-send,
  .cs-page-card .cs-iconbtn,
  .cs-main .cs-send,
  .cs-main .cs-iconbtn {
    flex-shrink: 0 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
  }
}


/* Filter pertanyaan yang sering ditanyakan (chip di atas kolom ketik) */
.cs-quick-wrap { margin: 0 0 2px; }
.cs-quick-wrap[hidden] { display: none; }
.cs-quick-title { margin: 0 4px 6px; font: 800 11px/1.3 'Roboto', ui-sans-serif, system-ui, sans-serif; color: #5a7799; text-transform: uppercase; letter-spacing: .04em; }
.cs-quick { padding-bottom: 6px; }
.cs-quick button { white-space: nowrap; }