/* Messages › the channel pane, timeline, message rows and thread panel
   (public/messages-pane.js, -timeline.js, -thread.js). Colours come from the
   app's theme variables so Daylight and Midnight both work; the few literals
   are the amber highlight Slack uses for mentions and pins. */

.msg-pane { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--surface); position: relative; }
.msg-pane-missing { padding: 40px; color: var(--muted); }

/* ----- header ----- */
.msg-pane-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px 6px; min-height: 56px; background: var(--surface); }
.mt-head-left { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.mt-head-title { display: flex; align-items: center; gap: 4px; min-width: 0; }
.mt-head-name { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; padding: 3px 8px 3px 6px; margin-left: -6px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; }
.mt-head-name:hover { background: var(--hover); }
.mt-head-name .ico { flex: none; }
.mt-head-name .ico:last-child { color: var(--muted); }
.mt-head-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-head-star { display: inline-flex; border: 0; background: none; padding: 5px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.mt-head-star:hover { background: var(--hover); color: var(--text); }
.mt-head-star.on { color: #e2a03f; }
.mt-head-muted { color: var(--muted); display: inline-flex; }
.mt-head-chip { padding: 1px 8px; border-radius: 999px; background: var(--hover); color: var(--muted); font-size: 12px; font-weight: 600; }
.mt-head-sub { min-width: 0; color: var(--muted); font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-head-topic { max-width: 100%; border: 0; background: none; padding: 0; margin: 0; color: var(--muted); font: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-head-topic:hover { color: var(--text); text-decoration: underline; }
.mt-head-topic.empty { color: var(--dim); }
.mt-head-right { flex: none; display: flex; align-items: center; gap: 4px; }
.mt-head-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.mt-head-btn:hover, .mt-head-btn.mt-anchor-open { background: var(--hover); color: var(--text); }
.mt-head-members { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--text); cursor: pointer; font-weight: 600; font-size: 13px; }
.mt-head-members:hover { background: var(--hover); }
.mt-head-faces { display: inline-flex; }
.mt-head-faces .msg-avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); border-radius: 6px; }
.mt-head-faces .msg-avatar:first-child { margin-left: 0; }
.mt-head-huddle { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--text); cursor: pointer; font-size: 13px; font-weight: 600; }
.mt-head-huddle:hover { background: var(--hover); }
.mt-head-huddle.live { background: var(--green); border-color: var(--green); color: #fff; }

/* ----- tabs and bookmarks ----- */
.msg-pane-tabs { flex: none; display: flex; align-items: flex-end; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.msg-pane-tabs::-webkit-scrollbar { display: none; }
.mt-tab { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 8px 10px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; max-width: 220px; }
.mt-tab:hover { color: var(--text); }
.mt-tab.active { color: var(--text); border-bottom-color: var(--brand); }
.mt-tab-label { overflow: hidden; text-overflow: ellipsis; }
.mt-tab-count { padding: 0 6px; border-radius: 999px; background: var(--hover); color: var(--muted); font-size: 11px; font-weight: 700; }
.mt-tab.add { padding: 8px; color: var(--muted); }
.msg-pane-marks { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.mt-mark { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); max-width: 240px; }
.mt-mark:hover { background: var(--hover); }
.mt-mark-link { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--text); }
.mt-mark-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-mark-link .ico { flex: none; color: var(--muted); }
.mt-mark-more { display: inline-flex; border: 0; background: none; padding: 4px 6px 4px 2px; color: var(--muted); border-radius: 999px; opacity: 0; cursor: pointer; }
.mt-mark:hover .mt-mark-more, .mt-mark-more:focus-visible, .mt-mark-more.mt-anchor-open { opacity: 1; }
.mt-mark-add { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px dashed var(--line); border-radius: 999px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.mt-mark-add:hover { color: var(--text); background: var(--hover); }

/* ----- body, tabs content ----- */
.msg-pane-body { flex: 1; min-height: 0; position: relative; }
.msg-pane-tab { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.msg-pane-tab[hidden] { display: none; }
.mt-tl-host { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.msg-pane-foot { flex: none; padding: 0 20px 14px; }
.msg-pane-foot:empty { display: none; }
.msg-pane-files, .msg-pane-pins { overflow-y: auto; padding: 14px 20px 24px; }
.msg-pane-loading { padding: 30px; color: var(--muted); text-align: center; }
.msg-pane-empty { margin: 60px auto; max-width: 340px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.msg-pane-empty .ico { color: var(--dim); }
.msg-pane-empty-title { font-weight: 800; color: var(--text); font-size: 16px; }

.mt-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--hover); }
.mt-banner-text { color: var(--text); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.mt-banner.archived .mt-banner-text { color: var(--muted); font-weight: 500; }

/* ----- buttons, chips, forms ----- */
.mt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mt-btn:hover { background: var(--hover); }
.mt-btn:disabled { opacity: .55; cursor: default; }
.mt-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.mt-btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
:root[data-theme="midnight"] .mt-btn.primary { color: #04140d; }
.mt-btn.small { padding: 4px 10px; font-size: 12.5px; }
.mt-link { border: 0; background: none; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.mt-link:hover { text-decoration: underline; }
.mt-chip { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.mt-chip:hover { background: var(--hover); color: var(--text); }
.mt-chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

/* ----- popovers, menus, tooltips ----- */
.mt-pop { position: fixed; z-index: 1200; min-width: 200px; max-width: 360px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, .22); font-size: 14px; }
.mt-menu { padding: 6px 0; min-width: 220px; }
.mt-menu-head { padding: 6px 14px 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.mt-menu-sep { height: 1px; margin: 5px 0; background: var(--line); }
.mt-menu-item { display: flex; align-items: center; gap: 8px; width: calc(100% - 12px); margin: 0 6px; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); text-align: left; font: inherit; font-size: 14px; cursor: pointer; }
.mt-menu-item:hover, .mt-menu-item:focus-visible { background: var(--brand); color: #fff; outline: none; }
:root[data-theme="midnight"] .mt-menu-item:hover, :root[data-theme="midnight"] .mt-menu-item:focus-visible { color: #04140d; }
.mt-menu-item.danger { color: var(--red); }
.mt-menu-item.danger:hover, .mt-menu-item.danger:focus-visible { background: var(--red); color: #fff; }
.mt-menu-ico { flex: none; width: 16px; display: inline-flex; justify-content: center; }
.mt-menu-label { flex: 1; min-width: 0; }
.mt-menu-hint { color: var(--muted); font-size: 12px; }
.mt-menu-item:hover .mt-menu-hint { color: inherit; opacity: .8; }
.mt-form { display: flex; flex-direction: column; gap: 8px; padding: 12px; width: 300px; }
.mt-form-title { font-weight: 800; }
.mt-form input { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.mt-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.mt-tooltip { position: fixed; z-index: 1300; max-width: 280px; padding: 6px 10px; border-radius: 8px; background: #1d1c1d; color: #fff; font-size: 12.5px; line-height: 1.35; pointer-events: none; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
.mt-tooltip.react { text-align: center; padding: 10px 12px; }
.mt-tooltip-emoji { font-size: 28px; line-height: 1.1; margin-bottom: 4px; }

/* ----- timeline ----- */
.msg-timeline { flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; padding: 0 0 8px; position: relative; outline: none; scroll-behavior: auto; }
.mt-tl-top { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.mt-tl-top[hidden], .mt-intro[hidden], .mt-unread-bar[hidden], .mt-tl-jump[hidden] { display: none; }
.mt-intro { padding: 28px 20px 8px; max-width: 760px; }
.mt-intro h2 { margin: 0 0 6px; font-size: 24px; font-weight: 900; display: flex; align-items: center; gap: 4px; }
.mt-intro p { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }
.mt-intro-faces { display: flex; gap: 6px; margin-bottom: 12px; }
.mt-intro-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mt-tl-error { margin: 40px auto; max-width: 320px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.mt-tl-jump { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); cursor: pointer; }
.mt-tl-jump.new { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="midnight"] .mt-tl-jump.new { color: #04140d; }
.mt-tl-host > .mt-tl-jump { bottom: 36px; }

.mt-unread-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 12px; padding: 6px 16px; background: linear-gradient(var(--brand-soft), var(--brand-soft)), var(--surface); border-bottom: 1px solid var(--line); font-size: 13px; }
.mt-unread-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 0; background: none; padding: 0; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; }
.mt-unread-text:hover { text-decoration: underline; }
.mt-unread-jump { flex: none; white-space: nowrap; margin-left: auto; border: 0; background: none; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.mt-unread-jump:hover { color: var(--text); text-decoration: underline; }
.mt-unread-mark { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.mt-unread-mark:hover { background: var(--hover); }

.mt-day { position: relative; display: flex; justify-content: center; margin: 14px 20px 6px; }
.mt-day::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.mt-day-chip { position: relative; padding: 2px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 700; }
.mt-newline { position: relative; display: flex; justify-content: flex-end; margin: 10px 20px 4px; }
.mt-newline::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--red); }
.mt-newline-chip { position: relative; padding: 0 8px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; }

/* ----- message rows ----- */
.mt-row { position: relative; display: flex; gap: 10px; padding: 4px 20px 4px 20px; }
.mt-row:hover, .mt-row.editing { background: var(--hover); }
.mt-row.grouped { padding-top: 1px; padding-bottom: 1px; }
.mt-row.mentioned { background: rgba(226, 160, 63, .13); box-shadow: inset 3px 0 0 #e2a03f; }
.mt-row.mentioned:hover { background: rgba(226, 160, 63, .19); }
.mt-row.pinned:not(.mentioned) { background: rgba(226, 160, 63, .08); }
.mt-row.flash { animation: mt-flash 2.6s ease-out; }
@keyframes mt-flash { 0%, 55% { background: rgba(47, 111, 237, .22); } 100% { background: transparent; } }
.mt-row.sending { opacity: .62; }
.mt-row.failed .mt-main-col { color: var(--red); }
.mt-gutter { flex: none; width: 36px; padding-top: 2px; }
.mt-avatar-btn { display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 6px; }
.mt-gutter-time { display: block; width: 36px; text-align: right; font-size: 11px; line-height: 20px; color: var(--muted); opacity: 0; white-space: nowrap; }
.mt-row.grouped:hover .mt-gutter-time { opacity: 1; }
.mt-main-col { flex: 1; min-width: 0; }
.mt-head { display: flex; align-items: baseline; gap: 8px; line-height: 1.3; }
.mt-name { border: 0; background: none; padding: 0; font: inherit; font-weight: 800; color: var(--text); cursor: pointer; }
.mt-name:hover { text-decoration: underline; }
.mt-name-status { font-size: 13px; }
.mt-time { color: var(--muted); font-size: 12px; }
.mt-time:hover { text-decoration: underline; }
.mt-edited { color: var(--muted); font-size: 12px; }
.mt-tombstone { color: var(--muted); font-style: italic; padding: 2px 0; }
.mt-row.deleted .mt-avatar-btn { opacity: .6; }
.mt-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 2px; }
.mt-tag { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); }
button.mt-tag { cursor: pointer; }
button.mt-tag:hover { text-decoration: underline; }
.mt-tag.pin { color: #b07712; }
.mt-tag.saved { color: var(--brand); }
:root[data-theme="midnight"] .mt-tag.pin { color: var(--amber); }
.mt-pending-note { color: var(--muted); font-size: 12px; }
.mt-failed-note { color: var(--red); font-size: 12.5px; margin-top: 2px; }
.mt-failed-note .mt-link { color: var(--red); text-decoration: underline; }

/* hover bar */
.mt-actions { position: absolute; top: -16px; right: 20px; z-index: 2; display: none; align-items: center; gap: 1px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.mt-row:hover > .mt-actions, .mt-row:focus-within > .mt-actions { display: flex; }
.mt-act { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 4px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.mt-act:hover, .mt-act.mt-anchor-open { background: var(--hover); color: var(--text); }
.mt-act.on { color: var(--brand); }
.mt-act.emoji { font-size: 15px; }
a.mt-act { text-decoration: none; }

/* reactions */
.mt-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mt-react { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--hover); color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.mt-react:hover { border-color: var(--dim); }
.mt-react.ro { cursor: default; }
.mt-react.mine { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.mt-react-emoji { font-size: 14px; line-height: 1; }
.mt-react-add { display: inline-flex; align-items: center; justify-content: center; height: 24px; width: 30px; border: 1px solid transparent; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; opacity: 0; }
.mt-row:hover .mt-react-add, .mt-react-add:focus-visible, .mt-react-add.mt-anchor-open { opacity: 1; border-color: var(--line); background: var(--hover); }

/* thread preview */
.mt-thread-prev { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin-top: 4px; padding: 3px 8px 3px 4px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
.mt-thread-prev:hover { border-color: var(--line); background: var(--surface); }
.mt-thread-faces { display: inline-flex; }
.mt-thread-faces .msg-avatar { margin-left: -4px; box-shadow: 0 0 0 2px var(--surface); border-radius: 5px; }
.mt-thread-faces .msg-avatar:first-child { margin-left: 0; }
.mt-thread-count { color: var(--brand); font-weight: 700; }
.mt-thread-prev:hover .mt-thread-count { text-decoration: underline; }
.mt-thread-view { display: none; }
.mt-thread-prev:hover .mt-thread-last { display: none; }
.mt-thread-prev:hover .mt-thread-view { display: inline; }
.mt-thread-prev .ico { opacity: 0; }
.mt-thread-prev:hover .ico { opacity: 1; }

/* attachments */
.mt-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.mt-att-img { display: block; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--hover); overflow: hidden; cursor: zoom-in; max-width: min(100%, 360px); min-height: 48px; }
.mt-att-img img { display: block; max-width: 100%; max-height: 280px; object-fit: contain; }
.mt-att-img.broken { cursor: default; display: inline-flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 20px; color: var(--muted); font-size: 12px; }
.mt-att-media { max-width: min(100%, 420px); max-height: 280px; border-radius: 8px; border: 1px solid var(--line); background: #000; }
.mt-att-file { display: flex; align-items: center; gap: 10px; min-width: min(240px, 100%); max-width: min(360px, 100%); padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.mt-att-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.mt-att-ico.pdf { background: rgba(228, 92, 92, .16); color: var(--red); }
.mt-att-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mt-att-name { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.mt-att-name:hover { text-decoration: underline; }
.mt-att-sub { color: var(--muted); font-size: 12px; }
.mt-att-dl { flex: none; display: inline-flex; padding: 6px; border-radius: 6px; color: var(--muted); }
.mt-att-dl:hover { background: var(--hover); color: var(--text); }

/* system and huddle lines */
.mt-row.sys { align-items: center; gap: 8px; padding-top: 3px; padding-bottom: 3px; color: var(--muted); font-size: 13px; }
.mt-row.sys .mt-sys-ico { flex: none; display: inline-flex; justify-content: center; width: 36px; }
.mt-row.huddle .mt-sys-ico { color: var(--green); }
.mt-sys-text { min-width: 0; }
.mt-sys-time { flex: none; margin-left: auto; font-size: 11.5px; color: var(--dim); white-space: nowrap; }

/* inline editor */
.mt-editor { margin-top: 4px; padding: 8px; border: 1px solid var(--brand); border-radius: 10px; background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.mt-editor-input { display: block; width: 100%; resize: vertical; border: 0; outline: 0; background: none; color: var(--text); font: inherit; line-height: 1.46; }
.mt-editor-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.mt-editor-hint { margin-right: auto; color: var(--muted); font-size: 12px; }

/* typing */
.mt-typing { flex: none; min-height: 22px; padding: 2px 20px 2px; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.mt-typing:empty { visibility: hidden; }
.mt-typing-dots { display: inline-flex; gap: 3px; }
.mt-typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: mt-dot 1.2s infinite ease-in-out; }
.mt-typing-dots i:nth-child(2) { animation-delay: .15s; }
.mt-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes mt-dot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

/* skeleton */
.mt-skel { padding: 16px 20px; display: flex; flex-direction: column; gap: 18px; }
.mt-skel-row { display: flex; gap: 10px; }
.mt-skel-row .a { flex: none; width: 36px; height: 36px; border-radius: 6px; background: var(--hover); }
.mt-skel-row .b { flex: 1; height: 36px; border-radius: 6px; background: linear-gradient(90deg, var(--hover), var(--line-soft, var(--hover)), var(--hover)); background-size: 200% 100%; animation: mt-shimmer 1.4s infinite linear; }
@keyframes mt-shimmer { to { background-position: -200% 0; } }

/* ----- files and pins tabs ----- */
.mt-files-bar { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.mt-files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.mt-file-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.mt-file-thumb { display: flex; align-items: center; justify-content: center; height: 120px; padding: 0; border: 0; background: var(--hover); color: var(--muted); cursor: pointer; overflow: hidden; }
.mt-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mt-file-meta { padding: 8px 10px 10px; min-width: 0; }
.mt-file-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-file-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-file-acts { position: absolute; top: 6px; right: 6px; display: none; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.mt-file-card:hover .mt-file-acts, .mt-file-card:focus-within .mt-file-acts { display: flex; }
.mt-pins { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.mt-pin-card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.mt-pin-top { display: flex; align-items: center; gap: 6px; padding: 6px 14px; background: rgba(226, 160, 63, .12); color: var(--muted); font-size: 12px; font-weight: 600; }
.mt-pin-top .ico { color: #e2a03f; }
.mt-pin-card .mt-row { padding-top: 10px; }
.mt-pin-card .mt-row:hover { background: none; }
.mt-pin-acts { display: flex; gap: 8px; padding: 0 14px 10px 60px; }

/* ----- lightbox ----- */
.mt-lightbox { position: fixed; inset: 0; z-index: 1400; display: flex; flex-direction: column; background: rgba(8, 10, 14, .9); color: #fff; }
.mt-lightbox-bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 10px 16px; }
.mt-lightbox-title { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-lightbox-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; }
.mt-lightbox-btn:hover { background: rgba(255, 255, 255, .22); }
.mt-lightbox-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 0 64px 24px; }
.mt-lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.mt-lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; }
.mt-lightbox-nav:hover { background: rgba(255, 255, 255, .25); }
.mt-lightbox-nav.prev { left: 12px; }
.mt-lightbox-nav.next { right: 12px; }
.mt-lightbox-nav[hidden] { display: none; }

/* ----- thread panel ----- */
.mt-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.mt-thread-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.mt-thread-title { flex: 1; min-width: 0; }
.mt-thread-h1 { font-size: 16px; font-weight: 800; }
.mt-thread-h2 { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-thread-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-anchor: none; padding-bottom: 8px; }
.mt-thread-sep { display: flex; align-items: center; gap: 10px; margin: 10px 18px 4px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.mt-thread-sep i { flex: 1; height: 1px; background: var(--line); }
.mt-thread .mt-row { padding-left: 18px; padding-right: 18px; }
.mt-thread .mt-actions { right: 14px; }
.mt-thread .mt-day { margin-left: 18px; margin-right: 18px; }
.mt-thread-foot { flex: none; padding: 0 14px 12px; }
.mt-thread > .mt-tl-jump { bottom: 120px; }

@media (max-width: 640px) {
  .msg-pane-head { padding: 8px 10px 6px; flex-wrap: wrap; }
  .mt-head-left { flex: 1 1 100%; }
  .mt-head-right { width: 100%; justify-content: flex-end; }
  .mt-head-members .mt-head-faces { display: none; }
  .mt-row { padding-left: 12px; padding-right: 12px; }
  .mt-actions { right: 8px; }
  .msg-pane-foot { padding: 0 10px 10px; }
  .mt-day, .mt-newline { margin-left: 12px; margin-right: 12px; }
  .mt-head-huddle span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mt-row.flash, .mt-typing-dots i, .mt-skel-row .b { animation: none; }
}
