/* Team messaging: full-width conversation, switcher dropdown, timeline, composer with tag picker. */
.content.chat-content { max-width: none; width: 100%; margin: 0; padding: 0; overflow: hidden; display: flex; }
.ch-page { flex: 1; min-width: 0; display: flex; height: 100%; }
.ch-page > .ch-main { flex: 1; }
.nav-item em.nav-unread { background: #ef5b5b; color: #fff; }
/* Keep the quick action button clear of the composer. */
.main-panel:has(.chat-content) .qa { bottom: 118px; }

/* Conversation switcher (title button + dropdown) */
.ch-switch { position: relative; min-width: 0; }
.ch-switch-btn { display: flex; align-items: center; gap: 12px; min-width: 0; max-width: 420px; padding: 6px 12px 6px 6px; border: 0; border-radius: 14px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ch-switch-btn:hover, .ch-switch-btn.open { background: var(--surface2); }
.ch-switch-text { display: grid; min-width: 0; }
.ch-switch-text strong { display: flex; align-items: center; gap: 5px; font-size: 15px; white-space: nowrap; }
.ch-switch-text strong svg { color: var(--muted); transition: transform .15s; }
.ch-switch-btn.open .ch-switch-text strong svg { transform: rotate(180deg); }
.ch-switch-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-switch-btn > em { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; color: #fff; background: #ef5b5b; }
.ch-switch-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: 380px; max-height: min(600px, 74vh); display: flex; flex-direction: column; overflow: hidden; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 26px 60px rgba(6, 12, 30, .34); animation: ch-pop .14s ease-out; }
.ch-switch-search { display: flex; align-items: center; gap: 8px; margin: 12px 12px 4px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); color: var(--muted); }
.ch-switch-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.ch-switch-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13.5px; }
.ch-switch-menu footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface2) 45%, var(--surface)); }
.ch-switch-menu footer button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ch-switch-menu footer button:hover { border-color: var(--accent); color: var(--accent); }
.ch-new-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.ch-new-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Conversation list (inside the switcher) */
.ch-conv-list { flex: 1; min-height: 0; overflow: auto; padding: 0 8px 8px; scrollbar-width: thin; }
.ch-conv-section + .ch-conv-section { border-top: 1px dashed var(--line); margin-top: 6px; }
.ch-conv-list h3 { display: flex; align-items: center; justify-content: space-between; margin: 12px 8px 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.ch-conv-list h3 span { display: inline-flex; align-items: center; gap: 6px; }
.ch-conv-list h3 i { font-style: normal; letter-spacing: 0; padding: 1px 6px; border-radius: 999px; background: var(--surface2); }
.ch-conv-list h3 button { width: 24px; height: 24px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.ch-conv-list h3 button:hover { background: var(--surface2); color: var(--accent); }
.ch-hint { margin: 2px 10px 8px; font-size: 12px; color: var(--muted); }
.ch-conv { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 12px; color: var(--ink); text-decoration: none; transition: background .12s; }
.ch-conv:hover { background: var(--surface2); }
.ch-conv.active { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.ch-conv.active::before { content: ''; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.ch-conv-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ch-conv-text strong { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-conv-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-conv.unread .ch-conv-text strong { font-weight: 800; }
.ch-conv.unread .ch-conv-text small { color: var(--ink); font-weight: 600; }
.ch-conv-meta { display: grid; justify-items: end; gap: 4px; flex: none; min-width: 34px; }
.ch-conv-meta time { font-size: 10.5px; color: var(--muted); }
.ch-conv.unread .ch-conv-meta time { color: #ef5b5b; font-weight: 700; }
.ch-conv-meta em { font-style: normal; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 800; line-height: 22px; text-align: center; color: #fff; background: #ef5b5b; box-shadow: 0 4px 10px rgba(239, 91, 91, .35); }
.ch-conv-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; color: var(--accent); background: var(--soft); }
.ch-conv-icon.department { color: #1b8a5f; background: rgba(47, 179, 128, .15); }
.ch-conv-icon.group { color: #6a52d6; background: rgba(138, 114, 240, .16); }
:root[data-theme=dark] .ch-conv-icon.department { color: #6fdcae; } :root[data-theme=dark] .ch-conv-icon.group { color: #b6a6ff; }
.ch-conv-icon.big { width: 60px; height: 60px; border-radius: 18px; }

/* Avatars */
.ch-avatar { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; font-size: 12.5px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 62% 52%), hsl(calc(var(--h) + 30) 60% 40%)); }
.ch-avatar.small { width: 28px; height: 28px; border-radius: 9px; font-size: 10.5px; }
.ch-avatar.big { width: 60px; height: 60px; border-radius: 18px; font-size: 20px; }

/* Main column */
.ch-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.ch-main.dropping::after { content: ''; position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--accent) 8%, transparent); pointer-events: none; }
.ch-head { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.ch-head > div { display: grid; min-width: 0; }
.ch-head strong { font-size: 15px; }
.ch-head small { font-size: 12px; color: var(--muted); }
.ch-spacer { flex: 1; }
.ch-members { display: flex; align-items: center; padding: 4px 8px 4px 12px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.ch-members:hover { background: var(--surface2); }
.ch-members .ch-avatar { margin-left: -6px; border: 2px solid var(--surface); }
.ch-members i { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); margin-left: 6px; align-self: center; }
.ch-member-list { display: grid; gap: 2px; max-height: 260px; overflow: auto; padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.ch-member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.ch-member:hover { background: var(--surface2); }
.ch-member > span:not(.ch-avatar) { flex: 1; min-width: 0; display: grid; }
.ch-member strong { font-size: 13px; } .ch-member strong i { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); }
.ch-member small { font-size: 11.5px; color: var(--muted); }
.ch-timeline { flex: 1; min-height: 0; overflow: auto; padding: 16px 22px 10px; scrollbar-width: thin; }
.ch-loading { display: grid; place-items: center; padding: 40px; color: var(--muted); }
.ch-loading svg, .ch-pending-item.uploading svg { animation: ch-spin 1s linear infinite; }
.ch-loading.full { flex: 1; }
.ch-empty-conv { display: grid; justify-items: center; align-content: center; gap: 8px; height: 100%; color: var(--muted); text-align: center; }
.ch-empty-conv strong { color: var(--ink); font-size: 16px; }
.ch-older { display: flex; align-items: center; gap: 6px; margin: 0 auto 10px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.ch-day { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; color: var(--muted); font-size: 11.5px; font-weight: 700; }
.ch-day::before, .ch-day::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Messages */
.ch-msg { position: relative; display: flex; gap: 12px; padding: 6px 10px; margin: 0 -10px; border-radius: 10px; }
.ch-msg.grouped { padding-top: 1px; }
.ch-msg:hover { background: color-mix(in srgb, var(--surface2) 70%, transparent); }
.ch-msg-side { width: 36px; flex: none; }
.ch-msg-side time { display: none; font-size: 10px; color: var(--muted); line-height: 22px; }
.ch-msg.grouped:hover .ch-msg-side time { display: block; }
.ch-msg-main { min-width: 0; flex: 1; display: grid; gap: 6px; }
.ch-msg-head { display: flex; align-items: baseline; gap: 8px; }
.ch-msg-head strong { font-size: 13.5px; }
.ch-msg.mine .ch-msg-head strong { color: var(--accent); }
.ch-msg-head time { font-size: 11px; color: var(--muted); }
.ch-text { font-size: 14px; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.ch-text a:not(.ch-tag) { color: var(--accent); }
.ch-deleted { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-style: italic; color: var(--muted); }
.ch-msg-tools { position: absolute; right: 8px; top: 4px; display: none; gap: 2px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.ch-msg:hover .ch-msg-tools { display: flex; }
.ch-msg-tools button { width: 28px; height: 28px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.ch-msg-tools button:hover { color: #d84a4a; background: rgba(216, 74, 74, .1); }

/* Tags */
.ch-tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; margin: 0 1px; border-radius: 7px; border: 0; font: inherit; font-size: 13px; font-weight: 700; vertical-align: baseline; text-decoration: none; cursor: pointer; }
.ch-tag.user { color: var(--accent); background: var(--soft); cursor: default; }
.ch-tag.client { color: #6a52d6; background: rgba(138, 114, 240, .14); }
.ch-tag.task { color: #1b8a5f; background: rgba(47, 179, 128, .14); }
:root[data-theme=dark] .ch-tag.client { color: #b6a6ff; } :root[data-theme=dark] .ch-tag.task { color: #6fdcae; }
.ch-tag.client:hover, .ch-tag.task:hover { filter: brightness(1.1); text-decoration: underline; }
.ch-tag.locked { color: var(--muted); background: var(--surface2); cursor: default; }

/* Attachments */
.ch-images { display: grid; gap: 6px; max-width: 520px; }
.ch-images.n2, .ch-images.n4 { grid-template-columns: 1fr 1fr; }
.ch-images.n3 { grid-template-columns: 1fr 1fr 1fr; }
.ch-images a { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface2); }
.ch-images img { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.ch-images.n1 { justify-items: start; }
.ch-images.n1 img { width: auto; max-width: 100%; max-height: 300px; }
.ch-file { display: flex; align-items: center; gap: 10px; max-width: 360px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.ch-file:hover { border-color: var(--accent); }
.ch-file > svg:first-child { color: var(--accent); }
.ch-file span { flex: 1; min-width: 0; display: grid; }
.ch-file strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-file small { font-size: 11.5px; color: var(--muted); }

/* Composer */
.ch-composer { position: relative; padding: 10px 22px 12px; border-top: 1px solid var(--line); background: var(--surface); flex: none; }
.ch-pending { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ch-pending-item { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 4px 6px 4px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); }
.ch-pending-item img { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; }
.ch-pending-item small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-pending-item button { width: 20px; height: 20px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.ch-pending-item.uploading { opacity: .7; }
.ch-input-row { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface2); }
.ch-input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
/* Textarea over a backdrop that paints the same text with coloured tags; both must share metrics exactly. */
.ch-input-wrap { position: relative; flex: 1; min-width: 0; display: grid; }
.ch-input-wrap > * { grid-area: 1 / 1; margin: 0; border: 0; padding: 8px 6px; font: inherit; font-size: 14px; font-weight: 400; line-height: 1.5; letter-spacing: normal; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; }
.ch-backdrop { overflow: hidden; color: var(--ink); pointer-events: none; max-height: 180px; }
.ch-input-wrap textarea { min-width: 0; max-height: 180px; outline: 0; resize: none; background: transparent; color: transparent; caret-color: var(--ink); overflow-y: auto; }
.ch-input-wrap textarea::placeholder { color: var(--muted); }
.ch-input-wrap textarea::selection { color: transparent; background: color-mix(in srgb, var(--accent) 30%, transparent); }
.ch-mark { border-radius: 5px; color: var(--accent); background: var(--soft); box-shadow: 0 0 0 2px var(--soft); }
.ch-mark.client { color: #6a52d6; background: rgba(138, 114, 240, .16); box-shadow: 0 0 0 2px rgba(138, 114, 240, .16); }
.ch-mark.task { color: #1b8a5f; background: rgba(47, 179, 128, .16); box-shadow: 0 0 0 2px rgba(47, 179, 128, .16); }
:root[data-theme=dark] .ch-mark.client { color: #b6a6ff; } :root[data-theme=dark] .ch-mark.task { color: #6fdcae; }
.ch-icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none; }
.ch-icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.ch-send { width: 40px; height: 36px; border-radius: 10px; border: 0; display: grid; place-items: center; cursor: pointer; color: #fff; background: linear-gradient(135deg, #3976d8, #214fa6); flex: none; }
.ch-send:hover { filter: brightness(1.08); }
.ch-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 22px; padding: 4px 4px 0; }
.ch-composer-foot small { font-size: 11px; color: var(--muted); }
.ch-typing { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ch-dots { display: inline-flex; gap: 3px; }
.ch-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: ch-bounce 1.2s infinite; }
.ch-dots i:nth-child(2) { animation-delay: .15s; } .ch-dots i:nth-child(3) { animation-delay: .3s; }

/* Tag picker */
.ch-picker { position: absolute; left: 22px; bottom: calc(100% - 4px); z-index: 20; width: min(380px, calc(100% - 44px)); max-height: 320px; overflow: auto; padding: 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 18px 44px rgba(6, 12, 30, .25); }
.ch-picker header { padding: 6px 8px 8px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ch-picker p { margin: 8px; font-size: 12.5px; color: var(--muted); }
.ch-picker button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ch-picker button span:last-child { display: grid; min-width: 0; }
.ch-picker strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-picker small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-picker button.active, .ch-picker button:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ch-pick-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.ch-pick-icon.client { color: #6a52d6; background: rgba(138, 114, 240, .16); }
.ch-pick-icon.task { color: #1b8a5f; background: rgba(47, 179, 128, .16); }

@media (max-width: 900px) {
  .ch-new-btn span, .ch-members { display: none; }
  .ch-switch-menu { width: min(380px, calc(100vw - 32px)); }
  .ch-composer-foot small { display: none; }
}
@keyframes ch-pop { from { opacity: 0; transform: translateY(-4px) } }
@keyframes ch-spin { to { transform: rotate(360deg) } }
@keyframes ch-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5 } 30% { transform: translateY(-3px); opacity: 1 } }

/* ======================================================================
   WhatsApp-style conversation (after MGTEUPortal's mail thread view)
   ====================================================================== */
:root { --ch-bg: #eef1f5; --ch-dots: rgba(148, 163, 184, .22); --ch-in: #ffffff; --ch-out: #dbeafe; --ch-in-ink: #111827; --ch-out-ink: #0f1e3d; --ch-meta: #64748b; }
:root[data-theme=dark] { --ch-bg: #0a1730; --ch-dots: rgba(148, 163, 184, .10); --ch-in: #17294a; --ch-out: #1d4384; --ch-in-ink: #e8eefc; --ch-out-ink: #eef4ff; --ch-meta: #9fb2d4; }
.ch-timeline { background-color: var(--ch-bg); background-image: radial-gradient(var(--ch-dots) 1px, transparent 1px); background-size: 16px 16px; padding: 14px 6% 12px; }
.ch-day { justify-content: center; margin: 14px 0 10px; }
.ch-day::before, .ch-day::after { display: none; }
.ch-day span { padding: 4px 12px; border-radius: 8px; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--muted); font-size: 11.5px; font-weight: 700; box-shadow: 0 1px 1.5px rgba(15, 23, 42, .12); }

.ch-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.ch-row.cont { margin-top: 3px; }
.ch-row.out { justify-content: flex-end; }
.ch-row-av { width: 28px; flex: none; align-self: flex-start; }
.ch-bubble { position: relative; max-width: min(72%, 680px); min-width: 90px; padding: 7px 10px 6px; border-radius: 12px; background: var(--ch-in); color: var(--ch-in-ink); box-shadow: 0 1px 1.5px rgba(15, 23, 42, .14); }
.ch-row.out .ch-bubble { background: var(--ch-out); color: var(--ch-out-ink); }
/* Tail on the first bubble of a run */
.ch-row:not(.cont).in .ch-bubble { border-top-left-radius: 2px; }
.ch-row:not(.cont).out .ch-bubble { border-top-right-radius: 2px; }
.ch-row:not(.cont) .ch-bubble::before { content: ''; position: absolute; top: 0; width: 10px; height: 12px; }
.ch-row:not(.cont).in .ch-bubble::before { left: -8px; background: var(--ch-in); clip-path: polygon(100% 0, 0 0, 100% 100%); }
.ch-row:not(.cont).out .ch-bubble::before { right: -8px; background: var(--ch-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.ch-bubble-name { display: block; margin-bottom: 2px; font-size: 12.5px; font-weight: 800; color: hsl(var(--h) 60% 42%); }
:root[data-theme=dark] .ch-bubble-name { color: hsl(var(--h) 75% 72%); }
.ch-bubble .ch-text { font-size: 14px; line-height: 1.5; color: inherit; overflow-wrap: anywhere; }
.ch-bubble .ch-text.clamp { max-height: 220px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.ch-more { display: block; margin-top: 2px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
/* Time + ticks float to the bottom right of the last line */
.ch-meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -2px 12px; font-size: 11px; color: var(--ch-meta); white-space: nowrap; }
.ch-row.out .ch-meta svg { color: #2563eb; }
:root[data-theme=dark] .ch-row.out .ch-meta svg { color: #7fb2ff; }
.ch-bubble::after { content: ''; display: block; clear: both; }
.ch-bubble.deleted { opacity: .75; }
.ch-bubble .ch-deleted { margin: 0; }
.ch-bubble-del { position: absolute; top: 50%; left: -34px; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; opacity: 0; box-shadow: 0 2px 6px rgba(15, 23, 42, .15); transition: opacity .12s; }
.ch-row:hover .ch-bubble-del { opacity: 1; }
.ch-bubble-del:hover { color: #dc2626; }
.ch-row.fresh .ch-bubble { animation: ch-fresh 1.3s ease 2; }
@keyframes ch-fresh { 0%, 100% { box-shadow: 0 1px 1.5px rgba(15, 23, 42, .14); } 50% { box-shadow: 0 0 0 5px rgba(37, 99, 235, .3); } }
/* Tags inside bubbles */
.ch-bubble .ch-tag { background: color-mix(in srgb, currentColor 10%, transparent); }
.ch-row.out .ch-bubble .ch-tag.user { color: #1d4ed8; background: rgba(255, 255, 255, .55); }
:root[data-theme=dark] .ch-row.out .ch-bubble .ch-tag.user { color: #fff; background: rgba(255, 255, 255, .14); }
/* Attachments inside bubbles */
.ch-bubble .ch-images { margin: 2px -4px 4px; max-width: 420px; }
.ch-bubble .ch-images a { border-radius: 9px; border: 0; }
.ch-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin: 4px 0 2px; }
.ch-bubble .ch-file { max-width: none; padding: 6px 8px; gap: 8px; border-radius: 9px; border: 1px solid rgba(148, 163, 184, .35); background: rgba(255, 255, 255, .55); color: inherit; }
:root[data-theme=dark] .ch-bubble .ch-file { background: rgba(255, 255, 255, .06); }
.ch-file-ico { width: 30px; height: 30px; flex: none; border-radius: 7px; display: grid; place-items: center; }
.ch-file-ico.pdf { background: #fee2e2; color: #dc2626; } .ch-file-ico.img { background: #ede9fe; color: #7c3aed; }
.ch-file-ico.xls { background: #dcfce7; color: #16a34a; } .ch-file-ico.doc { background: #dbeafe; color: #2563eb; }
.ch-file-ico.zip { background: #fef3c7; color: #b45309; } .ch-file-ico.eml { background: #e0f2fe; color: #0284c7; }
.ch-file-ico.oth { background: #f1f5f9; color: #64748b; }
.ch-file-name { flex: 1; min-width: 0; display: grid; }
.ch-file-name strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-file-name small { font-size: 10.5px; opacity: .7; }
/* Composer reads like a chat input bar */
.ch-composer { background: var(--surface); }
.ch-input-row { border-radius: 24px; padding: 4px 4px 4px 14px; }
.ch-send { border-radius: 50%; width: 40px; height: 40px; }
@media (max-width: 900px) {
  .ch-timeline { padding: 10px 10px 10px; }
  .ch-bubble { max-width: 86%; }
  .ch-bubble-del { opacity: 1; position: static; transform: none; width: 22px; height: 22px; float: right; margin: 4px 0 0 6px; box-shadow: none; background: transparent; }
  .ch-files { grid-template-columns: 1fr; }
}
.ch-file .ch-file-ico { flex: none; width: 30px; }
.ch-file .ch-file-name { flex: 1; }

/* ---------- image download bar ---------- */
.ch-img { display: block; position: relative; border-radius: 12px; overflow: hidden; background: var(--surface2); }
.ch-images .ch-img a:first-child { border: 0; border-radius: 0; }
.ch-img-bar { position: absolute; inset: auto 0 0 0; display: flex; align-items: center; gap: 8px; padding: 18px 8px 6px; background: linear-gradient(transparent, rgba(0, 0, 0, .62)); color: #fff; opacity: 0; transition: opacity .15s; }
.ch-img:hover .ch-img-bar, .ch-img:focus-within .ch-img-bar { opacity: 1; }
@media (hover: none) { .ch-img-bar { opacity: 1; } }
.ch-img-bar small { flex: 1; min-width: 0; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-images .ch-img-dl, .ch-img-dl { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .92); color: #10213f; font-size: 11.5px; font-weight: 800; text-decoration: none; flex: none; }
.ch-img-dl:hover { background: #fff; }

/* ---------- emoji picker ---------- */
.ch-emoji { position: absolute; left: 22px; bottom: calc(100% - 4px); z-index: 20; width: min(360px, calc(100% - 44px)); border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 18px 40px rgba(8, 23, 54, .18); overflow: hidden; }
.ch-emoji-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--surface2); }
.ch-emoji-tabs button { flex: 1; height: 32px; border: 0; border-radius: 8px; background: transparent; font-size: 17px; cursor: pointer; filter: grayscale(.7); opacity: .7; }
.ch-emoji-tabs button.on, .ch-emoji-tabs button:hover { background: var(--surface); filter: none; opacity: 1; }
.ch-emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; padding: 8px; max-height: 236px; overflow: hidden auto; }
.ch-emoji-grid button { min-width: 0; padding: 0; height: 38px; border: 0; border-radius: 8px; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.ch-emoji-grid button:hover { background: var(--surface2); }

/* ---------- go to date ---------- */
.ch-date-host { position: relative; }
.ch-date-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 260px; display: grid; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 18px 40px rgba(8, 23, 54, .18); }
.ch-date-pop label { display: grid; gap: 6px; font-size: 12px; font-weight: 800; color: var(--ink); }
.ch-date-pop input { height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font: inherit; }
.ch-date-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.ch-date-quick button { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.ch-date-quick button:hover { border-color: var(--accent); color: var(--accent); }
.ch-date-pop .primary { justify-content: center; }
.ch-jumped { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; margin: 0 auto 12px; width: fit-content; max-width: 100%; padding: 6px 6px 6px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--ink); font-size: 12.5px; font-weight: 700; box-shadow: 0 6px 18px rgba(8, 23, 54, .1); }
.ch-jumped > svg { color: var(--accent); flex: none; }
.ch-jumped button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 0; background: var(--accent); color: var(--surface); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.ch-newer { margin: 12px auto 0; }

/* ---------- voice messages ---------- */
.ch-voice { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; min-width: 260px; max-width: 360px; }
.ch-voice-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.ch-row.out .ch-voice-ico { background: rgba(255, 255, 255, .2); color: inherit; }
.ch-voice audio { flex: 1; min-width: 0; height: 36px; }
.ch-voice-dl { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: inherit; opacity: .7; flex: none; }
.ch-voice-dl:hover { opacity: 1; background: rgba(127, 127, 127, .15); }
.ch-rec { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 6px 4px 14px; border-radius: 24px; border: 1px solid color-mix(in srgb, #e5484d 45%, var(--line)); background: color-mix(in srgb, #e5484d 8%, var(--surface)); }
.ch-rec-dot { width: 11px; height: 11px; border-radius: 50%; background: #e5484d; animation: ch-rec-pulse 1s ease-in-out infinite; flex: none; }
@keyframes ch-rec-pulse { 50% { opacity: .3; transform: scale(.8); } }
.ch-rec strong { font-size: 13px; }
.ch-rec-time { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 14px; }
.ch-rec-max { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ch-rec-bar { flex: 1; height: 5px; border-radius: 5px; background: color-mix(in srgb, #e5484d 18%, transparent); overflow: hidden; }
.ch-rec-bar i { display: block; height: 100%; width: 0; background: #e5484d; transition: width .25s linear; }
@media (max-width: 640px) { .ch-rec strong, .ch-rec-max { display: none; } .ch-voice { min-width: 0; } .ch-date-pop { right: -60px; } }
.ch-conv-section h3 i.unread { background: #e5484d; color: #fff; }
