/* Inbox popout (measured: 600px wide, #242429, radius 8, hairline ring + 0 12px 24px shadow) */
.ib { position: fixed; z-index: 55; display: flex; flex-direction: column; width: 600px; height: min(906px, calc(100vh - 56px)); border-radius: 8px; background: var(--bg-surface-high); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.24); overflow: hidden; }
.ib-head { flex: none; padding: 16px 16px 0; }
.ib-title-row { display: flex; align-items: center; height: 34px; }
.ib-title-ic { display: flex; margin-right: 8px; color: var(--text-strong); }
.ib-title { flex: 1; color: var(--text-strong); font-size: 20px; font-weight: 600; line-height: 24px; }
.ib-ctrls { display: flex; gap: 8px; }
.ib-ctrl { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(151, 151, 159, 0.04); border-radius: 8px; background: var(--bg-mod-subtle); color: var(--text-strong); }
.ib-ctrl.wide { width: 34px; height: 34px; padding: 0 8px; }
.ib-ctrl:hover { background: var(--bg-mod-strong); }
.ib-req-badge { position: absolute; right: -4px; top: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--badge-red); color: #fff; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }
.ib-tabs { display: flex; gap: 8px; margin-top: 16px; border-bottom: 1px solid var(--border-subtle); }
.ib-tab { position: relative; flex: 1; height: 36px; padding: 0 8px 16px; color: var(--text-subtle); font-size: 14px; font-weight: 600; line-height: 19.6px; white-space: nowrap; }
.ib-tab:hover { color: var(--text-default); }
.ib-tab.on { color: var(--text-strong); }
.ib-tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: #8891f2; }
.ib-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 0; }

/* a channel's box */
.ib-box { margin-bottom: 16px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface-higher); }
.ib-box-head { position: sticky; top: -16px; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border-subtle); border-radius: 12px 12px 0 0; background: var(--bg-surface-higher); }
.ib-box-head .ib-icon, .ib-box-head > img, .ib-box-head > .avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; }
.ib-box-head .sv-icon.acronym { border-radius: 12px; }
.ib-box-names { flex: 1; min-width: 0; cursor: pointer; }
.ib-box-name { display: flex; align-items: center; gap: 4px; color: var(--text-default); font-size: 16px; font-weight: 600; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-box-names:hover .ib-box-name span:last-child { text-decoration: underline; }
.ib-hash .ch-ic { width: 16px; height: 16px; color: var(--text-muted); }
.ib-hash .ch-ic > svg { width: 16px; height: 16px; }
.ib-box-sub { color: var(--text-muted); font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-box-btns { display: flex; gap: 8px; }
.ib-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--bg-mod-subtle); color: var(--text-strong); }
.ib-btn:hover { background: var(--bg-mod-strong); }
.ib-box-more { padding: 12px 16px; color: var(--text-muted); font-size: 14px; line-height: 18px; }
.ib-box-msgs { padding: 0 0 4px; }

