/* ============================================================
   Clank — components.css
   Messages, composer, thread/details panel, modals, pickers,
   browse views, huddle, toasts
   ============================================================ */

/* ============ Message scroll area ============ */
.msg-scroll-wrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.msg-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; outline: none; }
.msg-list { padding: 8px 0 12px; }

/* day divider */
.day-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 20px 8px; position: relative;
}
.day-divider::before, .day-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--hairline);
}
.day-label {
  font-size: 13px; font-weight: 700; color: var(--ink);
  padding: 2px 12px; border: 1px solid var(--hairline); border-radius: 24px;
  background: #fff; white-space: nowrap;
}
.day-label .day-rel { color: var(--ink-60); font-weight: 400; }

/* unread divider */
.unread-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 20px 4px;
}
.unread-divider::before { content: ''; flex: 1; height: 1px; background: rgba(224,30,90,.45); }
.unread-label { color: var(--red); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ============ Message row ============ */
.msg {
  display: flex; padding: 4px 20px;
  position: relative;
  line-height: 1.46668;
}
.msg:hover { background: var(--hover-bg); }
.msg.grouped { padding-top: 1px; padding-bottom: 1px; }
.msg.mention-of-me { background: rgba(242,199,68,.14); box-shadow: inset 3px 0 0 var(--yellow); }
.msg.mention-of-me:hover { background: rgba(242,199,68,.2); }
.msg.flash { animation: msgflash 2.4s ease; }
@keyframes msgflash {
  0% { background: rgba(29,155,209,.25); }
  100% { background: transparent; }
}
.msg-gutter { flex: 0 0 36px; margin-right: 8px; position: relative; }
.msg-avatar { width: 36px; height: 36px; border-radius: 8px; display: block; cursor: pointer; }
.msg-gutter-ts {
  position: absolute; right: 0; top: 4px;
  font-size: 11px; color: var(--ink-40); opacity: 0; white-space: nowrap;
}
.msg:hover .msg-gutter-ts { opacity: 1; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 1px; }
.msg-author {
  font-weight: 900; color: var(--ink); cursor: pointer;
  overflow-wrap: anywhere;
}
.msg-author:hover { text-decoration: underline; }
.msg-app-badge {
  font-size: 10px; font-weight: 700; color: var(--ink-60);
  background: rgba(29,28,29,.08); border-radius: 3px; padding: 0 4px;
  position: relative; top: -1px;
}
.msg-ts { font-size: 12px; color: var(--ink-60); cursor: default; flex: 0 0 auto; }
.msg-ts:hover { text-decoration: underline; }
.msg-text {
  overflow-wrap: anywhere; word-break: break-word;
  font-size: 15px;
}
.msg-text p { margin: 0 0 4px; }
.msg-text p:last-child { margin-bottom: 0; }
.msg-edited { font-size: 12px; color: var(--ink-60); }

/* rich text bits */
.msg-text code {
  font-family: var(--mono); font-size: 12.5px;
  color: var(--code-red); background: rgba(224,30,90,.07);
  border: 1px solid rgba(224,30,90,.18);
  border-radius: 3px; padding: 0 3px;
  white-space: break-spaces;
}
.msg-text pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  background: #F8F8F8; border: 1px solid var(--hairline);
  border-radius: 6px; padding: 8px 10px; margin: 4px 0;
  overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-text pre code { background: none; border: none; color: var(--ink); padding: 0; font-size: inherit; }
.msg-text blockquote {
  border-left: 4px solid #DDD; padding-left: 12px; margin: 4px 0;
  color: var(--ink);
}
.msg-text ul, .msg-text ol { margin: 2px 0 4px 26px; }
.msg-text li { margin: 1px 0; }
.msg-text a { color: var(--link); overflow-wrap: anywhere; }
.msg-text .mention {
  color: var(--link); background: rgba(29,155,209,.1);
  border-radius: 3px; padding: 0 2px; font-weight: 500; cursor: pointer;
}
.msg-text .mention.me { color: var(--ink); background: rgba(242,199,68,.4); font-weight: 700; }
.msg-text .mention:hover { text-decoration: underline; }
.msg-text .chan-ref { color: var(--link); cursor: pointer; }
.msg-text .custom-emoji { width: 20px; height: 20px; vertical-align: -4px; }
.msg-text .big-emoji { font-size: 26px; line-height: 1.2; }
.msg-attachment { margin-top: 6px; max-width: 420px; }
.msg-attachment img { max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--hairline); display: block; }
.msg-attachment .att-name { font-size: 12px; color: var(--ink-60); margin-top: 3px; }

