a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; margin-left: 8px; }
.app-dl-wrap { margin-top: 12px; }
.app-dl { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.app-dl .btn { flex: none; width: 100%; }
.app-dl a.btn { margin-left: 0; }
.app-dl span { display: block; text-align: center; }
:root {
  --bg: #eef1f3;
  --bg-grad-a: #e5eae8;
  --bg-grad-b: #dbe7e4;
  --panel: #ffffff;
  --panel-2: #f0f2f4;
  --panel-3: #e6e9ec;
  --rail-bg: #f7f9fa;
  --accent: #3f8f8a;
  --accent-dark: #347873;
  --accent-soft: rgba(63, 143, 138, 0.12);
  --out-msg: #e3f2ef;
  --in-msg: #ffffff;
  --text: #1b1f23;
  --text-2: #6b737c;
  --danger: #c9524f;
  --success: #3f9a53;
  --border: #e2e6ea;
  --shadow: rgba(0,0,0,.14);
  --msg-shadow: rgba(0,0,0,.06);
  --link: #1461c9;
  --link-mine: #1461c9;
  --scroll-thumb: rgba(20,30,40,.24);
  --scroll-thumb-hover: rgba(20,30,40,.4);
  --logo-1: #9aa2ab;
  --logo-2: #b9c0c7;
  --logo-3: #d5dade;
  --logo-4: #e9ecef;
  --logo-5: #b9c0c7;
  --logo-6: #9aa2ab;
  --logo-7: #e9ecef;
  --logo-8: #ffffff;
  --rail-w: 64px;
  --sidebar-w: 320px;
  --font-size: 1rem;
  --font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
    --bg: #14171b;
  --bg-grad-a: #14181c;
  --bg-grad-b: #16201f;
  --panel: #1c2026;
  --panel-2: #23282f;
  --panel-3: #2a3138;
  --rail-bg: #171b20;
  --accent: #4e9a91;
  --accent-dark: #3f7f78;
  --accent-soft: rgba(78, 154, 145, 0.16);
  --out-msg: #2b4d52;
  --in-msg: #262c33;
  --text: #e7eaed;
  --text-2: #929aa3;
  --danger: #d06a6a;
  --success: #6fbf73;
  --border: #2c323a;
  --shadow: rgba(0,0,0,.5);
  --msg-shadow: rgba(0,0,0,.2);
  --link: #6db3f2;
  --link-mine: #8fd7ff;
  --scroll-thumb: rgba(255,255,255,.16);
  --scroll-thumb-hover: rgba(255,255,255,.3);
  --logo-1: #4a525b;
  --logo-2: #69727c;
  --logo-3: #8b939c;
  --logo-4: #a8afb6;
  --logo-5: #69727c;
  --logo-6: #4a525b;
  --logo-7: #a8afb6;
  --logo-8: #e7eaed;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: var(--font-size); }
body { height: 100%; }
body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-size: var(--font-size);
}

.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 0.8571rem; }
.error { color: var(--danger); font-size: 0.9286rem; margin-top: 8px; }
.screen { position: fixed; inset: 0; }
#login-screen {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft) 0%, var(--bg) 60%);
}
.login-box {
  background: var(--panel); border-radius: 18px; padding: 36px 40px;
  width: 360px; box-shadow: 0 20px 60px var(--shadow);
  border: 1px solid var(--border); text-align: center;
}
.login-logo { color: var(--accent); width: 60px; height: 60px; margin: 0 auto 12px; }
.login-box h1 { font-size: 1.5714rem; margin-bottom: 24px; font-weight: 600; }
.login-box input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 10px; font-size: 1.0714rem;
  background: var(--panel-2); color: var(--text); outline: none;
}
.login-box input:focus { border-color: var(--accent); }
.login-server { margin: -2px 0 12px; }
.login-server select {
  width: 100%; box-sizing: border-box; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 10px; font-size: 1rem;
  background: var(--panel-2); color: var(--text); outline: none; cursor: pointer;
}
.login-server select:focus { border-color: var(--accent); }
.login-settings {
  position: absolute; right: 16px; bottom: 16px; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--text-2); opacity: .45;
  transition: opacity .15s, background .15s, color .15s;
}
.login-settings:hover { opacity: 1; background: var(--panel-2); color: var(--accent); }
.login-settings svg { width: 22px; height: 22px; }
.server-edit-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.server-edit-row { display: flex; gap: 8px; align-items: center; }
.server-edit-row input { margin-bottom: 0 !important; flex: 1; }
.server-edit-row .server-del {
  flex: none; width: 38px; height: 38px; border: none; border-radius: 10px;
  background: var(--panel-2); color: var(--danger); cursor: pointer; font-size: 1.2rem;
}
.server-edit-row .server-del:hover { background: var(--danger); color: #fff; }
.login-remember {
  display: flex; align-items: center; justify-content: space-between;
  margin: -4px 0 16px; font-size: .9286rem; color: var(--text-2);
}
.login-remember input { width: auto !important; padding: 0 !important; border: none !important; background: none !important; height: auto !important; }
.login-box button {
  width: 100%; padding: 12px; margin-top: 6px; border: none;
  background: var(--accent); color: #fff; font-size: 1.0714rem; font-weight: 600;
  border-radius: 10px; cursor: pointer;
}
.login-box button:hover { background: var(--accent-dark); }
.login-box button:disabled { opacity: .6; cursor: not-allowed; }

.invite-table-wrap { overflow-x: auto; margin-top: 12px; }
.invite-table { width: 100%; border-collapse: collapse; font-size: 0.9286rem; }
.invite-table th, .invite-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.invite-table th { color: var(--text-2); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; z-index: 1; }
.invite-table tr:hover td { background: rgba(255,255,255,.03); }
.invite-url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.invite-actions { display: flex; gap: 6px; justify-content: flex-end; }
.invite-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .7857rem; font-weight: 600; }
.invite-badge.used { background: rgba(239,68,68,.15); color: #f87171; }
.invite-badge.active { background: rgba(34,197,94,.15); color: #4ade80; }
.invite-empty { text-align: center; padding: 40px !important; color: var(--text-2); }

.inv-form label { display: block; margin-bottom: 14px; font-size: .9286rem; color: var(--text-2); }
.inv-form input[type=text], .inv-form input[type=email] {
    width: 100%; padding: 10px 12px; margin-top: 4px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel-2); color: var(--text); font-size: 1rem; outline: none;
}
.inv-form input:focus { border-color: var(--accent); }
.inv-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.inv-token-preview { font-family: monospace; font-size: .8571rem; word-break: break-all; color: var(--text-2); background: var(--panel-2); padding: 8px 10px; border-radius: 8px; margin-top: 4px; }
.inv-vis-list { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px; margin-top: 4px; background: var(--panel-2); }
.inv-vis-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.inv-vis-item:hover { background: rgba(255,255,255,.05); }
.inv-vis-item input { accent-color: var(--accent); }

#invite-screen {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft) 0%, var(--bg) 60%);
}
.inv-row { align-items: center; }
.inv-row input[type=text], .inv-row input[type=email] {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel-2); color: var(--text); font-size: 1rem; outline: none;
}
.inv-row input:focus { border-color: var(--accent); }
.perm-switches { display: flex; gap: 16px; align-items: center; }
.inv-token-preview {
  margin: 10px 0; user-select: all; font-size: 1rem; color: var(--text); word-break: break-all;
}
#invite-box .small.muted { margin-bottom: 18px; }
#invite-box .error { margin-bottom: 10px; text-align: center; }

