/* The curator's chat bubble: the round button at the bottom right, and the chat window it opens. */

/* The button */
.cb-fab { position: fixed; right: 24px; bottom: 24px; z-index: 50; width: 45px; height: 45px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 10px 28px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .06) inset; transition: transform .18s var(--ease), box-shadow .18s; }
.cb-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(0, 0, 0, .4); }
.cb-fab-ico { position: absolute; display: grid; place-items: center; transition: opacity .2s, transform .25s var(--ease); }
.cb-fab-ico .ico { width: 21px; height: 21px; }
.cb-fab-ico.is-b { opacity: 0; transform: rotate(-90deg) scale(.6); }
.cb-fab.is-open .cb-fab-ico.is-a { opacity: 0; transform: rotate(90deg) scale(.6); }
.cb-fab.is-open .cb-fab-ico.is-b { opacity: 1; transform: none; }
.cb-ring { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent; transition: border-color .2s; }
.cb-fab.is-working .cb-ring { border-color: color-mix(in srgb, var(--accent) 30%, transparent); border-top-color: var(--accent-text); animation: cb-spin 1s linear infinite; }
@keyframes cb-spin { to { transform: rotate(360deg); } }
.cb-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; background: var(--warn); color: #1b1300; font-size: 12px; font-weight: 800; box-shadow: 0 0 0 3px var(--bg); }

/* The window */
.cb[hidden] { display: none; }
.cb-panel { position: fixed; right: 24px; bottom: 81px; z-index: 50; width: var(--cb-w, 560px); height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column; border-radius: 18px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); overflow: hidden; transform-origin: bottom right; }
.cb-panel[hidden] { display: none; }
.cb-panel.is-resizing { user-select: none; }
.cb-grip { position: absolute; z-index: 2; width: 20px; height: 20px; opacity: 0; transition: opacity .14s; touch-action: none; }
.cb-grip.is-near, .cb-panel.is-resizing .cb-grip { opacity: 1; }
.cb-grip.is-nw { top: 0; left: 0; cursor: ew-resize; }
.cb-grip.is-sw { bottom: 0; left: 0; cursor: ew-resize; }
.cb-grip::before { content: ''; position: absolute; bottom: 5px; right: 5px; width: 10px; height: 10px; opacity: .7; background-image: linear-gradient(135deg, transparent 30%, var(--muted) 30%, var(--muted) 40%, transparent 40%), linear-gradient(135deg, transparent 50%, var(--muted) 50%, var(--muted) 60%, transparent 60%), linear-gradient(135deg, transparent 70%, var(--muted) 70%, var(--muted) 80%, transparent 80%); }
.cb-grip.is-nw::before { transform: rotate(180deg); bottom: auto; right: auto; top: 5px; left: 5px; }
.cb-grip.is-sw::before { transform: rotate(90deg); right: auto; left: 5px; }
.cb-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--line); }
.cb-avatar { position: relative; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.cb-avatar .ico { width: 18px; height: 18px; }
.cb-avatar.is-working::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--accent-text); animation: cb-spin 1s linear infinite; }
.cb-title { display: grid; flex: 1; min-width: 0; }
.cb-title small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-3); flex: none; }
.cb-dot.is-on { background: #4ac578; box-shadow: 0 0 0 3px rgba(74, 197, 120, .18); }
.cb-meter { width: 46px; height: 5px; border-radius: 3px; background: var(--hover-strong); overflow: hidden; flex: none; }
.cb-meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.cb-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cb-chat .ch-timeline { padding: 16px 12px 14px 14px; }
.cb-chat .ch-composer { padding: 10px 12px 12px; }
.cb-chat .ch-tools, .cb-chat .ch-changes { margin-left: 0; }
.cb-chat .ch-msg.is-you { max-width: 88%; }
.cb-chat-av { background: var(--accent-soft); color: var(--accent-text); }
.cb-sys { display: flex; justify-content: center; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.cb-sys .ico { width: 14px; height: 14px; color: #4ac578; flex: none; }
.cb-sys small { font-size: 11px; opacity: .8; }

.cb-act { align-self: stretch; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, #4ac578 35%, var(--line)); background: color-mix(in srgb, #4ac578 7%, transparent); transition: border-color .25s, background-color .25s, opacity .25s; }
.cb-act-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, #4ac578 16%, transparent); color: #4ac578; flex: none; }
.cb-act-ico .ico { width: 16px; height: 16px; }
.cb-act-main { display: grid; flex: 1; min-width: 0; font-size: 13px; }
.cb-act-main small { color: var(--muted); font-size: 12px; }
.cb-act.is-undone { border-color: var(--line); background: transparent; opacity: .7; }
.cb-act.is-undone .cb-act-ico { background: var(--hover); color: var(--muted); }
.cb-act.is-refused { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: color-mix(in srgb, var(--danger) 7%, transparent); }
.cb-act.is-refused .cb-act-ico { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.cb-undo { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border-radius: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 600; transition: background-color .15s, color .15s; flex: none; }
.cb-undo:hover { background: var(--hover-strong); color: var(--text); }
.cb-undo .ico { width: 14px; height: 14px; }

@media (max-width: 640px) {
	.cb-fab { right: 16px; bottom: 16px; }
	.cb-panel { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; z-index: 85; }
	.cb-grip { display: none; }
	.cb-fab.is-open { opacity: 0; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) { .cb-fab.is-working .cb-ring, .cb-avatar.is-working::after { animation: none; } }

.cb-sys.is-error { color: var(--danger); }
.cb-sys.is-error .ico { color: var(--danger); }
.cb-dot.is-off { background: var(--danger); }
.cb-head .icon-btn:disabled { opacity: .4; }
.cu-row .cb-undo { margin-right: 4px; }
.cb-badge[hidden] { display: none; }
