/* Team chat. Tokens are shared with finder.css (.fx/.tk/.tb/.chat). */

.chat {
  --chat-bg: var(--box-bg);
  --chat-side: var(--fx-hover);
  --chat-active: #1c1d1f;
  --chat-active-text: #fff;
  --chat-unread: #e5484d;
  display: grid; grid-template-columns: 250px minmax(0, 1fr);
  height: calc(100dvh - 32px); margin-top: 12px;
  background: var(--chat-bg); border: 1px solid var(--fx-line); border-radius: 14px; overflow: hidden;
  color: var(--fx-text); font-family: "inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chat { --chat-active: #f1f3f5; --chat-active-text: #111; }
}
:root[data-theme="dark"] .chat { --chat-active: #f1f3f5; --chat-active-text: #111; }
.chat a { text-decoration: none; color: inherit; }
.chat *, .chat *::before, .chat *::after { box-sizing: border-box; }

/* ---------- room list ---------- */
.chat-side { background: var(--chat-side); border-right: 1px solid var(--fx-line); display: flex; flex-direction: column; min-height: 0; }
.chat-side__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 10px 18px; }
.chat-side__head h1 { font-size: 18px; font-weight: 700; margin: 0; }
.chat-iconbtn { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--fx-muted); cursor: pointer; }
.chat-iconbtn:hover { background: rgba(127, 127, 127, .16); color: var(--fx-text); }

.chat-newroom { display: flex; align-items: center; gap: 4px; margin: 0 10px 8px; padding: 4px 4px 4px 10px; background: var(--chat-bg); border: 1px solid var(--fx-accent); border-radius: 10px; }
.chat-newroom[hidden] { display: none; }
.chat-newroom__hash { color: var(--fx-muted); font-weight: 600; }
.chat .chat-newroom input[type=text] { flex: 1; min-width: 0; height: 30px !important; margin: 0 !important; padding: 0 4px !important; border: 0 !important; box-shadow: none !important; background: transparent !important; font-size: 14px; color: var(--fx-text); }
.chat-newroom__go { border: 0; border-radius: 7px; background: var(--fx-accent); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 10px; cursor: pointer; }

.chat-rooms { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 12px; overflow-y: auto; }
.chat-roomlink { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 14px; color: var(--fx-muted) !important; }
.chat-roomlink:hover { background: rgba(127, 127, 127, .12); color: var(--fx-text) !important; }
.chat-roomlink.is-unread { color: var(--fx-text) !important; font-weight: 650; }
.chat-roomlink.is-active { background: var(--chat-active); color: var(--chat-active-text) !important; font-weight: 600; }
.chat-roomlink__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-roomlink__badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--chat-unread); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.chat-roomlink__badge[hidden] { display: none; }

/* ---------- open room ---------- */
.chat-main { min-width: 0; min-height: 0; display: flex; }
.chat-main > turbo-frame { display: flex; flex: 1; min-width: 0; min-height: 0; }
.chat-room { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; position: relative; }
.chat-room__head { padding: 14px 20px; border-bottom: 1px solid var(--fx-line); display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.chat-room__head h2 { font-size: 17px; font-weight: 700; margin: 0; white-space: nowrap; }
.chat-room__topic { margin: 0; font-size: 13px; color: var(--fx-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* column-reverse: starts at the bottom and stays anchored there; older pages load above without a jump. */
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column-reverse; overscroll-behavior: contain; }
.chat-list { padding: 12px 0 8px; }
.chat-list turbo-frame { display: block; }

.chat-older { display: flex; justify-content: center; padding: 16px; }
.chat-older__spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--fx-line); border-top-color: var(--fx-accent); animation: chat-spin .8s linear infinite; }
@keyframes chat-spin { to { transform: rotate(360deg); } }


.chat-day { display: flex; align-items: center; gap: 12px; margin: 14px 20px 6px; color: var(--fx-muted); font-size: 12px; font-weight: 600; }
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--fx-line); }

/* ---------- message ---------- */
.cm { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; padding: 6px 20px; }
.cm:hover { background: var(--fx-hover); }
.cm__avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .02em; background: #9aa0a6; margin-top: 2px; user-select: none; }
.cm__meta { display: flex; align-items: baseline; gap: 5px; font-size: 14px; color: var(--fx-muted); line-height: 1.3; }
.cm__name { font-weight: 500; color: var(--fx-muted); }
.cm__time { font-size: 13px; }
.cm__body { font-size: 16px; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere; white-space: normal; margin-top: 1px; }
.cm__body a { color: var(--fx-accent) !important; text-decoration: underline; text-underline-offset: 2px; }

