:root {
    --bg: #0f1115;
    --panel: #161922;
    --panel-2: #1c2030;
    --line: #262b3a;
    --text: #e6e9ef;
    --muted: #8d94a7;
    --accent: #4f7cff;
    --accent-hover: #6a8dff;
    --bubble-in: #232940;
    --bubble-out: #2d4a8a;
    --green: #25d366;
    --tg: #2aabee;
    --ig: #e1306c;
    --fb: #1877f2;
    --danger: #ef4444;
    --ok: #22c55e;
    --warn: #f59e0b;
    --hover: rgba(255,255,255,0.05);
}

/* Light theme (WhatsApp Web palette) ------------------------------------- */
html[data-theme="light"] {
    --bg: #efeae2;
    --panel: #ffffff;
    --panel-2: #f0f2f5;
    --line: #d1d7db;
    --text: #111b21;
    --muted: #667781;
    --accent: #00a884;
    --accent-hover: #008069;
    --bubble-in: #ffffff;
    --bubble-out: #d9fdd3;
    --hover: rgba(0,0,0,0.05);
}
html[data-theme="light"] .badge.live { background: #e9edef; color: var(--muted); }
html[data-theme="light"] .conv-item.active { background: rgba(0,168,132,0.12); }
html[data-theme="light"] .chip.icon.active.st-closed { background: #8696a0; border-color: #8696a0; }
html[data-theme="light"] .bubble .reply:hover { background: rgba(0,0,0,0.04); }
html[data-theme="light"] .message.out .bubble .status[data-status="Read"] { color: #53bdeb; }
html[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.4); }
html[data-theme="light"] .internal-messages { background: var(--bg); }

* { box-sizing: border-box; }
/* HTML hidden-attribute MUST win over component-level display rules
   (e.g. .rec-bar { display:flex } would otherwise show a hidden bar). */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }

/* Custom scrollbars -------------------------------------------------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
body { font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); }

/* Sidebar ------------------------------------------------------------ */
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; grid-column: 1; grid-row: 1; }
.brand { height: 56px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.brand-logo { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo img { width: 28px; height: 28px; border-radius: 8px; display: block; }
.brand .logo { font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.badge.live { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: #374151; color: var(--muted); }
.badge.live.on { background: rgba(34,197,94,0.15); color: var(--ok); }

.filters { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.filters input[type="search"] { width: 100%; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; outline: none; }
.filter-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-top: 2px; }
.filter-divider { height: 1px; background: var(--line); margin: 4px 0; }
.channels, .statuses { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: 12px; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); color: white; border-color: var(--accent); }

.chip.icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.chip.icon svg { width: 18px; height: 18px; display: block; }
.chip.icon.wa { color: var(--green); }
.chip.icon.tg { color: var(--tg); }
.chip.icon.ig { color: var(--ig); }
.chip.icon.fb { color: var(--fb); }
.chip.icon:hover { background: rgba(255,255,255,0.06); border-color: currentColor; }
.chip.icon.active.wa { background: var(--green); border-color: var(--green); color: #052e1a; }
.chip.icon.active.tg { background: var(--tg); border-color: var(--tg); color: #0a293a; }
.chip.icon.active.ig { background: var(--ig); border-color: var(--ig); color: #fff; }
.chip.icon.active.fb { background: var(--fb); border-color: var(--fb); color: #fff; }

.chip.icon.st-open     { color: var(--accent); }
.chip.icon.st-pending  { color: var(--warn); }
.chip.icon.st-resolved { color: var(--ok); }
.chip.icon.st-closed   { color: var(--muted); }
.chip.icon.active.st-open     { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.icon.active.st-pending  { background: var(--warn);   border-color: var(--warn);   color: #2a1c00; }
.chip.icon.active.st-resolved { background: var(--ok);     border-color: var(--ok);     color: #042b0f; }
.chip.icon.active.st-closed   { background: #2a3146;       border-color: #2a3146;       color: #fff; }

.conv-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
.conv-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; padding: 10px 12px; align-items: center; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv-item:hover { background: var(--panel-2); }
.conv-item.active { background: rgba(79,124,255,0.12); }
.av-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #5b6cff, #c264ff); display: flex; align-items: center; justify-content: center; font-weight: 600; color: white; position: relative; overflow: hidden; }
img.avatar-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ch-dot { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--panel); z-index: 2; display: flex; align-items: center; justify-content: center; }
.ch-dot.wa { background: var(--green); }
.ch-dot.tg { background: var(--tg); }
.ch-dot.ig { background: var(--ig); }
.ch-dot.fb { background: var(--fb); }

.conv-meta { display: flex; flex-direction: column; min-width: 0; }
.conv-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }

/* Tiny status dot next to the contact name in the sidebar. */
.conv-status { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.conv-status.st-open     { background: var(--accent); }
.conv-status.st-pending  { background: var(--warn); }
.conv-status.st-resolved { background: var(--ok); }
.conv-status.st-closed   { background: #4a5170; }

/* Status pill in the thread header. */
.thread-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.2px; margin-left: 6px; vertical-align: middle; }
.thread-status.st-open     { background: rgba(79,124,255,0.18); color: var(--accent); }
.thread-status.st-pending  { background: rgba(245,158,11,0.18); color: var(--warn); }
.thread-status.st-resolved { background: rgba(34,197,94,0.18); color: var(--ok); }
.thread-status.st-closed   { background: rgba(141,148,167,0.18); color: var(--muted); }
.close-reason-hint { font-size: 12px; color: var(--muted); font-style: italic; font-weight: 400; vertical-align: middle; margin-left: 4px; }
.conv-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv-time { font-size: 11px; color: var(--muted); }
.conv-unread { background: var(--accent); color: white; padding: 1px 6px; border-radius: 999px; font-size: 11px; }

/* Thread ------------------------------------------------------------- */
/* min-height: 0 is critical — without it the flex column refuses to shrink
   below its content, so .messages overflow leaks out and the whole page
   gets a scrollbar instead of just the messages list. */
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; grid-column: 2; grid-row: 1; }
.thread-header { height: 56px; padding: 0 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); background: var(--panel); flex-shrink: 0; }
.thread-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-actions button { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 6px 12px; border-radius: 8px; cursor: pointer; margin-left: 6px; font-size: 13px; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.thread-status-mob { display: none; }
.btn-open { color: #3b82f6 !important; border-color: #3b82f640 !important; }
.btn-open:hover, .btn-open.active { background: #3b82f620 !important; border-color: #3b82f6 !important; color: #2563eb !important; }
.btn-pending { color: #f59e0b !important; border-color: #f59e0b40 !important; }
.btn-pending:hover, .btn-pending.active { background: #f59e0b20 !important; border-color: #f59e0b !important; color: #d97706 !important; }
.btn-resolve { color: #22c55e !important; border-color: #22c55e40 !important; }
.btn-resolve:hover, .btn-resolve.active { background: #22c55e20 !important; border-color: #22c55e !important; color: #16a34a !important; }
.btn-close-conv { color: #f97316 !important; border-color: #f9731640 !important; }
.btn-close-conv:hover, .btn-close-conv.active { background: #f9731620 !important; border-color: #f97316 !important; color: #ea580c !important; }
.thread-actions button:disabled { opacity: 0.35 !important; cursor: not-allowed !important; pointer-events: none !important; }

/* Close-reason modal */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.modal-overlay[hidden] { display: none; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: 320px; max-width: 92vw; }
.modal-title { font-size: 16px; font-weight: 700; margin: 0 0 16px; color: var(--text); }
.close-reason-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.reason-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; text-align: left; font-size: 14px; color: var(--text); cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.reason-btn:hover { background: var(--hover); border-color: var(--accent); }
.btn-cancel-modal { width: 100%; background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; color: var(--muted); cursor: pointer; transition: background 0.15s; }
.btn-cancel-modal:hover { background: var(--hover); }
.profile-avatar-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.profile-avatar-preview { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #5b6cff, #c264ff); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 18px; flex-shrink: 0; overflow: hidden; position: relative; }
.profile-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.profile-input { width: 100%; padding: 7px 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; outline: none; font-size: 13px; margin-top: 4px; box-sizing: border-box; }
.profile-input:focus { border-color: var(--accent); }
/* Theme selector (segmented control) */
.theme-selector { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 6px; }
.theme-btn { flex: 1; padding: 7px 4px; background: transparent; border: none; border-right: 1px solid var(--line); color: var(--muted); font-size: 12px; cursor: pointer; transition: background 0.15s, color 0.15s; }
.theme-btn:last-child { border-right: none; }
.theme-btn.active { background: var(--accent); color: #fff; }
.theme-btn:hover:not(.active) { background: var(--panel-2); color: var(--text); }
/* Chat background preview */
.chat-bg-preview { margin-top: 8px; height: 56px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg) center/cover no-repeat; transition: background 0.2s; }
/* Preset background grid */
.bg-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bg-preset-item { width: 52px; height: 52px; border-radius: 8px; border: 2px solid transparent; background: var(--panel-2) center/cover no-repeat; cursor: pointer; transition: border-color 0.15s, transform 0.1s; flex-shrink: 0; padding: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.bg-preset-item:hover { border-color: var(--accent); transform: scale(1.06); }
.bg-preset-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bg-preset-none { background: var(--panel-2); }
.agent-info { cursor: pointer; border-radius: 8px; padding: 2px 4px; transition: background 0.15s; }
.agent-info:hover { background: var(--panel-2); }

.messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.message { display: flex; max-width: 70%; }
.message.in { align-self: flex-start; }
.message.out { align-self: flex-end; flex-direction: row-reverse; }
.bubble { padding: 8px 12px; border-radius: 14px; position: relative; line-height: 1.35; word-wrap: break-word; }
.message.in .bubble { background: var(--bubble-in); border-bottom-left-radius: 4px; }
.message.out .bubble { background: var(--bubble-out); border-bottom-right-radius: 4px; }
.bubble .sender { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bubble .reply {
    border-left: 3px solid var(--accent);
    padding: 6px 8px; margin: 4px 0;
    background: rgba(255,255,255,0.05); border-radius: 4px;
    font-size: 12px; color: var(--text);
    display: flex; gap: 8px; align-items: center;
    cursor: pointer; transition: background 0.15s;
    max-width: 100%;
}
.bubble .reply:hover { background: rgba(255,255,255,0.10); }
.bubble .reply .reply-thumb {
    width: 36px; height: 36px; border-radius: 4px;
    object-fit: cover; flex-shrink: 0; display: block;
}
.bubble .reply .reply-body { min-width: 0; flex: 1; line-height: 1.25; }
.bubble .reply .reply-sender { color: var(--accent); font-weight: 600; font-size: 11px; margin-bottom: 1px; }
.bubble .reply .reply-text { color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }

/* Pulse highlight when arriving via reply-click */
.message.highlight .bubble {
    animation: msg-highlight 1.6s ease-out;
}
@keyframes msg-highlight {
    0%   { box-shadow: 0 0 0 0 rgba(79,124,255, 0.55); background-color: rgba(79,124,255, 0.18); }
    100% { box-shadow: 0 0 0 16px rgba(79,124,255, 0); background-color: transparent; }
}
.bubble .meta { font-size: 10px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.bubble .status { letter-spacing: -1px; }
.bubble .status[data-status="Read"] { color: #6ec1ff; }
.bubble .status[data-status="Failed"] { color: var(--danger); }
.bubble .reaction { position: absolute; bottom: -10px; right: 8px; background: var(--panel-2); border-radius: 999px; padding: 2px 6px; font-size: 12px; border: 1px solid var(--line); }
.bubble .actions { position: absolute; top: -10px; right: 6px; display: none; gap: 4px; }
.bubble:hover .actions { display: flex; }
.bubble .actions button { padding: 2px 6px; font-size: 11px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }

.attachment { margin-top: 6px; position: relative; display: inline-block; }
.attachment img, .attachment video { max-width: 280px; max-height: 280px; border-radius: 10px; display: block; }
.att-save-btn { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 6px; background: rgba(0,0,0,0.6); border: none; color: white; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; z-index: 15; transition: opacity 0.15s; }
.attachment:hover .att-save-btn { opacity: 1; }

/* Stickers — bigger than regular media, transparent (no rounded corners). */
.attachment.sticker img,
.attachment.sticker video,
.attachment.sticker lottie-player {
    width: 200px; height: 200px; max-width: 200px; max-height: 200px;
    border-radius: 0; background: transparent; object-fit: contain; display: block;
}
/* If the bubble contains only a sticker, drop the bubble fill — looks closer
   to native Telegram where a sticker floats on the chat background. */
.message .bubble:has(> .attachment.sticker:only-child) { background: transparent; padding: 0; }
.message .bubble:has(> .attachment.sticker:only-child) > .actions { top: 4px; right: 4px; }
.message .bubble:has(> .attachment.sticker:only-child) > .meta { color: var(--muted); padding-left: 4px; }
.attachment audio { width: 260px; }
.attachment .doc { padding: 8px 10px; background: rgba(255,255,255,0.05); border-radius: 8px; font-size: 13px; }
.attachment .doc a { color: var(--accent); text-decoration: none; }
.attachment .loc { padding: 8px 10px; background: rgba(255,255,255,0.05); border-radius: 8px; }
.attachment .loc a { color: var(--accent); text-decoration: none; }
.attachment.doc-unavail { padding: 8px 10px; background: rgba(255,255,255,0.05); border-radius: 8px; font-size: 13px; opacity: 0.6; }
/* Twemoji images: keep emoji inline at text height */
.message img.emoji { width: 1.2em; height: 1.2em; vertical-align: -0.2em; display: inline; }
.conv-preview img.emoji { width: 1em; height: 1em; vertical-align: -0.15em; display: inline; }

/* Composer ----------------------------------------------------------- */
/* Lives in grid row 2 col 2 — its top border aligns exactly with sidebar-footer's top. */
.composer { border-top: 1px solid var(--line); background: var(--panel); padding: 10px 14px; position: relative; grid-column: 2; grid-row: 2; }
.composer-row { display: flex; align-items: flex-end; gap: 4px; }

/* Mobile compose-expand: "+" button hidden on desktop (specificity 0,2,0 beats .icon-btn 0,1,0) */
.composer-row .composer-more-btn { display: none; }
.composer-extra-btns { display: contents; } /* transparent wrapper on desktop */

#btnRec.recording { color: var(--danger); animation: pulse 1.2s infinite; }
.rec-bar {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: var(--panel); border: 1px solid var(--danger); border-radius: 12px;
    box-shadow: 0 -6px 24px rgba(0,0,0,0.35);
    position: absolute; left: 14px; right: 14px; bottom: calc(100% - 6px); z-index: 30;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
#recTimer { font-variant-numeric: tabular-nums; color: var(--danger); flex: 1; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.3 } }
.composer textarea { width: 100%; max-height: 160px; resize: none; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 10px 12px; border-radius: 10px; outline: none; font-family: inherit; font-size: 14px; }
.icon-btn { background: transparent; border: 0; cursor: pointer; color: var(--muted); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; transition: background 0.15s, color 0.15s; }
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,0.08); }
button.primary { background: var(--accent); color: white; border: 0; padding: 0 18px; height: 36px; border-radius: 10px; cursor: pointer; font-weight: 600; }
button.primary:hover { background: var(--accent-hover); }
button.primary.send-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.attachments-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attachments-preview .pill { background: var(--panel-2); border: 1px solid var(--line); padding: 4px 8px 4px 4px; border-radius: 999px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; max-width: 240px; }
.attachments-preview .pill .pill-thumb { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.attachments-preview .pill .pill-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachments-preview .pill button { background: transparent; border: 0; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.attachments-preview .pill button:hover { color: var(--text); }

.reply-banner { background: var(--panel-2); border-left: 3px solid var(--accent); padding: 6px 10px; margin-bottom: 6px; border-radius: 6px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.reply-banner button { background: transparent; border: 0; color: var(--muted); cursor: pointer; }

.emoji-picker {
    display: flex; flex-wrap: wrap; gap: 6px; padding: 10px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 -6px 24px rgba(0,0,0,0.35);
    position: absolute; left: 14px; bottom: calc(100% - 6px); z-index: 30;
    max-width: 320px;
}
.emoji-picker span { cursor: pointer; font-size: 22px; user-select: none; padding: 2px 4px; border-radius: 6px; }
.emoji-picker span:hover { background: rgba(255,255,255,0.06); }

.empty { color: var(--text); padding: 12px 20px; text-align: center; margin: auto; background: rgba(0,0,0,0.1); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); border-radius: 12px; font-size: 14px; }

/* Floating reaction picker pinned next to a clicked bubble. */
.reaction-picker {
    position: fixed; z-index: 100;
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: 8px; max-width: 280px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: rp-in 0.12s ease-out;
}
.reaction-picker span {
    cursor: pointer; font-size: 22px; padding: 4px 6px; border-radius: 50%;
    transition: transform 0.1s, background 0.1s;
}
.reaction-picker span:hover { background: rgba(255,255,255,0.08); transform: scale(1.15); }
@keyframes rp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.attachment img { cursor: zoom-in; transition: opacity 0.15s; }
.attachment img:hover { opacity: 0.92; }

.attachment.video-wrap { position: relative; cursor: zoom-in; display: inline-block; overflow: hidden; border-radius: 10px; max-width: 280px; max-height: 280px; }
.attachment.video-wrap video { display: block; max-width: 280px; max-height: 280px; pointer-events: none; }
.attachment.video-wrap .play-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 36px; text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    background: rgba(0,0,0,0.18); transition: background 0.15s;
}
.attachment.video-wrap:hover .play-overlay { background: rgba(0,0,0,0.32); }

/* Filename ribbon over the bottom of an animated attachment. */
.attachment .anim-label {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 18px 10px 6px;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.7));
    color: #fff; font-size: 12px; line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    pointer-events: none;
}
.attachment.video-wrap.animation { position: relative; }

/* Login page --------------------------------------------------------- */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--bg); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 36px 40px; width: 360px; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-size: 22px; font-weight: 700; }
.login-logo img { width: 36px; height: 36px; border-radius: 10px; }
.login-card .field { margin-bottom: 16px; }
.login-card .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.login-card .field input { width: 100%; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; outline: none; font-size: 14px; }
.login-card .field input:focus { border-color: var(--accent); }
.login-btn { width: 100%; margin-top: 8px; height: 42px; font-size: 15px; border-radius: 10px; }
.login-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #f87171; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }

/* Admin page --------------------------------------------------------- */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px; color: var(--text); }
.admin-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-header h1 { font-size: 18px; margin: 0; flex: 1; }
.admin-back { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); text-decoration: none; font-size: 14px; flex-shrink: 0; }
.admin-back:hover { color: var(--accent-hover); }
.admin-header h1 { font-size: 22px; font-weight: 700; margin: 0; }
.admin-msg { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.admin-msg-ok { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.admin-msg-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.admin-body { display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start; }
.admin-agents h2, .admin-create h2 { font-size: 16px; font-weight: 600; margin: 0 0 14px; }
.agent-actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.icon-btn-danger { color: var(--danger) !important; border-color: rgba(239,68,68,0.3) !important; }
.icon-btn-danger:hover { background: rgba(239,68,68,0.12) !important; border-color: var(--danger) !important; }
.hide-xs { }
@media (max-width: 600px) {
  .admin-body { grid-template-columns: 1fr; }
  .hide-xs { display: none !important; }
  .agents-table th:nth-child(2), .agents-table td:nth-child(2) { display: none; }
  .admin-wrap { padding: 16px 12px; }
}
.agents-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.agents-table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.agents-table td { padding: 10px 10px; border-bottom: 1px solid var(--line); }
.agents-table td.muted { color: var(--muted); font-size: 12px; }
.agents-table code { background: var(--panel-2); padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.role-badge { padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.role-badge.role-admin { background: rgba(79,124,255,0.18); color: var(--accent); }
.role-badge.role-agent { background: rgba(34,197,94,0.12); color: var(--ok); }
.btn-danger-sm { background: transparent; border: 1px solid rgba(239,68,68,0.4); color: #f87171; padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.btn-danger-sm:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); }
.btn-sm { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.btn-sm:hover { color: var(--accent); border-color: var(--accent); }
.inline-edit-form { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; }
.inline-edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-edit-form .field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.inline-edit-form .field input { width: 100%; padding: 7px 10px; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 7px; outline: none; font-size: 13px; }
.inline-edit-form .field input:focus { border-color: var(--accent); }
.admin-create { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.create-form .field { margin-bottom: 14px; }
.create-form .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.create-form .field input { width: 100%; padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; outline: none; font-size: 14px; }
.create-form .field input:focus { border-color: var(--accent); }
.create-form .primary { width: 100%; height: 38px; border-radius: 8px; }

/* Sidebar footer ----------------------------------------------------- */
/* Lives in grid row 2 col 1 — directly below the sidebar, aligned with the composer. */
.sidebar-footer { border-top: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 56px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel); grid-column: 1; grid-row: 2; }
.agent-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.agent-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #5b6cff, #c264ff); display: flex; align-items: center; justify-content: center; font-weight: 600; color: white; font-size: 12px; flex-shrink: 0; overflow: hidden; position: relative; cursor: pointer; }
.agent-details { min-width: 0; }
.agent-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-role { font-size: 11px; color: var(--muted); }
.icon-btn-sm { background: transparent; border: 1px solid var(--line); color: var(--muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; }
.icon-btn-sm:hover { color: var(--text); border-color: var(--accent); }
.admin-link { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); }
.admin-link:hover { color: var(--accent); border-color: var(--accent); }

/* Round video (Telegram video_note) ---------------------------------- */
.attachment.video-round { display: inline-block; position: relative; }
.attachment.video-round video {
  width: 200px; height: 200px; border-radius: 50%;
  object-fit: cover; display: block;
  clip-path: circle(50%);
}
.video-mute-btn {
  position: absolute; bottom: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,0.55); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; transition: background 0.15s;
}
.video-mute-btn:hover { background: rgba(0,0,0,0.75); }

/* Layout ------------------------------------------------------------- */
/* Two-row grid: row 1 = scrollable content (sidebar/messages/client-panel),
   row 2 = bottom strip (sidebar-footer aligns with composer). */
.app { display: grid; grid-template-columns: 375px 1fr 375px; grid-template-rows: 1fr auto; height: 100vh; overflow: hidden; }
.app.internal-open { grid-template-columns: 375px 1fr 375px 375px; }
.app.internal-open .internal-panel { grid-column: 4; grid-row: 1 / 3; }


/* Client panel ------------------------------------------------------- */
/* Spans both grid rows so it fills the full viewport height, matching the sidebar. */
.client-panel { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; grid-column: 3; grid-row: 1 / 3; }
.cp-tabs { height: 56px; display: flex; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.cp-tab { flex: 1; padding: 0 10px; background: transparent; border: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.cp-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.cp-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px; }
.cp-empty { color: var(--muted); text-align: center; margin-top: 40px; font-size: 13px; }
.cp-avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg,#5b6cff,#c264ff); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: #fff; margin: 0 auto 12px; }
.cp-fields { font-size: 13px; }
.cp-field-row { display: flex; gap: 6px; margin-bottom: 7px; align-items: flex-start; }
.cp-field-label { color: var(--muted); min-width: 90px; font-size: 12px; padding-top: 1px; }
.cp-field-value { color: var(--text); word-break: break-word; }
.cp-edit-btn { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 5px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; margin-top: 10px; }
.cp-edit-btn:hover { color: var(--accent); border-color: var(--accent); }
.cp-cancel-btn { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 5px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.cp-edit-form .field { margin-bottom: 10px; }
.cp-edit-form .field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.cp-edit-form .field input,
.cp-edit-form .field textarea { width: 100%; padding: 6px 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 7px; outline: none; font-size: 13px; font-family: inherit; resize: vertical; }
.cp-edit-form .field input:focus,
.cp-edit-form .field textarea:focus { border-color: var(--accent); }
.cp-section { margin-bottom: 16px; }
.cp-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin: 14px 0 8px; }
.cp-docs { display: flex; flex-direction: column; gap: 6px; }
.cp-doc-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel-2); border-radius: 8px; border: 1px solid var(--line); font-size: 12px; }
.cp-doc-item a { color: var(--accent); text-decoration: none; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-doc-del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; }
.cp-doc-del:hover { color: var(--danger); }
.cp-doc-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; flex-shrink: 0; cursor: zoom-in; display: block; }
.cp-upload-btn { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); cursor: pointer; color: var(--muted); transition: background 0.15s, color 0.15s; }
.cp-upload-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.cp-agents { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-agent-chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text); }
.cp-prev-convs { display: flex; flex-direction: column; gap: 6px; }
.cp-prev-conv { padding: 7px 10px; background: var(--panel-2); border-radius: 8px; border: 1px solid var(--line); cursor: pointer; font-size: 12px; }
.cp-prev-conv:hover { border-color: var(--accent); }
.cp-prev-conv.active { border-color: var(--accent); background: rgba(79,124,255,0.08); }
.cp-prev-conv-name { font-weight: 600; color: var(--text); }
.cp-prev-conv-preview { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Notes tab */
.cp-notes-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 10px 8px; background: var(--bg); }
.cp-note { display: flex; flex-direction: column; max-width: 88%; }
.cp-note.mine  { align-self: flex-end;   align-items: flex-end; }
.cp-note.other { align-self: flex-start; align-items: flex-start; }
.cp-note-bubble { padding: 7px 10px; border-radius: 12px; font-size: 13px; line-height: 1.4; word-wrap: break-word; }
.cp-note.mine  .cp-note-bubble { background: var(--bubble-out); border-bottom-right-radius: 3px; }
.cp-note.other .cp-note-bubble { background: var(--bubble-in);  border-bottom-left-radius: 3px; }
.cp-note-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.cp-note-header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.cp-note-agent { color: var(--accent); font-weight: 600; font-size: 11px; }
.cp-note-time  { color: var(--muted); font-size: 11px; }
.cp-notes-composer { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.cp-notes-composer textarea { flex: 1; resize: none; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 10px 12px; border-radius: 10px; outline: none; font-family: inherit; font-size: 14px; max-height: 160px; }
.cp-notes-composer .primary { height: 40px; width: 40px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
#cpNotesContent { display: flex; flex-direction: column; height: 100%; }

/* Closed conversation notice */
.composer-notice { text-align: center; padding: 6px 14px; font-size: 12px; color: var(--muted); font-style: italic; border-top: 1px solid var(--line); background: var(--panel); flex-shrink: 0; }
.composer[aria-disabled="true"] textarea,
.composer[aria-disabled="true"] .primary,
.composer[aria-disabled="true"] label,
.composer[aria-disabled="true"] button { opacity: 0.38; pointer-events: none; }

/* Internal chat panel ------------------------------------------------ */
.internal-panel { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.internal-header { height: 56px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; flex-shrink: 0; gap: 8px; }
.internal-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.int-msg { display: flex; flex-direction: column; max-width: 100%; }
.int-msg.mine { align-items: flex-end; }
.int-msg.other { align-items: flex-start; }
.int-bubble { padding: 6px 10px; border-radius: 12px; font-size: 13px; line-height: 1.35; word-wrap: break-word; max-width: 240px; }
.int-msg.mine .int-bubble { background: var(--bubble-out); border-bottom-right-radius: 3px; }
.int-msg.other .int-bubble { background: var(--bubble-in); border-bottom-left-radius: 3px; }
.int-sender { font-size: 11px; color: var(--accent); font-weight: 600; margin-bottom: 2px; }
.int-time { font-size: 10px; color: var(--muted); margin-top: 2px; }
.internal-composer { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.internal-composer textarea { flex: 1; resize: none; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 10px 12px; border-radius: 10px; outline: none; font-family: inherit; font-size: 14px; max-height: 160px; }
.internal-composer .primary { height: 40px; width: 40px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.internal-unread { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; background: var(--danger); color: white; border-radius: 999px; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
/* DM agent list */
.int-agent-list { flex: 1 1 auto; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.int-agent-list-label { font-size: 11px; color: var(--muted); padding: 4px 6px 10px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.int-agent-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.int-agent-item:hover { background: var(--panel-2); }
.int-agent-item .int-agent-av { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg,#5b6cff,#c264ff); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: white; flex-shrink: 0; overflow: hidden; position: relative; }
.int-agent-item .int-agent-name { flex: 1; font-weight: 500; }
/* DM unread badge on agent item */
.int-agent-item .int-dm-unread { background: var(--danger); color: white; border-radius: 999px; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

/* Sender name on outgoing messages */
.bubble .sender.agent-sender { color: var(--accent); }

.lightbox {
    position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 9999;
    display: flex; align-items: center; justify-content: center; cursor: zoom-out;
    animation: lb-in 0.15s ease-out;
}
.lightbox img, .lightbox video {
    max-width: 95vw; max-height: 95vh; border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6); cursor: default; user-select: none;
    background: black;
}
.lb-close, .lb-download {
    position: absolute; top: 16px; background: rgba(0,0,0,0.5); color: white;
    border: 0; width: 40px; height: 40px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    text-decoration: none; transition: background 0.15s;
}
.lb-close   { right: 16px; font-size: 22px; line-height: 1; }
.lb-download { right: 64px; }
.lb-close:hover, .lb-download:hover { background: rgba(0,0,0,0.82); }
@keyframes lb-in { from { opacity: 0 } to { opacity: 1 } }

/* Back/info buttons in thread header (hidden on desktop) ------------- */
.btn-back, .btn-info { display: none; background: transparent; border: none; color: var(--muted); cursor: pointer; width: 36px; height: 36px; border-radius: 50%; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.15s, color 0.15s; padding: 0; }
.btn-back { margin-right: 4px; }
.btn-back:hover, .btn-info:hover { background: rgba(255,255,255,0.08); color: var(--text); }

/* Client-panel close button (hidden on desktop) ---------------------- */
.cp-close-btn { display: none; background: transparent; border: none; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center; flex-shrink: 0; margin-left: auto; transition: background 0.15s, color 0.15s; padding: 0; }
.cp-close-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }

/* Mobile responsive (≤767px) ---------------------------------------- */
@media (max-width: 767px) {
  html, body { overflow: hidden; height: 100%; }

  /* Two-row grid, single column. Row 1 = main panel, row 2 = footer strip. */
  .app {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr auto !important;
    height: 100vh;
    height: 100dvh;
  }

  /* All direct children collapse to the single column */
  .app > .sidebar,
  .app > .sidebar-footer,
  .app > .thread,
  .app > .composer,
  .app > .client-panel { grid-column: 1 !important; }

  /* client-panel doesn't span rows on mobile (it overlays via position:fixed) */
  .app > .client-panel { grid-row: 1 !important; }

  /* Default (sidebar view): sidebar in row 1, sidebar-footer in row 2 */
  .app .thread { display: none; }
  .app .client-panel { display: none; }
  .app > .composer { display: none; }
  .app > .sidebar { display: flex; width: 100%; grid-row: 1; }
  .app > .sidebar-footer { grid-row: 2; display: flex; }

  /* internal-panel: full-screen overlay regardless of grid */
  .app .internal-panel:not([hidden]) {
    display: flex !important;
    position: fixed; inset: 0; z-index: 60;
    height: 100vh; height: 100dvh;
    flex-direction: column;
  }

  /* mob-thread: thread in row 1, composer in row 2 */
  .app.mob-thread > .sidebar { display: none; }
  .app.mob-thread > .sidebar-footer { display: none; }
  .app.mob-thread > .thread { display: flex; width: 100%; grid-row: 1; }
  .app.mob-thread > .composer { display: block; grid-row: 2; }

  .btn-back, .btn-info { display: flex; }
  .cp-close-btn { display: flex; }

  /* Client panel as full-screen overlay when mob-panel class is active */
  .app.mob-panel .client-panel {
    display: flex;
    position: fixed; inset: 0; z-index: 50;
    height: 100vh; height: 100dvh;
    flex-direction: column;
    overflow: hidden;
  }
  /* The scrollable body inside the overlay */
  .app.mob-panel .cp-body { overflow-y: auto; }

  /* Thread header — wrap status buttons to a second row */
  .thread-header { height: auto; flex-wrap: wrap; padding: 6px 10px; gap: 0; }
  #btnBack { order: 0; flex-shrink: 0; }
  #threadTitle { order: 1; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #btnInfo { order: 2; flex-shrink: 0; }
  .thread-actions { order: 10; width: 100%; display: flex; align-items: center; justify-content: flex-end; padding-top: 5px; border-top: 1px solid var(--line); margin-top: 4px; }
  .thread-actions button { padding: 5px 7px; font-size: 0; gap: 0; margin-left: 4px; }
  .thread-actions button svg { width: 16px; height: 16px; }
  .thread-status-mob { display: inline-flex; margin-right: auto; }
  #threadTitle .thread-status, #threadTitle .close-reason-hint { display: none; }

  /* Full-width message bubbles */
  .message { max-width: 88%; }

  /* Composer compact + expand button */
  .composer { padding: 8px 8px; }
  .composer-row .composer-more-btn { display: flex; }
  /* Extra buttons float above the composer as a pill tray */
  .composer-extra-btns {
    display: flex;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 6px;
    flex-direction: row;
    gap: 4px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 6px 8px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.18s, transform 0.18s;
    z-index: 20;
  }
  .composer-extra-btns.expanded {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}