/* system / join message */
.msg.sys .msg-text { color: var(--ink-60); font-style: normal; }
.msg.sys .msg-gutter { display: flex; align-items: center; justify-content: center; color: var(--ink-40); }
.msg.sys .msg-gutter svg { width: 16px; height: 16px; }
.msg.deleted .msg-text { color: var(--ink-60); font-style: italic; }

/* thread context chip (thread reply broadcast to channel) */
.thread-ctx {
  font-size: 13px; color: var(--ink-60); margin-bottom: 3px;
  display: flex; align-items: center; gap: 5px;
}
.thread-ctx svg { width: 14px; height: 14px; }
.thread-ctx .ctx-quote { color: var(--ink-60); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }

/* ============ Reactions ============ */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 7px;
  background: rgba(29,28,29,.04); border: 1px solid transparent;
  border-radius: 12px; font-size: 13px;
  transition: border-color .1s, background .1s;
}
.reaction:hover { border-color: var(--hairline-strong); background: #fff; }
.reaction.mine { background: rgba(29,155,209,.12); border-color: rgba(29,155,209,.35); }
.reaction.mine:hover { background: rgba(29,155,209,.18); }
.reaction .rx-emoji { font-size: 15px; line-height: 1; }
.reaction .rx-emoji img { width: 16px; height: 16px; vertical-align: -3px; }
.reaction .rx-count { font-weight: 700; font-size: 11px; color: var(--ink-60); }
.reaction.mine .rx-count { color: var(--link); }
.reaction.rx-new { animation: rxpop .35s ease; }
@keyframes rxpop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ============ Thread strip under message ============ */
.thread-strip {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 4px; padding: 3px 8px 3px 4px;
  border: 1px solid transparent; border-radius: 6px;
  color: var(--link); font-size: 13px; font-weight: 700;
  max-width: 100%;
}
.thread-strip:hover { border-color: var(--hairline); background: #fff; box-shadow: var(--shadow-1); }
.thread-strip .ts-avatars { display: flex; }
.thread-strip .ts-avatars img { width: 20px; height: 20px; border-radius: 4px; border: 2px solid #fff; margin-left: -5px; }
.thread-strip .ts-avatars img:first-child { margin-left: 0; }
.thread-strip .ts-count { }
.thread-strip .ts-last { color: var(--ink-60); font-weight: 400; }

/* ============ Hover action bar ============ */
.hoverbar {
  position: absolute; top: -15px; right: 16px; z-index: 6;
  display: none; align-items: center;
  background: #fff; border: 1px solid var(--hairline); border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  padding: 2px;
}
.msg:hover .hoverbar { display: flex; }
.hb-btn {
  width: 32px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-60);
}
.hb-btn:hover { background: var(--hover-bg); color: var(--ink); }
.hb-btn svg { width: 17px; height: 17px; }
.hb-btn .hb-emoji-icon { font-size: 16px; line-height: 1; filter: grayscale(1) opacity(.7); }
.hb-btn:hover .hb-emoji-icon { filter: none; }

/* ============ Typing bar ============ */
.typing-bar {
  flex: 0 0 auto; min-height: 22px;
  padding: 0 20px 2px;
  font-size: 13px; color: var(--ink-60);
  display: flex; align-items: center; gap: 5px;
}
.typing-bar:empty { padding-bottom: 0; }
.typing-bar .t-name { font-weight: 700; }
.typing-dots { display: inline-flex; gap: 2px; align-items: center; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-60); animation: tdot 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .2s; }
.typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes tdot { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }

/* ============ Composer ============ */
.composer-root { flex: 0 0 auto; padding: 0 20px 20px; }
.composer {
  border: 1px solid var(--ink-40); border-radius: 8px;
  background: #fff;
}
.composer:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.composer-toolbar {
  display: flex; align-items: center; gap: 1px;
  background: #F8F8F8; border-bottom: 1px solid var(--hairline);
  border-radius: 8px 8px 0 0; padding: 3px 6px;
}
.ct-btn {
  width: 28px; height: 26px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-60); font-weight: 700; font-size: 13px;
}
.ct-btn:hover { background: rgba(29,28,29,.08); color: var(--ink); }
.ct-btn.on { background: rgba(29,28,29,.12); color: var(--ink); }
.ct-btn svg { width: 15px; height: 15px; }
.ct-sep { width: 1px; height: 18px; background: var(--hairline); margin: 0 4px; }
.ct-spacer { flex: 1; }
.composer-input-wrap { padding: 8px 12px 4px; position: relative; }
.composer-input {
  width: 100%; border: none; outline: none; resize: none;
  font-size: 15px; line-height: 1.46668;
  max-height: 40vh; min-height: 22px;
  background: transparent; display: block;
}
.composer-input::placeholder { color: var(--ink-40); }
.composer-attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--hairline); border-radius: 6px; padding: 4px 8px;
  font-size: 13px; margin-bottom: 4px; background: #F8F8F8;
}
.composer-attach-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.composer-attach-chip .att-x { display: flex; color: var(--ink-60); }
.composer-attach-chip .att-x svg { width: 14px; height: 14px; }
.composer-footer { display: flex; align-items: center; padding: 2px 8px 8px; gap: 2px; }
.cf-btn {
  width: 30px; height: 28px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-60);
}
.cf-btn:hover { background: rgba(29,28,29,.08); color: var(--ink); }
.cf-btn svg { width: 17px; height: 17px; }
.cf-sep { width: 1px; height: 18px; background: var(--hairline); margin: 0 4px; }
.cf-spacer { flex: 1; }
.cf-hint { font-size: 12px; color: var(--ink-40); margin-right: 8px; opacity: 0; transition: opacity .15s; }
.composer:focus-within .cf-hint { opacity: 1; }
.cf-hint b { font-weight: 700; color: var(--ink-60); }
.send-btn {
  width: 32px; height: 28px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(29,28,29,.08); color: rgba(29,28,29,.5);
  cursor: default; transition: background .12s;
}
.send-btn.ready { background: var(--green); color: #fff; cursor: pointer; }
.send-btn.ready:hover { background: #006B4E; }
.send-btn svg { width: 16px; height: 16px; }
.composer.dnd-note-on { border-radius: 0 0 8px 8px; }
.dnd-note {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-60);
  background: rgba(29,28,29,.04);
  border: 1px solid var(--ink-40); border-bottom: none;
  border-radius: 8px 8px 0 0; padding: 6px 12px;
}
.dnd-note svg { width: 15px; height: 15px; }
.dnd-note .notify-anyway { color: var(--link); font-weight: 700; cursor: pointer; }

/* autocomplete popup */
.ac-pop {
  position: absolute; z-index: 60;
  background: #fff; border-radius: 8px; box-shadow: var(--shadow-menu);
  min-width: 240px; max-width: 340px; max-height: 280px; overflow-y: auto;
  padding: 4px 0;
}
.ac-item { display: flex; align-items: center; gap: 8px; padding: 5px 12px; cursor: pointer; font-size: 14px; }
.ac-item.sel { background: var(--link); color: #fff; }
.ac-item.sel .ac-sub { color: rgba(255,255,255,.75); }
.ac-item img { width: 20px; height: 20px; border-radius: 4px; }
.ac-item .ac-name { font-weight: 700; }
.ac-item .ac-sub { color: var(--ink-60); font-size: 12px; }
.ac-item .ac-cmd { font-weight: 700; font-family: var(--mono); font-size: 13px; }

/* inline edit */
.msg-edit-wrap { margin-top: 2px; }
.msg-edit-ta {
  width: 100%; border: 1px solid var(--hairline-strong); border-radius: 8px;
  padding: 8px 10px; font-size: 15px; line-height: 1.46668; resize: none;
  outline: none; font-family: inherit; min-height: 44px;
}
.msg-edit-ta:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.msg-edit-hint { font-size: 12px; color: var(--ink-60); margin-top: 4px; }
.msg-edit-btns { display: flex; gap: 8px; margin-top: 6px; }
.btn {
  font-size: 14px; font-weight: 700; padding: 5px 12px;
  border-radius: 4px; border: 1px solid var(--hairline-strong);
  background: #fff; transition: background .1s;
}
.btn:hover { background: var(--hover-bg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #006B4E; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #C4184F; }

/* ============ Jump-to-new pill ============ */
.jump-new {
  position: absolute; right: 24px; bottom: 12px; z-index: 8;
  display: flex; align-items: center; gap: 6px;
  background: var(--link); color: #fff;
  font-size: 13px; font-weight: 700;
  padding: 6px 12px; border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  animation: jumpin .2s ease;
}
.jump-new svg { width: 14px; height: 14px; }
@keyframes jumpin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ Right panel ============ */
.panel {
  width: 400px; flex: 0 0 400px;
  border-left: 1px solid var(--hairline);
  display: flex; flex-direction: column; background: #fff; min-height: 0;
}
.panel-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--hairline); min-height: 49px;
}
.panel-title { font-weight: 900; font-size: 18px; letter-spacing: -.25px; }
.panel-sub { color: var(--ink-60); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.panel-close {
  width: 32px; height: 32px; border-radius: 6px; margin-left: auto;
  display: flex; align-items: center; justify-content: center; color: var(--ink-60);
}
.panel-close:hover { background: var(--hover-bg); color: var(--ink); }
.panel-close svg { width: 18px; height: 18px; }
.panel-body { flex: 1; overflow-y: auto; min-height: 0; }

/* thread view */
.thread-parent { padding: 12px 0 4px; }
.thread-reply-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 16px 4px; font-size: 13px; color: var(--ink-60);
}
.thread-reply-divider::after { content: ''; flex: 1; height: 1px; background: var(--hairline); }
.thread-composer-wrap { flex: 0 0 auto; padding: 4px 16px 16px; }
.thread-also-send { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-60); padding: 4px 2px 0; }
.thread-also-send input { accent-color: var(--green); }
.panel .msg { padding-left: 16px; padding-right: 16px; }
.panel .msg-gutter { flex-basis: 32px; }
.panel .msg-avatar { width: 32px; height: 32px; }

/* details tabs */
.det-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--hairline); }
.det-tab {
  padding: 8px 10px; font-size: 13px; font-weight: 700; color: var(--ink-60);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.det-tab:hover { color: var(--ink); }
.det-tab.on { color: var(--ink); border-bottom-color: var(--green); }
.det-tab .tab-n { font-weight: 400; color: var(--ink-60); }
.det-section { padding: 16px 20px; border-bottom: 1px solid var(--hairline); }
.det-row-label { font-size: 13px; font-weight: 700; color: var(--ink-60); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.det-row-label svg { width: 14px; height: 14px; }
.det-topic { font-size: 15px; line-height: 1.45; }
.det-topic-edit { width: 100%; border: 1px solid var(--hairline-strong); border-radius: 6px; padding: 6px 8px; font-size: 14px; resize: none; outline: none; }
.det-edit-link { color: var(--link); font-size: 13px; cursor: pointer; font-weight: 700; }
.det-muted { color: var(--ink-60); font-size: 13px; }
.det-leave { color: var(--red); font-weight: 700; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.det-leave:hover { text-decoration: underline; }
.det-leave svg { width: 16px; height: 16px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 6px; cursor: pointer; }
.member-row:hover { background: var(--hover-bg); }
.member-row .m-ava { position: relative; width: 36px; height: 36px; flex: 0 0 auto; }
.member-row .m-ava img { width: 36px; height: 36px; border-radius: 8px; }
.member-row .m-name { font-weight: 700; }
.member-row .m-sub { color: var(--ink-60); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .m-txt { min-width: 0; }

/* pinned */
.pin-item { border: 1px solid var(--hairline); border-radius: 8px; padding: 10px 12px; margin: 10px 16px; position: relative; }
.pin-item:hover { box-shadow: var(--shadow-1); }
.pin-item .pin-by { font-size: 12px; color: var(--ink-60); margin-bottom: 4px; }
.pin-item .pin-jump { color: var(--link); font-size: 13px; font-weight: 700; cursor: pointer; margin-top: 6px; display: inline-block; }
.pin-item .pin-remove { position: absolute; top: 8px; right: 8px; color: var(--ink-60); width: 26px; height: 26px; border-radius: 4px; display: none; align-items: center; justify-content: center; }
.pin-item:hover .pin-remove { display: flex; }
.pin-item .pin-remove:hover { background: var(--hover-bg); color: var(--ink); }

/* ============ Browse views (Later/Threads/Activity) ============ */
.browse-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.browse-head { padding: 12px 20px; border-bottom: 1px solid var(--hairline); display: flex; align-items: center; gap: 10px; }
.browse-title { font-weight: 900; font-size: 18px; letter-spacing: -.25px; }
.browse-body { flex: 1; overflow-y: auto; padding: 8px 0 20px; }
.browse-item { border-bottom: 1px solid var(--hairline); padding: 10px 20px 12px; position: relative; }
.browse-item:hover { background: var(--hover-bg); }
.browse-item .bi-where { font-size: 13px; color: var(--ink-60); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.browse-item .bi-where svg { width: 13px; height: 13px; }
.browse-item .bi-actions { position: absolute; top: 10px; right: 16px; display: none; gap: 4px; }
.browse-item:hover .bi-actions { display: flex; }
.browse-item .bi-btn { font-size: 12px; font-weight: 700; color: var(--ink-60); border: 1px solid var(--hairline); border-radius: 4px; padding: 3px 8px; background: #fff; }
.browse-item .bi-btn:hover { color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.browse-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 40px; text-align: center; gap: 10px; }
.browse-empty .be-art { font-size: 54px; }
.browse-empty .be-title { font-weight: 900; font-size: 18px; }
.browse-empty .be-sub { color: var(--ink-60); max-width: 380px; line-height: 1.5; }

/* ============ Huddle bar ============ */
.huddle-bar {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--hairline);
  background: #F8F8F8;
  padding: 6px 20px;
  display: flex; align-items: center; gap: 12px;
}
.huddle-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 1.6s infinite; flex: 0 0 auto; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.huddle-faces { display: flex; }
.huddle-faces img { width: 24px; height: 24px; border-radius: 4px; border: 2px solid #F8F8F8; margin-left: -6px; }
.huddle-faces img:first-child { margin-left: 0; }
.huddle-caption { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-60); overflow: hidden; }
.huddle-caption .cap-name { font-weight: 700; color: var(--ink); }
.huddle-caption .cap-text { font-style: italic; }
.huddle-btn { font-size: 13px; font-weight: 700; color: var(--ink-60); border: 1px solid var(--hairline-strong); border-radius: 4px; padding: 3px 10px; background: #fff; display: flex; align-items: center; gap: 5px; }
.huddle-btn:hover { box-shadow: 0 1px 2px rgba(0,0,0,.1); color: var(--ink); }
.huddle-btn.leave { color: var(--red); border-color: rgba(224,30,90,.4); }
.huddle-btn svg { width: 14px; height: 14px; }
.huddle-btn.muted { color: var(--red); }

/* ============ Overlays / modals / menus ============ */
.overlay-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(29,28,29,.5);
  display: flex; align-items: flex-start; justify-content: center;
  animation: fadein .12s ease;
}
.overlay-scrim.transparent { background: transparent; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(29,28,29,.1), 0 12px 48px rgba(0,0,0,.3);
  margin-top: 12vh; width: 520px; max-width: calc(100vw - 64px);
  max-height: 76vh; display: flex; flex-direction: column;
  animation: modalin .15s ease;
  overflow: hidden;
}
@keyframes modalin { from { transform: scale(.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; padding: 18px 20px 12px;
  font-weight: 900; font-size: 20px; letter-spacing: -.25px;
}
.modal-head .modal-x { margin-left: auto; width: 36px; height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--ink-60); }
.modal-head .modal-x:hover { background: var(--hover-bg); color: var(--ink); }
.modal-body { padding: 0 20px 20px; overflow-y: auto; }
.modal-body p { line-height: 1.5; margin-bottom: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; }

/* generic popover/menu */
.menu {
  position: fixed; z-index: 300;
  background: #fff; border-radius: 8px; box-shadow: var(--shadow-menu);
  padding: 6px 0; min-width: 200px; max-width: 320px;
  animation: menuin .1s ease;
  max-height: 70vh; overflow-y: auto;
}
@keyframes menuin { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px; font-size: 14px; cursor: pointer; width: 100%; text-align: left;
}
.menu-item:hover { background: var(--link); color: #fff; }
.menu-item:hover .menu-sub { color: rgba(255,255,255,.75); }
.menu-item.danger { color: var(--red); }
.menu-item.danger:hover { background: var(--red); color: #fff; }
.menu-item .menu-sub { margin-left: auto; color: var(--ink-60); font-size: 12px; }
.menu-item svg { width: 16px; height: 16px; flex: 0 0 auto; }
.menu-sep { height: 1px; background: var(--hairline); margin: 6px 0; }
.menu-head { padding: 8px 16px; }
.menu-head .mh-name { font-weight: 900; font-size: 15px; }
.menu-head .mh-sub { color: var(--ink-60); font-size: 13px; }
.menu-item.disabled { color: var(--ink-40); cursor: default; }
.menu-item.disabled:hover { background: none; color: var(--ink-40); }

/* ============ Profile popover ============ */
.profile-pop { width: 300px; padding: 0; overflow: hidden; }
.profile-pop .pp-banner { height: 8px; }
.profile-pop .pp-body { padding: 16px; }
.profile-pop .pp-avatar { width: 220px; height: 220px; border-radius: 12px; margin: 0 auto 12px; display: block; }
.profile-pop .pp-name { font-weight: 900; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.profile-pop .pp-name .presence { position: static; border-color: #fff; }
.profile-pop .pp-pron { color: var(--ink-60); font-size: 13px; margin-bottom: 6px; }
.profile-pop .pp-status { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; margin-bottom: 8px; }
.profile-pop .pp-title { color: var(--ink-60); font-size: 14px; margin-bottom: 10px; }
.profile-pop .pp-local { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; margin-bottom: 12px; }
.profile-pop .pp-local svg { width: 14px; height: 14px; color: var(--ink-60); }
.profile-pop .pp-stats { border-top: 1px solid var(--hairline); padding-top: 10px; margin-top: 4px; }
.profile-pop .pp-stat { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.profile-pop .pp-stat b { font-weight: 700; }
.profile-pop .pp-btn-row { display: flex; gap: 8px; margin-top: 10px; }
.profile-pop .pp-btn { flex: 1; text-align: center; border: 1px solid var(--hairline-strong); border-radius: 4px; padding: 6px 0; font-weight: 700; font-size: 14px; }
.profile-pop .pp-btn:hover { background: var(--hover-bg); }

/* ============ Search modal ============ */
.search-modal { width: 680px; margin-top: 8vh; padding: 0; }
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; border-bottom: 1px solid var(--hairline); }
.search-input-row svg { width: 18px; height: 18px; color: var(--ink-60); flex: 0 0 auto; }
.search-input { flex: 1; border: none; outline: none; font-size: 16px; }
.search-tabs { display: flex; gap: 2px; padding: 8px 14px 0; }
.search-tab { padding: 6px 10px; font-size: 13px; font-weight: 700; color: var(--ink-60); border-bottom: 2px solid transparent; }
.search-tab.on { color: var(--ink); border-bottom-color: var(--green); }
.search-hints { display: flex; gap: 6px; padding: 8px 18px; flex-wrap: wrap; }
.search-hint-chip { font-size: 12px; color: var(--ink-60); border: 1px solid var(--hairline); border-radius: 12px; padding: 2px 8px; cursor: pointer; }
.search-hint-chip:hover { background: var(--hover-bg); color: var(--ink); }
.search-results { flex: 1; overflow-y: auto; padding: 6px 0 12px; min-height: 120px; }
.search-result { display: flex; gap: 10px; padding: 8px 18px; cursor: pointer; }
.search-result:hover { background: var(--hover-bg); }
.search-result img { width: 32px; height: 32px; border-radius: 6px; flex: 0 0 auto; }
.search-result .sr-head { font-size: 13px; color: var(--ink-60); display: flex; gap: 6px; align-items: baseline; }
.search-result .sr-head b { color: var(--ink); font-weight: 900; }
.search-result .sr-text { font-size: 14px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-result mark { background: rgba(242,199,68,.5); border-radius: 2px; padding: 0 1px; }
.search-empty { padding: 40px 20px; text-align: center; color: var(--ink-60); }
.search-empty .se-art { font-size: 40px; margin-bottom: 8px; }
.search-recent-label { padding: 8px 18px 4px; font-size: 13px; font-weight: 700; color: var(--ink-60); }

/* ============ Quick switcher ============ */
.switcher-modal { width: 580px; margin-top: 14vh; }
.switcher-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--hairline); }
.switcher-input { flex: 1; border: none; outline: none; font-size: 16px; }
.switcher-list { max-height: 380px; overflow-y: auto; padding: 6px 0; }
.switcher-item { display: flex; align-items: center; gap: 10px; padding: 6px 18px; cursor: pointer; font-size: 15px; }
.switcher-item.sel { background: var(--link); color: #fff; }
.switcher-item.sel .sw-sub { color: rgba(255,255,255,.75); }
.switcher-item .sw-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.switcher-item .sw-icon svg { width: 15px; height: 15px; }
.switcher-item img { width: 20px; height: 20px; border-radius: 4px; }
.switcher-item .sw-sub { margin-left: auto; font-size: 12px; color: var(--ink-60); }

/* ============ Emoji picker ============ */
.emoji-pop {
  position: fixed; z-index: 320; width: 356px;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-menu);
  display: flex; flex-direction: column; overflow: hidden;
  animation: menuin .1s ease;
}
.emoji-search-row { padding: 10px 12px 6px; }
.emoji-search { width: 100%; border: 1px solid var(--hairline-strong); border-radius: 6px; padding: 6px 10px; font-size: 14px; outline: none; }
.emoji-search:focus { border-color: var(--link); box-shadow: 0 0 0 1px var(--link); }
.emoji-cats { display: flex; gap: 2px; padding: 4px 10px; border-bottom: 1px solid var(--hairline); }
.emoji-cat { width: 32px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--ink-60); }
.emoji-cat:hover { background: var(--hover-bg); }
.emoji-cat.on { background: rgba(29,155,209,.15); }
.emoji-grid-wrap { height: 300px; overflow-y: auto; padding: 6px 10px 10px; }
.emoji-cat-label { font-size: 12px; font-weight: 700; color: var(--ink-60); padding: 8px 2px 4px; position: sticky; top: -6px; background: #fff; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji-cell { width: 36px; height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; }
.emoji-cell:hover { background: rgba(29,155,209,.15); transform: scale(1.15); }
.emoji-cell img { width: 22px; height: 22px; }
.emoji-preview-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--hairline); min-height: 44px; }
.emoji-preview-bar .ep-emoji { font-size: 26px; }
.emoji-preview-bar .ep-name { font-weight: 700; font-size: 14px; }
.emoji-preview-bar .ep-key { color: var(--ink-60); font-size: 13px; }

/* ============ Status modal ============ */
.status-emoji-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--hairline-strong); border-radius: 6px; padding: 8px 12px; width: 100%; font-size: 15px; }
.status-emoji-btn .se-face { font-size: 20px; }
.status-input-row { display: flex; border: 1px solid var(--hairline-strong); border-radius: 6px; overflow: hidden; margin-bottom: 12px; }
.status-input-row .status-emoji-in { width: 52px; border-right: 1px solid var(--hairline); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.status-input-row input { flex: 1; border: none; outline: none; padding: 10px 12px; font-size: 15px; }
.status-suggest { display: flex; align-items: center; gap: 10px; padding: 8px 4px; cursor: pointer; border-radius: 6px; width: 100%; text-align: left; }
.status-suggest:hover { background: var(--hover-bg); }
.status-suggest .ss-emoji { font-size: 20px; }
.status-suggest .ss-clear { margin-left: auto; color: var(--ink-60); font-size: 13px; }
.status-select { width: 100%; border: 1px solid var(--hairline-strong); border-radius: 6px; padding: 8px 10px; font-size: 14px; margin-top: 10px; background: #fff; }

/* ============ Shortcuts modal ============ */
.shortcut-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.shortcut-row .keys { display: flex; gap: 4px; }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 700; color: var(--ink-60);
  background: #F8F8F8; border: 1px solid var(--hairline-strong); border-bottom-width: 2px;
  border-radius: 4px; padding: 2px 6px;
}

/* ============ New message modal ============ */
.nm-to-row { display: flex; flex-wrap: wrap; gap: 6px; border: 1px solid var(--hairline-strong); border-radius: 6px; padding: 6px 8px; margin-bottom: 12px; min-height: 42px; align-items: center; }
.nm-chip { display: flex; align-items: center; gap: 6px; background: rgba(29,155,209,.12); border-radius: 4px; padding: 2px 6px; font-size: 14px; font-weight: 700; color: var(--link); }
.nm-chip img { width: 18px; height: 18px; border-radius: 3px; }
.nm-chip .chip-x { display: flex; cursor: pointer; color: var(--link); }
.nm-chip .chip-x svg { width: 12px; height: 12px; }
.nm-to-row input { flex: 1; min-width: 120px; border: none; outline: none; font-size: 15px; }
.nm-msg-ta { width: 100%; border: 1px solid var(--hairline-strong); border-radius: 6px; padding: 10px 12px; font-size: 15px; min-height: 90px; resize: vertical; outline: none; font-family: inherit; }
.nm-msg-ta:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

/* ============ Browse channels rows ============ */
.bc-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--hairline); }
.bc-row .bc-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.bc-row .bc-name svg { width: 14px; height: 14px; color: var(--ink-60); }
.bc-row .bc-sub { color: var(--ink-60); font-size: 13px; }
.bc-row .bc-btn { margin-left: auto; }
.bc-row .bc-view { color: var(--link); font-weight: 700; font-size: 13px; margin-left: auto; cursor: pointer; }

/* ============ Toasts ============ */
.toast-root {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  border-radius: 8px; padding: 10px 16px;
  font-size: 14px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  animation: toastin .18s ease;
  pointer-events: auto;
}
.toast.gone { animation: toastout .25s ease forwards; }
.toast svg { width: 16px; height: 16px; }
.toast .t-action { color: var(--sky); font-weight: 700; cursor: pointer; }
@keyframes toastin { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastout { to { transform: translateY(10px); opacity: 0; } }

/* ============ Empty channel state ============ */
.chan-empty { padding: 48px 20px 20px; }
.chan-empty .ce-hash { font-size: 42px; font-weight: 900; color: var(--ink); display: flex; align-items: center; gap: 4px; }
.chan-empty .ce-hash svg { width: 34px; height: 34px; }
.chan-empty h1 { font-size: 26px; font-weight: 900; letter-spacing: -.5px; margin: 12px 0 8px; }
.chan-empty .ce-sub { color: var(--ink-60); font-size: 15px; line-height: 1.5; max-width: 560px; }
.chan-empty .ce-actions { display: flex; gap: 10px; margin-top: 18px; }
.dm-empty-card { border: 1px solid var(--hairline); border-radius: 12px; padding: 16px; margin-top: 16px; max-width: 420px; }
.dm-empty-card .dec-row { display: flex; gap: 12px; align-items: center; }
.dm-empty-card img { width: 48px; height: 48px; border-radius: 10px; }
.dm-empty-card .dec-name { font-weight: 900; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.dm-empty-card .dec-sub { color: var(--ink-60); font-size: 13px; margin-top: 2px; }

/* date-tooltip via title attr is native; skip custom */

/* responsive-ish */
@media (max-width: 1180px) {
  .panel { width: 340px; flex-basis: 340px; }
  .topbar-left, .topbar-right { width: 150px; }
}