/* a message inside (padding 2 16 2 72, 12px apart) */
.ib-msg { position: relative; min-height: 44px; margin: 12px 0; padding: 2px 16px 2px 72px; }
.ib-msg:hover { background: var(--message-bg-hover); }
.ib-av { position: absolute; left: 16px; top: 4px; width: 40px; height: 40px; border-radius: 50%; }
.ib-msg-head { display: flex; align-items: baseline; gap: 8px; line-height: 22px; }
.ib-msg-name { color: var(--text-strong); font-size: 16px; font-weight: 500; }
.ib-msg-ts { color: var(--text-muted); font-size: 12px; line-height: 22px; }
.ib-msg-body { color: var(--text-default); font-size: 16px; line-height: 22px; overflow-wrap: anywhere; }
.ib-fwd { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 14px; font-style: italic; }
.ib-msg-acts { position: absolute; right: 12px; top: -10px; display: none; gap: 4px; padding: 2px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg-surface-high); }
.ib-msg:hover .ib-msg-acts { display: flex; }
.ib-jump { height: 24px; padding: 0 8px; border-radius: 6px; color: var(--text-default); font-size: 12px; font-weight: 600; }
.ib-jump:hover, .ib-x:hover { background: var(--bg-mod-normal); color: var(--text-strong); }
.ib-x { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--text-muted); }
.ib-due { display: inline-flex; align-items: center; gap: 4px; margin: 10px 16px 0; padding: 2px 8px; border-radius: 8px; background: var(--bg-mod-subtle); color: var(--text-subtle); font-size: 12px; font-weight: 600; line-height: 16px; }
.ib-due.late { color: #f8a3a5; }

/* nothing to show */
.ib-empty { display: flex; flex-direction: column; align-items: center; padding: 72px 40px; text-align: center; }
.ib-empty-emoji { width: 64px; height: 64px; }
.ib-empty-t { margin-top: 20px; color: var(--text-strong); font-size: 20px; font-weight: 600; line-height: 24px; }
.ib-empty-d { max-width: 340px; margin-top: 8px; color: var(--text-subtle); font-size: 14px; line-height: 20px; }
.titlebar .tb-icon.active { color: var(--text-strong); }

/* ---------- Search: results column (measured: 419px incl. a hairline left border, 49px header, 16px padding) ---------- */
.chat-body.searching > .profile { display: none; }
.search-results { flex: none; display: flex; flex-direction: column; width: 419px; min-height: 0; border-left: 1px solid var(--border-subtle); background: var(--bg-base-lower); }
.search-results[hidden] { display: none; }
.sr-header { flex: none; display: flex; align-items: center; height: 49px; padding: 8px 16px; border-bottom: 1px solid var(--border-subtle); }
.sr-total { flex: 1; min-width: 0; color: var(--text-strong); font-size: 16px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.sr-ctrls { display: flex; align-items: center; gap: 8px; }
.sr-btn { display: flex; align-items: center; gap: 4px; height: 32px; padding: 3px 11px; border: 1px solid rgba(151, 151, 159, 0.04); border-radius: 8px; background: var(--bg-mod-subtle); color: var(--text-strong); font-size: 14px; font-weight: 500; line-height: 18px; }
.sr-btn.icon { width: 32px; padding: 0; justify-content: center; }
.sr-btn:hover { background: var(--bg-mod-strong); }
.sr-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 0; }
.sr-chan { display: flex; align-items: center; gap: 4px; margin: 4px 0 8px; color: var(--text-muted); font-size: 14px; font-weight: 600; line-height: 18px; }
.sr-chan .ch-ic, .sr-chan .ch-ic > svg { width: 16px; height: 16px; }
.sr-card { position: relative; margin-bottom: 8px; padding: 8px 12px 10px 64px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg-surface-high); cursor: pointer; }
.sr-card:hover { background: var(--bg-surface-higher); }
.sr-av { position: absolute; left: 12px; top: 10px; width: 40px; height: 40px; border-radius: 50%; }
.sr-head { display: flex; align-items: baseline; gap: 8px; line-height: 22px; }
.sr-name { color: var(--text-strong); font-size: 16px; font-weight: 500; }
.sr-ts { color: var(--text-muted); font-size: 12px; }
.sr-body { color: var(--text-default); font-size: 16px; line-height: 22px; overflow-wrap: anywhere; }
.sr-hit { border-radius: 2px; background: rgba(250, 168, 26, 0.35); color: inherit; }
.sr-jump { position: absolute; right: 8px; top: 8px; display: none; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--bg-mod-normal); color: var(--text-default); font-size: 12px; font-weight: 600; }
.sr-card:hover .sr-jump { display: block; }
.sr-jump:hover { background: var(--bg-mod-strong); color: var(--text-strong); }
.sr-empty { display: flex; align-items: center; justify-content: center; min-height: 100%; padding: 20px; }
.sr-empty-in { width: 280px; padding-bottom: 40px; text-align: center; }
.sr-empty-art { display: block; width: 160px; height: 160px; margin: 0 auto; }
.sr-empty-t { margin-top: 40px; color: #efeff1; font-size: 16px; font-weight: 500; line-height: 24px; }
.sr-loading { display: grid; place-items: center; padding: 80px 0; }
.sr-spin { width: 28px; height: 28px; border: 3px solid var(--bg-mod-strong); border-top-color: var(--brand); border-radius: 50%; animation: sr-spin 0.8s linear infinite; }
@keyframes sr-spin { to { transform: rotate(360deg); } }

/* the box: a clear (x) button instead of the magnifier once there's text */
.search .sr-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: none; place-items: center; width: 20px; height: 20px; border-radius: 4px; color: var(--icon-subtle); }
.search .sr-clear:hover { color: var(--text-strong); }
.search.has-text .sr-clear { display: grid; }
.search.has-text > .ic { display: none; }

/* options under the box (measured about 356px wide, sections split by a hairline) */
.sr-pop { position: fixed; z-index: 58; width: 356px; max-height: 420px; overflow-y: auto; padding: 4px 0; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--bg-surface-higher); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24); }
.sr-pop-sec { padding: 8px; }
.sr-pop-sec + .sr-pop-sec { border-top: 1px solid var(--border-subtle); }
.sr-pop-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 8px; color: var(--text-muted); font-size: 12px; font-weight: 600; line-height: 16px; }
.sr-pop-clear { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; color: var(--text-muted); }
.sr-pop-clear:hover { color: var(--text-strong); }
.sr-pop-row { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; border-radius: 6px; color: var(--text-default); font-size: 14px; font-weight: 500; line-height: 18px; cursor: pointer; }
.sr-pop-row.focused, .sr-pop-row:hover { background: var(--interactive-bg-hover); color: var(--text-strong); }
.sr-pop-k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-pop-hint { color: var(--text-muted); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-pop-ic { display: flex; color: var(--text-muted); }
.sr-pop-none { padding: 8px; color: var(--text-muted); font-size: 14px; }