/* Consecutive messages from the same person within 5 minutes: no avatar/name repeat. */
.cm--cont { padding-top: 1px; padding-bottom: 1px; }
.cm--cont .cm__avatar { visibility: hidden; height: 0; margin: 0; }
.cm--cont .cm__meta { display: none; }

.cm--pending { opacity: .6; }
.cm--failed { opacity: 1; cursor: pointer; }
.cm--failed .cm__time { color: #d93025; }

.cm__delete { position: absolute; top: 4px; right: 14px; display: none; width: 30px; height: 30px; border: 1px solid var(--fx-line); border-radius: 8px; background: var(--chat-bg); color: var(--fx-muted); cursor: pointer; place-items: center; }
.cm--mine:hover .cm__delete, .cm--mine .cm__delete:focus-visible { display: grid; }
.cm__delete:hover { color: #d93025; border-color: #d93025; }
.cm--pending .cm__delete { display: none !important; }

.chat-jump { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 5; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--fx-accent); color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--fx-pop); cursor: pointer; }
.chat-jump[hidden] { display: none; }

/* ---------- composer ---------- */
.chat-composer { display: flex; align-items: flex-end; gap: 8px; margin: 8px 16px 16px; padding: 8px 8px 8px 14px; border: 1px solid var(--fx-line); border-radius: 14px; background: var(--chat-bg); }
.chat-composer:focus-within { border-color: var(--fx-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fx-accent) 18%, transparent); }
.chat .chat-composer textarea {
  flex: 1; min-width: 0; resize: none; border: 0 !important; outline: none; box-shadow: none !important; background: transparent !important;
  font: inherit; font-size: 15px; line-height: 1.45; padding: 6px 0 !important; margin: 0 !important; max-height: 200px; min-height: 24px; height: auto; color: var(--fx-text);
}
.chat-send { width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 10px; background: var(--fx-accent); color: #fff; display: grid; place-items: center; cursor: pointer; }
.chat-send:hover { filter: brightness(1.08); }

/* ---------- sidebar / header badge ---------- */
.chat-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-right: 4px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 10px; font-weight: 700; vertical-align: 1px; }
.chat-badge[hidden] { display: none; }

/* ---------- phones: rooms become chips above the conversation (like the mockup) ---------- */
@media (max-width: 760px) {
  .chat { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 90px); margin-top: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .chat-side { border-right: 0; border-bottom: 1px solid var(--fx-line); background: var(--chat-bg); }
  .chat-side__head { padding: 10px 12px 4px 16px; }
  .chat-side__head h1 { font-size: 16px; }
  .chat-rooms { flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 6px 12px 12px; max-height: 108px; overflow-y: auto; }
  .chat-roomlink { padding: 8px 16px; border-radius: 999px; background: var(--fx-hover); font-size: 15px; color: var(--fx-text) !important; font-weight: 500; }
  .chat-roomlink__name { flex: none; }
  .chat-room__head { display: none; }
  .cm { padding: 6px 14px; }
  .chat-composer { margin: 6px 10px 10px; }
  .cm__delete { display: grid; opacity: 0; }
  .cm--mine .cm__delete { opacity: 1; }
}

/* ======================= round 2: threads, reactions, files, mentions, DMs ======================= */
.chat.has-panel { grid-template-columns: 250px minmax(0, 1fr) 380px; }
.chat-panel { display: contents; }
.chat-panel:empty { display: none; }

.chat-search { position: relative; margin: 0 10px 10px; }
.chat-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fx-muted); pointer-events: none; }
.chat .chat-search input[type=search] { width: 100%; height: 34px !important; margin: 0 !important; padding: 0 10px 0 30px !important; border: 1px solid var(--fx-line) !important; border-radius: 9px; background: var(--chat-bg) !important; font-size: 13px; box-shadow: none !important; color: var(--fx-text); }
.chat .chat-search input[type=search]:focus { border-color: var(--fx-accent) !important; outline: none; }

