.cmyk-chat-ui {
    --cmyk-ink: #122536;
    --cmyk-cyan: #087ba2;
    --cmyk-soft: #e5f6fc;
    --cmyk-line: #dce7ec;
    color: var(--cmyk-ink);
    font: 15px/1.45 system-ui, sans-serif;
}
.cmyk-chat-ui *, .cmyk-chat-ui *::before, .cmyk-chat-ui *::after { box-sizing: border-box; }
.cmyk-chat-ui [hidden] { display: none !important; }
.cmyk-chat-ui button {
    padding: 9px 13px; color: #fff; background: var(--cmyk-cyan); border: 1px solid transparent;
    border-radius: 8px; cursor: pointer; font: inherit; font-weight: 650;
}
.cmyk-chat-ui button:disabled { opacity: .55; cursor: default; }
.cmyk-chat-ui label { display: grid; gap: 4px; min-width: 0; font-weight: 600; }
.cmyk-chat-ui textarea, .cmyk-chat-ui input:not([type=checkbox]), .cmyk-chat-ui select {
    width: 100%; min-width: 0; margin: 0; padding: 8px; border: 1px solid #9fb5c1;
    border-radius: 7px; background: #fff; color: var(--cmyk-ink); font: inherit; font-weight: normal;
}
.cmyk-chat-ui textarea { resize: vertical; }
.cmyk-chat-ui header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 16px; background: var(--cmyk-ink); color: #fff; }
.cmyk-chat-ui header a { color: #fff; margin-left: auto; font-size: 13px; }
.cmyk-chat-ui small { display: block; font-size: 12px; }
.cmyk-chat-ui header small { color: #c3e7f4; }
.cmyk-chat-ui [data-error] { margin: 0; padding: 9px 15px; color: #9b2046; background: #fff0f5; }
.cmyk-floating { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); left: 16px; z-index: 99999; }
.cmyk-floating [data-toggle] { border-radius: 999px; box-shadow: 0 6px 22px #12253632; }
.cmyk-floating [data-box] { position: absolute; bottom: 51px; left: 0; width: min(430px, calc(100vw - 32px)); height: min(630px, calc(100dvh - 90px)); box-shadow: 0 12px 36px #12253630; }
.cmyk-inline { width: 100%; max-width: 960px; margin: 16px auto; }
.cmyk-inline [data-box] { height: min(760px, max(570px, 82dvh)); }
.cmyk-panel { min-width: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--cmyk-line); border-radius: 14px; overflow: hidden; }
.cmyk-room { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cmyk-service { margin: 0; padding: 8px 16px; background: #fff5d6; font-size: 13px; }
.cmyk-start { display: grid; gap: 11px; padding: 16px; overflow: auto; }
.cmyk-messages { flex: 1; min-height: 0; overflow: auto; padding: 14px; background: #f2f6f8; }
.cmyk-message { width: fit-content; max-width: min(86%, 660px); margin-bottom: 9px; padding: 9px 12px; background: white; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmyk-message small { color: #475f6c; margin-bottom: 4px; }
.cmyk-message a { display: block; }
.cmyk-chat-ui[data-role=customer] [data-sender=customer], .cmyk-chat-ui[data-role=operator] [data-sender=admin] { margin-left: auto; background: var(--cmyk-soft); }
.cmyk-compose { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; padding: 10px 13px; border-top: 1px solid var(--cmyk-line); }
.cmyk-textbox { flex: 1 1 120px; }
.cmyk-upload { flex-basis: 190px; font-size: 12px; }
.cmyk-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px; }
.cmyk-actions button, .cmyk-chat-ui [data-older] { color: var(--cmyk-ink); background: var(--cmyk-soft); font-size: 13px; }
.cmyk-inbox { display: grid; grid-template-columns: minmax(220px, 290px) minmax(0, 1fr); gap: 12px; }
.cmyk-inbox aside, .cmyk-settings { padding: 12px; background: #fff; border: 1px solid var(--cmyk-line); border-radius: 12px; }
.cmyk-inbox aside label + label { margin: 8px 0; }
.cmyk-inbox [data-list] { display: grid; gap: 4px; max-height: 56vh; overflow: auto; }
.cmyk-inbox [data-conversation] { text-align: left; overflow-wrap: anywhere; color: var(--cmyk-ink); background: #f2f6f8; }
.cmyk-inbox [aria-pressed=true] { background: var(--cmyk-soft); border-color: var(--cmyk-cyan); }
.cmyk-inbox .cmyk-panel { height: min(800px, max(480px, 78vh)); }
.cmyk-settings { margin-top: 14px; }
.cmyk-settings summary { cursor: pointer; font-weight: 650; }
.cmyk-settings label { margin: 8px 0; }
.cmyk-settings label:has(input[type=checkbox]) { display: block; }
@media (max-width: 780px) {
    .cmyk-inbox { grid-template-columns: 1fr; }
    .cmyk-inbox [data-list] { max-height: 200px; }
}

.cmyk-knowledge-chat, .cmyk-knowledge-preview {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--cmyk-line);
    border-radius: 10px;
    background: #f6fbfd;
}
.cmyk-knowledge-log { max-height: 260px; overflow: auto; }
.cmyk-knowledge-log:empty { display: none; }
.cmyk-knowledge-preview button { margin: 4px 4px 0 0; }
.cmyk-knowledge-chat [data-knowledge-status] { margin-bottom: 0; }
/* Workspace chat layout */
.cmyk-chat-ui { --cmyk-ink:#172b32; --cmyk-cyan:#087e8b; --cmyk-soft:#d9f4f1; }
.cmyk-inbox { gap:0; border:1px solid #d5dfe2; border-radius:12px; overflow:hidden; background:white; }
.cmyk-inbox aside { border:0; border-right:1px solid #d5dfe2; border-radius:0; }
.cmyk-inbox .cmyk-panel { border:0; border-radius:0; height:82vh; }
.cmyk-chat-ui header { background:#edf3f4; color:#172b32; }
.cmyk-chat-ui header small { color:#526970; }
.cmyk-chat-ui header a { color:#087e8b; }
.cmyk-messages { background:#eae7df; padding:22px; }
.cmyk-message { border-radius:8px; padding:10px 13px; box-shadow:0 1px 1px #172b321a; }
.cmyk-message button { display:block; margin-top:8px; font-size:12px; }
.cmyk-compose { background:#f0f3f4; }
.cmyk-inline { max-width:1250px; margin:0 auto; }
.cmyk-inline [data-box] { height:85dvh; min-height:500px; }
.cmyk-inbox [data-conversation] { padding:16px 12px; border-radius:0; border-bottom:1px solid #e8edef; background:white; }
.cmyk-inbox [aria-pressed=true] { background:#e7f1f3; }
.cmyk-compose small { flex-basis:100%; color:#526970; font-size:11px; }
@media(max-width:780px) { .cmyk-inbox .cmyk-panel { height:70dvh; } .cmyk-messages { padding:12px; } .cmyk-inline [data-box] { height:85dvh; border-radius:0; } }

/* Compact composer shared by customer and operator. */
.cmyk-chat-ui .cmyk-compose { display:block; padding:10px; }
.cmyk-compose-bar { display:flex; align-items:center; gap:4px; width:100%; padding:4px 6px; border:1px solid #e2e7e8; border-radius:28px; background:#fff; }
.cmyk-compose-bar:focus-within { border-color:#087e8b; }
.cmyk-chat-ui .cmyk-compose-bar textarea { flex:1; width:0; min-width:0; height:38px; min-height:38px; max-height:120px; padding:8px 4px; border:0; border-radius:0; resize:none; box-shadow:none; outline:none; line-height:22px; background:transparent; }
.cmyk-chat-ui .cmyk-icon-button { display:flex; flex:0 0 40px; align-items:center; justify-content:center; width:40px; height:40px; padding:8px; border:0; border-radius:50%; background:transparent; color:#263b40; }
.cmyk-chat-ui .cmyk-icon-button:hover { background:#edf4f4; }
.cmyk-chat-ui .cmyk-icon-button:focus-visible { outline:2px solid #087e8b; outline-offset:2px; }
.cmyk-icon-button svg { display:block; width:23px; height:23px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.cmyk-chat-ui .cmyk-send-button { color:#087e8b; }
.cmyk-file-preview { display:flex; align-items:center; gap:8px; padding:6px 12px 0; font-size:12px; }
.cmyk-file-preview span { min-width:0; overflow-wrap:anywhere; }
.cmyk-chat-ui .cmyk-file-preview button { padding:0 8px; background:transparent; color:#526970; font-size:22px; }