.page-body-wide { max-width: none; }
.settings-cols { display: grid; grid-template-columns: 1fr; gap: 0 22px; }
.settings-col { min-width: 0; }
@media (min-width: 1160px) {
  .settings-cols-two { grid-template-columns: minmax(0, 460px) minmax(0, 600px); justify-content: center; align-items: start; }
}
.set-field { padding: 11px 0; border-bottom: 1px solid var(--border); }
.set-field:last-child { border-bottom: none; }
.set-field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.set-field-label { font-size: 0.9643rem; font-weight: 600; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.set-field-hint { font-size: 0.8571rem; color: var(--text-2); white-space: nowrap; }
.set-row { display: flex; align-items: center; gap: 8px; }
.set-select {
  flex: 1; min-width: 0; width: 100%; box-sizing: border-box;
  padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  font-size: 0.9286rem; outline: none;
  text-overflow: ellipsis;
}
.set-select:focus { border-color: var(--accent); }
.set-btn {
  flex-shrink: 0; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 9px; padding: 8px 14px; font-size: 0.8929rem; cursor: pointer; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.set-btn:hover { border-color: var(--accent); color: var(--accent); }
.set-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.set-meter { width: 100%; height: 8px; margin-top: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.set-meter-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #31c468, #e0a93f, #e0563f); transition: width .05s linear; }
.set-slider { width: 100%; accent-color: var(--accent); margin-top: 2px; }
.set-err { font-size: 0.8214rem; color: var(--danger); margin-top: 6px; }
.invite-table td.invite-url-cell { max-width: none; width: 100%; overflow-wrap: break-word; white-space: normal; }
.invite-table { table-layout: auto; }
.page-body.page-wide { max-width: 100%; margin: 0; padding: 24px; }
.perm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 0 12px; color: var(--text-2); font-size: 0.8214rem; font-weight: 600; }
.perm-head .perm-head-name { flex: 1; min-width: 0; }
.perm-head .perm-head-col { width: auto; min-width: 42px; flex-shrink: 0; text-align: center; white-space: nowrap; }
.perm-head .perm-head-col + .perm-head-col { margin-left: 16px; }
.perm-search { width: 100%; box-sizing: border-box; margin-top: 14px; margin-bottom: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); color: var(--text); font-size: 0.9286rem; outline: none; }
.perm-search:focus { border-color: var(--accent); }
.inv-base-hint { margin-bottom: 10px; }
.perm-scroll {
  max-height: 280px; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 4px 12px; margin-bottom: 14px; background: var(--panel-2);
  scrollbar-width: thin;
}
.perm-scroll .switch-row { padding: 7px 0; }
.perm-scroll .switch-row > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#app-screen { display: flex; }

#rail {
  width: var(--rail-w); flex-shrink: 0; background: var(--rail-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0;
}
.rail-logo { width: 40px; height: 40px; margin-bottom: 20px; }
.rail-logo svg { width: 100%; height: 100%; display: block; width: 100%; height: 100%; }
.rail-nav {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex: 1; justify-content: center;
}
.rail-bottom { display: flex; flex-direction: column; align-items: center; }
.rail-btn {
  position: relative; width: 42px; height: 42px; border: none; cursor: pointer;
  background: transparent; color: var(--text-2); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { background: var(--panel-2); color: var(--text); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent); }
.rail-logout:hover { color: var(--danger); }
.rail-badge {
  position: absolute; top: 3px; right: 3px; background: var(--danger); color: #fff;
  border-radius: 9px; min-width: 17px; height: 17px; font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

#sidebar {
  width: var(--sidebar-w); background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: relative; height: 100vh;
}
.sidebar-header {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px; height: 62px; min-height: 62px;
  border-bottom: 1px solid var(--border); position: relative;
}
.sidebar-title {
  font-size: 1.2143rem; font-weight: 700; padding-left: 4px; flex-shrink: 0;
}
.sidebar-title.hidden { display: none !important; }
.search-wrap { flex: 1; min-width: 0; }
.search-wrap input {
  width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid transparent;
  background: var(--panel-2); color: var(--text); font-size: 1rem; outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }
#chat-search-wrap.hidden { display: none !important; }
.global-search { position: relative; }
.gs-main { flex: 1; min-width: 0; }
.sidebar-actions { display: flex; gap: 2px; flex-shrink: 0; }
.topics-group-bar { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.topics-group-name { font-weight: 700; font-size: 1rem; color: var(--text); }
.conv-group-title {
  font-size: 0.8214rem; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-2); padding: 12px 14px 4px; font-weight: 600;
}

.conv-list { flex: 1; overflow-y: auto; }
.conv-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.conv-item:hover { background: var(--panel-2); }
.conv-item.active { background: var(--accent-soft); }
.conv-item.active .conv-name { color: var(--accent); }
.conv-info { flex: 1; min-width: 0; }
.conv-name {
  font-size: 1.0357rem; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.conv-preview {
  font-size: 0.9286rem; color: var(--text-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.conv-time { font-size: 0.8571rem; color: var(--text-2); }
.unread-badge {
  background: var(--accent); color: #fff; font-size: 0.7857rem; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
}
.conv-pin {
  border: none; background: none; cursor: pointer; color: var(--text-2);
  width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .12s;
}
.conv-pin svg { width: 15px; height: 15px; }
.conv-item:hover .conv-pin { opacity: 1; }
.conv-pin.pinned { opacity: 1; color: var(--accent); }
.conv-pin:hover { background: var(--panel-3); color: var(--accent); }
.conv-item.has-unread .conv-name { font-weight: 700; }
.conv-item.has-unread .conv-preview { color: var(--text); }

.bookmark-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.bookmark-item:hover { background: var(--panel-2); }
.bookmark-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.bookmark-chat { font-size: 0.9286rem; font-weight: 600; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bookmark-date { font-size: 0.7857rem; color: var(--text-2); flex-shrink: 0; }
.bookmark-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.bookmark-del {
  background: none; border: none; padding: 2px; cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; opacity: 0; transition: opacity .12s, color .12s;
}
.bookmark-del svg { width: 15px; height: 15px; }
.bookmark-item:hover .bookmark-del { opacity: 1; }
.bookmark-del:hover { color: var(--danger); }
.bookmark-text { font-size: 0.9286rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


.user-bubble, .chat-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  color: #fff; font-weight: 700; font-size: 1.0714rem;
  background: linear-gradient(135deg, #4e9a91, #3f7f78);
}
.chat-avatar { width: 42px; height: 42px; }
.user-bubble img, .chat-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.icon-btn {
  background: none; border: none; cursor: pointer; font-size: 1.2857rem;
  width: 34px; height: 34px; border-radius: 8px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.tiny { font-size: 1rem; width: 26px; height: 26px; }
.icon-btn svg, .send-btn svg { width: 20px; height: 20px; }
.icon-btn.tiny svg { width: 14px; height: 14px; }


#chat-area { flex: 1; display: flex; flex-direction: row; min-width: 0; height: 100vh; position: relative; }
#chat-view { display: flex; flex-direction: column; flex: 1; min-width: 0; height: 100%; position: relative; }
.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; color: var(--text-2);
}
.empty-state h2 { font-size: 1.5714rem; color: var(--text); }
#chat-header {
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  height: 62px; min-height: 62px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}
.chat-header-info { flex: 1; min-width: 0; }
#chat-header .chat-avatar, #chat-header .chat-header-info { cursor: pointer; }
.chat-back-btn { display: none; flex-shrink: 0; }
#chat-header .chat-avatar:hover { opacity: .85; }
#chat-header .chat-header-info:hover .chat-title { color: var(--accent); }
.chat-title { font-size: 1.1429rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chat-header-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.chat-header-actions { display: flex; gap: 6px; align-items: center; position: relative; flex-shrink: 0; }

#messages-container {
  flex: 1; overflow-y: auto; padding: 16px 20px 92px;
  overflow-anchor: none;
  background-color: var(--bg);
  background-image: linear-gradient(125deg, var(--bg-grad-a) 0%, var(--bg-grad-b) 50%, var(--bg-grad-a) 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

#pinned-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 10px; min-height: 30px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  cursor: pointer; box-sizing: border-box; position: relative;
}
#pinned-bar.hidden { display: none; }
#pinned-bar:hover { background: var(--panel-2); }
#pinned-bar-ico { color: var(--accent); width: 16px; height: 16px; flex: 0 0 auto; }
.pinned-bar-left { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow: hidden; }
.pinned-bar-main { flex: 1; min-width: 0; overflow: hidden; }
.pinned-bar-title {
  font-size: 0.7143rem; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .02em; line-height: 1.2;
}
.pinned-bar-text {
  font-size: 0.8571rem; color: var(--text-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; display: block; line-height: 1.3;
}
.pinned-bar-from { font-size: 0.7143rem; color: var(--text-2); display: block; }
#pinned-bar-thumb-wrap { position: relative; width: 26px; height: 26px; flex: 0 0 auto; }
#pinned-bar-thumb {
  width: 100%; height: 100%; border-radius: 6px; object-fit: cover; display: block;
  background: var(--panel-2); color: var(--text-2);
}
#pinned-bar-thumb-wrap:not(.hidden) #pinned-bar-thumb { display: flex; align-items: center; justify-content: center; }
#pinned-bar-thumb .pinned-thumb { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; display: block; }
.pinned-bar-nav-btn {
  width: 24px; height: 24px; flex: 0 0 auto; display: flex; align-items: center;
  justify-content: center; border: none; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--text-2);
}
.pinned-bar-nav-btn:hover:not(:disabled) { background: var(--panel-3); color: var(--accent); }
.pinned-bar-nav-btn:disabled { opacity: .35; cursor: default; }
.pinned-bar-nav-btn svg { width: 16px; height: 16px; }
.pinned-bar-right { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }

.v-spacer { width: 100%; flex: 0 0 auto; pointer-events: none; }
.msg-row { display: flex; align-items: flex-end; margin-bottom: 10px; }
.msg-row.mine { justify-content: flex-end; }
.msg-row.mine .msg-menu-btn { margin-left: 0; margin-right: 4px; }
.msg-avatar { width: 34px; height: 34px; font-size: .82rem; flex-shrink: 0; align-self: flex-start; margin: 0 8px 0 0; }
.msg-avatar.clickable { cursor: pointer; transition: opacity .12s, transform .12s; }
.msg-avatar.clickable:hover { opacity: .85; transform: scale(1.06); }
.msg-sender.cm-hl { border-radius: 6px; box-shadow: 0 0 0 4px rgba(63,143,138,.22); background: rgba(63,143,138,.12); }
.msg-row.mine .msg-avatar { margin: 0 0 0 8px; }
.msg {
  max-width: 68%; min-width: 0; padding: 7px 11px 6px;
  border-radius: 12px; position: relative; font-size: 1rem; line-height: 1.35;
  box-shadow: 0 1px 1px rgba(0,0,0,.2); word-break: break-word;
}
.msg.in { background: var(--in-msg); border-top-left-radius: 3px; }
.msg.mine { background: var(--out-msg); border-top-right-radius: 3px; }
.msg .msg-sender {
  font-size: .9286rem; font-weight: 700; display: block; margin-bottom: 2px;
  color: var(--accent); cursor: pointer;
}
.msg .msg-sender:hover { text-decoration: underline; }
.msg.mine .msg-sender { text-align: right; }
.msg .msg-body { white-space: pre-wrap; }
.msg .msg-link { color: var(--link); text-decoration: underline; display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis;   white-space: nowrap; vertical-align: bottom;}
.msg.mine .msg-link { color: var(--link-mine); }
.lp-slot { display: block; }
.lp-card {
  display: block; margin-top: 6px; border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0; overflow: hidden; text-decoration: none;
  background: rgba(127,127,127,.12); max-width: 320px; color: var(--text);
}
.lp-card:hover { background: rgba(127,127,127,.2); }
.lp-img { width: 100%; max-height: 170px; object-fit: cover; display: block; }
.lp-body { padding: 6px 10px 8px; }
.lp-site { font-size: .7143rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); }
.lp-title { font-size: .8571rem; font-weight: 700; margin-top: 1px; }
.lp-desc { font-size: .7857rem; color: var(--text-2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticks { color: var(--text-2); }
.ticks-2 { color: var(--accent); font-weight: 800; letter-spacing: -3px; }
.msg .msg-forward {
  font-size: 0.8571rem; font-style: italic; color: var(--accent);
  border-left: 2px solid var(--accent); padding-left: 6px; margin-bottom: 3px;
}
.msg .msg-scheduled {
  font-size: 0.7857rem; color: var(--accent);
  border-left: 2px solid var(--accent); padding-left: 6px; margin-bottom: 3px;
  display: inline-flex; align-items: center; gap: 4px;
}
.msg .msg-scheduled svg { width: 14px; height: 14px; flex-shrink: 0; }

.msg .msg-reply {
  border-left: 3px solid var(--accent);
  background: rgba(63, 143, 138, .10);
  border-bottom: 1px solid rgba(255,255,255,.12);
  border-radius: 6px; padding: 4px 8px 5px; margin-bottom: 6px;
  max-width: 100%; overflow: hidden;
}
.msg.mine .msg-reply { background: rgba(63, 143, 138, .16); }
.msg-reply-name { font-size: 0.8571rem; font-weight: 700; color: var(--accent); margin-bottom: 1px; }
.msg .msg-reply { cursor: pointer; }
.msg .msg-reply:hover { filter: brightness(1.25); }
.msg-reply-row { display: flex; align-items: center; gap: 6px; }
.msg-reply-text {
  font-size: 0.8929rem; color: var(--text-2); font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.msg-reply-pic { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.msg-reply-pic.sticker { object-fit: contain; background: transparent; padding: 2px; }
.msg .msg-quote {
  border-left: 3px solid #c98f2a;
  background: rgba(224, 169, 63, .16);
  border-radius: 6px; padding: 4px 8px 6px; margin-bottom: 6px;
  max-width: 100%; overflow: hidden; cursor: pointer;
}
.msg.mine .msg-quote { background: rgba(224, 169, 63, .24); }
.msg .msg-quote:hover { filter: brightness(1.15); }
.msg-quote-cap {
  font-size: 0.7143rem; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: #c98f2a; margin-bottom: 2px;
}
.msg-quote-head { font-size: 0.8214rem; color: var(--text-2); }
.msg-quote-name { font-weight: 600; }
.msg-quote-text {
  font-size: 0.8929rem; color: var(--text); font-style: italic;
  border-left: 2px solid rgba(201, 143, 42, .55); padding-left: 7px; margin-top: 3px;
  white-space: pre-wrap; word-break: break-word;
}
.msg-actions {
  display: flex; align-items: center; gap: 2px;
  align-self: center; padding: 2px;
  background: var(--panel-2); border-radius: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .15s; flex-shrink: 0;
}
.msg-row:hover .msg-actions { opacity: 1; pointer-events: auto; }
.msg-action {
  width: 30px; height: 30px; border: none; background: transparent; cursor: pointer;
  border-radius: 50%; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
}
.msg-action:hover { color: var(--accent); background: var(--panel-3); }
.msg-action svg { width: 16px; height: 16px; }
.msg-menu-btn {
  align-self: flex-start; margin-top: 2px; margin-left: 4px; flex-shrink: 0;
  width: 26px; height: 26px; border: none; background: transparent; cursor: pointer;
  border-radius: 50%; color: var(--text-2); opacity: .45;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s, background .15s;
}
.msg-row:hover .msg-menu-btn { opacity: 1; }
.msg-menu-btn svg { width: 17px; height: 17px; }
.msg-menu-btn:hover { background: var(--panel-2); color: var(--accent); }
.rx-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 6px; clear: both; }
.rx-pill {
  position: relative; display: inline-flex; align-items: center; gap: 4px;
  background: rgba(128,128,128,.18); border: none; border-radius: 12px;
  padding: 1px 7px 1px 4px; cursor: pointer; transition: background .12s;
}
.rx-pill:hover { background: rgba(128,128,128,.32); }
.rx-pill.me { background: rgba(128,128,128,.38); }
.rx-emoji { display: inline-flex; align-items: center; font-size: 15px; line-height: 1.2; }
.rx-emoji-img { width: 17px; height: 17px; display: block; object-fit: contain; }
.rx-emoji-text { font-size: 15px; line-height: 1.2; }
.rx-lottie { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.rx-lottie > img, .rx-lottie > svg { width: 100%; height: 100%; display: block; object-fit: contain; }
.rx-lottie.rx-size { width: 17px; height: 17px; }
.rx-lottie.react-size { width: 20px; height: 20px; }
.rx-count { font-size: 11px; color: var(--text-2); font-weight: 600; }
.rx-pill:hover .rx-tip { display: block; }
.rx-tip {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--panel-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 11px; z-index: 40; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  text-align: left;
  min-width: 140px;
}
.rx-tip-row {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 0;
}
.rx-tip-avatar {
  width: 18px; height: 18px; border-radius: 50%; background: var(--panel-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--text); overflow: hidden; flex-shrink: 0;
}
.rx-tip-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rx-tip-name { display: inline; white-space: nowrap; }
.msg-react-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text-2); cursor: pointer; position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .12s, color .12s;
}
.msg-react-btn svg { width: 15px; height: 15px; }
.msg-row:hover .msg-react-btn { opacity: .8; }
.msg-react-btn:hover { opacity: 1 !important; color: var(--accent); }
.react-pop {
  display: none; position: absolute; top: 50%; transform: translateY(-50%); left: calc(100% + 8px); right: auto; z-index: 60;
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 5px 7px; box-shadow: 0 4px 14px rgba(0,0,0,.18);
  flex-direction: column; gap: 5px;
}
.react-pop::before {
  content: ''; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px;
}
.msg-react-btn:hover .react-pop,
.react-pop.open { display: flex; }
.react-pop-row { display: flex; align-items: center; gap: 2px; }
.react-opt, .react-cell, .react-expand {
  border: none; background: none; cursor: pointer; padding: 3px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-2);
  transition: transform .1s, background .1s;
}
.react-opt:hover, .react-cell:hover, .react-expand:hover { background: var(--panel-2); transform: scale(1.18); }
.react-expand svg { width: 16px; height: 16px; transition: transform .15s; }
.react-expand.up svg { transform: rotate(180deg); }
.react-emoji-img { width: 20px; height: 20px; display: block; object-fit: contain; }
.react-pop-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  max-height: 108px; overflow-y: auto; overflow-x: hidden;
  padding-right: 3px; scrollbar-width: thin;
}
.react-pop-grid.hidden { display: none; }
.react-pop-grid .react-cell { padding: 2px; }
@media (max-width: 820px) {
  .react-pop { left: auto; right: calc(100% + 8px); }
  .react-pop::before { left: auto; right: -12px; }
}
.msg-menu-btn:hover { background: var(--panel-2); color: var(--accent); }
.msg-edited { font-size: 0.7143rem; color: var(--text-2); font-style: italic; margin-right: 6px; }
.deleted-msg { color: var(--text-2); font-style: italic; }
mark { background: rgba(240, 200, 80, .35); color: var(--text); border-radius: 2px; padding: 0 1px; }
.msg-row.search-match .msg { box-shadow: 0 0 0 2px rgba(240,200,80,.5); }
.msg-row.search-current .msg { box-shadow: 0 0 0 2px var(--accent); }
@keyframes msgRowFlash {
  0%, 100% { background-color: transparent; }
  10%, 35%, 60%, 85% { background-color: rgba(214, 202, 178, .55); }
  22%, 48%, 72%, 95% { background-color: rgba(214, 202, 178, .08); }
}
.msg-row.search-current { animation: msgRowFlash 2s ease-in-out 1; border-radius: 10px; }
.select-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; min-height: 40px; box-sizing: border-box;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.select-bar.hidden { display: none; }
#chat-header.selecting .chat-header-actions { visibility: hidden; }
.select-count { font-size: .9643rem; font-weight: 600; color: var(--accent); flex: 1; min-width: 0; }
.select-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.select-action {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; color: var(--text);
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  font-size: .9286rem; transition: background .12s, color .12s;
}
.select-action svg { width: 18px; height: 18px; flex-shrink: 0; }
.select-action:hover { background: var(--accent-soft); color: var(--accent); }
.select-action.danger:hover { background: rgba(201,82,79,.12); color: var(--danger); }
.msg-row { position: relative; }
.msg-row.has-read-receipt { margin-bottom: 24px; }
.msg-read-receipt {
  position: absolute; right: 44px; bottom: -16px;
  font-size: 0.7143rem; color: var(--text-2); opacity: .72;
  user-select: none; pointer-events: none;
}
.msg-check {
  display: none;
  position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--text-2); background: var(--panel);
  box-sizing: border-box; z-index: 3; pointer-events: none;
  align-items: center; justify-content: center;
}
.msg-check svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
#messages-container.select-mode .msg-check { display: flex; }
#messages-container.select-mode .msg-row { padding-left: 30px; }
#messages-container.select-mode .msg-check.checked { background: var(--accent); border-color: var(--accent); }
#messages-container.select-mode .msg-check.checked svg { opacity: 1; }
#messages-container.select-mode .msg-row .msg { cursor: pointer; }
#messages-container.select-mode .msg-row .msg * { pointer-events: none; }
#messages-container.select-mode .msg-row .msg-avatar { pointer-events: none; }
#messages-container.select-mode .msg-menu-btn { display: none; }
#modal .md-btn:disabled { opacity: .5; cursor: default; }
@media (max-width: 640px) {
  .select-action span { display: none; }
}
.msg-time {
  float: right; margin-left: 8px; margin-top: 6px;
  font-size: 0.7857rem; color: var(--text-2); display: inline-flex; align-items: center; gap: 3px;
}
.msg.mine .msg-time { color: var(--text-2); }
.msg .attachment {
  display: block; max-width: 450px; border-radius: 8px; margin-bottom: 4px; overflow: hidden; width: fit-content;
}
.msg .attachment img { max-height: 500px; max-width: 100%; width: auto; display: block; border-radius: 8px; }
.msg.msg-has-img { max-width: 100%; }
.msg .file-att-name { font-size: 0.9286rem; color: var(--accent); word-break: break-all; }
.msg .file-att, .cmt-main .file-att {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: rgba(127,127,127,.10); border-radius: 12px; padding: 9px 12px;
  margin-bottom: 4px; max-width: 260px; color: var(--text);
}
.msg .file-att:hover, .cmt-main .file-att:hover { background: rgba(127,127,127,.2); }
.fa-badge {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 11px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; color: #fff; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.fa-badge svg { width: 17px; height: 17px; stroke-width: 2; }
.fa-badge-ext { font-size: 0.6071rem; font-weight: 800; letter-spacing: .4px; line-height: 1; text-transform: uppercase; }
.fa-pdf { background: linear-gradient(135deg, #e2593f, #b93a24); }
.fa-word { background: linear-gradient(135deg, #4a90e2, #2b5fb0); }
.fa-excel { background: linear-gradient(135deg, #33a35c, #1c7a41); }
.fa-ppt { background: linear-gradient(135deg, #e0863a, #c05f16); }
.fa-arch { background: linear-gradient(135deg, #9b7fd4, #6a4cae); }
.fa-text { background: linear-gradient(135deg, #8a929b, #5b636b); }
.fa-media { background: linear-gradient(135deg, #5aa8a2, #3a7a73); }
.fa-design { background: linear-gradient(135deg, #d46aa8, #a83a7c); }
.fa-file { background: linear-gradient(135deg, #8a929b, #5b636b); }
.file-att .fa-txt { display: flex; flex-direction: column; min-width: 0; }
.file-att .fa-name { font-size: 0.9286rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.file-att .fa-size { font-size: 0.7857rem; color: var(--text-2); margin-top: 1px; }
.msg .msg-audio { display: none; }
.msg.msg-voice { background: none !important; box-shadow: none !important; padding: 0; border-radius: 0; max-width: 320px; }
.msg.msg-voice .msg-sender { margin-bottom: 4px; }
.msg.msg-voice .rx-wrap { margin-top: 4px; }

.audio-player { display: flex; align-items: center; gap: 10px; width: 250px; max-width: 100%; padding: 4px 0; }
.audio-player audio { display: none; }
.msg.msg-voice .audio-player { background: var(--in-msg); border-radius: 14px; padding: 10px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.10); }
.msg.mine.msg-voice .audio-player { background: var(--out-msg); }
.ap-btn { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; padding: 0; transition: filter .15s; }
.ap-btn:hover { filter: brightness(1.08); }
.ap-btn svg { width: 22px; height: 22px; display: block; }
.ap-btn .ap-ic-pause { display: none; }
.audio-player.playing .ap-btn .ap-ic-pause { display: block; }
.audio-player.playing .ap-btn .ap-ic-play { display: none; }
.ap-wave { position: relative; flex: 1; height: 26px; cursor: pointer; }
.ap-wave::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); height: 4px; border-radius: 2px; background: rgba(128,128,128,.35); }
.ap-fill { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 4px; width: 0; border-radius: 2px; background: var(--accent); }
.ap-knob { position: absolute; top: 50%; left: 0; transform: translate(-50%,-50%); width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.ap-time { flex-shrink: 0; font-size: 0.75rem; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.msg .msg-video { display: block; max-width: 450px; border-radius: 8px; margin-bottom: 4px; background: #000; }


.msg .sticker-img { max-width: 160px; max-height: 160px; border-radius: 10px; display: block; filter: url(#sticker-outline); }

.msg.msg-sticker {
  background: transparent !important; box-shadow: none; padding: 0; max-width: 220px;
}
.msg.msg-sticker .sticker-img { max-width: 200px; max-height: 200px; }
.msg.msg-sticker .msg-time {
  position: absolute; right: 4px; bottom: 2px; background: rgba(0,0,0,.45);
  color: #fff; border-radius: 8px; padding: 0 5px; font-size: 0.7143rem; margin: 0;
  opacity: 0; transition: opacity .15s;
}
.msg.msg-sticker:hover .msg-time { opacity: 1; }
.msg.msg-sticker .msg-edited { position: absolute; left: 4px; bottom: 2px; }
.msg-row.mine.msg-sticker-row { justify-content: flex-end; }
.msg.msg-sticker .sticker-img { margin: 5px; }


.msg-comments {
  display: flex; align-items: center; gap: 6px;
  clear: both; margin: 8px -11px -6px; padding: 6px 12px;
  width: auto; font-size: .7857rem; color: var(--text-2);
  background: rgba(127,127,127,.13);
  border-radius: 0 0 12px 12px; cursor: pointer; user-select: none;
}
.msg-comments svg { width: 14px; height: 14px; flex-shrink: 0; }
.msg-comments:hover { background: rgba(127,127,127,.26); color: var(--text); }
.msg.msg-sticker .msg-comments { margin: -2px 0 5px; border-radius: 8px; padding: 5px 10px; background: rgba(127,127,127,.18); }
.cm-reply { display: flex; align-items: center; gap: 8px; font-size: .8571rem; color: var(--text-2); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 5px 10px; margin-bottom: 8px; }
.cm-reply-ico { color: var(--accent); }
.cm-reply-x { margin-left: auto; background: none; border: none; color: var(--text-2); cursor: pointer; }

#chat-view { position: relative; }
#comments-view, #fav-view, #scheduled-view {
  position: absolute; inset: 0; z-index: 15; background: var(--bg);
  display: flex; flex-direction: column;
}
.fav-entry { user-select: none; }
.fav-entry:hover { background: var(--panel-2); }
.fav-src { color: var(--text-2); font-weight: 400; font-size: .7857rem; margin-left: 6px; }
.fav-search {
  align-self: center; width: 160px; background: var(--panel-2); color: var(--text);
  border: 1px solid transparent; border-radius: 10px; padding: 8px 12px;
  font-size: 1rem; outline: none; font-family: var(--font-family); flex-shrink: 0;
}
.fav-search:focus { border-color: var(--accent); }
.fav-row { width: 100%; position: relative; }
.fav-acts { display: flex; flex-direction: column; gap: 6px; align-self: center; flex-shrink: 0; margin-left: 6px; }
.fav-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color .12s, border-color .12s, transform .1s;
}
.fav-btn svg { width: 14px; height: 14px; }
.fav-btn:hover { color: var(--accent); border-color: var(--accent); transform: scale(1.08); }
.fav-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
#fav-list.fav-select-mode .fav-row { padding-left: 30px; cursor: pointer; }
#fav-list.fav-select-mode .fav-row .cmt-main,
#fav-list.fav-select-mode .fav-row .cmt-avatar,
#fav-list.fav-select-mode .fav-row .fav-acts { pointer-events: none; }
#fav-list.fav-select-mode .fav-row .fav-acts { display: none; }
.fav-check {
  display: none;
  position: absolute; left: 2px; top: 18px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--text-2); background: var(--panel);
  box-sizing: border-box; z-index: 3; pointer-events: none;
  align-items: center; justify-content: center;
}
.fav-check svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
#fav-list.fav-select-mode .fav-check { display: flex; }
#fav-list.fav-select-mode .fav-check.checked { background: var(--accent); border-color: var(--accent); }
#fav-list.fav-select-mode .fav-check.checked svg { opacity: 1; }
.fav-row.selected .cmt-main { outline: 2px solid var(--accent); }
.fav-menu-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; align-self: center; margin-left: 6px;
}
.fav-menu-btn:hover { color: var(--accent); border-color: var(--accent); }
.fav-menu-btn svg { width: 18px; height: 18px; }
#fav-select-toggle.active { color: var(--accent); background: var(--accent-soft); }
#fav-select-toggle { align-self: center; flex-shrink: 0; }
#fav-select-bar { margin: 0; }
#fav-view.fav-selecting .fav-composer { display: none; }
#fav-view.fav-selecting #fav-list { padding-bottom: 20px; }
.cmt-avatar.clickable, .cmt-name.clickable { cursor: pointer; }
.cmt-avatar.clickable:hover { opacity: .85; transform: scale(1.06); }
.cmt-name.clickable:hover { text-decoration: underline; }
.cmt-name.clickable:hover { text-decoration: underline; }
.cmt-img.zoomable { cursor: zoom-in; }

.sched-row { position: relative; }
.sched-avatar { background: var(--accent) !important; }
.sched-avatar::after {
  content: '🕒'; font-size: 18px; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.sched-avatar img { display: none; }
.sched-when {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .7857rem; color: var(--text-2); margin-left: 6px;
  font-weight: 600;
}
.sched-when svg { width: 14px; height: 14px; flex-shrink: 0; }
.sched-recur-badge {
  font-size: .7857rem; margin-left: 6px; color: var(--accent); font-weight: 700;
}

.sched-modal { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.sched-body-input {
  width: 100%; min-height: 80px; resize: vertical; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  font-size: .9286rem; font-family: var(--font-family); outline: none; line-height: 1.35;
}
.sched-body-input:focus { border-color: var(--accent); }
.sched-info { font-size: .9286rem; color: var(--text-2); }
.sched-preview {
  background: var(--panel-2); border-radius: 10px; padding: 8px 10px;
  display: flex; gap: 10px; align-items: center; overflow: hidden;
}
.sched-preview-text { font-size: .9286rem; color: var(--text); word-break: break-word; }
.sched-preview-img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.sched-dt-row {
  display: flex; gap: 8px; align-items: center;
}
.sched-datetime {
  flex: 1; background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 1rem; font-family: var(--font-family);
  outline: none;
}
.sched-datetime:focus { border-color: var(--accent); }

#btn-send.sched-pressing {
  background: var(--accent-dark) !important;
  box-shadow: 0 0 0 6px rgba(63,143,138,.35);
  transform: scale(1.05);
}
#cmt-list .rx-wrap, .cmt-main .rx-wrap { margin-top: 4px; }
#cmt-list .msg-react-btn, .cmt-main .msg-react-btn { opacity: .55; }
.cmt-header {
  display: flex; align-items: stretch; gap: 6px; flex-shrink: 0;
  padding: 4px 12px; min-height: 58px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.cmt-back {
  width: 46px; border: none; background: none; color: var(--text-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cmt-back:hover { color: var(--accent); }
.cmt-back svg { width: 24px; height: 24px; }
.cmt-head-main { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1; }
.cmt-title { font-size: 1.0714rem; font-weight: 700; line-height: 1.3; }
.cmt-sub { font-size: .8214rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.cmt-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cmt-row { display: flex; gap: 10px; align-items: flex-start; }
.cmt-indent { flex-shrink: 0; align-self: stretch; }
.cmt-avatar { width: 36px; height: 36px; font-size: .85rem; flex-shrink: 0; }
.cmt-main { min-width: 0; max-width: 78%; background: var(--panel); border-radius: 12px; padding: 7px 11px 6px; }
.cmt-name { font-size: .9286rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.cmt-text { font-size: .9286rem; white-space: pre-wrap; word-break: break-word; line-height: 1.35; }
.cmt-sticker { width: 130px; height: 130px; object-fit: contain; display: block; margin: 2px 0 4px; filter: url(#sticker-outline); }
.cmt-img { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; margin: 2px 0 4px; }
.cmt-video { max-width: 260px; border-radius: 10px; display: block; margin: 2px 0 4px; background: #000; }
.cmt-main .file-att { max-width: 240px; margin: 2px 0 4px; }
#cmt-attach.active { color: var(--accent); background: var(--panel-3); }
.cmt-pending { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.cmt-pending.hidden { display: none; }
.cmt-pend {
  position: relative; display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 5px 26px 5px 6px; max-width: 200px;
}
.cmt-pend.uploading { opacity: .6; }
.cmt-pend-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.cmt-pend-meta { min-width: 0; }
.cmt-pend-name { font-size: .8571rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.cmt-pend-size { font-size: .7143rem; color: var(--text-2); }
.cmt-pend-x { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border: none; border-radius: 50%; background: var(--panel-3); color: var(--text-2); cursor: pointer; font-size: .7143rem; line-height: 1; }
.cmt-pend-x:hover { background: var(--danger); color: #fff; }
#cmt-emoji.active { color: var(--accent); background: var(--panel-3); }
.cmt-meta { display: flex; gap: 10px; align-items: center; margin-top: 4px; font-size: .7857rem; color: var(--text-2); }
.cmt-act { background: none; border: none; color: var(--text-2); cursor: pointer; font-size: .7857rem; padding: 0; }
.cmt-act:hover { color: var(--accent); text-decoration: underline; }
.cmt-act.danger:hover { color: var(--danger); }
.cm-deleted .cmt-text { color: var(--text-2); font-style: italic; }
.cmt-composer { flex-shrink: 0; padding: 8px 14px 14px; position: relative; }
.cmt-input-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 5px 6px 5px 14px;
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
}
#cmt-input {
  flex: 1; background: none; border: none; outline: none; color: var(--text);
  font-size: 1rem; font-family: var(--font-family); padding: 6px 0;
}
.cmt-composer .cm-reply { position: absolute; left: 20px; right: 20px; bottom: calc(100% + 6px); margin: 0; }
.msg-date-sep {
  text-align: center; margin: 14px 0; font-size: 0.8929rem;
}
.msg-date-sep span, .msg-date-sep {
  color: var(--text);
}
.msg-date-sep::before { content: ''; }
.msg-date-sep span { padding: 4px 12px; border-radius: 12px; background: rgba(0,0,0,.35); backdrop-filter: blur(2px); color: #fff; }
.msg-system-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0; user-select: none; }
.msg-system-text {
  padding: 4px 12px; border-radius: 12px; background: rgba(0,0,0,.28);
  backdrop-filter: blur(2px); color: #fff; font-size: 0.8571rem; text-align: center;
}
.msg-system-time { font-size: 0.7143rem; color: #fff; opacity: .75; background: rgba(0,0,0,.28); padding: 2px 8px; border-radius: 10px; }
html[data-theme="light"] .msg-system-text, html[data-theme="light"] .msg-system-time { background: rgba(0,0,0,.32); color: #fff; }

#composer {
  padding: 8px 29px 14px 14px;
  background: transparent;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 5;
}

#reply-preview, #edit-preview {
  display: flex; align-items: stretch; gap: 10px; padding: 0;
  background: var(--out-msg); border-radius: 12px 12px 4px 12px; margin-bottom: 8px;
  font-size: 13px; width: auto; max-width: 68%;
  align-self: flex-end; margin-right: 4%;
  pointer-events: auto;
  box-shadow: 0 4px 18px rgba(0,0,0,.35); overflow: hidden;
}
.reply-accent { width: 4px; background: var(--accent); flex-shrink: 0; }
#reply-preview.quoting .reply-accent { background: #c98f2a; }
#reply-preview.quoting .reply-label { color: #c98f2a; }
.reply-thumb {
  width: 44px; height: 44px; flex-shrink: 0; align-self: center;
  margin-left: 8px; border-radius: 8px; overflow: hidden; background: var(--panel-3);
  display: flex; align-items: center; justify-content: center;
}
.reply-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reply-thumb img.reply-sticker { object-fit: contain; padding: 2px; }
.reply-main { flex: 1; min-width: 0; padding: 7px 2px; cursor: pointer; }
.reply-label { font-weight: 700; color: var(--accent); white-space: nowrap; font-size: 0.8571rem; }
.reply-text { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }
#reply-preview .icon-btn, #edit-preview .icon-btn { align-self: center; margin-right: 6px; flex-shrink: 0; }

.composer-shell {
  width: 100%;
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 6px 5px 14px;
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
  pointer-events: auto;
}
#composer-input {
  flex: 1 1 auto; min-width: 40px; min-height: 24px; max-height: 140px; outline: none;
  font-size: 1rem; line-height: 1.35; overflow-y: auto; overflow-x: hidden;
  white-space: pre-wrap; word-break: break-word; padding: 6px 0;
}
#composer-input:empty::before { content: attr(data-ph); color: var(--text-2); }
.composer-shell .icon-btn {
  flex-shrink: 0; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
}
.send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.send-btn:hover { background: var(--accent-dark); }
.send-btn svg { width: 20px; height: 20px; }
.send-btn.voice-mode { background: var(--accent-soft); color: var(--accent); }
.send-btn.voice-mode:hover { background: var(--accent); color: #fff; }
.send-btn.recording { background: var(--danger); animation: pulse-recording 1.2s infinite; }
@keyframes pulse-recording { 0% { box-shadow: 0 0 0 0 rgba(220,53,69,.5); } 70% { box-shadow: 0 0 0 10px rgba(220,53,69,0); } 100% { box-shadow: 0 0 0 0 rgba(220,53,69,0); } }
.send-btn .hidden { display: none !important; }
.pending-attachments {
  width: 92%; display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 10px; justify-content: flex-start; pointer-events: auto;
}
.pending-attachments:empty { display: none; }
.pending-item {
  position: relative; width: 64px; height: 64px; border-radius: 12px;
  overflow: hidden; background: var(--panel-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.pending-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pending-item:not(.pending-file) { width: 96px; height: 96px; }
.pending-thumb { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.pending-file { width: auto !important; min-width: 64px; max-width: 150px; height: 64px; flex-direction: column; padding: 4px; }
.pending-file .pending-thumb { height: 40px; color: var(--text-2); }
.pending-file .pending-thumb svg { width: 22px; height: 22px; }
.pending-file .pending-file-name {
  max-width: 140px; font-size: 0.6786rem; color: var(--text); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.pending-progress {
  position: absolute; inset: 0; background: rgba(0,0,0,.65);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.progress-ring { width: 34px; height: 34px; transform: rotate(-90deg); }
.progress-ring .ring-bg { fill: none; stroke: rgba(128,128,128,.35); stroke-width: 3.5; }
.progress-ring .ring-fg { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset .15s linear; }
.progress-pct { font-size: 0.7857rem; color: var(--text); font-weight: 600; }
.pending-remove {
  position: absolute; inset: 0; background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
  color: var(--danger); cursor: pointer;
}
.pending-remove svg { width: 24px; height: 24px; }

@media (max-width: 820px) {
  .composer-shell, .pending-attachments { width: 94%; }
  #reply-preview, #edit-preview { max-width: 94%; margin-right: 3%; }
}

.emoji-sidebar {
  width: 300px; flex-shrink: 0; background: var(--panel);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}
.emoji-sidebar-head {
  display: flex; align-items: stretch; justify-content: space-between; gap: 0;
  padding: 0; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 1rem; min-height: 44px; flex-shrink: 0;
}
.emoji-tabs { display: flex; gap: 1px; flex: 1; min-width: 0; background: var(--border); }
.emoji-tabs::-webkit-scrollbar { height: 0; }
.emoji-tab {
  flex: 1; border: none; background: var(--panel); color: var(--text-2); cursor: pointer;
  border-radius: 0; padding: 12px 0; font-size: 1rem; font-weight: 600; white-space: nowrap;
  text-align: center; transition: background .12s, color .12s;
}
.emoji-tab.active { background: var(--panel-2); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.emoji-sidebar-grid {
  flex: 1; overflow-y: auto; display: flex; flex-wrap: wrap; gap: 2px;
  padding: 10px; align-content: flex-start;
}
.emoji-sidebar-grid span {
  font-size: 1.5714rem; cursor: pointer; padding: 4px; border-radius: 6px;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.emoji-sidebar-grid span:hover { background: var(--panel-2); }
.emoji-sidebar-grid > span:not(.sticker-cell) {
  width: calc((100% - 8px) / 5); height: auto; aspect-ratio: 1; box-sizing: border-box;
}
.panel-emoji { width: 100%; height: 100%; display: block; pointer-events: none; }
.msg .msg-emoji { width: 40px; height: 40px; vertical-align: -10px; }
.emoji-cell { position: relative; }
.emoji-cell > svg, .emoji-cell > img { width: 100%; height: 100%; display: block; }
.emoji-anim { display: inline-block; width: 40px; height: 40px; vertical-align: -10px; line-height: 0; }
.emoji-anim > img, .emoji-anim > svg { width: 100%; height: 100%; display: block; margin: 0; vertical-align: 0; }
.emoji-sidebar-grid .sticker-cell {
  width: calc((100% - 4px) / 3); height: auto; aspect-ratio: 1; padding: 4px; box-sizing: border-box;
}
.emoji-sidebar-grid .sticker-cell img { width: 100%; height: 100%; object-fit: contain; filter: url(#sticker-outline); }
#btn-emoji.active { color: var(--accent); background: var(--panel-2); }
.emoji-sidebar-close {
  flex-shrink: 0; width: 100%; padding: 12px; border: none;
  background: var(--panel-2); color: var(--text-2); cursor: pointer;
  font-size: 0.9643rem; font-weight: 600;
  border-top: 1px solid var(--border);
  transition: background .12s, color .12s;
}
.emoji-sidebar-close:hover { background: var(--panel-3); color: var(--accent); }
.sticker-packs {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%;
}
.sticker-pack {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; padding: 8px; border-radius: 12px; background: var(--panel-2);
  transition: background .12s;
}
.sticker-pack:hover { background: var(--panel-3); }
.sticker-pack-cover {
  width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--panel); display: flex; align-items: center; justify-content: center;
}
.sticker-pack-cover img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.sticker-pack-name {
  font-size: 0.8929rem; color: var(--text); text-align: center; width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sticker-pack-head {
  display: flex; align-items: center; gap: 6px; width: 100%; flex: 1 0 100%;
  margin-bottom: 4px;
}
.sticker-cells {
  width: 100%; display: flex; flex-wrap: wrap; gap: 2px; flex: 1 0 100%; align-content: flex-start;
}
.sticker-pack-back {
  width: 30px; height: 30px; border: none; background: var(--panel-2); color: var(--text-2);
  border-radius: 8px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sticker-pack-back svg { width: 18px; height: 18px; }
.sticker-pack-back:hover { background: var(--panel-3); color: var(--accent); }
.sticker-pack-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.detail-panel {
  width: 300px; flex-shrink: 0; height: 100%; position: relative;
  background: var(--panel); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.detail-content { position: relative; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; }
#detail-body { padding: 0 14px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.detail-close-btn {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  background: var(--panel-2); border-radius: 50%;
}
.detail-close-bottom {
  border: none; background: var(--panel-2); color: var(--text); cursor: pointer;
  padding: 12px; font-size: 1rem; font-weight: 600; border-top: 1px solid var(--border);
  width: 100%; flex-shrink: 0;
}
.detail-close-bottom:hover { background: var(--panel-3); color: var(--accent); }
.detail-avatar {
  width: 96px; height: 96px; border-radius: 50%; margin: 28px auto 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 2.1429rem; position: relative;
  background: linear-gradient(135deg, #4e9a91, #3f7f78);
}
.detail-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.detail-name { text-align: center; font-size: 1.2857rem; font-weight: 600; padding: 0 14px; word-break: break-word; }
.detail-position { text-align: center; color: var(--text-2); font-size: 0.9286rem; padding: 2px 14px 6px; }
.detail-phone { text-align: center; color: var(--accent); font-size: 0.9286rem; margin-bottom: 6px; }
.detail-email { text-align: center; color: var(--text-2); font-size: 0.8929rem; margin-bottom: 6px; word-break: break-all; user-select: text; }
.detail-online { text-align: center; color: var(--success); font-size: 0.8571rem; margin-bottom: 18px; }

.detail-tabs { display: flex; border-bottom: 1px solid var(--border); }
.detail-tab {
  flex: 1; padding: 10px 8px; background: none; border: none; cursor: pointer;
  font-size: 0.9643rem; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 500;
}
.detail-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.detail-tab-body { padding: 12px; }

.detail-media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.detail-media-grid .dm-thumb {
  aspect-ratio: 1; background-size: cover; background-position: center; border-radius: 6px;
  cursor: pointer; background-color: var(--panel-2);
}
.detail-file-list { display: flex; flex-direction: column; gap: 6px; }
.detail-file-item {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px;
  cursor: pointer; transition: background .12s;
}
.detail-file-item:hover { background: var(--panel-2); }
.detail-file-item .df-ico {
  width: 38px; height: 38px; border-radius: 10px; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0;
}
.detail-file-item .df-ico svg { width: 20px; height: 20px; }
.detail-file-item .df-ico .fa-badge { width: 38px; height: 38px; border-radius: 10px; box-shadow: none; }
.detail-file-item .df-ico img { width: 26px; height: 26px; object-fit: contain; border-radius: 4px; }
.detail-file-item .df-ico .df-fav-emoji { font-size: 18px; }
.detail-file-item .df-info { flex: 1; min-width: 0; }
.detail-file-item .df-name { font-size: 0.9286rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-file-item .df-sub { font-size: 0.8214rem; color: var(--text-2); }
.detail-file-item .df-dl {
  width: 32px; height: 32px; border: none; background: none; cursor: pointer; border-radius: 50%;
  color: var(--text-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.detail-file-item .df-dl:hover { background: var(--panel); color: var(--accent); }
.detail-file-item .df-dl svg { width: 17px; height: 17px; }
.detail-empty { text-align: center; color: var(--text-2); font-size: 0.9286rem; padding: 24px 0; }
.detail-head { text-align: center; }
.detail-tab-body-content { padding: 12px; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; }
.detail-tab-content { padding: 0 12px 12px; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; }
.detail-avatar-container { position: relative; margin: 0 auto; width: fit-content; }
.detail-avatar-upload {
  position: absolute; right: -4px; bottom: -2px; width: 32px; height: 32px;
  border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid var(--panel);
  cursor: pointer; z-index: 3; padding: 0; display: flex; align-items: center; justify-content: center;
}
.detail-avatar-upload svg { width: 16px; height: 16px; }
.detail-avatar-upload:hover { background: var(--accent-dark); transform: scale(1.08);}
.detail-members-count { text-align: center; color: var(--text-2); font-size: 0.8571rem; margin: 4px 0 12px; }
.members-list { display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; overflow-x: hidden; }
.detail-tab-content .members-list { flex: 1; max-height: none; }
.member-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  color: #fff; font-weight: 700; font-size: 1.0714rem;
  background: linear-gradient(135deg, #4e9a91, #3f7f78);
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.member-avatar.avatar-offline { background: #7e868e; }
html[data-theme="dark"] .member-avatar.avatar-offline { background: #565e67; }
.online-dot {
  position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px;
  border-radius: 50%; background: #31c468; border: 2px solid var(--panel);
  box-sizing: content-box; z-index: 30; pointer-events: none;
}
.online-dot.away { background: #e0a93f; }
.msg-mention { color: var(--accent); font-weight: 700; cursor: pointer; }
.msg-mention:hover { text-decoration: underline; }
.notif-open-btn {
  flex-shrink: 0; border: none; background: var(--accent); color: #fff;
  border-radius: 8px; padding: 4px 10px; font-size: .82rem; cursor: pointer;
}
.notif-open-btn:hover { background: var(--accent-dark); }
.mention-pop {
  position: absolute; left: 14px; bottom: calc(100% + 6px); z-index: 40;
  width: min(320px, calc(100% - 28px)); max-height: 260px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.22); padding: 5px;
}
.lb-doc { position: absolute; left: 50%; transform: translateX(-50%); top: 60px; bottom: 96px; width: min(1000px, calc(100vw - 160px)); background: #fff; border-radius: 12px; overflow: hidden; z-index: 105; }
.lb-doc iframe { width: 100%; height: 100%; border: 0; display: block; }
#messages-container img, #messages-container video, #chat-view img, #emoji-panel img, .sticker-img, .cmt-img, .panel-emoji {
  -webkit-user-drag: none; user-select: none;
}
.mention-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px;
  border-radius: 9px; cursor: pointer;
}
.mention-item:hover, .mention-item.sel { background: var(--panel-2); }
.mention-item .user-bubble { width: 30px; height: 30px; min-width: 30px; font-size: .8rem; }
.mention-name { font-weight: 600; font-size: .92rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-pos { font-size: .78rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-pop { pointer-events: auto; }
.pin-badge {
  position: absolute; left: -3px; bottom: -4px; font-size: .7rem; line-height: 1;
  background: var(--panel); border: 1px solid var(--border); border-radius: 50%;
  width: 17px; height: 17px; display: flex; align-items: center; justify-content: center;
  box-sizing: border-box; z-index: 30; pointer-events: none;
}
.ext-badge {
  position: absolute; right: -4px; top: -4px; font-size: .65rem; line-height: 1;
  background: #e8a33d; color: #fff; border: 1.5px solid var(--panel); border-radius: 50%;
  width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  box-sizing: border-box; z-index: 31; pointer-events: none;
}
.user-bubble, .chat-avatar, .member-avatar, .detail-avatar { z-index: 2; }
.member-action-btn {
  width: 30px; height: 30px; border-radius: 8px; border: none; cursor: pointer;
  background: none; color: var(--text-2); padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.member-action-btn svg { width: 17px; height: 17px; }
.member-action-btn:hover { background: var(--panel-2); color: var(--accent); }
.member-action-btn.admin-active { color: #e0a93f; }
.member-action-btn.admin-active svg { fill: #e0a93f; }
.member-action-btn.danger:hover { background: rgba(208,106,106,.14); color: var(--danger); }
.member-add-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 8px; padding: 9px;
  border: 1px dashed var(--border); border-radius: 10px; cursor: pointer;
  background: none; color: var(--text-2); font-size: 0.9643rem;
}
.member-add-btn svg { width: 16px; height: 16px; }
.member-add-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.member-add-box { margin-top: 8px; }
.member-add-box .modal-search { width: 100%; }
.member-add-box .modal-contact-list { max-height: 220px; overflow-y: auto; }
.media-thumb { width: 100%; aspect-ratio: 1; background: var(--panel-2); border-radius: 6px; overflow: hidden; cursor: pointer; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.files-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.file-item { padding: 10px; border-radius: 8px; background: var(--panel-2); }
.file-link { color: var(--text); text-decoration: none; font-size: 0.9286rem; }
.file-link:hover { text-decoration: underline; color: var(--accent); }
.create-pin-wrap { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.pin-toggle-label {
  display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 600; cursor: pointer;
  user-select: none;
}
.pin-switch { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.pin-lock { color: var(--accent); width: 40px; height: 40px; margin: 0 auto 6px; }
.pin-lock svg { width: 40px; height: 40px; }
.pinpad { text-align: center; }
.pp-title { font-size: 1.0714rem; font-weight: 600; margin-bottom: 14px; word-break: break-word; }
.pp-dots { display: flex; gap: 14px; justify-content: center; margin-bottom: 16px; min-height: 16px; }
.pp-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--text-2); box-sizing: border-box; transition: background .1s, border-color .1s; }
.pp-dot.on { background: var(--accent); border-color: var(--accent); }
.pp-chips { margin-bottom: 18px; }
.pp-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 240px; margin: 0 auto; }
.pp-key {
  aspect-ratio: 1; border: none; border-radius: 50%; background: var(--panel-2); color: var(--text);
  font-size: 1.4286rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s, transform .06s;
}
.pp-key:active { transform: scale(.93); }
.pp-key.flash { background: var(--accent); color: #fff; }
.pp-key svg { width: 24px; height: 24px; }
.pp-del { background: transparent; color: var(--text-2); }
.pp-del:active { transform: scale(.93); }
.pp-del.flash { background: var(--panel-3); color: var(--text); }
.pp-ok { background: var(--accent); color: #fff; }
.pp-ok.flash { background: var(--accent-dark, var(--accent)); }
.pp-cancel { display: block; margin: 18px auto 0; background: none; border: none; color: var(--text-2); cursor: pointer; font-size: .9643rem; }
.pp-cancel:hover { color: var(--text); }
@keyframes ppShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
.pp-shake { animation: ppShake .4s; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0; background: var(--panel-3);
  border-radius: 24px; transition: .2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }

.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--panel-3); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  border: 1px solid var(--border); padding: 12px 18px; font-size: 1rem;
  display: flex; align-items: center; gap: 12px; min-width: 240px; max-width: 420px;
  pointer-events: auto; animation: toastIn .2s ease; color: var(--text);
}
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-info { border-left: 3px solid var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.modal-dialog { text-align: center; }
.modal-dialog .md-title { font-size: 1.1429rem; font-weight: 600; margin-bottom: 6px; }
.modal-dialog .md-text { font-size: 0.9643rem; color: var(--text-2); margin-bottom: 16px; word-break: break-word; }
.modal-dialog .md-input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 1.0714rem; outline: none; margin-bottom: 12px; background: var(--panel-2); color: var(--text); }
.modal-dialog .md-input:focus { border-color: var(--accent); }
.modal-dialog .md-chip-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.modal-dialog .md-chip {
  border: 1px solid var(--border); background: var(--panel-2); border-radius: 16px;
  padding: 6px 12px; font-size: 0.8929rem; cursor: pointer; color: var(--text);
}
.modal-dialog .md-chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#modal .md-actions { display: flex; gap: 10px; justify-content: center; }
.delete-conv { display: flex; flex-direction: column; gap: 14px; }
.delete-forall { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9286rem; color: var(--text-2); }
.delete-forall input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.delete-confirm-row { border-top: 1px solid var(--border); padding-top: 12px; }
#modal .md-btn { padding: 9px 20px; border: none; border-radius: 12px; font-size: 1rem; cursor: pointer; background: var(--accent); color: #fff; transition: opacity .15s, transform .1s; }
#modal .md-btn.md-ghost { background: var(--panel-2); color: var(--text); }
#modal .md-btn:hover { opacity: .92; }
#modal .md-btn:active { transform: scale(.97); }
#modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--panel); border-radius: 14px; width: 420px; max-width: 92vw; max-height: 80vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.6);
  border: 1px solid var(--border);
}
.modal.modal-compact { width: 340px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.2143rem; }
#modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; min-height: 0; }
#modal-body input[type=text], #modal-body input[type=password], #modal-body .modal-search {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 1rem; margin-bottom: 12px; outline: none;
  background: var(--panel-2); color: var(--text);
}
#modal-body input:focus, #modal-body .modal-search:focus { border-color: var(--accent); }

.contact-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 6px;
  border-radius: 8px; cursor: pointer;
}
.contact-item:hover { background: var(--panel-2); }
.contact-item .contact-name { font-size: 1.0357rem; }
.contact-item.selected { background: var(--accent-soft); }
.contact-item .check { margin-left: auto; color: var(--accent); font-weight: 700; }
.topic-pick-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.topic-pick-back {
  width: 32px; height: 32px; flex-shrink: 0; border: none; border-radius: 50%; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.topic-pick-back:hover { background: var(--panel-3); color: var(--accent); }
.topic-pick-back svg { width: 18px; height: 18px; }
.topic-pick-title {
  font-size: 1.0357rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topic-chevron { margin-left: auto; color: var(--text-2); font-size: 1.4286rem; line-height: 1; font-weight: 700; }
.contact-item:hover .topic-chevron { color: var(--accent); }
.member-item { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 8px; }
.member-item:hover { background: var(--panel-2); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 1.0357rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-name .badge-admin {
  font-size: 0.7857rem; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; margin-left: 6px;
}
.member-actions { display: flex; gap: 2px; flex-shrink: 0; }
.member-actions .icon-btn { width: 30px; height: 30px; }
.member-actions .icon-btn svg { width: 16px; height: 16px; }
.member-actions .icon-btn.admin-active { color: #d9a441; }
.member-actions .icon-btn.danger:hover { color: var(--danger); background: rgba(208,106,106,.14); }
.members-section-title {
  font-size: 0.8571rem; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-2); margin: 14px 0 4px;
}
.members-list-wrap { max-height: 300px; overflow-y: auto; }
.member-add-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin: 2px 0 12px; font-size: .9286rem;
}
.member-add-btn svg { width: 16px; height: 16px; }
.add-member { display: flex; flex-direction: column; gap: 4px; }
.add-member .md-actions { margin-top: 12px; }
.member-plus {
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; transition: transform .1s, opacity .15s;
}
.member-plus:hover { opacity: .9; transform: scale(1.06); }
.member-plus:disabled { opacity: .5; cursor: default; transform: none; }
.member-plus svg { width: 15px; height: 15px; }
.member-plus.added { background: var(--panel-3); color: var(--text-2); cursor: default; transform: none; }

#modal-body:has(.nc-cols) { display: flex; flex-direction: column; overflow: hidden; }
#modal-body:has(.nc-cols) > div { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.nc-cols { display: flex; flex-direction: row; gap: 16px; align-items: stretch; flex: 1; min-height: 0; }
.nc-left, .nc-right { min-width: 0; }
.nc-left { overflow-y: auto; min-height: 0; }
.nc-right { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.nc-right .modal-contact-list { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
.modal-actions { flex-shrink: 0; }
@media (min-width: 760px) {
  .modal:has(.nc-cols) { width: 760px; max-width: 94vw; }
  .nc-left { flex: 0 0 300px; padding-right: 8px; }
}
@media (max-width: 759px) {
  .nc-cols { flex-direction: column; }
}
.nc-ext-wrap { border-top: 1px solid var(--border); margin-top: 4px; }
.nc-hint { font-size: .85rem; color: var(--text-2); padding: 6px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.contact-item.dim { opacity: .55; pointer-events: none; }
.contact-item.excluded-mark { background: rgba(231,76,60,.12); }
.contact-item.excluded-mark .check { color: #e74c3c; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 12px; }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.modal-tabs .btn { flex: 1; }
.btn {
  padding: 9px 16px; border: none; border-radius: 10px; font-size: 1rem; cursor: pointer;
  background: var(--accent); color: #fff;
}
.btn.btn-ghost { background: var(--panel-2); color: var(--text); }
.btn.btn-danger { background: var(--danger); width: 100%; margin-top: 10px; }
.btn:hover { opacity: .92; }


#lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
  overflow: hidden;
}
#lightbox img {
  max-width: 92vw; max-height: 88vh; border-radius: 10px;
  box-shadow: 0 10px 50px rgba(0,0,0,.6); cursor: default;
  touch-action: none; -webkit-user-drag: none; user-select: none; will-change: transform;
}
#lightbox.zoomed img { cursor: grab; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 110;
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.15); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lb-nav:hover { background: rgba(255,255,255,.35); }
.lb-nav svg { width: 24px; height: 24px; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
.lb-close { top: 18px; right: 18px; transform: none; background: rgba(255,255,255,.18); }
.lb-caption {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 110;
  display: flex; align-items: center; gap: 14px;
  background: rgba(0,0,0,.6); color: #fff; border-radius: 22px;
  padding: 8px 18px; backdrop-filter: blur(4px);
}
.lb-counter { font-size: 0.9286rem; font-weight: 600; white-space: nowrap; }
.lb-goto {
  border: none; background: var(--accent); color: #fff; border-radius: 14px;
  padding: 6px 14px; font-size: 0.8929rem; cursor: pointer; white-space: nowrap;
}
.lb-goto:hover { background: var(--accent-dark); }
#lb-download { display: inline-flex; align-items: center; gap: 6px; }
#lb-download svg { width: 15px; height: 15px; }
.chat-search-clear {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 24px; height: 24px; padding: 0; border: none; border-radius: 50%;
  background: var(--panel-3); color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.chat-search-clear svg { width: 12px; height: 12px; }
.chat-search-clear:hover { color: var(--text); }
#chat-search { padding-right: 36px; }
#chat-search::-webkit-search-cancel-button,
#chat-msg-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.msg-src-item { align-items: center; }
.msg-src-item .conv-preview { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg-src-sender { color: var(--accent); font-weight: 600; }
.gs-hl { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 2px; font-weight: 600; }
.msg-src-time { font-size: .8571rem; color: var(--text-2); flex-shrink: 0; align-self: flex-start; }

.modal-contact-list { max-height: min(320px, 30vh); overflow-y: auto; margin-top: 4px; }
#modal-body::-webkit-scrollbar, .modal-contact-list::-webkit-scrollbar, .members-list::-webkit-scrollbar { width: 6px; }
#modal-body::-webkit-scrollbar-thumb, .modal-contact-list::-webkit-scrollbar-thumb, .members-list::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 3px; }
#modal-body::-webkit-scrollbar-track, .modal-contact-list::-webkit-scrollbar-track { background: transparent; }
.modal-empty { text-align: center; color: var(--text-2); font-size: 0.9286rem; padding: 16px 0; }
.forward-preview {
  background: var(--panel-2); border-radius: 10px; padding: 8px 12px;
  margin-bottom: 12px; font-size: 0.9286rem; color: var(--text); word-break: break-word;
  border-left: 3px solid var(--accent);
}

.dropdown-menu {
  position: absolute; top: 50px; left: 10px; z-index: 60;
  background: var(--panel-3); border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.5);
  border: 1px solid var(--border); padding: 6px;
  width: max-content; max-width: 280px; min-width: 150px;
}
.dropdown-menu.dropdown-right { left: auto; right: 10px; top: 54px; }
#msg-menu { position: fixed; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border: none; background: transparent; cursor: pointer;
  border-radius: 10px; font-size: 1.0357rem; color: var(--text); text-align: left;
  white-space: nowrap;
}
.menu-item:hover { background: var(--panel-2); }
.menu-item svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-2); }
.menu-item:hover svg { color: var(--text); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }

.msg-search-nav {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  padding: 6px 14px; background: var(--panel); border-bottom: 1px solid var(--border);
  font-size: 0.9286rem;
}
.msg-search-nav #msg-search-count { margin-right: auto; color: var(--text-2); }
.msg-search-nav .icon-btn { width: 30px; height: 30px; }
.msg-search-nav .icon-btn svg { width: 16px; height: 16px; }

.scroll-down-btn {
  position: absolute; right: 24px; bottom: 96px; z-index: 6;
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border); cursor: pointer;
  background: var(--panel-3); color: var(--text-2);
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
}
.scroll-down-btn:hover { color: var(--accent); }
.scroll-down-btn svg { width: 22px; height: 22px; }

.chat-search-wrap {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel-2); border-radius: 12px; padding: 6px 10px;
  min-width: 0; max-width: 260px;
}
.chat-search-wrap svg { width: 16px; height: 16px; color: var(--text-2); flex-shrink: 0; }
.chat-search-wrap input {
  border: none; background: transparent; outline: none; font-size: 1rem;
  width: 100%; min-width: 60px; color: var(--text);
}
.chat-search-btn { display: none; }
.chat-search-close { display: none; }

#messages-container { transition: background-image .3s; }
#messages-container.no-copy .msg, #messages-container.no-copy .msg-body, #messages-container.no-copy .msg-reply { user-select: none; -webkit-user-select: none; }

.profile-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile-avatar { width: 64px; height: 64px; font-size: 1.5714rem; border-radius: 50%; overflow: hidden; }
.profile-name { font-size: 1.2857rem; font-weight: 600; }
.profile-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 1rem;
}
.profile-row span:last-child { text-align: right; word-break: break-word; color: var(--text); }
.page-view {
  flex: 1; min-width: 0; height: 100vh; overflow-y: auto; background: var(--bg);
}
.page-header {
  height: 62px; min-height: 62px; display: flex; align-items: center; padding: 0 22px;
  border-bottom: 1px solid var(--border); background: var(--panel);
  font-size: 1.2857rem; font-weight: 700; position: sticky; top: 0; z-index: 2;
}
.page-body { padding: 24px; max-width: 760px; margin: 0 auto; }
.page-body.page-body-wide { max-width: 1200px; }
.page-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; margin-bottom: 16px;
}
.page-card h3 { font-size: 1.0714rem; margin-bottom: 12px; font-weight: 600; }
.cache-size-val { font-weight: 600; color: var(--accent); }
.cache-hint { margin-top: 4px; }
.cache-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-box {
  background: var(--panel-2); border-radius: 12px; padding: 16px; text-align: center;
}
.stat-num { font-size: 1.8571rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8929rem; color: var(--text-2); margin-top: 4px; }
.page-avatar { width: 84px; height: 84px; font-size: 2rem; border-radius: 50%; overflow: hidden; }

.bg-gallery {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  max-height: min(520px, 52vh); overflow-y: auto; padding-right: 6px; margin-bottom: 0;
  align-content: start;
}
.bg-gallery::-webkit-scrollbar { width: 6px; }
.bg-gallery::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 3px; }
.bg-gallery::-webkit-scrollbar-track { background: transparent; }
.modal:has(.cs-cols) { width: 720px; }
.cs-cols { display: flex; gap: 22px; align-items: flex-start; }
.gt-avatar-section { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.gt-info { flex: 1; min-width: 0; }
.gt-info .rename-box { margin-bottom: 6px; }
.cs-left { flex: 0 0 385px; min-width: 0; }
.cs-right { flex: 1 1 auto; min-width: 0; }
.cs-nobg { width: 100%; margin-top: 10px; }
.rename-box { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; }
.rename-box .modal-search { flex: 1; margin-bottom: 0; height: 42px; }
#modal-body .rename-box input { margin-bottom: 0; }
.rename-box .btn { flex-shrink: 0; padding: 0 16px; height: 42px; }
.bg-tile {
  aspect-ratio: 1; border-radius: 12px; background-size: cover; background-position: center;
  cursor: pointer; border: 3px solid transparent; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.bg-tile:hover { border-color: var(--accent); }
.bg-tile.active { border-color: var(--accent); }

.profile-avatar-wrap { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.profile-avatar-wrap .profile-avatar { width: 84px; height: 84px; font-size: 2rem; }
.avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); color: #fff; cursor: pointer; opacity: .45; transition: opacity .15s;
}
.avatar-overlay svg { width: 24px; height: 24px; }
.profile-avatar-wrap:hover .avatar-overlay { opacity: 1; }
.profile-avatar-upload {  position: absolute;  right: -2px;  bottom: -2px;  width: 30px;  height: 30px;  border-radius: 50%;  background: var(--accent);
  color: #fff;  border: 2px solid var(--panel);  cursor: pointer;  padding: 0;  display: flex;  align-items: center;  justify-content: center;  z-index: 3;
  transition: transform .15s, background .15s;}
.profile-avatar-upload svg { width: 15px; height: 15px; }
.profile-avatar-upload:hover {
  background: var(--accent-dark);
  transform: scale(1.08);
}
.profile-avatar-delete {
  position: absolute; left: -4px; top: -4px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--danger); color: #fff; border: 2px solid var(--panel); cursor: pointer;
  padding: 0; display: flex; align-items: center; justify-content: center; z-index: 3;
  transition: transform .15s, background .15s;
}
.profile-avatar-delete svg { width: 14px; height: 14px; }
.profile-avatar-delete:hover { background: #b13b39; transform: scale(1.08); }
.profile-edit-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border: none; background: var(--panel-2); color: var(--text-2); border-radius: 50%; cursor: pointer;
  margin-top: 4px; transition: background .15s, color .15s;
}
.profile-edit-btn svg { width: 14px; height: 14px; }
.profile-edit-btn:hover { background: var(--accent-soft); color: var(--accent); }
.profile-row { align-items: center; }
.profile-row .profile-row-edit {
  flex-shrink: 0; width: 24px; height: 24px; border: none; background: none; color: var(--text-2);
  border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.profile-row .profile-row-edit svg { width: 14px; height: 14px; }
.profile-row .profile-row-edit:hover { background: var(--accent-soft); color: var(--accent); }
.avatar-crop { text-align: center; }
.crop-stage {
  width: 260px; height: 260px; margin: 0 auto 10px; border-radius: 50%;
  overflow: hidden; position: relative; background: var(--panel-2);
  cursor: grab; border: 2px solid var(--accent);
}
.crop-stage:active { cursor: grabbing; }
.crop-img {
  position: absolute; user-select: none; pointer-events: none; transform-origin: center center;
}
.avatar-crop .md-actions { margin-top: 14px; }

.att-album { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 4px; max-width: 320px; }
.att-album.n1 { grid-template-columns: 1fr; }
.att-album .ab-tile { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; cursor: zoom-in; background: var(--panel-2); }
.att-album img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-album.odd .ab-tile:first-child { grid-column: span 2; aspect-ratio: 2 / 1; }

.lb-thumbs {
  position: absolute; bottom: 58px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; max-width: 92vw; overflow-x: auto; padding: 4px 6px;
}
.lb-thumbs.hidden { display: none; }
.lb-thumbs::-webkit-scrollbar { height: 4px; }
.lb-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.35); border-radius: 2px; }
.lb-thumb {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 6px; overflow: hidden;
  border: 2px solid transparent; padding: 0; background: none; cursor: pointer; opacity: .55;
  transition: opacity .12s, border-color .12s;
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-thumb:hover { opacity: .85; }
.lb-thumb.active { opacity: 1; border-color: var(--accent); }

.font-range { width: 100%; accent-color: var(--accent); margin-top: 4px; }
.font-fam-row { justify-content: flex-start; }
.font-fam-row > span { margin-right: 10px; }
.font-fam-wrap { display: flex; align-items: center; gap: 8px; position: relative; }
.font-fam-select {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 200px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 12px; font-size: .9286rem; cursor: pointer; text-align: left;
}
.font-fam-select:hover { border-color: var(--accent); }
.font-fam-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-fam-caret { color: var(--text-2); font-size: .7857rem; }
.font-fam-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 95;
  min-width: 220px; max-height: 264px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); padding: 6px;
}
.font-fam-option {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: .9286rem;
}
.font-fam-option:hover { background: var(--panel-2); }
.font-fam-option.active { color: var(--accent); background: rgba(63,143,138,.14); }

@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (max-width: 760px) {
  #app-screen { flex-direction: column; }
  #rail {
    display: flex; width: 100%; height: 52px; min-height: 52px;
    flex-direction: row; align-items: center; padding: 0 8px; flex-shrink: 0;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .rail-logo { display: none; }
  .rail-nav { flex-direction: row; flex: 1; align-items: center; justify-content: space-around; gap: 2px; overflow-x: auto; }
  .rail-bottom { flex-direction: row; align-items: center; }
  .rail-btn { width: 38px; height: 38px; }
  #sidebar { width: 100%; height: auto; flex: 1; min-height: 0; }
  #chat-area { flex: none; height: 0; min-height: 0; width: 100%; overflow: hidden; }
  #empty-state { display: none; }
  #page-view { position: fixed; top: 52px; left: 0; right: 0; bottom: 0; width: 100%; height: auto; z-index: 5; overflow-y: auto; }
  #page-view .page-body, #page-view .page-body-wide { padding: 16px 16px 24px; }
  #page-view .page-body-wide { max-width: 760px; margin: 0 auto; }
  #chat-view { position: fixed; inset: 0; z-index: 10; }
  .chat-back-btn { display: flex; }
  .detail-panel { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 20; border-left: none; }
  .emoji-sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: 55%; z-index: 20; border-left: none;
    border-top: 1px solid var(--border); border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,.3);
  }
  .emoji-sidebar:not(.hidden) { animation: sheet-up .22s ease; }
  .modal:has(.cs-cols) { width: 100%; max-width: 100vw; }
  .cs-cols { flex-direction: column; gap: 14px; }
  .cs-left, .cs-right { width: 100%; flex: 1 1 auto; }
  .chat-search-btn { display: flex; }
  .chat-search-wrap { display: none; }
  #chat-header.searching #btn-chat-back,
  #chat-header.searching #chat-header-avatar,
  #chat-header.searching .chat-header-info,
  #chat-header.searching #btn-chat-menu,
  #chat-header.searching #btn-chat-search { display: none; }
  #chat-header.searching .chat-header-actions { flex: 1; }
  #chat-header.searching .chat-search-wrap { display: flex; flex: 1; max-width: none; }
  #chat-header.searching .chat-search-close { display: flex; }
}

.dm-thumb-video { position: relative; background: #000; }
.dm-thumb-video > video { width: 100%; height: 100%; object-fit: cover; }
.dm-play-ico {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.22); color: #fff; pointer-events: none;
}
.dm-play-ico svg { width: 34px; height: 34px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }

.video-modal {
  position: fixed; inset: 0; z-index: 4000; background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.vm-box { display: flex; flex-direction: column; gap: 8px; width: min(96vw, 1000px); }
.vm-head { display: flex; align-items: center; gap: 10px; color: #e8e8e8; }
.vm-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.vm-dl, .vm-close {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--border); color: #e8e8e8;
  font-size: .88rem; text-decoration: none; cursor: pointer;
}
.vm-dl:hover, .vm-close:hover { background: var(--accent); color: #fff; }
.video-modal video {
  width: 100%; max-height: 82vh; border-radius: 10px; background: #000; outline: none;
}

.typing-preview { color: var(--accent) !important; font-style: italic; }
.pending-thumb video { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.vn-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
}
.vn-timer { color: #fff; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.vn-circle {
  width: min(70vw, 320px); aspect-ratio: 1 / 1;
  border-radius: 50%; overflow: hidden;
  border: 4px solid var(--accent);
  box-shadow: 0 0 0 6px rgba(63,143,138,.25);
  background: #000;
}
.vn-circle video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.vn-circle.rec { animation: vn-rec-pulse 1.2s infinite; }
.vn-circle.cancel { border-color: var(--danger); box-shadow: 0 0 0 6px rgba(220,53,69,.3); animation: none; }
@keyframes vn-rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(220,53,69,.55), 0 0 0 6px rgba(220,53,69,.18); }
  70% { box-shadow: 0 0 0 14px rgba(220,53,69,0), 0 0 0 6px rgba(220,53,69,.18); }
  100% { box-shadow: 0 0 0 0 rgba(220,53,69,0), 0 0 0 6px rgba(220,53,69,.18); }
}
.vn-timer { display: inline-flex; align-items: center; gap: 8px; }
.vn-timer::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: vn-dot 1s infinite; }
@keyframes vn-dot { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.vn-hint { color: rgba(255,255,255,.75); font-size: .9rem; }
.msg-vnote {
  position: relative; width: 160px; height: 160px;
  border-radius: 50%; overflow: hidden; cursor: pointer;
  background: #000; display: inline-block; vertical-align: middle;
}
.msg-vnote video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vnote-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2rem; text-shadow: 0 1px 4px rgba(0,0,0,.6);
  background: rgba(0,0,0,.25); transition: opacity .15s;
}
.vnote-play.hidden { opacity: 0; pointer-events: none; }

.msg.msg-vnote-bubble { background: none !important; box-shadow: none !important; padding: 0; border-radius: 0; max-width: none; }
.msg.msg-vnote-bubble .msg-sender { margin-bottom: 4px; }

.voice-indicator {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; margin-bottom: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.25);
  align-self: flex-end; pointer-events: auto; font-size: .9rem;
}
.vi-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: vn-dot 1s infinite; }
.vi-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.vi-label { color: var(--text-2); }
.voice-indicator.cancel {
  border-color: var(--danger); background: rgba(220, 70, 70, .12);
  animation: vi-cancel-pulse .8s infinite;
}
.voice-indicator.cancel .vi-label { color: var(--danger); font-weight: 700; }
@keyframes vi-cancel-pulse {
  0%, 100% { box-shadow: 0 2px 10px rgba(0,0,0,.25); }
  50% { box-shadow: 0 0 0 4px rgba(220, 70, 70, .25); }
}

.detail-call-row {
  display: flex; justify-content: center; gap: 34px;
  margin: 16px 0 10px;
}
.detail-call-btn {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--text-2); font-size: 0.7857rem; font-family: inherit;
}
.detail-call-btn .dcb-ico {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, transform .12s;
}
.detail-call-btn:hover .dcb-ico { background: var(--accent); color: #fff; transform: scale(1.07); }
.detail-call-btn:active .dcb-ico { transform: scale(.95); }
.dcb-ico svg { width: 22px; height: 22px; }

#call-overlay {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(8, 10, 13, .74);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
}
.call-box {
  position: relative; width: 80vw; height: 80vh;
  border-radius: 24px; overflow: hidden;
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(78, 154, 145, .28) 0%, transparent 62%),
    linear-gradient(165deg, #1e242c 0%, #12161a 60%, #0d1013 100%);
  box-shadow: 0 24px 90px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column;
}
.call-remote-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: #000; z-index: 1;
}
.call-local-video {
  position: absolute; right: 18px; top: 18px; z-index: 4;
  width: clamp(120px, 18%, 240px); aspect-ratio: 3 / 4;
  border-radius: 14px; object-fit: cover; background: #000;
  border: 2px solid rgba(255, 255, 255, .28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.call-info {
  position: relative; z-index: 2;
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 24px;
}
.call-avatar {
  width: 128px; height: 128px; border-radius: 50%;
  margin: 0 auto 18px; overflow: hidden;
  background: linear-gradient(135deg, #5aa8a2, #3f7f78);
  color: #fff; font-size: 2.71rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.call-avatar img { width: 100%; height: 100%; object-fit: cover; }
.call-box.call-video-on .call-info { position: static; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 18px 16px 0; }
.call-box.call-video-on .call-avatar { display: none; }
.call-box.call-video-on .call-name { text-shadow: 0 2px 14px rgba(0, 0, 0, .8); }
.call-box.call-video-on .call-status { text-shadow: 0 2px 14px rgba(0, 0, 0, .8); }
.call-name { font-size: 1.5714rem; font-weight: 700; color: #fff; }
.call-status { margin-top: 8px; font-size: 0.9643rem; color: rgba(255, 255, 255, .68); font-variant-numeric: tabular-nums; }
.call-controls {
  position: relative; z-index: 3;
  margin-top: auto;
  display: flex; justify-content: center; align-items: center; gap: 22px;
  padding: 0 0 34px;
}
#call-remote-audio { position: absolute; width: 0; height: 0; overflow: hidden; }
.call-ctl {
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: background .15s, color .15s, transform .12s;
}
.call-ctl svg { width: 25px; height: 25px; }
.call-ctl:hover { background: rgba(255, 255, 255, .26); }
.call-ctl:active { transform: scale(.93); }
.call-ctl.call-ctl-off { background: rgba(255, 255, 255, .92); color: #14171b; }
.call-ctl.call-ctl-danger { background: var(--danger); width: 66px; height: 66px; }
.call-ctl.call-ctl-danger:hover { background: #b04340; }
.call-ctl.call-ctl-accept { background: var(--success); width: 66px; height: 66px; }
.call-ctl.call-ctl-accept:hover { background: #357f45; }
@media (max-width: 760px) {
  .call-box { width: 94vw; height: 86vh; border-radius: 18px; }
  .call-ctl { width: 54px; height: 54px; }
  .call-ctl.call-ctl-danger, .call-ctl.call-ctl-accept { width: 60px; height: 60px; }
}


* { scrollbar-color: var(--scroll-thumb) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 3px solid transparent; background-clip: padding-box;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

.msg.msg-media { padding: 0; display: flex; flex-direction: column; align-items: flex-start; }
.msg.msg-media.msg-has-img { max-width: min(100%, var(--img-w, 450px)); display: inline-flex; flex-direction: column; }
.msg.msg-media.msg-has-img > .attachment { margin: 0; display: block; width: auto; max-width: 100%; border-radius: 12px 12px 0 0; order: -1; }
.msg.msg-media.msg-has-img > .attachment img { display: block; width: auto; height: auto; min-width: 200px; max-width: 100%; border-radius: 12px 12px 0 0; }
.msg.msg-media.msg-has-img .msg-body,
.msg.msg-media.msg-has-img .msg-sender,
.msg.msg-media.msg-has-img .msg-forward,
.msg.msg-media.msg-has-img .msg-scheduled,
.msg.msg-media.msg-has-img .msg-reply,
.msg.msg-media.msg-has-img .msg-quote,
.msg.msg-media.msg-has-img .msg-time,
.msg.msg-media.msg-has-img .msg-edited { max-width: 100%; overflow-wrap: break-word; word-break: break-word; }
.msg.msg-media > .attachment { max-width: 100%; width: 100%; margin: 0; display: block; border-radius: 12px 12px 0 0; order: -1; }
.msg.msg-media > .attachment img { border-radius: 12px 12px 0 0; max-height: 500px; max-width: 100%; width: auto; }
.msg.msg-media > .msg-video { max-height: 500px; width: auto; margin: 0; border-radius: 12px 12px 0 0; order: -1; }
.msg.msg-media .att-album { margin: 0; max-width: 100%; gap: 2px; border-radius: 12px 12px 0 0; overflow: hidden; order: -1; }
.msg.msg-media .att-album .ab-tile { border-radius: 0; }
.msg.msg-media .msg-body { padding: 8px 11px 2px; order: 2; width: 100%; box-sizing: border-box; }
.msg.msg-media .msg-sender { margin: 8px 11px 0; order: 1; }
.msg.msg-media .msg-forward, .msg.msg-media .msg-scheduled { margin: 8px 11px 0; order: 1; }
.msg.msg-media .msg-reply { margin: 8px 11px 0; order: 1; }
.msg.msg-media .msg-quote { margin: 8px 11px 0; order: 1; }
.msg.msg-media .msg-time { margin: 0 11px 6px; order: 3; align-self: flex-end; }
.msg.msg-media .msg-edited { margin: 0 0 0 11px; order: 3; }
.msg.msg-media .rx-wrap { margin: 4px 11px 6px; order: 4; }
.msg.msg-media .msg-comments { margin: 4px 0 0; order: 5; width: 100%; }

.msg.msg-photo {
  padding: 0; max-width: min(100%, 460px); border-radius: 14px; overflow: hidden;
  display: inline-block; background: transparent;
}
.msg.msg-photo > .attachment {
  display: block; position: relative; margin: 0; width: auto; max-width: none;
  border-radius: 0; overflow: hidden; line-height: 0;
}
.msg.msg-photo > .attachment img {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 520px;
  border-radius: 0;
}
.msg.msg-photo > .attachment::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 42px;
  background: linear-gradient(to bottom, rgba(0,0,0,.34), transparent); pointer-events: none;
}
.msg.msg-photo > .attachment::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 48px;
  background: linear-gradient(to top, rgba(0,0,0,.42), transparent); pointer-events: none;
}
.msg.msg-photo > .msg-sender {
  position: absolute; top: 6px; left: 10px; right: 10px; margin: 0; z-index: 2;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); line-height: 1.3; text-align: right;
}
.msg.msg-photo > .msg-time {
  position: absolute; right: 8px; bottom: 6px; margin: 0; z-index: 2;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); line-height: 1.3;
}
.msg.msg-photo > .msg-edited {
  position: absolute; left: 8px; bottom: 6px; margin: 0; z-index: 2;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); line-height: 1.3;
}
.msg.msg-photo > .rx-wrap { padding: 4px 8px 6px; margin: 0; }
.msg.msg-photo > .msg-comments { margin: 0; padding: 6px 10px; }

.pin-err {
  width: 100%;
  color: var(--danger); font-size: .85rem; font-weight: 600;
  background: rgba(220, 70, 70, .10);
  border: 1px solid rgba(220, 70, 70, .40);
  border-radius: 10px; padding: 7px 12px; margin-top: 4px;
  text-align: center;
}
.pin-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pin-box input.modal-search { width: 100%; box-sizing: border-box; height: 42px; margin-bottom: 0; }
.pin-box .pin-err { margin-top: 0; }
.pin-box .btn { align-self: flex-end; height: 42px; padding: 0 16px; }
@keyframes pin-shake-anim {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.pin-shake { animation: pin-shake-anim .45s ease; }

.fav-composer {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: center;
  padding: 8px 29px 14px 14px;
  background: transparent;
  pointer-events: none;
}
.fav-composer-shell {
  width: 100%;
  display: flex; gap: 8px; align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 6px 5px 14px;
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
  pointer-events: auto;
}
.fav-composer-shell .fav-note-input {
  flex: 1 1 auto; min-width: 40px;
  background: transparent; color: var(--text);
  border: none; border-radius: 0;
  padding: 6px 0; font-size: 1rem; font-family: inherit;
  outline: none;
  resize: none; display: block;
  line-height: 1.35; max-height: 120px; overflow-y: auto;
}
#fav-view #fav-list { padding-bottom: 84px; }
button.fav-note-clip {
  flex-shrink: 0; width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: transparent; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .15s, background .15s;
}
button.fav-note-clip:hover { color: var(--accent); background: var(--panel-2); }
button.fav-note-clip svg { width: 20px; height: 20px; }
.fav-pending {
  position: absolute; left: 0; right: 0; bottom: 68px; z-index: 6;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  padding: 0 29px 0 14px;
  pointer-events: none;
}
.fav-pend-chip {
  pointer-events: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
  max-width: 280px;
}
.fav-pend-chip .fpc-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; }
.fav-pend-chip .fpc-info { min-width: 0; }
.fav-pend-chip .fpc-name { font-size: .85rem; color: var(--text); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-pend-chip .fpc-size { font-size: .75rem; color: var(--text-2); }
.fav-pend-chip button.fpc-rm {
  flex: none; width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: var(--panel-2); color: var(--text-2);
  font-size: .75rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.fav-pend-chip button.fpc-rm:hover { color: var(--danger); }
button.fav-note-send {
  width: 34px; height: 34px; flex: none;
  border: none; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .12s, background .15s;
}
button.fav-note-send:hover { background: var(--accent-2, var(--accent)); transform: scale(1.06); }
button.fav-note-send:active { transform: scale(.94); }
button.fav-note-send svg { width: 18px; height: 18px; }
.fav-note-tag {
  display: inline-block; margin-left: 6px;
  font-size: .72rem; font-weight: 600;
  color: var(--accent); background: var(--accent-soft, rgba(90,168,162,.15));
  border-radius: 8px; padding: 1px 7px; vertical-align: middle;
}
#chat-view.drag-over { position: relative; }
#chat-view.drag-over::after {
  content: 'Перетащите файлы сюда';
  position: absolute; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(90,168,162,.12); border: 3px dashed var(--accent);
  border-radius: 12px; font-size: 1.2rem; color: var(--accent); font-weight: 600;
  pointer-events: none;
}

.conv-ticks {
  font-size: 0.75rem; line-height: 1; color: var(--text-2);
}
.conv-ticks.ticks-2 {
  color: var(--accent);
}

.rr-chip {
  letter-spacing: 0; cursor: pointer; white-space: nowrap; user-select: none;
}
.read-pop {
  position: fixed; z-index: 1200; min-width: 220px; max-width: 300px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px var(--shadow); padding: 6px 0; font-size: .85rem;
}
.rp-row {
  display: flex; align-items: center; gap: 10px; padding: 5px 12px;
}
.read-pop .rp-row:hover { background: var(--panel-2); }
.rp-av { width: 26px; height: 26px; min-width: 26px; border-radius: 50%; overflow: hidden; font-size: .6rem; }
.rp-av img { width: 100%; height: 100%; object-fit: cover; }
.rp-info { flex: 1; min-width: 0; }
.rp-when { color: var(--text-2); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-time-right { margin-left: auto; white-space: nowrap; align-self: center; }
.rp-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-time { color: var(--text-2); font-size: .75rem; }
.rp-more {
  display: block; width: 100%; margin-top: 4px; padding: 6px 12px;
  background: none; border: none; border-top: 1px solid var(--border);
  color: var(--accent); text-align: center; cursor: pointer; font-size: .85rem;
}
.rp-more:hover { text-decoration: underline; }
.rp-empty { padding: 8px 12px; color: var(--text-2); }
.read-modal { max-height: 60vh; overflow-y: auto; min-width: 280px; }
.read-modal .rp-row { padding: 7px 6px; border-bottom: 1px solid rgba(127,127,127,.12); }
.read-modal .rp-row:last-child { border-bottom: none; }

/* ── Опросы ─────────────────────────────────────── */
.poll-card { min-width: 240px; max-width: 380px; padding: 2px 0 2px; }
.poll-question { font-weight: 700; margin: 2px 0 8px; word-break: break-word; }
.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-opt { position: relative; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; cursor: pointer; overflow: hidden; background: var(--panel-2); transition: border-color .15s; }
.poll-opt:hover { border-color: var(--accent); }
.poll-opt.poll-static { cursor: default; }
.poll-opt.poll-static:hover { border-color: var(--border); }
.poll-opt.poll-static.poll-opt-voted:hover { border-color: var(--accent); }
.poll-opt-top { position: relative; display: flex; align-items: center; gap: 8px; z-index: 1; }
.poll-radio { width: 14px; height: 14px; min-width: 14px; border: 2px solid var(--text-2); border-radius: 50%; box-sizing: border-box; }
.poll-radio.on { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2.5px var(--panel-2); }
.poll-check { color: var(--accent); font-weight: 900; width: 14px; min-width: 14px; text-align: center; }
.poll-opt-text { flex: 1; word-break: break-word; }
.poll-opt-nums { color: var(--text-2); font-size: .78rem; white-space: nowrap; }
.poll-bar { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: transparent; border-radius: 0 0 8px 8px; overflow: hidden; }
.poll-bar-fill { height: 100%; width: 0; background: var(--accent-soft); border-radius: 0 0 8px 8px; transition: width .35s ease; }
.poll-bar-fill.mine { background: var(--accent); }
.poll-opt-voted { border-color: var(--accent); }
.poll-foot { margin-top: 8px; color: var(--text-2); font-size: .78rem; }
/* создание опроса */
.poll-create { display: flex; flex-direction: column; gap: 8px; min-width: 320px; }
.pc-opts { display: flex; flex-direction: column; gap: 6px; }
.pc-opt-row { display: flex; gap: 6px; align-items: center; }
.pc-opt-row .modal-search { flex: 1; }
.pc-del { width: 28px; height: 28px; min-width: 28px; border: none; border-radius: 6px; background: var(--panel-3); color: var(--danger); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.pc-del:hover { background: var(--danger); color: #fff; }

.notif-item .user-bubble { border-radius: 50%; }
.notif-item.notif-new { background: var(--panel-3); }
.pc-confirm { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.pc-confirm.hidden { display: none; }
.pc-confirm-text { flex: 1; color: var(--text); font-size: 0.9286rem; }