.chat-section { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 4px 18px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fx-muted); }
.chat-roomlink__icon { width: 16px; text-align: center; font-size: 13px; opacity: .8; }
.chat-roomlink__avatar { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.chat-newroom { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
.chat-newroom__row { display: flex; align-items: center; gap: 4px; }
.chat-newroom__private { font-size: 12px; color: var(--fx-muted); display: flex; align-items: center; gap: 6px; }
.chat .chat-newroom__private input[type=checkbox] { position: static !important; opacity: 1 !important; pointer-events: auto !important; width: 15px; height: 15px; margin: 0; }
.chat-dmpicker { margin: 0 10px 8px; padding: 8px; background: var(--chat-bg); border: 1px solid var(--fx-accent); border-radius: 10px; }
.chat-dmpicker[hidden] { display: none; }
.chat .chat-dmpicker input[type=search] { width: 100%; height: 32px !important; margin: 0 0 6px !important; padding: 0 8px !important; border: 1px solid var(--fx-line) !important; border-radius: 7px; font-size: 13px; box-shadow: none !important; background: transparent !important; color: var(--fx-text); }
.chat-dmpicker__empty { font-size: 12px; color: var(--fx-muted); padding: 6px; }

.chat-lock { vertical-align: -1px; margin-right: 2px; color: var(--fx-muted); }
.chat-headbtn { margin-left: auto; font-size: 13px; font-weight: 600; padding: 6px 10px; border: 1px solid var(--fx-line); border-radius: 8px; color: var(--fx-text) !important; white-space: nowrap; }
.chat-headbtn:hover { background: var(--fx-hover); }

/* message extras */
.cm--highlight { background: color-mix(in srgb, #f5c542 22%, transparent) !important; transition: background 1s; }
.cm--mentions-me { background: color-mix(in srgb, #f5c542 10%, transparent); box-shadow: inset 3px 0 0 #e0a800; }
.cm-mention { color: var(--fx-accent); background: color-mix(in srgb, var(--fx-accent) 12%, transparent); padding: 0 3px; border-radius: 4px; font-weight: 500; }
.cm-mention.is-me { color: #9a6b00; background: color-mix(in srgb, #f5c542 30%, transparent); }
.cm__edited { font-size: 12px; color: var(--fx-muted); }

.cm__files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.cm__image img { display: block; max-width: min(360px, 100%); max-height: 280px; border-radius: 10px; border: 1px solid var(--fx-line); object-fit: cover; }
.cm__file { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--fx-line); border-radius: 10px; max-width: 320px; background: var(--chat-bg); }
.cm__file:hover { border-color: var(--fx-accent); }
.cm__file-ext { width: 36px; height: 36px; border-radius: 7px; background: var(--fx-accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.cm__file-info { display: flex; flex-direction: column; min-width: 0; }
.cm__file-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm__file-size { font-size: 12px; color: var(--fx-muted); }

.cm__reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cm__reactions:empty { display: none; }
.cm-react { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border: 1px solid var(--fx-line); border-radius: 999px; background: var(--chat-bg); font-size: 13px; cursor: pointer; color: var(--fx-text); }
.cm-react:hover { border-color: var(--fx-muted); }
.cm-react.is-mine { border-color: var(--fx-accent); background: color-mix(in srgb, var(--fx-accent) 12%, transparent); }
.cm-react__count { font-size: 12px; font-weight: 600; }

.cm__thread:empty { display: none; }
.cm__thread-link { margin-top: 4px; border: 0; background: none; padding: 2px 0; color: var(--fx-accent); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.cm__thread-link:hover { text-decoration: underline; }
.cm__thread-when { color: var(--fx-muted); font-weight: 400; }

/* hover toolbar (replaces the round-1 delete button) */
.cm__delete { display: none !important; }
.cm__actions { position: absolute; top: -12px; right: 16px; display: none; gap: 2px; padding: 2px; background: var(--chat-bg); border: 1px solid var(--fx-line); border-radius: 9px; box-shadow: 0 2px 8px rgba(16, 24, 40, .1); z-index: 3; }
.cm:hover .cm__actions, .cm:focus-within .cm__actions { display: flex; }
.cm__actions button { width: 30px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--fx-muted); display: grid; place-items: center; cursor: pointer; }
.cm__actions button:hover { background: var(--fx-hover); color: var(--fx-text); }
.cm__actions .cm__own { display: none; }
.cm--mine .cm__actions .cm__own { display: grid; }
.cm__actions .cm__danger:hover { color: #d93025; }
.cm--pending .cm__actions, .chat-thread__parent .cm__actions button[data-action="chat-room#openThread"] { display: none !important; }

.cm-picker { position: absolute; top: 18px; right: 16px; z-index: 6; display: grid; grid-template-columns: repeat(6, 34px); gap: 2px; padding: 6px; background: var(--chat-bg); border: 1px solid var(--fx-line); border-radius: 12px; box-shadow: var(--fx-pop); }
.cm-picker button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; font-size: 20px; cursor: pointer; }
.cm-picker button:hover { background: var(--fx-hover); }

.cm-edit textarea { width: 100%; min-height: 60px; padding: 8px 10px; border: 1px solid var(--fx-accent) !important; border-radius: 10px; font: inherit; font-size: 15px; background: var(--chat-bg) !important; color: var(--fx-text); resize: vertical; box-shadow: none !important; }
.cm-edit__bar { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 12px; color: var(--fx-muted); }
.cm-edit__save { border: 0; border-radius: 7px; background: var(--fx-accent); color: #fff; font-weight: 600; font-size: 12px; padding: 5px 12px; cursor: pointer; }

/* composer: files + mentions */
.chat-composer { flex-direction: column; align-items: stretch; position: relative; }
.chat-composer__row { display: flex; align-items: flex-end; gap: 8px; }
.chat-attach { width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 10px; background: transparent; color: var(--fx-muted); display: grid; place-items: center; cursor: pointer; }
.chat-attach:hover { background: var(--fx-hover); color: var(--fx-text); }
.chat-composer__files { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 8px; }
.chat-composer__files[hidden] { display: none; }
.chat-upload { display: inline-flex; align-items: center; gap: 8px; max-width: 260px; padding: 5px 6px 5px 10px; border: 1px solid var(--fx-line); border-radius: 8px; font-size: 12px; background: var(--fx-hover); }
.chat-upload__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-upload__state { color: var(--fx-muted); flex-shrink: 0; }
.chat-upload.is-done .chat-upload__state { color: #1f9d55; }
.chat-upload.is-error .chat-upload__state { color: #d93025; }
.chat-upload button { border: 0; background: none; font-size: 16px; line-height: 1; color: var(--fx-muted); cursor: pointer; }
.chat-mentions { position: absolute; left: 44px; bottom: calc(100% + 6px); min-width: 220px; max-width: 320px; padding: 6px; background: var(--chat-bg); border: 1px solid var(--fx-line); border-radius: 12px; box-shadow: var(--fx-pop); z-index: 10; }
.chat-mentions[hidden] { display: none; }
.chat-mention { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; color: var(--fx-text); cursor: pointer; font-family: inherit; }
.chat-mention:hover, .chat-mention.is-active { background: var(--fx-hover); }

.chat-typing { height: 20px; padding: 0 22px; font-size: 12px; color: var(--fx-muted); font-style: italic; }
.chat-jump--present { bottom: 110px; text-decoration: none; }

/* thread / members panel */
.chat-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; border-left: 1px solid var(--fx-line); background: var(--chat-bg); position: relative; }
.chat-thread__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--fx-line); }
.chat-thread__head h3 { font-size: 16px; font-weight: 700; margin: 0; }
.chat-thread__room { font-size: 12px; color: var(--fx-muted); }
.chat-thread__parent { padding-bottom: 6px; }
.chat-thread__count { margin: 2px 20px 6px; padding-bottom: 6px; border-bottom: 1px solid var(--fx-line); font-size: 12px; color: var(--fx-muted); }
.chat-members__list { flex: 1; overflow-y: auto; padding: 8px 10px; }
.chat-member { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; font-size: 14px; }
.chat-member:hover { background: var(--fx-hover); }
.chat-member__name { flex: 1; min-width: 0; }
.chat-member__name small { color: var(--fx-muted); }
.chat-member form { margin: 0; }
.chat-member__btn, .chat-member__leave { border: 1px solid var(--fx-line); background: transparent; border-radius: 7px; font-size: 12px; padding: 4px 8px; cursor: pointer; color: var(--fx-text); }
.chat-member__leave { margin: 10px 18px 16px; color: #d93025; border-color: currentColor; }
.chat-members__add { display: flex; gap: 6px; padding: 8px 18px; }
.chat .chat-members__add select { display: block !important; flex: 1; height: 32px; border: 1px solid var(--fx-line); border-radius: 7px; background: var(--chat-bg); color: var(--fx-text); }

/* search results */
.chat-results__list { overflow-y: auto; padding: 8px 12px 16px; flex: 1; }
.chat-result { display: block; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; }
.chat-result:hover { background: var(--fx-hover); border-color: var(--fx-line); }
.chat-result__where { font-size: 12px; color: var(--fx-muted); }
.chat-result__who { font-weight: 600; font-size: 14px; margin-top: 2px; }
.chat-result__body { font-size: 15px; margin-top: 2px; }
.chat-results__empty { color: var(--fx-muted); padding: 20px; }

@media (max-width: 1100px) {
  .chat.has-panel { grid-template-columns: 220px minmax(0, 1fr); }
  .chat.has-panel .chat-thread { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 50; box-shadow: var(--fx-pop); }
}
@media (max-width: 760px) {
  .chat.has-panel { grid-template-columns: 1fr; }
  .chat-section { padding: 4px 12px 0 16px; }
  .chat-search { margin-bottom: 4px; }
  .cm__actions { top: -8px; }
}
/* The app's global input rules force content-box on inputs; chat inputs size with border-box. */
.chat input, .chat textarea, .chat select { box-sizing: border-box !important; }


/* ======================= inside the app sidebar (Messages / DM buttons) ======================= */
.chat.chat--side { display: flex; flex-direction: column; position: relative; height: calc(100vh - 56px); margin: 8px 0 0; border: 0; border-radius: 0; background: transparent; }
.chat--side .chat-side { border: 0; background: transparent; flex-shrink: 0; }
.chat--side .chat-rooms { flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 2px 10px 10px; max-height: 104px; overflow-y: auto; border-bottom: 1px solid var(--fx-line); }
.chat--side .chat-roomlink { padding: 5px 11px; border-radius: 999px; background: var(--fx-hover); font-size: 13px; color: var(--fx-text) !important; border: 0; cursor: pointer; font-family: inherit; }
.chat--side .chat-roomlink.is-active { background: var(--chat-active); color: var(--chat-active-text) !important; }
.chat--side .chat-roomlink--add { background: transparent; border: 1px dashed var(--fx-line); color: var(--fx-muted) !important; }
.chat--side .chat-roomlink__name { flex: none; }
.chat--side .chat-roomlink__avatar { width: 18px; height: 18px; font-size: 9px; }
.chat--side .chat-newroom, .chat--side .chat-dmpicker { margin: 8px 10px; }
.chat--side .chat-main { flex: 1; min-height: 0; }
.chat--side .chat-room__head { padding: 8px 12px; }
.chat--side .chat-room__head h2 { font-size: 15px; }
.chat--side .chat-room__topic { display: none; }
.chat--side .cm { padding: 5px 10px; grid-template-columns: 30px minmax(0, 1fr); column-gap: 8px; }
.chat--side .cm__avatar { width: 30px; height: 30px; font-size: 11px; }
.chat--side .cm__meta { font-size: 12px; }
.chat--side .cm__body { font-size: 14px; }
.chat--side .cm__actions { right: 6px; }
.chat--side .cm__image img { max-width: 100%; }
.chat--side .chat-day { margin: 10px 10px 4px; }
.chat--side .chat-typing { padding: 0 12px; }
.chat--side .chat-composer { margin: 4px 6px 8px; padding: 6px 6px 6px 8px; }
.chat--side .chat-attach { width: 30px; height: 30px; }
.chat--side .chat-send { width: 32px; height: 32px; }
.chat--side .chat-mentions { left: 0; }
.chat--side .chat-empty { padding: 32px 16px; text-align: center; color: var(--fx-muted); font-size: 14px; }
/* threads and members slide over the conversation */
.chat--side .chat-panel:not(:empty) { display: block; position: absolute; inset: 0; z-index: 20; background: var(--box-bg); }
.chat.chat--side .chat-thread, .chat.chat--side.has-panel .chat-thread { position: absolute; inset: 0; width: auto; border-left: 0; box-shadow: none; }
.chat.chat--side.has-panel { grid-template-columns: none; }

/* Hover toolbar sits inside the message row (was above it and got cut off by the list edge). */
.cm__actions { top: 4px !important; right: 12px; }
.chat--side .cm__actions { top: 2px !important; right: 4px; }
/* Emoji picker lives on <body> (fixed), so it uses the app's global colours. */
.cm-picker { position: fixed; top: 0; left: 0; z-index: 10000; display: grid; grid-template-columns: repeat(6, 36px); gap: 2px; padding: 6px;
  background: var(--box-bg); border: 1px solid var(--border-chip); border-radius: 12px; box-shadow: 0 12px 32px rgba(16, 24, 40, .18); }
.cm-picker button { width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; }
.cm-picker button:hover { background: var(--bg-color); }
/* Picker must size to its emoji (global page styles were stretching it to full width). */
.cm-picker { width: max-content !important; max-width: calc(100vw - 16px); height: auto !important; right: auto !important; bottom: auto !important; margin: 0 !important; }
/* Direct messages have no threads. */
.chat-room--dm .cm__actions button[data-action="chat-room#openThread"],
.chat-room--dm .cm__thread { display: none !important; }
/* @ Mentions */
.chat-roomlink__at { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #e0a800; color: #fff; font-size: 11px; font-weight: 700; }
.chat--side .chat-roomlink--mentions { font-weight: 600; }
.chat-mentionlist { overflow-y: auto; height: 100%; padding: 6px 6px 16px; }
.chat-result.is-unread { background: color-mix(in srgb, #f5c542 12%, transparent); box-shadow: inset 3px 0 0 #e0a800; }
