/* Compact chat details and actions, shared by desktop and mobile. */
.msg-actions { display: none !important; }
.msg-other { align-items: flex-end; gap: 7px; }
.message-inline-avatar { flex: none; width: 34px; height: 34px; margin-bottom: 1px; }
.message-inline-avatar .avatar { width: 34px; height: 34px; font-size: 12px; }
.msg:has(.msg-reactions) { margin-bottom: 10px; }
.msg-reactions { position: absolute; z-index: 1; right: -10px; bottom: -10px; flex-wrap: nowrap; gap: 3px; margin: 0; }
.msg-reaction, .msg-reaction.active { min-width: 23px; height: 23px; justify-content: center; padding: 1px 3px; border: 1px solid #e6ebee; border-radius: 12px; background: #fff; box-shadow: 0 1px 4px rgba(32, 52, 62, .12); }
.msg-reaction:hover { background: #f5faf3; }
.msg-reaction .runa-emoji { width: 19px; height: 19px; object-fit: contain; }
.msg-reaction.is-single > span { display: none; }
.msg-reply[role="button"] { cursor: pointer; }
.msg-reply[role="button"]:focus-visible { outline: 2px solid #3197d4; outline-offset: 2px; }
.msg-hover-reactions {
  position: fixed; z-index: 106; display: flex; flex-direction: column;
  align-items: center; gap: 1px; width: 38px; padding: 4px 2px;
  border: 1px solid #e6ebef; border-radius: 19px; background: #fff;
  box-shadow: 0 9px 27px rgba(27, 43, 57, .18);
  animation: hoverReactionIn 140ms ease-out;
}
@keyframes hoverReactionIn { from { opacity: 0; transform: scale(.88); } to { opacity: 1; transform: scale(1); } }
.msg-hover-reactions button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; font-size: 23px; cursor: pointer; }
.msg-hover-reactions button:hover, .msg-hover-reactions button:focus-visible { background: #fff1e5; outline: none; transform: scale(1.08); }
.msg-hover-reactions .runa-emoji { width: 28px; height: 28px; object-fit: contain; }

.chat-pinned-bar { flex: none; min-height: 44px; display: flex; align-items: stretch; border-bottom: 1px solid #e9edf1; background: #fff; }
.chat-pinned-bar[hidden] { display: none; }
.chat-pinned-open { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 5px 15px; border: 0; background: none; color: #263348; text-align: left; cursor: pointer; }
.chat-pinned-open:hover { background: #f7fafc; }
.chat-pinned-copy { min-width: 0; flex: 1; }
.chat-pinned-mark { align-self: stretch; width: 3px; border-radius: 3px; background: #3a9fe8; }
.chat-pinned-mark.is-multiple { width: 4px; background: repeating-linear-gradient(to bottom,#3a9fe8 0 8px,#e4eff8 8px 10px); }
.chat-pinned-thumb { flex: none; width: 32px; height: 32px; border-radius: 4px; object-fit: cover; }
.chat-pinned-open strong { display: block; color: #187ec6; font-size: 12px; font-weight: 650; }
.chat-pinned-open small { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #586c80; font-size: 11px; }
.chat-pinned-list-button { flex: none; display: flex; align-items: center; gap: 3px; padding: 0 14px; border: 0; background: none; color: #8a9aaa; font-size: 11px; cursor: pointer; }
.chat-pinned-list-button:hover { color: #187ec6; background: #f7fafc; }
.chat-pinned-list-button svg { width: 17px; height: 17px; }
.chat-pinned-list { position: fixed; z-index: 120; width: min(350px,calc(100vw - 16px)); max-height: min(420px,70vh); overflow: auto; padding: 8px; border: 1px solid #e2e8ee; border-radius: 12px; background: #fff; box-shadow: 0 14px 38px rgba(25,42,60,.2); }
.chat-pinned-list > strong { display: block; padding: 8px 10px 10px; color: #263348; font-size: 13px; }
.chat-pinned-list button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 7px 9px; border: 0; border-radius: 8px; background: none; text-align: left; color: #263348; font: inherit; font-size: 12px; cursor: pointer; }
.chat-pinned-list button:hover { background: #f1f7fb; }
.chat-pinned-list button > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pinned-list-number { flex: none; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 7px; background: #e8f4fc; color: #187ec6; font-size: 11px; }

.pin-confirm-modal { width: min(360px,calc(100vw - 32px)); padding: 22px 22px 16px; border-radius: 14px; }
.pin-confirm-modal .modal-title { margin-bottom: 18px; font-size: 16px; }
.pin-share-choice { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; color: #243345; font-size: 13px; cursor: pointer; }
.pin-share-choice input { flex: none; width: 18px; height: 18px; accent-color: #258ee0; }
.pin-confirm-hint { margin: 0 0 20px; color: #66778a; font-size: 13px; line-height: 1.45; }
.pin-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pin-confirm-actions button { min-height: 36px; padding: 6px 12px; border: 0; border-radius: 8px; background: transparent; color: #258ee0; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.pin-confirm-actions button:hover { background: #eaf5fd; }
.pin-confirm-actions button:disabled { opacity: .55; cursor: progress; }

.chat-header-menu, .chat-wallpaper-menu { position: fixed; z-index: 120; width: min(270px, calc(100vw - 20px)); padding: 6px; border: 1px solid #e2e8ee; border-radius: 12px; background: #fff; box-shadow: 0 14px 38px rgba(25,42,60,.2); }
.chat-header-menu button, .chat-wallpaper-menu button { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; color: #25364a; text-align: left; font: inherit; font-size: 13px; cursor: pointer; }
.chat-header-menu button:hover, .chat-wallpaper-menu button:hover { background: #f2f6fa; }
.chat-header-menu svg { width: 17px; height: 17px; color: #78899b; }
.chat-wallpaper-menu strong { display: block; padding: 8px 10px; color: #23364b; font-size: 13px; }
#carea[data-wallpaper="sea"] .messages { background-color: #d8e8e6; background-image: none; }
#carea[data-wallpaper="sand"] .messages { background-color: #f0eadc; background-image: none; }

.msg-og { margin: 5px 0 2px; min-width: min(260px, 58vw); max-width: min(410px, 65vw); }
.msg-og .lp-card { border: 0; border-left: 3px solid #49aabd; border-radius: 3px 7px 7px 3px; background: #eaf5f6; color: #273648; }
.msg-own .msg-og .lp-card { background: #dcf5d2; border-left-color: #4fbf67; }
.msg-og .lp-card:hover { background: #e0f0f1; }
.msg-og .lp-card-body { padding: 7px 9px 5px; }
.msg-og .lp-domain { color: #2587b4; font-size: 11px; font-weight: 600; margin-bottom: 3px; }
.msg-og .lp-title { color: #17273a; font-size: 12px; line-height: 1.3; margin-bottom: 2px; }
.msg-og .lp-desc { color: #33475b; font-size: 11px; line-height: 1.35; margin: 0; -webkit-line-clamp: 3; }
.msg-og .lp-image { display: block; width: 100%; max-height: 205px; object-fit: cover; border-top: 2px solid #b7dde3; }
.msg-og .lp-card-compact { gap: 6px; padding: 7px 9px; }
.msg-og .lp-card-compact .lp-card-body { padding: 0; }
.msg-og .lp-loading { min-height: 42px; background: #edf6f7; border-left-color: #49aabd; }
.msg-og .lp-loading-line, .msg-og .lp-loading-shimmer { background: #d9e9ec; }

@media (max-width: 680px) {
  .msg-og { min-width: 0; max-width: min(320px, 67vw); }
  .msg-og .lp-image { max-height: 145px; }
}
@media (hover: none) { .msg-hover-reactions { display: none; } }

/* Keep the same chat canvas and compact input at desktop and narrow widths. */
#carea[data-wallpaper="original"] {
  background-color: #cfe5bc;
  background-image: url("/assets/chat-doodles.svg?v=17362"), linear-gradient(115deg, #e6e8aa 0%, #c7dfb4 52%, #9acbb4 100%);
  background-size: 300px 300px, cover;
}
#carea .composer { gap: 4px; margin: 0; padding: 4px 10px max(4px, var(--safe-bottom)); border: 0; border-top: 1px solid #e5eaec; border-radius: 0; box-shadow: none; backdrop-filter: none; }
#carea .composer-input { min-height: 38px; padding: 7px 8px; }
#carea .composer-btn { width: 36px; height: 36px; }
#carea #reply-bar { padding: 0; background: #fff; }
#carea #reply-bar:empty { display: none; }
#carea .composer-reply { min-height: 49px; gap: 10px; padding: 6px 13px; border-top: 1px solid #e5eaec; background: #fff; }
#carea .composer-reply-mark { display: grid; place-items: center; flex: none; width: 26px; color: #338fc6; font-size: 20px; }
#carea .composer-reply-mark svg { width: 21px; height: 21px; }
#carea .composer-reply-bar { height: 33px; background: #46a5d5; }
#carea .composer-reply-preview { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 2px; padding: 0; border: 0; background: transparent; color: #25354a; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
#carea .composer-reply-preview strong { color: #278dc6; font-weight: 650; }
#carea .composer-reply-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#carea .composer-reply-close { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: #83909b; font-size: 23px; cursor: pointer; }
#carea .composer-reply-close:hover { background: #f0f4f6; color: #273749; }
.reply-options-overlay { position: fixed; inset: 0; z-index: 510; display: grid; place-items: center; padding: 16px; background: rgba(18,31,39,.4); }
.reply-options-dialog { width: min(360px,100%); overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 16px 48px rgba(16,30,45,.22); color: #263648; }
.reply-options-title { padding: 16px 18px; font-size: 15px; font-weight: 650; }
.reply-options-preview { display: flex; flex-direction: column; gap: 3px; padding: 12px 17px; border-left: 3px solid #48a1d0; background: #f3f8fb; font-size: 12px; }
.reply-options-preview strong { color: #2488be; }
.reply-options-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-options-dialog > button { display: block; width: 100%; min-height: 42px; padding: 9px 18px; border: 0; background: #fff; color: #263648; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.reply-options-dialog > button:hover, .reply-options-dialog > button:focus-visible { background: #edf5f9; outline: none; }
.reply-options-dialog > button:last-child { border-top: 1px solid #e7ecef; color: #328ec6; text-align: right; }
@media (max-width: 768px) {
  #carea .messages { padding: 8px 14px 12px; background: transparent; }
}

/* Readable, compact conversations with Runa's orange as the action color. */
#carea[data-wallpaper="original"] {
  background-image: url("/assets/chat-doodles.svg?v=17364"), linear-gradient(115deg, #e0e7b4 0%, #c7dfb8 52%, #a6d2bd 100%);
  background-size: 235px 235px, cover;
}
#carea .messages { gap: 2px; padding: 8px clamp(16px, 3vw, 42px) 14px; }
#carea .msg-other { gap: 6px; }
#carea .message-inline-avatar { width: 30px; height: 30px; }
#carea .message-inline-avatar .avatar { width: 30px; height: 30px; font-size: 11px; }
#carea .msg-bubble { max-width: min(78%, 460px); padding: 5px 9px 4px; border-radius: 9px; color: #172b36; box-shadow: 0 1px 2px rgba(31, 57, 56, .11); line-height: 1.32; }
#carea .msg-other .msg-bubble { background: #fff; border-bottom-left-radius: 3px; }
#carea .msg-own .msg-bubble { background: #fff1e3; border-bottom-right-radius: 3px; }
#carea .msg-text { color: #172b36; font-size: 13px; line-height: 1.32; }
#carea .msg-bubble--plain .msg-text { display: inline; }
#carea .msg-bubble--plain .msg-meta { display: inline-flex; margin: 0 0 0 8px; vertical-align: baseline; white-space: nowrap; }
#carea .msg-time { color: #83929d; font-size: 10px; }
#carea .msg-own .msg-time, #carea .msg-own .msg-status { color: #b46a2b; }
#carea .msg-status.read { color: #e77513; }
#carea .msg-forwarded, #carea .msg-reply-name, #carea .msg-sender { color: #d86d13; }
#carea .msg-reply { border-left-color: #e77513; background: rgba(245, 130, 32, .08); }
#carea .msg-bubble--image { padding: 0 !important; background: transparent !important; box-shadow: none !important; }
#carea .msg-emoji-only .msg-bubble { padding: 2px 4px; background: transparent; box-shadow: none; }
@media (max-width: 768px) { #carea .messages { padding-inline: 10px; } #carea .msg-bubble { max-width: min(86%, 460px); } }

/* Quiet controls and a compact voice message card. Keep orange for the Runa mark. */
.btn-primary { background: #263c50; box-shadow: none; }
.btn-primary:hover { background: #324e66; }
.chat-item.active { background: #f1f5f7; box-shadow: inset 3px 0 #f58220; }
#carea .msg-own .msg-bubble { background: #fffaf4; }
#carea .msg-reply { background: #f5f7f8; }
#carea .msg-voice-circle { display: flex; align-items: center; width: min(290px, 67vw); max-width: 100%; box-sizing: border-box; gap: 9px; padding: 5px 7px; }
#carea .msg-voice-circle .msg-vc-avatar { position: relative; flex: 0 0 48px; width: 48px; height: 48px; }
#carea .msg-voice-circle .msg-vc-avatar img { display: block; box-sizing: border-box; width: 100%; height: 100%; border: 2px solid #d7e2e5; border-radius: 50%; object-fit: cover; }
#carea .msg-vc-waveform { display: flex; flex: 1; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
#carea .msg-vc-bar { flex: 0 0 2px; width: 2px; border-radius: 2px; background: #e99455; }
#carea .msg-vc-time { flex: none; color: #87949d; font-size: 11px; }
#carea .msg-voice { min-width: 0; width: min(280px, 65vw); max-width: 100%; }
#carea .msg-voice-play { background: #f2f5f7; color: #263c50; box-shadow: none; }
#carea .msg-voice-bar.played { background: #e99455; }
#carea .composer-reply { width: 100%; max-width: none; box-sizing: border-box; margin: 0; border: 0; }
#carea .composer-reply-mark { display: none; }
#carea .composer-reply-bar { flex: none; width: 3px; border-radius: 3px; background: #f58220; }
#carea .composer-reply-preview strong { color: #bd6218; }
.profile-direct-link { color: #a85b20; cursor: copy; user-select: text; }
.profile-direct-link:hover { text-decoration: underline; }
input[type="checkbox"] { accent-color: #334b5e; }
.setting-row input[type="checkbox"], .forward-message-options input[type="checkbox"], .rich-check input, .rich-task-item input { accent-color: #334b5e; }
