:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #1e2635;
  background: #eef1f7;
  --brand: #3370ff;
  --brand-dark: #2a5ce0;
  --brand-soft: #eaf1ff;
  --nav: #f4f6fb;
  --panel: #f7f8fb;
  --border: #e4e8f0;
  --muted: #8792a6;
  --text: #1e2635;
  --incoming: #fff;
  --outgoing: #3370ff;
  --shadow: 0 18px 50px rgba(24, 36, 62, .12);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body { margin: 0; overflow: hidden; background: #eaeef6; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid rgba(51, 112, 255, .5); outline-offset: 2px; }

/* The web client is touch-friendly: labels and list rows are controls, not
   document text. Prevent the browser's long-press selection/callout from
   leaving blue highlights on those controls while keeping fields and message
   bodies selectable for normal editing/copying. */
.app-nav,
.conversation-panel,
.conversation-item,
.conversation-empty,
.chat-header,
.message-meta,
.date-divider,
.system-message,
.typing-indicator,
.composer-toolbar,
.product-header,
.product-toolbar,
.section-heading,
.empty-product,
.modal-empty,
.toast,
.contact-card,
.app-discovery-section,
.app-discovery-card,
.app-chat-search-result,
.app-key-panel,
.app-key-empty,
.app-card,
.apps-info-item,
.apps-doc-bar,
.conversation-member,
.group-member-result,
.user-result,
.forward-item,
.conversation-info-modal,
.settings-modal,
.contact-modal,
.group-modal,
  .confirm-modal,
  .message-context-menu,
  .member-context-menu,
  .list-context-menu,
  .floating-app-window,
  .floating-app-header {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.app-shell input,
.app-shell textarea,
.app-shell [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* Message text remains copyable even though surrounding chat chrome is not. */
.app-shell .message-bubble {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
.app-shell .message-bubble button,
.app-shell .message-bubble a {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.app-shell .app-key-secret code {
  -webkit-user-select: all;
  user-select: all;
  -webkit-touch-callout: default;
}

.app-shell {
  display: grid;
  grid-template-columns: 64px 316px minmax(0, 1fr);
  width: min(1440px, calc(100vw - 28px));
  height: min(900px, calc(100vh - 28px));
  min-height: 560px;
  margin: 14px auto;
  overflow: hidden;
  border: 1px solid rgba(117, 132, 149, .22);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.app-nav { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 18px 0 14px; background: var(--nav); border-right: 1px solid #d9e0e7; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(145deg, #5b8cff, #2a5ce0); box-shadow: 0 7px 14px rgba(13, 49, 173, .24); }
.ui-icon { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .ui-icon { width: 23px; height: 23px; stroke-width: 2.2; }
.nav-list, .nav-bottom { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.nav-list { margin-top: 42px; align-self: stretch; }
.nav-item { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 11px; color: #728092; background: transparent; transition: color .18s ease, background .18s ease, transform .18s ease; }
.nav-item:hover { color: #2f3e50; background: rgba(255, 255, 255, .66); transform: translateY(-1px); }
.nav-item.active { color: var(--brand-dark); background: #fff; box-shadow: 0 5px 14px rgba(88, 106, 127, .11); }
.nav-glyph { width: 21px; height: 21px; stroke-width: 1.75; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: #c6ccd4; box-shadow: 0 0 0 3px rgba(198, 204, 212, .25); }
.connection-dot.online { background: var(--brand); box-shadow: 0 0 0 3px rgba(13, 49, 173, .15); }

.conversation-panel { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: var(--panel); border-right: 1px solid var(--border); }
.conversation-header { display: flex; align-items: center; justify-content: space-between; height: 74px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.profile-chip { display: flex; align-items: center; min-width: 0; gap: 10px; }
.profile-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.profile-copy strong { overflow: hidden; max-width: 174px; color: #303b48; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy span { color: var(--muted); font-size: 11px; }
.avatar { display: grid; flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: 50%; font-weight: 650; }
.avatar.has-image { background: transparent; }
.avatar.has-image img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-user { width: 39px; height: 39px; color: #fff; background: linear-gradient(145deg, #739ab1, #4f6d84); }
.avatar-chat { width: 38px; height: 38px; color: #fff; background: linear-gradient(145deg, #5970c1, #172f88); font-size: 13px; }
.avatar-conversation { width: 42px; height: 42px; color: #fff; background: linear-gradient(145deg, #a9c8d8, #698ca5); font-size: 13px; }
.avatar-conversation.alt-1 { background: linear-gradient(145deg, #cba883, #a87858); }
.avatar-conversation.alt-2 { background: linear-gradient(145deg, #b9a8d7, #7f6ca9); }
.avatar-conversation.alt-3 { background: linear-gradient(145deg, #909dc8, #506098); }
.avatar-conversation.alt-4 { background: linear-gradient(145deg, #d7a5ae, #a75e76); }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; color: #687586; background: transparent; }
.icon-button:hover { color: #344456; background: #e7ebf0; }
.search-icon { flex: 0 0 auto; width: 17px; height: 17px; margin-right: 7px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.conversation-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 7px; margin: 12px 13px 8px; }
.conversation-search { display: flex; min-width: 0; flex: 1; align-items: center; height: 34px; gap: 7px; padding: 0 10px; border: 1px solid #e1e7eb; border-radius: 7px; color: #9aa5b1; background: #fff; }
.conversation-search:focus-within { border-color: #aebbe1; box-shadow: 0 0 0 3px rgba(51, 112, 255, .07); }
.conversation-search .search-icon { width: 15px; height: 15px; margin: 0; }
.conversation-search input { min-width: 0; width: 100%; height: 100%; padding: 0; border: 0; outline: 0; color: #354152; background: transparent; font-size: 11px; }
.conversation-search input::placeholder { color: #a6aeb8; }
.conversation-tabs { display: flex; gap: 3px; padding: 0 13px 8px; }
.conversation-visible-count { margin-left: auto; padding: 4px 0; color: #9aa3b0; font-size: 10px; white-space: nowrap; }
.conversation-tab { border: 0; border-radius: 6px; padding: 5px 10px; color: #8994a1; background: transparent; font-size: 12px; }
.conversation-tab:hover, .conversation-tab.active { color: #344689; background: #e0e4f3; }
.conversation-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 5px; scrollbar-width: thin; }
.conversation-item { display: flex; align-items: center; min-height: 69px; gap: 11px; margin: 2px 0; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.conversation-item:hover { background: #e9edf1; }
.conversation-item.active { background: #dde1ee; }
.conversation-item.unread .conversation-name { color: #1f3173; font-weight: 700; }
.conversation-copy { min-width: 0; flex: 1; }
.conversation-line { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.conversation-name { overflow: hidden; color: #374352; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-time { flex: 0 0 auto; color: #a3acb7; font-size: 10px; }
.conversation-preview { overflow: hidden; margin-top: 5px; color: #99a3ae; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-load-more { display: flex; width: calc(100% - 12px); min-height: 34px; align-items: center; justify-content: center; gap: 5px; margin: 6px; padding: 6px 10px; border: 1px solid #e1e6eb; border-radius: 7px; color: #64718a; background: #fff; font-size: 11px; }
.conversation-load-more:hover { color: #344689; border-color: #b8c3df; background: #f5f7fb; }
.conversation-load-more:disabled { cursor: wait; opacity: .65; }
.conversation-load-more .ui-icon { width: 14px; height: 14px; }
.unread-count { display: inline-grid; place-items: center; min-width: 16px; height: 16px; margin-left: 5px; padding: 0 4px; border-radius: 8px; color: #fff; background: #f16c60; font-size: 10px; font-weight: 700; }
.conversation-empty { padding: 60px 18px; color: #9aa4ae; text-align: center; font-size: 12px; }
.conversation-footer { display: flex; align-items: center; justify-content: space-between; padding: 9px 15px; border-top: 1px solid var(--border); color: #a2abb5; font-size: 10px; }
.conversation-footer-status { display: flex; align-items: center; gap: 8px; min-width: 0; }
.latency-status { display: inline-flex; align-items: center; gap: 4px; color: #9ca6b2; white-space: nowrap; }
.latency-status.good { color: #2f9f6b; }
.latency-status.warn { color: #d59a2f; }
.latency-status.bad { color: #d35c58; }
.latency-signal { display: inline-flex; width: 11px; height: 10px; align-items: flex-end; gap: 1px; }
.latency-signal i { display: block; width: 2px; border-radius: 1px; background: currentColor; }
.latency-signal i:nth-child(1) { height: 3px; }
.latency-signal i:nth-child(2) { height: 5px; }
.latency-signal i:nth-child(3) { height: 7px; }
.latency-signal i:nth-child(4) { height: 10px; }
.version-pill { padding: 2px 5px; border-radius: 4px; color: #5768a3; background: #e2e6f2; font-size: 9px; }

.chat-panel { position: relative; display: flex; min-width: 0; min-height: 0; flex-direction: column; background: #f8f9fa; }
.chat-panel.floating-conversation-hidden { visibility: hidden; pointer-events: none; }
.chat-header { display: flex; align-items: center; justify-content: space-between; height: 74px; padding: 0 22px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .8); }
.chat-title-wrap { display: flex; align-items: center; gap: 11px; min-width: 0; }
.chat-title-wrap h1 { overflow: hidden; margin: 0; color: #303c4a; font-size: 15px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.chat-title-wrap p { margin: 5px 0 0; color: #9ba4af; font-size: 11px; }
.chat-actions { display: flex; gap: 4px; }
.message-area { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 6%; scrollbar-gutter: stable; scrollbar-width: thin; }
.message-empty { display: flex; height: 100%; align-items: center; justify-content: center; color: #a4adb8; font-size: 13px; }
.system-message { display: flex; justify-content: center; margin: 15px 0; padding: 0 8px; color: #7d8796; font-size: 12px; line-height: 1.45; text-align: center; }
.system-message-text { max-width: min(86%, 520px); padding: 7px 14px; border: 1px solid #e4e8ef; border-radius: 999px; background: rgba(255, 255, 255, .78); box-shadow: 0 2px 8px rgba(39, 51, 69, .04); }
.date-divider { display: flex; align-items: center; justify-content: center; margin: 5px 0 18px; color: #a9b0b9; font-size: 10px; }
.message-row { display: flex; align-items: flex-start; gap: 9px; margin: 13px 0; }
.message-row.outgoing { flex-direction: row-reverse; }
.message-row .avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 10px; }
.message-content { display: flex; max-width: min(70%, 620px); flex-direction: column; align-items: flex-start; }
.message-row.outgoing .message-content { align-items: flex-end; }
.message-meta { margin: 0 4px 4px; color: #adb5be; font-size: 10px; }
.message-bubble { position: relative; min-width: 30px; padding: 9px 12px; border: 1px solid #e8ebee; border-radius: 5px 12px 12px 12px; color: #303b49; background: var(--incoming); box-shadow: 0 2px 5px rgba(51, 64, 79, .025); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.message-row.outgoing .message-bubble { border-color: rgba(255,255,255,.18); border-radius: 12px 5px 12px 12px; background: var(--outgoing); color: #fff; }
.message-bubble.visual-bubble {
  border: var(--visual-bubble-border-width, 1px) var(--visual-bubble-border-style, solid) var(--visual-bubble-border-color, #56e7ff);
  border-radius: var(--visual-bubble-radius, 17px);
  color: #e9f7ff;
  background: var(--visual-bubble-bg, #0c1d3a);
  box-shadow: 0 0 12px rgba(63, 210, 255, .26), 0 0 28px rgba(118, 91, 255, .14), inset 0 1px rgba(255,255,255,.13);
}
.message-bubble.visual-bubble.visual-bubble-gradient-border {
  border-color: transparent;
  background: linear-gradient(var(--visual-bubble-bg, #0c1d3a), var(--visual-bubble-bg, #0c1d3a)) padding-box, var(--visual-bubble-border, linear-gradient(120deg, #56e7ff, #4a8dff 42%, #9b7bff 72%, #ff57c8)) border-box;
}
.message-row.outgoing .message-bubble.visual-bubble {
  border-width: var(--visual-bubble-border-width, 1px);
  border-style: var(--visual-bubble-border-style, solid);
  border-color: var(--visual-bubble-border-color, #56e7ff);
  border-radius: var(--visual-bubble-radius, 17px);
  color: #eff5ff;
  background: var(--visual-bubble-bg, #161d4c);
}
.message-row.outgoing .message-bubble.visual-bubble.visual-bubble-gradient-border {
  border-color: transparent;
  background: linear-gradient(var(--visual-bubble-bg, #161d4c), var(--visual-bubble-bg, #161d4c)) padding-box, var(--visual-bubble-border, linear-gradient(120deg, #9b7bff, #658aff 46%, #56e7ff)) border-box;
}
.message-bubble.visual-bubble-shadow-soft { box-shadow: 0 0 10px rgba(63, 210, 255, .18), inset 0 1px rgba(255,255,255,.1); }
.message-bubble.visual-bubble-shadow-neon { box-shadow: 0 0 14px rgba(63, 210, 255, .38), 0 0 34px rgba(118, 91, 255, .2), inset 0 1px rgba(255,255,255,.14); }
.message-bubble.visual-bubble { isolation: isolate; }
.message-bubble.visual-bubble::before, .message-bubble.visual-bubble::after { position: absolute; z-index: 0; pointer-events: none; content: ''; }
.message-bubble.visual-bubble-ornament-corners::before { inset: 6px; border-radius: inherit; background: linear-gradient(var(--visual-bubble-border-color, #56e7ff), var(--visual-bubble-border-color, #56e7ff)) left top / 22px 1px no-repeat, linear-gradient(var(--visual-bubble-border-color, #56e7ff), var(--visual-bubble-border-color, #56e7ff)) left top / 1px 16px no-repeat, linear-gradient(var(--visual-bubble-border-color, #56e7ff), var(--visual-bubble-border-color, #56e7ff)) right top / 22px 1px no-repeat, linear-gradient(var(--visual-bubble-border-color, #56e7ff), var(--visual-bubble-border-color, #56e7ff)) right top / 1px 16px no-repeat, linear-gradient(var(--visual-bubble-border-color, #56e7ff), var(--visual-bubble-border-color, #56e7ff)) left bottom / 22px 1px no-repeat, linear-gradient(var(--visual-bubble-border-color, #56e7ff), var(--visual-bubble-border-color, #56e7ff)) left bottom / 1px 16px no-repeat, linear-gradient(var(--visual-bubble-border-color, #56e7ff), var(--visual-bubble-border-color, #56e7ff)) right bottom / 22px 1px no-repeat, linear-gradient(var(--visual-bubble-border-color, #56e7ff), var(--visual-bubble-border-color, #56e7ff)) right bottom / 1px 16px no-repeat; opacity: .72; }
.message-bubble.visual-bubble-ornament-scanline::before { top: 7px; right: 14px; left: 14px; height: 2px; background: linear-gradient(90deg, transparent, var(--visual-bubble-border-color, #56e7ff), transparent); box-shadow: 0 0 8px var(--visual-bubble-border-color, #56e7ff); opacity: .9; }
.message-bubble.visual-bubble-ornament-scanline::after { right: 22px; bottom: 7px; left: 22px; height: 1px; background: linear-gradient(90deg, transparent, var(--visual-bubble-border-color, #56e7ff), transparent); opacity: .34; }
.message-bubble.visual-bubble-ornament-dots::before { top: 8px; right: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--visual-bubble-border-color, #56e7ff); box-shadow: -12px 4px 0 -1px var(--visual-bubble-border-color, #56e7ff), -24px 0 0 -2px var(--visual-bubble-border-color, #56e7ff); opacity: .9; }
.message-bubble.visual-bubble-ornament-dots::after { bottom: 8px; left: 11px; width: 4px; height: 4px; border-radius: 50%; background: var(--visual-bubble-border-color, #56e7ff); box-shadow: 12px -3px 0 -1px var(--visual-bubble-border-color, #56e7ff); opacity: .62; }
.message-bubble.visual-bubble-ornament-grid::before { inset: 1px; border-radius: inherit; background-image: linear-gradient(rgba(86, 231, 255, .14) 1px, transparent 1px), linear-gradient(90deg, rgba(86, 231, 255, .14) 1px, transparent 1px); background-size: 12px 12px; opacity: .45; }
.message-bubble.visual-bubble-ornament-circuit::before { top: 7px; right: 8px; width: 34px; height: 24px; border-top: 1px solid var(--visual-bubble-border-color, #56e7ff); border-right: 1px solid var(--visual-bubble-border-color, #56e7ff); background: linear-gradient(90deg, transparent 48%, var(--visual-bubble-border-color, #56e7ff) 49%, var(--visual-bubble-border-color, #56e7ff) 51%, transparent 52%) 0 100% / 22px 1px no-repeat; opacity: .78; }
.message-bubble.visual-bubble-ornament-circuit::after { top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--visual-bubble-border-color, #56e7ff); box-shadow: -26px 26px 0 -1px var(--visual-bubble-border-color, #56e7ff); }
.message-bubble.visual-bubble-ornament-spark::before { top: -13px; right: 10px; color: var(--visual-bubble-border-color, #56e7ff); content: '✦'; font-size: 15px; line-height: 1; text-shadow: 0 0 9px var(--visual-bubble-border-color, #56e7ff); }
.message-bubble.visual-bubble-ornament-spark::after { bottom: -8px; left: 13px; color: var(--visual-bubble-border-color, #56e7ff); content: '·'; font-size: 20px; line-height: 1; opacity: .82; }
.message-text-segment { display: inline; }
.message-text-styled { display: inline; }
.message-text-glow-soft { text-shadow: 0 0 7px rgba(104, 230, 255, .52); }
.message-text-glow-strong { text-shadow: 0 0 8px currentColor, 0 0 18px currentColor; }
.message-text-animation-flow { animation: message-style-flow 3.8s linear infinite; }
.message-text-animation-pulse { animation: message-style-pulse 1.8s ease-in-out infinite; }
.message-text-animation-glitch { text-shadow: 2px 0 #ff4da8, -2px 0 #50f1ff, 0 0 10px rgba(255,255,255,.45); animation: message-style-glitch 1.8s steps(2, end) infinite; }
.message-bubble.visual-bubble > * { position: relative; z-index: 1; }
@keyframes message-style-flow { from { background-position: 0% 50%; } to { background-position: 240% 50%; } }
@keyframes message-style-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .68; } }
@keyframes message-style-glitch { 0%, 86%, 100% { transform: translate(0); } 88% { transform: translate(-1px, 1px); } 91% { transform: translate(1px, -1px); } 94% { transform: translate(0); } }
@media (prefers-reduced-motion: reduce) {
  .message-text-animation-flow,
  .message-text-animation-pulse,
  .message-text-animation-glitch { animation: none; }
}
.message-row.outgoing .message-quote strong { color: #fff; }
.message-bubble img { display: block; max-width: 220px; margin: 4px 0; border-radius: 7px; }
.message-bubble hr { border: 0; border-top: 1px dashed #ced1d8; margin: 8px 0; }
.message-quote { display: block; max-width: 280px; margin: 0 0 7px; padding: 6px 8px; border-left: 3px solid #8c99c3; border-radius: 3px 6px 6px 3px; color: #6d7780; background: rgba(255, 255, 255, .62); font-size: 11px; line-height: 1.45; }
.message-row.outgoing .message-quote { border-left-color: rgba(255,255,255,.6); color: rgba(255,255,255,.92); background: rgba(255,255,255,.18); }
.message-quote strong { display: block; max-width: 100%; margin-bottom: 3px; overflow: hidden; color: #4e5774; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.message-quote-content { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-quote-content img { display: inline-block; width: 42px; height: 42px; margin: 0 4px 0 0; object-fit: cover; vertical-align: middle; }
.action-link { display: block; width: fit-content; margin: 4px 0; padding: 3px 0; border: 0; color: #1676bd; background: transparent; text-decoration: underline; cursor: pointer; font-size: 13px; text-align: left; }
.message-row.outgoing .action-link { color: #fff; text-decoration-color: rgba(255,255,255,.55); }
.typing-indicator { min-height: 18px; padding: 0 6%; color: #9da7b2; font-size: 11px; }
.composer-area { padding: 0 25px 18px; background: #f8f9fa; }
.composer-toolbar { display: flex; align-items: center; gap: 4px; height: 39px; border-top: 1px solid #e7eaed; }
.tool-button { display: grid; place-items: center; width: 29px; height: 29px; border: 0; border-radius: 6px; color: #738090; background: transparent; }
.composer-toolbar .composer-icon { display: block; width: 20px; height: 20px; fill: initial; stroke: none; }
.composer-toolbar .burn-icon-on { display: none; }
#burn-button.active .burn-icon-off { display: none; }
#burn-button.active .burn-icon-on { display: block; }
.tool-button:hover { color: #405063; background: #e8edf1; }
.tool-button.active { color: #c95645; background: #fff0ed; }
.toolbar-hint { margin-left: auto; color: #b0b7bf; font-size: 10px; }
.composer { display: flex; align-items: flex-end; gap: 12px; }
.composer textarea { flex: 1; min-height: 42px; max-height: 96px; resize: none; overflow-y: hidden; border: 1px solid #e3e7eb; border-radius: 8px; padding: 11px 12px; outline: 0; color: var(--text); background: #fff; font-size: 13px; line-height: 1.45; }
.composer textarea:focus { border-color: #93b0ff; box-shadow: 0 0 0 3px rgba(51, 112, 255, .12); }
.send-button { min-width: 66px; height: 42px; border: 0; border-radius: 8px; color: #fff; background: var(--brand); box-shadow: 0 4px 9px rgba(13, 49, 173, .18); font-size: 13px; }
.send-button:hover { background: var(--brand-dark); }
.button-muted { height: 42px; border: 1px solid #dbe1e6; border-radius: 8px; padding: 0 15px; color: #74808d; background: #fff; }

.modal-backdrop { position: fixed; z-index: 5; inset: 0; display: grid; place-items: center; background: rgba(30, 42, 57, .28); backdrop-filter: blur(2px); }
.modal-backdrop.hidden { display: none; }
#confirm-modal { z-index: 80; }
#announcement-modal { z-index: 20; }
.announcement-modal { display: flex; width: min(500px, calc(100vw - 30px)); max-height: min(620px, calc(100vh - 36px)); flex-direction: column; padding: 24px; border: 1px solid #eadfbe; border-radius: 14px; background: #fff; box-shadow: 0 20px 70px rgba(26, 39, 55, .2); }
.announcement-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.announcement-modal h2 { margin: 0; color: #303c4a; font-size: 20px; }
.announcement-modal-header p:last-child { margin: 7px 0 0; color: #98a2ae; font-size: 11px; }
.announcement-modal-content { min-height: 84px; max-height: min(390px, 48vh); margin-top: 22px; overflow-y: auto; padding: 15px 16px; border: 1px solid #f0e5c7; border-radius: 9px; color: #4a4436; background: #fffaf0; font-size: 13px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.announcement-modal-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.announcement-modal-actions .send-button { min-width: 110px; }
.settings-modal { width: min(400px, calc(100vw - 30px)); padding: 22px; border: 1px solid #e1e6eb; border-radius: 14px; background: #fff; box-shadow: 0 20px 70px rgba(26, 39, 55, .2); }
.settings-modal header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 19px; }
.settings-modal h2 { margin: 0; color: #303c4a; font-size: 18px; }
.settings-modal p { margin: 6px 0 0; color: #98a2ae; font-size: 12px; }
.settings-modal label { display: grid; gap: 7px; margin: 13px 0; color: #687585; font-size: 12px; }
.settings-modal input { height: 39px; border: 1px solid #dce2e8; border-radius: 8px; padding: 0 10px; outline: 0; color: var(--text); background: #fafbfc; }
.settings-modal input:focus { border-color: #919fcf; }
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.toast { position: fixed; z-index: 1000; bottom: 27px; left: 50%; max-width: min(420px, calc(100vw - 30px)); padding: 9px 14px; border-radius: 8px; color: #fff; background: rgba(38, 49, 64, .9); box-shadow: 0 9px 25px rgba(26, 39, 55, .2); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  body { overflow: auto; }
  .app-shell { grid-template-columns: 54px 260px minmax(0, 1fr); width: 100vw; height: 100vh; min-height: 500px; margin: 0; border-radius: 0; }
  .conversation-header { padding: 0 10px; }
  .profile-copy { display: none; }
  .message-area { padding-left: 3%; padding-right: 3%; }
  .composer-area { padding-left: 12px; padding-right: 12px; }
  .toolbar-hint { display: none; }
}

@media (max-width: 600px) {
  .app-shell { grid-template-columns: 52px minmax(0, 1fr); }
  .conversation-panel { position: absolute; z-index: 2; left: 52px; width: min(310px, calc(100vw - 52px)); height: 100vh; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 7px 0 20px rgba(31, 43, 57, .14); }
  .conversation-panel.mobile-open { transform: translateX(0); }
  .chat-header { padding: 0 12px; }
  .chat-announcement { padding: 0 12px; }
  .chat-title-wrap h1 { font-size: 14px; }
  .message-content { max-width: 82%; }
}

/* Final chat visual direction: a light, compact desktop client inspired by
   modern WeChat/QQ layouts, while keeping OpenChat's own brand and controls. */
:root {
  --brand: #3370ff;
  --brand-dark: #2a5ce0;
  --brand-soft: #eaf1ff;
  --nav: #f4f6fb;
  --panel: #fff;
  --border: #e7eaf1;
  --muted: #939cad;
  --text: #232a36;
  --incoming: #fff;
  --outgoing: #3370ff;
  --shadow: 0 20px 60px rgba(24, 36, 62, .13);
}
body { background: linear-gradient(135deg, #eef2fb 0%, #e7ecf7 100%); }
.app-shell { position: relative; width: min(1280px, calc(100vw - 40px)); height: min(920px, calc(100vh - 40px)); margin: 20px auto; border-color: #e0e5f0; border-radius: 14px; box-shadow: var(--shadow); }
.app-shell.product-mode { grid-template-columns: 64px minmax(0, 1fr); }
.app-shell.product-mode .conversation-panel { display: none; }
.app-nav { padding-top: 20px; background: #f4f4f7; border-right-color: #e4e8eb; }
.brand-mark { border-radius: 11px; background: linear-gradient(145deg, #5b8cff, #2a5ce0); box-shadow: 0 6px 14px rgba(43, 92, 224, .24); }
.brand-mark.nav-profile { background: transparent; box-shadow: none; }
.nav-profile .avatar { width: 38px; height: 38px; border-radius: 50%; font-size: 12px; }
.nav-list, .nav-bottom { gap: 11px; }
.nav-list { margin-top: 48px; }
.nav-item { width: 39px; height: 39px; border-radius: 9px; }
.nav-item { position: relative; }
.nav-item:hover { color: #2e3d4d; background: #fff; }
.nav-item.active { color: #2a5ce0; background: #fff; box-shadow: 0 4px 12px rgba(73,89,103,.1); }
.nav-badge { position: absolute; top: -5px; right: -7px; display: grid; min-width: 16px; height: 16px; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--nav); border-radius: 10px; color: #fff; background: #e5485d; font-size: 9px; font-weight: 750; line-height: 12px; white-space: nowrap; }
.conversation-panel { background: #fff; border-right-color: #e5e9ec; }
.conversation-header { height: 68px; padding: 0 17px; background: #fff; }
.conversation-header .profile-chip { width: 100%; }
.conversation-toolbar { margin: 12px 13px 8px; }
.conversation-toolbar > .icon-button { flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid #e1e7eb; border-radius: 7px; background: #fff; }
.conversation-toolbar > .icon-button:hover { border-color: #b9c2dc; color: #0b2b98; background: #f0f3fa; }
.conversation-tabs { padding-bottom: 7px; }
.conversation-tab:hover, .conversation-tab.active { color: #163498; background: #e4e8f6; }
.conversation-list { padding: 0 7px; }
.conversation-item { position: relative; min-height: 67px; margin: 1px 0; padding: 9px 10px; border-radius: 5px; }
.conversation-item:hover { background: #f4f5f8; }
.conversation-item.active { position: relative; background: #e7ebf7; }
.conversation-item.active::before { position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #3370ff; content: ""; }
.conversation-long-press-progress { position: absolute; right: 10px; bottom: 4px; left: 10px; height: 2px; overflow: hidden; border-radius: 2px; opacity: 0; background: #dfe5f0; pointer-events: none; }
.conversation-long-press-progress-fill { display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left center; background: #3370ff; }
.conversation-item.long-press-progressing .conversation-long-press-progress { opacity: 1; }
.conversation-footer { background: #fff; }
.chat-panel { background: #fafbfc; }
.chat-header { height: 82px; padding: 0 24px; border-bottom-color: #e6eaed; background: #fff; }
.chat-title-wrap h1 { font-size: 16px; font-weight: 600; }
.chat-announcement {
  display: flex;
  width: 100%;
  min-height: 35px;
  align-items: center;
  gap: 7px;
  padding: 0 24px;
  border: 0;
  border-bottom: 1px solid #f0e5c7;
  color: #67562b;
  background: #fffaf0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.chat-announcement:hover { background: #fff6df; }
.chat-announcement:focus-visible { position: relative; z-index: 1; outline: 2px solid rgba(51, 112, 255, .48); outline-offset: -2px; }
.chat-announcement-icon { display: grid; flex: 0 0 auto; place-items: center; color: #c28b24; }
.chat-announcement-icon .ui-icon { width: 15px; height: 15px; stroke-width: 1.9; }
.chat-announcement-label { flex: 0 0 auto; color: #9a6b12; font-size: 11px; font-weight: 650; }
.chat-announcement-preview { min-width: 0; overflow: hidden; color: #847653; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-announcement-arrow { width: 14px; height: 14px; margin-left: auto; color: #b8a16c; }
.message-area { display: block; width: 100%; padding-top: 25px; padding-bottom: 20px; background: #fafbfc; }
.date-divider { margin-bottom: 16px; }
.message-row { display: flex; width: 100%; flex: 0 0 100%; margin: 16px 0; }
.message-row .avatar { width: 34px; height: 34px; border-radius: 50%; }
.message-content { min-width: 0; max-width: min(72%, 660px); }
.message-meta { color: #aab2ba; }
.message-bubble { padding: 9px 13px; border-color: #e4e8eb; border-radius: 4px 11px 11px 11px; box-shadow: 0 2px 7px rgba(43,54,65,.035); line-height: 1.65; }
.message-row.outgoing .message-bubble { border-color: rgba(255,255,255,.18); border-radius: 11px 4px 11px 11px; background: var(--outgoing); color: #fff; }
.composer-area { position: relative; padding: 0 27px 19px; background: #fff; }
.composer-toolbar { border-top-color: #e6eaed; }
.tool-button { width: 31px; height: 31px; border-radius: 5px; }
.tool-button:hover { color: #2a5ce0; background: #edf0f8; }
.composer textarea { border-color: #e3e7ea; border-radius: 6px; background: #fafbfc; }
.composer textarea:focus { border-color: #8196d5; box-shadow: 0 0 0 3px rgba(13, 54, 187, .08); background: #fff; }
.send-button { background: #3370ff; box-shadow: 0 4px 10px rgba(13, 54, 187, .18); }
.send-button:hover { background: #2a5ce0; }
.emoji-popover { position: absolute; z-index: 3; left: 25px; bottom: 105px; width: min(360px, calc(100% - 50px)); padding: 12px 12px 10px; border: 1px solid #e1e6e9; border-radius: 9px; background: #fff; box-shadow: 0 15px 38px rgba(31,45,59,.16); }
.emoji-popover-title { margin: 0 0 8px 3px; color: #87919a; font-size: 11px; }
.emoji-grid { display: grid; grid-template-columns: repeat(9, 1fr); max-height: 180px; gap: 2px; overflow-y: auto; }
.emoji-grid button { display: grid; place-items: center; width: 32px; height: 31px; border: 0; border-radius: 5px; background: transparent; font-size: 20px; }
.emoji-grid button:hover { background: #f0f2f7; transform: scale(1.08); }
.toast { bottom: 35px; }
.avatar-chat.avatar-group { background: linear-gradient(135deg, #5e8fd8 0 33%, #7b8cc2 33% 66%, #d99c70 66%); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.avatar-chat.avatar-direct { background: linear-gradient(145deg, #c99d7d, #9a684d); }
.chat-title-wrap h1 { white-space: nowrap; }
.chat-title-wrap > #chat-avatar { display: none; }
.mobile-conversations { display: none; }
/* Keep the conversation title bar stable when the message stream is full or
   the viewport is short. Without flex-shrink: 0, the chat header can be
   compressed differently for direct and group conversations. */
.chat-header { flex-shrink: 0; }
.message-row { display: flex; width: 100%; flex: 0 0 100%; gap: 0; margin: 9px 0; }
.message-row.compact { margin-top: 3px; }
.message-content { max-width: min(76%, 700px); }
.message-meta { margin-bottom: 3px; }
/* Consecutive ordinary messages use a tighter corner treatment. Official
   visual bubbles own their shape, so a compact row must not overwrite the
   selected bubble style and make the same user's messages look inconsistent. */
.message-row.compact .message-bubble:not(.visual-bubble) { border-radius: 7px 11px 11px 11px; }
.message-row.outgoing.compact .message-bubble:not(.visual-bubble) { border-radius: 11px 7px 11px 11px; }
.message-row { gap: 9px; }
.date-divider { width: 100%; }
.message-row > .avatar { flex: 0 0 34px; }
.avatar-user,
.message-row .avatar.avatar-user { border-radius: 50%; }

@media (max-width: 850px) {
  .app-shell { width: 100vw; height: 100vh; margin: 0; border-radius: 0; }
  .app-shell.product-mode { grid-template-columns: 54px minmax(0, 1fr); }
  .chat-header { height: 76px; }
}

/* Product UI: account entry, first-class pages and in-app dialogs. */
.hidden { display: none !important; }
.auth-screen { display: grid; grid-template-columns: minmax(360px, .95fr) minmax(390px, .75fr); min-height: 100vh; overflow: auto; background: #f7f8fa; }
.auth-visual { position: relative; display: flex; min-height: 100vh; flex-direction: column; overflow: hidden; padding: 42px clamp(38px, 7vw, 112px) 34px; color: #f3f6ff; background: linear-gradient(145deg, #10236a 0%, #0f2989 52%, #1536ad 100%); }
.auth-visual::before, .auth-visual::after { position: absolute; content: ""; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; pointer-events: none; }
.auth-visual::before { width: 580px; height: 580px; right: -310px; top: 12%; }
.auth-visual::after { width: 380px; height: 380px; left: -250px; bottom: -180px; }
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; color: #fff; font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.auth-brand .brand-mark { width: 37px; height: 37px; background: rgba(255,255,255,.2); box-shadow: none; }
.auth-brand .brand-mark .ui-icon { width: 24px; height: 24px; }
.auth-visual-copy { position: relative; z-index: 1; max-width: 540px; margin: auto 0; }
.eyebrow { margin: 0 0 12px; color: #576cb6; font-size: 10px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.auth-visual .eyebrow { color: rgba(230, 235, 254, .66); }
.auth-visual-copy h1 { margin: 0; color: #fff; font-size: clamp(30px, 4vw, 54px); font-weight: 600; letter-spacing: -.05em; line-height: 1.16; }
.auth-visual-copy h1 em { color: #aab9ee; font-style: normal; }
.auth-visual-copy > p:last-child { max-width: 425px; margin: 24px 0 0; color: rgba(236, 240, 254, .74); font-size: 14px; line-height: 1.85; }
.auth-visual-footer { position: relative; z-index: 1; display: flex; gap: 18px; color: rgba(228, 234, 254, .58); font-size: 10px; letter-spacing: .03em; }
.auth-visual-decoration { position: absolute; right: 12%; bottom: 19%; width: 240px; height: 180px; opacity: .9; transform: rotate(-12deg); }
.deco-orb { position: absolute; display: block; border-radius: 50%; background: rgba(197, 210, 253, .2); filter: blur(.2px); }
.orb-one { width: 68px; height: 68px; left: 16px; top: 33px; }
.orb-two { width: 26px; height: 26px; right: 18px; top: 10px; background: rgba(230, 235, 254, .44); }
.orb-three { width: 16px; height: 16px; right: 44px; bottom: 16px; background: rgba(230, 235, 254, .36); }
.deco-window { position: absolute; right: 26px; bottom: 25px; display: grid; gap: 13px; width: 165px; padding: 19px 16px; border: 1px solid rgba(255,255,255,.32); border-radius: 13px; background: rgba(255,255,255,.11); box-shadow: 0 18px 40px rgba(0,0,0,.08); backdrop-filter: blur(7px); }
.deco-window div { height: 7px; border-radius: 5px; background: rgba(236, 240, 254, .72); }
.deco-window div:nth-child(2) { width: 72%; background: rgba(236, 240, 254, .42); }
.deco-window div:nth-child(3) { width: 53%; background: rgba(236, 240, 254, .28); }
.auth-card { align-self: center; width: min(430px, calc(100% - 48px)); margin: 0 auto; padding: 34px 38px 27px; border: 1px solid #e2e4eb; border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: 0 22px 60px rgba(31, 40, 72, .12); }
.auth-card-header { display: flex; align-items: flex-start; justify-content: space-between; }
.auth-card h2 { margin: 0; color: #252835; font-size: 25px; letter-spacing: -.035em; }
.auth-card-header > div:first-child > p:last-child { margin: 8px 0 0; color: #9a9ea9; font-size: 12px; }
.auth-status-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #0e2c96; background: #e5e9f6; }
.auth-status-mark .ui-icon { width: 19px; height: 19px; stroke-width: 2.2; }
.auth-mode-tabs { display: flex; gap: 4px; margin: 26px 0 23px; padding: 4px; border-radius: 9px; background: #f1f2f5; }
.auth-mode { flex: 1; height: 34px; border: 0; border-radius: 7px; color: #8b9a93; background: transparent; font-size: 12px; transition: all .18s ease; }
.auth-mode:hover { color: #33437c; }
.auth-mode.active { color: #25346b; background: #fff; box-shadow: 0 2px 8px rgba(51, 61, 94, .1); font-weight: 650; }
.field-label { display: grid; gap: 8px; margin: 14px 0; color: #686c79; font-size: 11px; font-weight: 600; }
.field-control { display: flex; align-items: center; height: 43px; gap: 9px; padding: 0 11px; border: 1px solid #dcdfe7; border-radius: 9px; color: #9b9fac; background: #fbfcfd; transition: border .18s ease, box-shadow .18s ease, background .18s ease; }
.field-control:focus-within { border-color: #7889c6; background: #fff; box-shadow: 0 0 0 3px rgba(13, 49, 173, .08); }
.field-icon { flex: 0 0 auto; width: 16px; height: 16px; stroke-width: 1.7; }
.field-control input { min-width: 0; width: 100%; height: 100%; border: 0; outline: 0; color: #313542; background: transparent; font-size: 13px; }
.field-control input::placeholder { color: #b0b4be; }
.inline-feedback { min-height: 18px; margin: 8px 0; color: #d65f58; font-size: 11px; line-height: 1.5; }
.inline-feedback:empty { min-height: 0; margin: 0; }
.inline-feedback.success { color: #1f9d63; }
.auth-submit { display: flex; align-items: center; justify-content: center; width: 100%; height: 45px; gap: 10px; margin-top: 18px; border: 0; border-radius: 9px; color: #fff; background: linear-gradient(135deg, #4b83ff, #2a5ce0); box-shadow: 0 9px 18px rgba(42, 92, 224, .26); font-size: 13px; font-weight: 650; transition: transform .18s ease, box-shadow .18s ease; }
.auth-submit:hover { box-shadow: 0 11px 21px rgba(13, 49, 173, .27); transform: translateY(-1px); }
.auth-submit:disabled { cursor: wait; opacity: .7; transform: none; }
.auth-submit .ui-icon { width: 17px; height: 17px; }
.auth-privacy { margin: 21px 0 0; color: #a4a7b0; font-size: 10px; line-height: 1.6; text-align: center; }

.product-view { flex: 1; min-height: 0; overflow: auto; padding: clamp(28px, 5vw, 60px) clamp(25px, 7vw, 90px); background: linear-gradient(145deg, #f8f8fb, #f4f5f8); }
.product-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; max-width: 920px; margin: 0 auto 31px; }
.product-header h1 { margin: 0; color: #292d3a; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.045em; }
.product-header p:last-child { margin: 10px 0 0; color: #9498a3; font-size: 12px; line-height: 1.7; }
#contacts-add-button { display: none; }
.product-toolbar { display: flex; max-width: 920px; align-items: center; gap: 9px; margin: 0 auto 11px; }
.inline-search { display: flex; align-items: center; flex: 1; height: 42px; gap: 8px; padding: 0 13px; border: 1px solid #dcdfe6; border-radius: 9px; background: #fff; }
.inline-search:focus-within { border-color: #8595c9; box-shadow: 0 0 0 3px rgba(13, 49, 173, .07); }
.inline-search .search-icon { margin: 0; color: #9ca0ad; }
.inline-search input { min-width: 0; width: 100%; border: 0; outline: 0; color: #313543; background: transparent; font-size: 12px; }
#contacts-search-button { flex: 0 0 auto; height: 42px; border-color: #3370ff; color: #fff; background: #3370ff; }
#contacts-search-button:hover { border-color: #2a5ce0; color: #fff; background: #2a5ce0; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; max-width: 920px; margin: 31px auto 13px; }
.section-heading h2 { margin: 0; color: #4b4f5b; font-size: 13px; }
.section-heading span { color: #a3a6b0; font-size: 11px; }
.contact-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); max-width: 920px; gap: 10px; margin: 0 auto; }
.contact-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px; border: 1px solid #e3e5eb; border-radius: 11px; background: #fff; box-shadow: 0 3px 13px rgba(41, 48, 72, .035); transition: border .18s ease, box-shadow .18s ease, transform .18s ease; }
.contact-card:hover { border-color: #acb6d7; box-shadow: 0 8px 19px rgba(42, 57, 106, .09); transform: translateY(-1px); }
.contact-card-copy { min-width: 0; flex: 1; }
.contact-card-copy strong, .contact-card-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-card-copy strong { color: #363a47; font-size: 13px; }
.contact-card-copy span { margin-top: 4px; color: #9a9ea9; font-size: 10px; }
.contact-card .button-muted { height: 30px; padding: 0 9px; font-size: 11px; }
.contact-card-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.contact-subheading { margin-top: 14px; }
.empty-product { max-width: 500px; margin: 70px auto; color: #9598a4; text-align: center; }
.empty-product .empty-icon, .modal-empty .empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; color: #7786b7; background: #e5e8f4; }
.empty-product .empty-icon .ui-icon, .modal-empty .empty-icon .ui-icon { width: 26px; height: 26px; }
.empty-product h3 { margin: 0; color: #545865; font-size: 15px; }
.empty-product p { margin: 9px 0 17px; font-size: 12px; }
.button-compact { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; min-width: 120px; }
.button-compact .ui-icon { width: 15px; height: 15px; }
.edition-badge { padding: 6px 9px; border: 1px solid #ced5ea; border-radius: 6px; color: #2a3f87; background: #e8ebf7; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.apps-layout { display: grid; max-width: 920px; gap: 18px; margin: 0 auto; }

.app-discovery-section { display: grid; gap: 11px; padding: 20px 22px; border: 1px solid #dce4f5; border-radius: 16px; background: linear-gradient(145deg, #f9fbff, #eef3ff); box-shadow: 0 8px 24px rgba(55, 79, 145, .06); }
.app-discovery-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.app-discovery-heading h2 { margin: 3px 0 0; color: #2f3d69; font-size: 16px; }
.app-discovery-heading p:last-child { margin: 6px 0 0; color: #7d89a9; font-size: 11.5px; line-height: 1.6; }
.app-discovery-heading > span { flex: 0 0 auto; color: #6e7fa9; font-size: 10.5px; }
.app-discovery-search { display: flex; align-items: center; height: 40px; gap: 8px; padding-left: 12px; border: 1px solid #d7deef; border-radius: 9px; background: #fff; }
.app-discovery-search:focus-within { border-color: #7d95d3; box-shadow: 0 0 0 3px rgba(53, 91, 185, .09); }
.app-discovery-search .search-icon { flex: 0 0 auto; width: 15px; height: 15px; margin: 0; color: #9aa7c5; }
.app-discovery-search input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; color: #384563; background: transparent; font-size: 12px; }
.app-discovery-search input::placeholder { color: #a4aec4; }
.app-discovery-search .search-submit { height: 32px; }
.app-discovery-section .inline-feedback { min-height: 0; margin: 0; color: #7a89ac; font-size: 10.5px; }
.app-discovery-list { display: grid; gap: 5px; max-height: 330px; overflow-y: auto; }
.app-discovery-empty { padding: 18px 8px 10px; color: #96a1ba; font-size: 11px; text-align: center; }
.app-discovery-card { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 10px; border: 1px solid transparent; border-radius: 10px; background: rgba(255,255,255,.7); transition: border .16s ease, background .16s ease; }
.app-discovery-card:hover { border-color: #d1daf0; background: #fff; }
.app-discovery-card .avatar { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; font-size: 13px; }
.app-discovery-copy { display: grid; min-width: 0; flex: 1; gap: 3px; }
.app-discovery-copy strong, .app-discovery-copy span, .app-discovery-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-discovery-copy strong { color: #354568; font-size: 12.5px; }
.app-discovery-copy span { color: #8290af; font-size: 10px; }
.app-discovery-copy small { color: #9aa6be; font-size: 10px; }
.app-discovery-open { flex: 0 0 auto; min-width: 66px; height: 30px; padding: 0 10px; color: #3e5ba8; border-color: #cbd6ef; background: #f8faff; font-size: 10.5px; }
.app-discovery-open:hover { border-color: #9eb1dd; color: #294993; background: #eef3ff; }
.app-discovery-open:disabled { color: #96a0b4; border-color: #dce1eb; background: #f5f7fb; cursor: wait; }

.app-key-panel { position: relative; padding: 22px 24px; border: 1px solid #dce0eb; border-radius: 16px; background: linear-gradient(150deg, #ffffff, #f3f5fa); box-shadow: 0 10px 28px rgba(34, 47, 90, .06); transition: border .2s ease, box-shadow .2s ease; }
.app-key-panel:hover { border-color: #c7cee4; box-shadow: 0 14px 32px rgba(34, 47, 90, .09); }
.app-key-copy { display: flex; align-items: center; gap: 14px; }
.app-key-copy > div { min-width: 0; flex: 1; }
.app-key-icon { display: grid; flex: 0 0 auto; place-items: center; width: 44px; height: 44px; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #5b8cff, #0e2a8b); box-shadow: 0 7px 15px rgba(16, 45, 146, .22); }
.app-key-icon .ui-icon { width: 22px; height: 22px; }
.app-key-copy h2 { margin: 0; color: #2d3349; font-size: 16px; }
.app-key-copy p { max-width: 660px; margin: 6px 0 0; color: #808596; font-size: 11.5px; line-height: 1.7; }
.app-create-trigger { flex: 0 0 auto; min-width: 96px; height: 38px; padding: 0 16px; border-radius: 10px; font-size: 12px; }
.app-create-trigger.limit-reached { color: #515c82; background: #eaedf6; box-shadow: none; }
.app-create-trigger.limit-reached:hover { background: #e1e4f0; }
.app-create-close { display: none; }
.app-key-panel:not(.create-modal) .app-key-form { display: none; }
.app-key-panel:not(.create-modal) #apps-key-feedback { min-height: 0; }

.app-key-panel.create-modal { position: fixed; z-index: 16; top: 50%; left: 50%; width: min(680px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); overflow: auto; margin: 0; padding: 26px 28px 24px; border-radius: 20px; transform: translate(-50%, -50%); box-shadow: 0 30px 90px rgba(21, 26, 43, .32); }
.app-key-panel.create-modal:hover { border-color: #dce0eb; box-shadow: 0 30px 90px rgba(21, 26, 43, .32); }
.app-key-panel.create-modal .app-key-icon { width: 40px; height: 40px; border-radius: 12px; }
.app-key-panel.create-modal .app-create-close { position: absolute; top: 16px; right: 16px; display: grid; }
.app-key-panel.create-modal .app-key-copy { padding-right: 40px; }
.app-key-panel.create-modal .app-create-trigger { display: none; }
#apps-view.create-app-open::before { position: fixed; z-index: 15; inset: 0; display: block; background: rgba(26, 30, 40, .38); content: ''; backdrop-filter: blur(3px); }

.app-key-form { display: grid; gap: 14px; margin-top: 20px; }
.app-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.app-key-form label { display: grid; gap: 7px; color: #6b707f; font-size: 11px; font-weight: 600; }
.app-key-form input, .app-key-form textarea { width: 100%; min-width: 0; padding: 0 12px; border: 1px solid #dfe2e9; border-radius: 9px; outline: 0; color: #303443; background: #fbfcfd; font-size: 12px; font-family: inherit; transition: border .16s ease, box-shadow .16s ease, background .16s ease; }
.app-key-form input { height: 40px; }
.app-key-form textarea { min-height: 84px; padding: 11px 12px; resize: vertical; line-height: 1.6; }
.app-key-form input:focus, .app-key-form textarea:focus { border-color: #7b8dc9; background: #fff; box-shadow: 0 0 0 3px rgba(13, 49, 173, .09); }
.app-form-actions { display: flex; justify-content: flex-end; }
.app-form-actions .send-button { height: 40px; min-width: 120px; border-radius: 10px; }
.app-key-form .send-button:disabled { cursor: not-allowed; opacity: .55; }
.app-avatar-editor { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid #e3e6ee; border-radius: 11px; background: rgba(255,255,255,.7); }
.app-avatar-preview { width: 42px; height: 42px; border-radius: 50%; }
.app-avatar-copy { display: grid; min-width: 0; flex: 1; gap: 3px; }
.app-avatar-copy strong { color: #4a5061; font-size: 11.5px; }
.app-avatar-copy span { color: #9397a3; font-size: 10px; line-height: 1.45; }
.app-avatar-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.app-avatar-actions .button-muted { height: 31px; padding: 0 10px; font-size: 10.5px; }
.app-key-secret { display: grid; gap: 9px; margin-top: 18px; padding: 16px; border: 1px solid #ecd9a4; border-radius: 12px; color: #7d642a; background: linear-gradient(150deg, #fffdf6, #fff7e6); }
.app-key-secret strong { color: #6a5219; font-size: 12.5px; }
.app-key-secret p { margin: 0; font-size: 11px; line-height: 1.6; }
.app-key-secret code { display: block; overflow: auto; padding: 11px 12px; border: 1px solid #f0e2bd; border-radius: 9px; color: #55472a; background: #fff; font: 11.5px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; user-select: all; }
.app-key-secret-actions { display: flex; gap: 8px; }
.app-key-secret-actions .button-muted { height: 32px; padding: 0 13px; font-size: 11px; }

.app-key-list-section { display: grid; gap: 12px; }
.app-key-list-section .section-heading { margin: 4px 0 0; }
.app-key-list-section .section-heading span:not(:empty) { padding: 4px 10px; border-radius: 999px; color: #273b80; background: #e8ecf7; font-size: 10px; font-weight: 700; }
.app-key-list { display: grid; gap: 12px; }
.app-key-empty { display: grid; justify-items: center; gap: 8px; padding: 40px 24px; border: 1px dashed #d6d9e5; border-radius: 16px; color: #9498a6; background: rgba(255,255,255,.6); text-align: center; }
.app-key-empty .app-empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #2a5ce0; background: #e7eaf6; }
.app-key-empty .app-empty-icon .ui-icon { width: 24px; height: 24px; }
.app-key-empty strong { color: #4d5263; font-size: 14px; }
.app-key-empty span:last-child { font-size: 11.5px; line-height: 1.6; }

.app-card { display: grid; gap: 13px; padding: 17px 18px; border: 1px solid #e2e4eb; border-radius: 15px; background: #fff; box-shadow: 0 5px 18px rgba(38, 47, 77, .04); transition: border .18s ease, box-shadow .18s ease, transform .18s ease; }
.app-card:hover { border-color: #b8c1dc; box-shadow: 0 12px 26px rgba(39, 54, 106, .1); transform: translateY(-1px); }
.app-card.is-disabled { border-color: #e6e9e7; background: #fbfbfc; }
.app-card.is-disabled .app-card-mark { opacity: .55; filter: grayscale(.5); }
.app-card-head { display: flex; align-items: center; gap: 12px; }
.app-card-mark { display: grid; flex: 0 0 auto; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #4261cb, #2450cc); font-size: 15px; font-weight: 700; }
.app-card-mark.has-image { overflow: hidden; background: transparent; }
.app-card-mark img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.app-card-title { display: flex; min-width: 0; flex: 1; align-items: center; gap: 9px; }
.app-card-title strong { overflow: hidden; color: #303545; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.app-status-pill { flex: 0 0 auto; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.app-status-pill.is-on { color: #223988; background: #e7eaf6; }
.app-status-pill.is-off { color: #9c8145; background: #f7f1e2; }
.app-card-desc { margin: 0; color: #7c808f; font-size: 12px; line-height: 1.65; }
.app-card-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.app-card-meta span { padding: 4px 9px; border-radius: 7px; color: #7e8290; background: #f4f5f8; font-size: 10.5px; }
.app-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px dashed #e5e7ed; }
.app-prefix-wrap { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; gap: 5px; }
.app-card-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.app-debug { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 11px; }
.app-edit { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 11px; }
.app-prefix { min-width: 0; max-width: 100%; overflow: hidden; flex: 1 1 auto; padding: 5px 9px; border-radius: 7px; color: #5d6271; background: #f2f3f7; font: 10.5px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; cursor: text; -webkit-user-select: all; user-select: all; -webkit-touch-callout: default; }
.app-key-reveal { display: grid; flex: 0 0 auto; place-items: center; width: 29px; height: 29px; padding: 0; border: 1px solid #e0e3eb; border-radius: 8px; color: #697188; background: #fff; cursor: pointer; transition: border .16s ease, color .16s ease, background .16s ease; }
.app-key-reveal:hover { border-color: #b9c4e2; color: #3157c5; background: #f5f7ff; }
.app-key-reveal:focus-visible { outline: 2px solid rgba(49, 87, 197, .35); outline-offset: 2px; }
.app-key-reveal:disabled { cursor: not-allowed; opacity: .45; }
.app-key-reveal .ui-icon { width: 15px; height: 15px; }
.app-key-copy-button { flex: 0 0 auto; height: 29px; padding: 0 9px; border-radius: 8px; font-size: 10.5px; }
.app-key-copy-button:disabled { cursor: not-allowed; opacity: .45; }
.app-delete { height: 30px; padding: 0 12px; border: 1px solid #f0dcd9; border-radius: 8px; color: #c26a63; background: #fff; font-size: 11px; transition: border .16s ease, color .16s ease, background .16s ease; }
.app-delete:hover { border-color: #e8bcb7; color: #b04f47; background: #fff7f6; }

.app-toggle { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; height: 28px; cursor: pointer; }
.app-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.app-toggle-track { position: relative; display: block; width: 40px; height: 22px; border-radius: 999px; background: #cbced6; transition: background .18s ease, box-shadow .18s ease; }
.app-toggle-track::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(30, 34, 45, .22); content: ''; transition: transform .18s ease; }
.app-toggle input:checked + .app-toggle-track { background: #3370ff; box-shadow: 0 0 0 3px rgba(57, 85, 179, .12); }
.app-toggle input:checked + .app-toggle-track::after { transform: translateX(18px); }
.app-toggle input:focus-visible + .app-toggle-track { outline: 2px solid rgba(13, 49, 173, .55); outline-offset: 2px; }
.app-toggle input:disabled + .app-toggle-track { cursor: wait; opacity: .55; }

.apps-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.apps-info-item { padding: 16px; border: 1px solid #e4e6ed; border-radius: 14px; background: rgba(255,255,255,.72); }
.apps-info-icon { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 10px; border-radius: 10px; color: #2a5ce0; background: #e7ebf6; }
.apps-info-icon .ui-icon { width: 17px; height: 17px; }
.apps-info-item h3 { margin: 0 0 6px; color: #3c4152; font-size: 12.5px; }
.apps-info-item p { margin: 0; color: #878b98; font-size: 11px; line-height: 1.65; }

.apps-doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border: 1px solid #dadeea; border-radius: 14px; background: linear-gradient(120deg, #f2f4fb, #eaedf7); }
.apps-doc-copy { display: grid; min-width: 0; gap: 5px; }
.apps-doc-copy strong { color: #30374e; font-size: 12.5px; }
.apps-doc-copy span { color: #7e8393; font-size: 11px; }
.apps-doc-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.apps-doc-actions .button-muted, .apps-doc-actions .send-button { height: 36px; padding: 0 15px; border-radius: 9px; font-size: 11.5px; }

.account-summary { display: flex; align-items: center; gap: 10px; margin: -2px 0 17px; padding: 11px; border-radius: 10px; background: #f2f4f8; }
.account-summary > div:last-child { min-width: 0; }
.account-summary strong, .account-summary span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-summary strong { color: #3c404f; font-size: 13px; }
.account-summary span { margin-top: 3px; color: #999ca8; font-size: 10px; }
.avatar-upload { display: flex; align-items: center; gap: 9px; margin: -5px 0 17px; }
.avatar-upload .button-muted { height: 32px; padding: 0 11px; font-size: 11px; }
.avatar-upload span { color: #999ca8; font-size: 10px; }
.account-details { display: grid; gap: 9px; margin: 0 0 18px; padding: 2px 1px; }
.account-details > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 28px; color: #84948c; font-size: 11px; }
.account-details strong { overflow: hidden; color: #3c404f; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.account-detail-value { display: flex; min-width: 0; align-items: center; gap: 4px; }
.account-edit-button { width: 25px; height: 25px; color: #8a95a5; }
.account-edit-button .ui-icon { width: 14px; height: 14px; stroke-width: 1.7; }
.account-edit-button:disabled { cursor: wait; opacity: .55; }
.account-details > .display-name-editor { display: grid; align-items: initial; justify-content: initial; min-height: 0; gap: 7px; margin: -1px 0 3px; padding: 10px 11px 11px; border: 1px solid #e1e5ed; border-radius: 9px; background: #f7f8fb; }
.display-name-editor label { margin: 0; color: #687585; font-size: 10px; }
.display-name-editor input { width: 100%; height: 35px; padding: 0 9px; border: 1px solid #dce2e8; border-radius: 7px; outline: 0; color: #303b49; background: #fff; font-size: 12px; }
.display-name-editor input:focus { border-color: #8292c7; box-shadow: 0 0 0 3px rgba(51, 112, 255, .08); }
.display-name-editor-actions { display: flex; justify-content: flex-end; gap: 7px; }
.display-name-editor-actions .button-muted, .display-name-editor-actions .send-button { height: 29px; min-width: 56px; padding: 0 10px; border-radius: 7px; font-size: 10.5px; }
.display-name-editor-actions .send-button:disabled, .display-name-editor-actions .button-muted:disabled { cursor: wait; opacity: .6; }
.display-name-editor .inline-feedback { min-height: 0; margin: 0; font-size: 10px; }
.storage-card { margin: 0 0 18px; border: 1px solid #e1e6ef; border-radius: 11px; padding: 12px; background: #f7f8fb; }
.storage-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #3c404f; font-size: 12px; }
.storage-heading span { color: #6d7890; font-size: 11px; font-weight: 600; }
.storage-progress { height: 7px; margin: 9px 0 7px; overflow: hidden; border-radius: 999px; background: #e4e8f0; }
.storage-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: #4c6fe3; transition: width .2s ease; }
.storage-card p { min-height: 16px; margin: 0 0 9px; color: #8992a1; font-size: 10px; line-height: 1.5; }
.storage-card .button-muted { height: 30px; padding: 0 10px; font-size: 10px; }
.settings-modal .eyebrow, .contact-modal .eyebrow { margin-bottom: 8px; }
.settings-modal label { margin: 12px 0; }
.settings-modal label input { height: 40px; }
.settings-modal .display-name-editor label { margin: 0; }
.settings-modal .display-name-editor input { height: 35px; }
.settings-actions { align-items: center; }
.action-spacer { flex: 1; }
.button-muted.danger { color: #c66d66; }
.button-muted.danger:hover { border-color: #e8bcb7; color: #b6544c; background: #fff7f6; }
.contact-modal { width: min(500px, calc(100vw - 30px)); max-height: min(670px, calc(100vh - 36px)); overflow: auto; padding: 25px; border: 1px solid #e0e2e9; border-radius: 16px; background: #fff; box-shadow: 0 20px 70px rgba(26,39,55,.2); }
.user-profile-modal { width: min(420px, calc(100vw - 30px)); max-height: min(620px, calc(100vh - 36px)); overflow: auto; padding: 25px; border: 1px solid #e0e2e9; border-radius: 16px; background: #fff; box-shadow: 0 20px 70px rgba(26,39,55,.2); }
.user-profile-modal header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.user-profile-modal h2 { margin: 0; color: #303c4a; font-size: 20px; }
.user-profile-modal header p:last-child { margin: 7px 0 0; color: #98a2ae; font-size: 11px; }
.user-profile-summary { display: flex; align-items: center; gap: 13px; margin: 0 0 19px; padding: 15px; border-radius: 11px; background: #f3f5fa; }
.user-profile-summary .avatar { width: 58px; height: 58px; border-radius: 50%; font-size: 16px; }
.user-profile-summary-copy { min-width: 0; }
.user-profile-summary-copy strong, .user-profile-summary-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-profile-summary-copy strong { color: #303c4a; font-size: 15px; }
.user-profile-summary-copy span { margin-top: 5px; color: #818b9b; font-size: 11px; }
.user-profile-details { display: grid; gap: 9px; padding: 2px 1px; }
.user-profile-details > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 29px; color: #84948c; font-size: 11px; }
.user-profile-details strong { overflow: hidden; color: #3c404f; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.user-profile-modal .inline-feedback { min-height: 16px; margin: 10px 0 0; font-size: 11px; }
.conversation-info-modal { width: min(600px, calc(100vw - 30px)); max-height: min(720px, calc(100vh - 36px)); overflow: auto; padding: 25px; border: 1px solid #e0e2e9; border-radius: 16px; background: #fff; box-shadow: 0 20px 70px rgba(26,39,55,.2); }
.conversation-info-modal header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.conversation-info-modal h2 { margin: 0; color: #303c4a; font-size: 20px; }
.conversation-info-modal header p:last-child { margin: 7px 0 0; color: #98a2ae; font-size: 11px; }
.conversation-info-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; padding: 12px 14px; border: 1px solid #e6e9f1; border-radius: 10px; color: #778293; background: #f6f7fb; font-size: 11px; }
.conversation-info-summary-copy { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.conversation-info-summary-copy > span { color: #8b95a5; font-size: 10.5px; }
.conversation-info-summary strong { color: #38435e; font-size: 13px; }
.conversation-app-session { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 13px; padding: 11px 14px; border: 1px solid #e5e8f0; border-radius: 10px; background: #fff; }
.conversation-app-session-copy { display: grid; min-width: 0; flex: 1; gap: 3px; overflow: hidden; }
.conversation-app-session-copy strong { overflow: hidden; color: #445170; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-app-session-copy span { overflow: hidden; color: #929baa; font-size: 10.5px; line-height: 1.5; text-overflow: ellipsis; }
.conversation-app-session .button-muted { flex: 0 0 auto; height: 31px; padding: 0 10px; font-size: 10.5px; }
.conversation-announcement { display: grid; gap: 9px; margin: 0 0 13px; padding: 12px 14px; border: 1px solid #dfe5f2; border-radius: 10px; background: #f9fbff; }
.conversation-announcement-heading strong, .conversation-announcement-heading span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-announcement-heading strong { color: #445170; font-size: 12px; }
.conversation-announcement-heading span { margin-top: 3px; color: #929baa; font-size: 10.5px; }
.conversation-announcement textarea { width: 100%; min-height: 68px; max-height: 150px; resize: vertical; border: 1px solid #dfe5ec; border-radius: 7px; padding: 9px 10px; outline: 0; color: var(--text); background: #fff; font: inherit; font-size: 11px; line-height: 1.5; }
.conversation-announcement textarea:focus { border-color: #8ca5e5; box-shadow: 0 0 0 3px rgba(51,112,255,.1); }
.conversation-announcement-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 31px; }
.conversation-announcement-feedback { flex: 1; min-width: 0; margin: 0; }
.conversation-announcement-actions .button-muted { flex: 0 0 auto; height: 31px; padding: 0 12px; color: #5266a2; border-color: #cbd6ef; font-size: 10.5px; }
.conversation-announcement-actions .button-muted:hover { border-color: #9eb1dd; color: #294993; background: #f8faff; }
.conversation-announcement-actions .button-muted:disabled { cursor: wait; opacity: .55; }
.conversation-info-moderation { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 13px; padding: 11px 14px; border: 1px solid #e5e8f0; border-radius: 10px; background: #fff; }
.conversation-info-moderation > div { min-width: 0; }
.conversation-info-moderation strong, .conversation-info-moderation span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-info-moderation strong { color: #445170; font-size: 12px; }
.conversation-info-moderation span { margin-top: 3px; color: #929baa; font-size: 10.5px; }
.conversation-info-moderation .button-muted { flex: 0 0 auto; height: 31px; padding: 0 10px; color: #5266a2; border-color: #d0d6e7; font-size: 10.5px; }
.conversation-info-moderation .button-muted.is-enabled { color: #ad5d37; border-color: #e7c8b8; background: #fff8f4; }
.conversation-info-danger { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 13px; padding: 11px 14px; border: 1px solid #f0cbd2; border-radius: 10px; background: #fff8f9; }
.conversation-info-danger > div { min-width: 0; flex: 1; }
.conversation-info-danger strong, .conversation-info-danger span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-info-danger strong { color: #bd5d68; font-size: 12px; }
.conversation-info-danger span { margin-top: 3px; color: #a17d84; font-size: 10.5px; }
.conversation-info-danger .button-muted { flex: 0 0 auto; height: 31px; padding: 0 10px; font-size: 10.5px; }
.conversation-info-danger .button-muted:disabled { cursor: wait; opacity: .55; }
.conversation-info-actions {
  position: sticky;
  z-index: 2;
  bottom: -20px;
  display: flex;
  gap: 18px;
  margin: 18px -5px -20px;
  padding: 14px 0 20px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 14px);
}
.conversation-info-actions > .conversation-info-moderation,
.conversation-info-actions > .conversation-info-danger {
  display: flex;
  min-width: 0;
  flex: 1 1 0;
  align-items: stretch;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.conversation-info-actions > .conversation-info-moderation > div,
.conversation-info-actions > .conversation-info-danger > div { display: none; }
.conversation-info-actions .button-muted {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cbd6ef;
  border-radius: 9px;
  color: #5266a2;
  background: #fff;
  font-size: 11px;
}
.conversation-info-actions .button-muted:hover { border-color: #9eb1dd; color: #294993; background: #f8faff; }
.conversation-info-actions .conversation-info-danger .button-muted {
  border-color: #e7b8bf;
  color: #bd5d68;
}
.conversation-info-actions .conversation-info-danger .button-muted:hover { border-color: #d9949e; color: #a94755; background: #fff8f9; }
.conversation-info-tabs { display: flex; gap: 4px; margin: 0 0 14px; padding: 4px; border: 1px solid #e5e8f0; border-radius: 10px; background: #f5f6fa; }
.conversation-info-tab { display: inline-flex; flex: 1; align-items: center; justify-content: center; height: 34px; gap: 5px; border: 0; border-radius: 7px; color: #8b94a2; background: transparent; font-size: 11px; transition: color .18s ease, background .18s ease, box-shadow .18s ease; }
.conversation-info-tab:hover { color: #42527f; background: #eceff7; }
.conversation-info-tab.active { color: #263d90; background: #fff; box-shadow: 0 2px 7px rgba(47, 64, 112, .1); font-weight: 650; }
.conversation-info-tab > span { color: #a0a8b4; font-size: 10px; font-weight: 500; }
.conversation-info-tab.active > span { color: #6a7db7; }
.conversation-info-panel { min-width: 0; }
.conversation-member-permission { margin: 0 0 12px; padding: 9px 11px; border: 1px solid #ebe0c4; border-radius: 8px; color: #8b7442; background: #fffaf0; font-size: 11px; line-height: 1.5; }
.conversation-member-tools { margin: 0 0 13px; }
.conversation-member-tools .modal-search { height: 40px; }
.conversation-member-tools .search-submit { height: 30px; }
.conversation-member-tools .inline-feedback { min-height: 15px; margin: 5px 0 2px; }
.conversation-member-search-results { display: grid; gap: 3px; }
.conversation-member-search-results:empty { display: none; }
.conversation-member-result { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 8px; }
.conversation-member-result:hover { background: #f3f5fa; }
.conversation-member-result .avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 10px; }
.conversation-member-result-copy { min-width: 0; flex: 1; }
.conversation-member-result-copy strong, .conversation-member-result-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-member-result-copy strong { color: #3b4351; font-size: 11.5px; }
.conversation-member-result-copy span { margin-top: 2px; color: #99a1ae; font-size: 10px; }
.conversation-member-result .button-muted { height: 29px; padding: 0 9px; color: #2a5ce0; border-color: #d0d5e7; font-size: 10.5px; }
.conversation-member-result .button-muted:disabled { color: #9aa2af; border-color: #e1e4eb; background: #f7f8fa; cursor: default; }
.conversation-member-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px 10px; min-height: 112px; padding: 9px 2px 5px; }
.conversation-member { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 6px; }
.conversation-member .avatar { width: 46px; height: 46px; border-radius: 50%; font-size: 12px; }
.conversation-member > span { width: 100%; overflow: hidden; color: #697483; font-size: 11px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.conversation-member-name { display: flex; width: 100%; min-width: 0; align-items: center; justify-content: center; gap: 2px; overflow: hidden; color: #697483; font-size: 11px; text-align: center; }
.conversation-member-name > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-member-name .conversation-member-badge { flex: 0 0 auto; max-width: 100%; }
.conversation-members-empty { grid-column: 1 / -1; display: grid; place-items: center; min-height: 100px; color: #9aa3ae; font-size: 12px; }
.conversation-members-more { display: block; min-width: 118px; height: 34px; margin: 10px auto 0; color: #5266a2; font-size: 11px; }
.conversation-apps-section { margin: 0; padding: 15px; border: 1px solid #e3e6ef; border-radius: 11px; background: #fafbfe; }
.conversation-apps-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.conversation-apps-heading > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.conversation-apps-heading strong { color: #3b4560; font-size: 13px; }
.conversation-apps-heading span { color: #98a1af; font-size: 10.5px; }
.conversation-apps-hint { margin: 6px 0 9px; color: #8b94a2; font-size: 10.5px; line-height: 1.55; }
.conversation-apps-toolbar { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; }
.conversation-apps-search { display: flex; align-items: center; min-width: 0; height: 32px; flex: 1; gap: 7px; padding: 0 9px; border: 1px solid #e0e3eb; border-radius: 8px; background: #fff; }
.conversation-apps-search:focus-within { border-color: #9eadd8; box-shadow: 0 0 0 3px rgba(67, 96, 177, .07); }
.conversation-apps-search .search-icon { flex: 0 0 auto; width: 14px; height: 14px; margin: 0; color: #a1a8b5; }
.conversation-apps-search input { min-width: 0; width: 100%; height: 100%; padding: 0; border: 0; outline: 0; color: #4a5364; background: transparent; font-size: 10.5px; }
.conversation-apps-search input::placeholder { color: #adb4c0; }
.conversation-apps-browse { flex: 0 0 auto; height: 32px; padding: 0 10px; color: #5266a2; border-color: #d0d6e7; font-size: 10.5px; white-space: nowrap; }
.conversation-apps-list { display: grid; max-height: 286px; gap: 4px; overflow-y: auto; padding-right: 2px; }
.conversation-application { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 8px; border-radius: 9px; }
.conversation-application:hover { background: #f1f4fb; }
.conversation-application .avatar { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; font-size: 10px; }
.conversation-application-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.conversation-application-copy strong, .conversation-application-copy span, .conversation-application-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-application-copy strong { color: #3f4758; font-size: 11.5px; }
.conversation-application-copy span { color: #8d96a5; font-size: 10px; }
.conversation-application-copy small { color: #a3aab6; font-size: 9.5px; }
.conversation-application-toggle { flex: 0 0 auto; min-width: 58px; height: 29px; padding: 0 9px; color: #5266a2; border-color: #d0d6e7; font-size: 10.5px; }
.conversation-application-toggle.is-enabled { color: #2d7b57; border-color: #b8dfc8; background: #f0fbf4; }
.conversation-application-toggle:disabled { color: #9aa2af; border-color: #e1e4eb; background: #f7f8fa; cursor: default; }
.conversation-applications-empty { padding: 16px 8px 9px; color: #9aa3ae; font-size: 11px; text-align: center; }
.conversation-info-modal .inline-feedback { min-height: 16px; margin: 2px 0; font-size: 11px; }
.contact-modal header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.contact-modal h2 { margin: 0; color: #303c4a; font-size: 20px; }
.contact-modal header p:last-child { margin: 7px 0 0; color: #98a2ae; font-size: 11px; }
.modal-search { display: flex; align-items: center; height: 43px; gap: 8px; padding-left: 12px; border: 1px solid #dcdee5; border-radius: 9px; background: #fbfcfd; }
.modal-search:focus-within { border-color: #7d8ec5; box-shadow: 0 0 0 3px rgba(13, 49, 173, .07); }
.modal-search .search-icon { margin: 0; color: #9b9fad; }
.modal-search input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; color: #363a48; background: transparent; font-size: 12px; }
.search-submit { height: 33px; margin-right: 5px; padding: 0 13px; border: 0; border-radius: 7px; color: #fff; background: #3370ff; font-size: 11px; }
.contact-results { margin-top: 13px; }
.group-modal { width: min(560px, calc(100vw - 30px)); }
.group-title-field { display: grid; gap: 7px; margin-bottom: 14px; color: #707a8a; font-size: 11px; }
.group-title-field input { width: 100%; height: 40px; box-sizing: border-box; padding: 0 11px; border: 1px solid #dcdee5; border-radius: 9px; outline: 0; color: #363a48; background: #fbfcfd; font-size: 12px; }
.group-title-field input:focus { border-color: #7d8ec5; box-shadow: 0 0 0 3px rgba(13, 49, 173, .07); }
.group-selected-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 7px; color: #596579; font-size: 11px; }
.group-selected-heading span { color: #9aa3ae; font-size: 10px; }
.group-selected-members { display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; margin-bottom: 13px; padding: 7px; border: 1px solid #e5e8ee; border-radius: 9px; background: #fafbfc; }
.group-selected-empty { align-self: center; color: #a0a8b3; font-size: 10px; }
.group-member-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 180px; height: 27px; padding: 0 8px; border: 1px solid #d9e0f2; border-radius: 999px; color: #4560a7; background: #f0f4ff; font-size: 10px; cursor: pointer; }
.group-member-chip:hover { border-color: #aebbe0; background: #e8efff; }
.group-member-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-member-tools { margin-bottom: 4px; }
.group-member-results { display: grid; gap: 3px; max-height: 220px; margin-top: 7px; overflow: auto; }
.group-member-results:empty { display: none; }
.group-member-result { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 8px; }
.group-member-result:hover { background: #f3f5fa; }
.group-member-result .avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 10px; }
.group-member-result-copy { min-width: 0; flex: 1; }
.group-member-result-copy strong, .group-member-result-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-member-result-copy strong { color: #3b4351; font-size: 11.5px; }
.group-member-result-copy span { margin-top: 2px; color: #99a1ae; font-size: 10px; }
.group-member-result .button-muted { height: 29px; padding: 0 10px; color: #2a5ce0; border-color: #d0d5e7; font-size: 10.5px; }
.group-member-result .button-muted.selected { color: #738099; border-color: #e1e4eb; background: #f7f8fa; }
.group-modal .inline-feedback { min-height: 16px; margin: 7px 0; font-size: 11px; }
.group-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.group-modal-actions button { min-width: 82px; height: 36px; }
.modal-empty { padding: 35px 20px 24px; color: #9a9ea9; text-align: center; font-size: 11px; }
.modal-empty p { margin: 0; }
.user-result { display: flex; align-items: center; gap: 11px; padding: 11px 9px; border-radius: 9px; }
.user-result:hover { background: #f1f3f8; }
.user-result-copy { min-width: 0; flex: 1; }
.user-result-copy strong, .user-result-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-result-copy strong { color: #383c4a; font-size: 13px; }
.user-result-copy span { margin-top: 4px; color: #9a9ea9; font-size: 10px; }
.user-result .button-muted { height: 31px; padding: 0 10px; color: #2a5ce0; border-color: #d0d5e7; font-size: 11px; }
.user-result .button-muted:hover { background: #edf0fa; }

@media (max-width: 850px) {
  .auth-screen { grid-template-columns: 1fr; min-height: 100vh; }
  .auth-visual { display: none; }
  .auth-card { width: min(430px, calc(100% - 34px)); margin: auto; }
  .apps-info { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .product-view { padding: 27px 18px; }
  .product-header { flex-direction: column; gap: 17px; margin-bottom: 23px; }
  .product-toolbar { flex-wrap: nowrap; gap: 8px; }
  .product-toolbar .inline-search { flex: 1 1 auto; min-width: 0; flex-basis: auto; }
  #contacts-search-button { padding: 0 13px; }
  .contact-list { grid-template-columns: 1fr; }
  .apps-layout { gap: 14px; }
  .app-discovery-section { padding: 18px; }
  .app-discovery-heading { flex-direction: column; gap: 5px; }
  .app-discovery-search { height: 42px; }
  .app-discovery-card { align-items: flex-start; }
  .app-discovery-open { align-self: center; }
  .app-key-panel { padding: 18px; }
  .app-key-copy { flex-wrap: wrap; align-items: flex-start; }
  .app-create-trigger { width: 100%; }
  .app-form-row { grid-template-columns: 1fr; }
  .app-form-actions { justify-content: stretch; }
  .app-form-actions .send-button { width: 100%; }
  .app-card { padding: 15px; }
  .app-card-foot { flex-direction: column; align-items: stretch; }
  .app-card-actions { width: 100%; }
  .app-card-actions .app-debug, .app-card-actions .app-edit, .app-card-actions .app-delete { flex: 1; width: auto; }
  .apps-doc-bar { flex-direction: column; align-items: stretch; }
  .apps-doc-actions { justify-content: flex-end; }
  .app-key-panel.create-modal { width: calc(100vw - 24px); max-height: calc(100vh - 24px); padding: 22px 20px 20px; }
  .conversation-info-modal { width: calc(100vw - 24px); padding: 20px; }
  .conversation-member-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px 8px; }
}

/* A message row may also carry the compact class for consecutive messages.
   Keep it independent from compact product buttons and always render it as
   one full-width chat row. */
.message-area > .message-row {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  flex: 0 0 100%;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 9px;
}

/* WeChat-style composer: the editor, tool buttons and send action share one
   rounded panel instead of rendering as separate controls. */
.composer-area {
  position: relative;
  margin: 0 16px 16px;
  padding: 10px 10px 48px;
  border: 1px solid #e1e6e9;
  border-radius: 10px;
  background: #fff;
}
.composer {
  display: block;
}
.composer-attachments { display: flex; flex-direction: column; gap: 7px; margin: 0 0 8px; padding: 7px 8px; border: 1px solid #e3e5e9; border-radius: 8px; background: #fbfcfd; }
.composer-quote { display: flex; align-items: flex-start; gap: 8px; min-width: 0; padding: 6px 8px; border-left: 3px solid #7a8dc6; border-radius: 3px 6px 6px 3px; color: #68737d; background: #f1f3fa; font-size: 11px; line-height: 1.4; }
.composer-quote-copy { min-width: 0; flex: 1; overflow: hidden; }
.composer-quote-copy strong { display: block; overflow: hidden; color: #45527e; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.composer-quote-content { max-height: 54px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.composer-quote-content img { display: inline-block; width: 34px; height: 34px; margin-right: 4px; object-fit: cover; vertical-align: middle; }
.composer-quote .composer-remove { position: static; flex: 0 0 auto; }
.composer-image-list { display: flex; flex-wrap: wrap; gap: 7px; }
.composer-image-item { position: relative; width: 64px; height: 64px; overflow: hidden; border: 1px solid #dcdfe6; border-radius: 7px; background: #eeeff3; }
.composer-image-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.composer-image-item.is-error::after { position: absolute; inset: 0; display: grid; place-items: center; padding: 4px; color: #a34f4f; background: rgba(255, 247, 247, .9); content: '图片不可用'; font-size: 10px; text-align: center; }
.composer-remove { position: absolute; z-index: 1; top: 3px; right: 3px; display: grid; place-items: center; width: 17px; height: 17px; border: 0; border-radius: 50%; color: #fff; background: rgba(37, 47, 55, .48); font-size: 13px; line-height: 1; }
.composer-remove:hover { background: rgba(37, 47, 55, .75); }
.composer-remove .ui-icon { width: 11px; height: 11px; stroke-width: 2.6; }
.composer textarea {
  display: block;
  width: 100%;
  height: 96px;
  min-height: 96px;
  max-height: 96px;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  padding: 2px 4px 0;
  background: transparent;
  box-shadow: none;
}
.composer textarea:focus {
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}
.composer-toolbar {
  position: absolute;
  right: 10px;
  bottom: 8px;
  left: 10px;
  height: 30px;
  border-top: 0;
}
.toolbar-hint {
  margin-right: 70px;
  white-space: nowrap;
}
.composer .send-button {
  position: absolute;
  right: 10px;
  bottom: 8px;
  min-width: 58px;
  height: 30px;
  border-radius: 7px;
  box-shadow: none;
  font-size: 12px;
}
.emoji-popover {
  bottom: calc(100% + 8px);
  left: 0;
}

@media (max-width: 600px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    width: 100vw;
    height: 100vh;
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .app-shell.product-mode { grid-template-columns: minmax(0, 1fr); }
  .app-nav {
    position: absolute;
    z-index: 8;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: 100%;
    height: 54px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 9px;
    border-top: 1px solid #e3e8eb;
    border-right: 0;
  }
  .app-nav .nav-profile { display: none; }
  .app-nav .nav-list,
  .app-nav .nav-bottom {
    flex-direction: row;
    align-items: center;
    gap: 5px;
    margin: 0;
  }
  .app-nav .nav-list { align-self: auto; }
  .app-nav .nav-bottom { margin-left: auto; }
  .app-nav .nav-item { width: 38px; height: 38px; }
  .chat-panel { padding-bottom: 54px; }
  .conversation-panel {
    position: absolute;
    z-index: 10;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, 86vw);
    height: auto;
    transform: translateX(-102%);
    /* The drawer is off-screen while closed. Do not let its shadow bleed
       into the left edge of the chat viewport. */
    box-shadow: none;
  }
  .conversation-panel.mobile-open {
    transform: translateX(0);
    box-shadow: 10px 0 28px rgba(31, 43, 57, .18);
  }
  .mobile-conversation-backdrop {
    position: fixed;
    z-index: 9;
    inset: 0;
    display: block;
    border: 0;
    padding: 0;
    background: rgba(24, 35, 47, .22);
  }
  .mobile-conversation-backdrop.hidden { display: none; }
  .mobile-conversations { display: grid; flex: 0 0 auto; }
  .chat-header { padding: 0 10px; }
  .chat-announcement { padding: 0 10px; }
  .chat-title-wrap { gap: 7px; }
  .chat-title-wrap h1 { max-width: calc(100vw - 130px); font-size: 14px; }
  .chat-actions { gap: 0; }
  .message-area { padding: 18px 10px 12px; }
  .message-content { max-width: calc(100vw - 78px); }
  .message-bubble img { max-width: min(220px, calc(100vw - 112px)); }
  .composer-area {
    margin: 0 8px 8px;
    padding: 8px 9px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .composer textarea {
    height: 42px;
    min-height: 42px;
    max-height: 96px;
    overflow-y: hidden;
    padding: 10px 126px 10px 11px;
    border: 1px solid #e3e7ed;
    border-radius: 14px;
    background: #fafbfc;
    line-height: 1.45;
  }
  .composer textarea:focus { border-color: #e3e7ed; box-shadow: none; background: #fafbfc; }
  .composer-toolbar {
    right: 13px;
    bottom: 12px;
    left: auto;
    width: auto;
    height: 34px;
    gap: 2px;
    border-top: 0;
    pointer-events: none;
  }
  .composer-toolbar > * { pointer-events: auto; }
  .composer-toolbar .toolbar-hint { display: none; }
  .composer-toolbar .tool-button { width: 30px; height: 30px; border-radius: 50%; }
  .composer-toolbar #image-button { border: 0; border-radius: 5px; color: #697482; }
  .composer-toolbar #image-button .ui-icon,
  .composer-toolbar #image-button .composer-icon { display: block; width: 17px; height: 17px; }
  .composer-area.has-composer-content #image-button { display: none; }
  .composer-area.has-composer-content .composer-toolbar { right: 75px; }
  .composer .send-button {
    position: absolute;
    right: 13px;
    bottom: 12px;
    display: none;
    min-width: 58px;
    height: 34px;
    border-radius: 9px;
    box-shadow: none;
    font-size: 12px;
  }
  .composer-area.has-composer-content .send-button { display: block; }
}

/* Keep the desktop chat panel full width. Only the message stream's inner
   spacing is tightened so the avatar sits near the conversation divider
   without leaving an artificial blank column on the right. */
@media (min-width: 1200px) {
  .message-area {
    padding-left: 18px;
    padding-right: 18px;
  }
}

.message-mention { display: inline-block; padding: 0 3px; border-radius: 4px; color: #315fc1; background: #eaf0ff; font-weight: 650; }
.message-emoji { display: inline-block; width: 1.35em; height: 1.35em; margin: 0 .08em; vertical-align: -.28em; object-fit: contain; }
.message-bubble img.message-emoji { display: inline-block; max-width: none; margin: 0 .08em; border-radius: 0; }
/* Message actions opened with the desktop right mouse button (and the
   equivalent context gesture on touch-enabled browsers). */
.message-context-menu {
  position: fixed;
  z-index: 20;
  display: grid;
  width: 148px;
  overflow: hidden;
  padding: 4px;
  border: 1px solid #e0e1e9;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(31, 45, 59, .18);
}
.message-context-menu.hidden { display: none; }
.message-context-menu button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 11px;
  color: #3f4d59;
  background: transparent;
  font-size: 12px;
  text-align: left;
}
.message-context-menu button:hover { color: #1d5fd6; background: #edf0f9; }
.message-context-menu button[data-message-action="delete"] { color: #c2615c; }
.message-context-menu button[data-message-action="delete"]:hover { color: #ad4f49; background: #fff3f1; }
.message-context-menu button[data-message-action="report"] { color: #b05d56; }
.message-context-menu button[data-message-action="report"]:hover { color: #a24740; background: #fff3f1; }
.member-context-menu {
  position: fixed;
  z-index: 40;
  display: grid;
  min-width: 142px;
  padding: 5px;
  border: 1px solid #dfe4ec;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(34, 48, 69, .17);
}
.member-context-menu.hidden { display: none; }
.member-context-menu button {
  height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  color: #4e596b;
  background: transparent;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}
.member-context-menu button:hover { color: #1d5fd6; background: #edf0f9; }
.member-context-menu button[data-member-action="remove"] { color: #c2615c; }
.member-context-menu button[data-member-action="remove"]:hover { color: #ad4f49; background: #fff3f1; }
.list-context-menu {
  position: fixed;
  z-index: 45;
  display: grid;
  min-width: 142px;
  padding: 5px;
  border: 1px solid #dfe4ec;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(34, 48, 69, .17);
}
.list-context-menu.hidden { display: none; }
.list-context-menu button {
  height: 33px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  color: #4e596b;
  background: transparent;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}
.list-context-menu button:hover { color: #1d5fd6; background: #edf0f9; }
.list-context-menu button[data-conversation-action="remove"],
.list-context-menu button[data-contact-action="delete"],
.list-context-menu button[data-direct-action="clear"] { color: #c2615c; }
.list-context-menu button[data-conversation-action="remove"]:hover,
.list-context-menu button[data-contact-action="delete"]:hover,
.list-context-menu button[data-direct-action="clear"]:hover { color: #ad4f49; background: #fff3f1; }
.list-context-menu button:disabled { cursor: wait; opacity: .55; }
.floating-app-window {
  position: fixed;
  z-index: 4;
  display: flex;
  min-width: 300px;
  min-height: 300px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d7deea;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(27, 42, 67, .24), 0 3px 10px rgba(27, 42, 67, .1);
  resize: both;
}
.floating-app-window.hidden { display: none !important; }
.floating-app-window.minimized {
  width: 210px !important;
  height: 46px !important;
  min-width: 0;
  min-height: 0;
  border-radius: 23px;
  resize: none;
}
.floating-app-window.minimized .floating-app-messages,
.floating-app-window.minimized .floating-app-composer { display: none; }
.floating-app-window.minimized .floating-app-header {
  flex-basis: 46px;
  height: 46px;
  padding: 0 7px 0 9px;
  border-bottom: 0;
  border-radius: inherit;
}
.floating-app-window.minimized .floating-app-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.floating-app-window.minimized .floating-app-title-wrap { gap: 7px; }
.floating-app-window.minimized .floating-app-title-copy { gap: 0; }
.floating-app-window.minimized .floating-app-title-copy strong { font-size: 12px; }
.floating-app-window.minimized .floating-app-title-copy span { display: none; }
.floating-app-window.minimized .floating-app-title-copy span.is-notification {
  display: block;
  max-width: 112px;
  overflow: hidden;
  color: #3370ff;
  font-size: 10px;
  line-height: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.floating-app-window.minimized .floating-app-actions .icon-button { width: 27px; height: 27px; }
.floating-app-header {
  display: flex;
  flex: 0 0 56px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 9px 0 13px;
  border-bottom: 1px solid #e6eaf0;
  color: #334153;
  background: #fff;
  cursor: grab;
  touch-action: none;
}
.floating-app-window.is-dragging .floating-app-header { cursor: grabbing; }
.floating-app-title-wrap { display: flex; min-width: 0; align-items: center; gap: 9px; }
.floating-app-avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 10px; }
.floating-app-title-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.floating-app-title-copy strong { overflow: hidden; color: #303b49; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.floating-app-title-copy span { overflow: hidden; color: #9aa5b1; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.floating-app-actions { display: flex; flex: 0 0 auto; gap: 2px; }
.floating-app-actions .icon-button { width: 29px; height: 29px; border-radius: 6px; }
.floating-app-actions .icon-button:hover { color: #2a5ce0; background: #edf1fa; }
.floating-app-messages { flex: 1 1 auto; min-height: 0; padding: 15px 14px; background: #f8fafc; }
.floating-app-messages .message-row { margin: 10px 0; }
.floating-app-messages .message-content { max-width: 82%; }
.floating-app-messages .message-bubble img { max-width: 170px; }
.floating-app-composer { position: relative; display: block; flex: 0 0 auto; min-width: 0; margin: 0; padding: 8px 9px; border: 0; border-radius: 0; background: transparent; }
.floating-app-attachments { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.floating-app-quote { display: flex; min-width: 0; align-items: center; gap: 7px; padding: 5px 7px; border-left: 3px solid #7a8dc6; border-radius: 3px 5px 5px 3px; color: #68737d; background: #f1f3fa; font-size: 10px; line-height: 1.35; }
.floating-app-quote-copy { min-width: 0; flex: 1; overflow: hidden; }
.floating-app-quote-copy strong,
.floating-app-quote-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.floating-app-quote-copy strong { color: #45527e; font-size: 10px; }
.floating-app-quote-copy span { color: #68737d; }
.floating-app-quote-remove { position: static; flex: 0 0 auto; width: 17px; height: 17px; }
.floating-app-image-list { display: flex; flex-wrap: wrap; gap: 6px; }
.floating-app-image-list .composer-image-item { width: 52px; height: 52px; }
.floating-app-toolbar { position: absolute; z-index: 2; right: 13px; bottom: 12px; left: auto; display: flex; width: auto; height: 34px; align-items: center; gap: 2px; border-top: 0; pointer-events: none; }
.floating-app-composer.has-floating-composer-content .floating-app-toolbar,
.floating-app-composer.has-composer-content .floating-app-toolbar { right: 75px; }
.floating-app-toolbar > * { pointer-events: auto; }
.floating-app-toolbar .tool-button { width: 30px; height: 30px; border-radius: 50%; color: #697482; }
.floating-app-toolbar .tool-button:hover { color: #2a5ce0; background: #edf0f8; }
.floating-app-toolbar .tool-button.active { color: #c95645; background: #fff0ed; }
.floating-app-toolbar .tool-button:disabled { cursor: not-allowed; opacity: .45; }
.floating-app-toolbar .composer-icon,
.floating-app-toolbar .ui-icon { display: block; width: 17px; height: 17px; }
.floating-app-toolbar .floating-app-image-button { display: grid; border-radius: 5px; }
.floating-app-toolbar .floating-app-burn-button .burn-icon-on { display: none; }
.floating-app-toolbar .floating-app-burn-button.active .burn-icon-off { display: none; }
.floating-app-toolbar .floating-app-burn-button.active .burn-icon-on { display: block; }
.floating-app-emoji-popover { right: 0; bottom: calc(100% + 7px); left: auto; width: min(270px, calc(100vw - 30px)); padding: 10px 10px 8px; }
.floating-app-emoji-grid { grid-template-columns: repeat(8, 1fr); max-height: 160px; }
.floating-app-emoji-grid button { width: 28px; height: 28px; font-size: 18px; }
.floating-app-composer-row { position: static; display: block; min-width: 0; }
.floating-app-composer textarea { display: block; width: 100%; min-width: 0; height: 42px; min-height: 42px; max-height: 96px; resize: none; overflow-y: hidden; border: 1px solid #e3e7ed; border-radius: 14px; padding: 10px 126px 10px 11px; outline: 0; color: var(--text); background: #fafbfc; font-size: 13px; line-height: 1.45; }
.floating-app-composer textarea:focus { border-color: #e3e7ed; box-shadow: none; background: #fafbfc; }
.floating-app-composer.has-floating-composer-content .floating-app-image-button,
.floating-app-composer.has-composer-content .floating-app-image-button { display: none; }
.floating-app-composer .send-button { position: absolute; right: 13px; bottom: 12px; display: none; min-width: 58px; height: 34px; padding: 0 10px; border-radius: 9px; box-shadow: none; font-size: 12px; }
.floating-app-composer.has-floating-composer-content .send-button,
.floating-app-composer.has-composer-content .send-button { display: block; }
.floating-app-composer .send-button:disabled { cursor: not-allowed; opacity: .55; }
.floating-app-window textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.message-context-menu { z-index: 55; }
.conversation-item.pinned .conversation-name { color: #2f467f; }
.conversation-pin {
  display: inline-flex;
  align-items: center;
  height: 15px;
  margin-left: 5px;
  padding: 0 4px;
  border-radius: 4px;
  color: #5d6fa9;
  background: #e9edfa;
  font-size: 8px;
  font-weight: 650;
  line-height: 1;
  vertical-align: 1px;
  white-space: nowrap;
}
.conversation-member-badge,
.message-sender-badge {
  display: inline-flex;
  align-items: center;
  height: 17px;
  margin-left: 5px;
  padding: 0 5px;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: #6677b0;
  background: #f0f3ff;
  font-size: 9px;
  font-weight: 650;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
}
.conversation-member-badge.owner,
.message-sender-badge.owner { color: #ce6d58; background: #fff0ea; }
.conversation-member-badge.admin,
.message-sender-badge.admin { color: #2875c7; background: #eaf4ff; }
.message-sender-badge.bot {
  margin-left: 0;
  margin-right: 5px;
  border-color: #d8a62e;
  color: #8a5c00;
  background: linear-gradient(180deg, #fff4c9 0%, #f5d978 100%);
  box-shadow: 0 1px 3px rgba(181, 126, 11, .16);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .35px;
}
.conversation-member-badge.custom { font-weight: 600; }
.message-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0; }
.mute-composer .composer,
.mute-composer .composer-toolbar { opacity: .68; }
.mute-composer textarea,
.mute-composer button:disabled { cursor: not-allowed; }

.confirm-modal { width: min(420px, calc(100vw - 30px)); padding: 22px; border: 1px solid #e1e6eb; border-radius: 14px; background: #fff; box-shadow: 0 20px 70px rgba(26, 39, 55, .2); }
.confirm-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.confirm-modal-header h2 { margin: 0; color: #303c4a; font-size: 18px; }
.confirm-message { margin: 17px 0 0; color: #53606d; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
.confirm-input-wrap { display: grid; gap: 7px; margin-top: 15px; color: #687585; font-size: 12px; }
.confirm-input-field { display: flex; align-items: center; width: 100%; height: 40px; min-height: 40px; border: 1px solid #dce2e8; border-radius: 8px; background: #fafbfc; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.confirm-input-field:focus-within { border-color: #919fcf; box-shadow: 0 0 0 3px rgba(13, 54, 187, .08); background: #fff; }
.confirm-input { display: block; min-width: 0; width: 100%; height: 38px; min-height: 38px; border: 0; border-radius: 7px; padding: 0 10px; outline: 0; color: var(--text); background: transparent; font: inherit; line-height: 1.5; }
.confirm-input:focus-visible { outline: 0; }
.confirm-input-field.color-only { justify-content: flex-start; }
.confirm-input-field.color-only .confirm-input { display: none; }
.confirm-color-control { display: flex; align-items: center; gap: 11px; min-height: 40px; }
.confirm-color-input { flex: 0 0 auto; width: 32px; height: 32px; aspect-ratio: 1; margin: 0 4px 0 0; border: 1px solid #d2dbe7; border-radius: 6px; padding: 2px; background: #fff; cursor: pointer; }
.confirm-color-input:disabled { cursor: not-allowed; opacity: .55; }
.confirm-color-default { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: #687585; font-size: 12px; cursor: pointer; }
.confirm-color-default input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.confirm-actions .send-button.danger { background: #c45d58; }
.confirm-actions .send-button.danger:hover { background: #ad4f49; }
.confirm-input-wrap.member-title-input .confirm-input-field { background: #fff; }
.confirm-input-wrap.member-title-input .confirm-color-control { gap: 8px; }
#confirm-modal.member-title-dialog .confirm-actions { justify-content: space-between; }
#confirm-modal.member-title-dialog .confirm-actions .send-button { order: -1; }

.message-image { cursor: zoom-in; }
.burn-pending-image { filter: blur(8px); cursor: pointer; }
.burn-cover,
.burn-image-hint { border: 0; border-radius: 7px; color: #8e4f45; background: #fff2ef; cursor: pointer; font-size: 11px; }
.burn-cover { display: block; width: 100%; min-height: 48px; padding: 10px 13px; }
.burn-image-hint { display: block; margin: 6px 0 0; padding: 5px 8px; }
.burn-countdown { display: block; margin-top: 5px; color: #b46a5b; font-size: 10px; }

.image-viewer { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; background: rgba(20, 27, 36, .78); backdrop-filter: blur(4px); }
.image-viewer.hidden { display: none; }
.image-viewer-panel { position: relative; display: flex; width: min(94vw, 980px); height: min(92vh, 760px); flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.image-viewer-stage { display: grid; width: 100%; min-height: 0; flex: 1; place-items: center; overflow: hidden; }
.image-viewer-stage img { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; transform-origin: center; transition: transform .15s ease; }
.image-viewer-close { position: absolute; z-index: 1; top: -4px; right: -4px; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .42); cursor: pointer; font-size: 25px; line-height: 1; }
.image-viewer-close .ui-icon { width: 16px; height: 16px; stroke-width: 2.2; }
.image-viewer-controls { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 9px; color: #eef0f5; background: rgba(0, 0, 0, .44); }
.image-viewer-controls button { min-width: 32px; height: 28px; border: 0; border-radius: 6px; color: inherit; background: transparent; cursor: pointer; font-size: 17px; }
.image-viewer-controls button:hover { background: rgba(255, 255, 255, .16); }
.image-viewer-controls button .ui-icon { width: 15px; height: 15px; stroke-width: 2; }
.image-viewer-controls span { min-width: 48px; font-size: 11px; text-align: center; }

.forward-modal {
  width: min(500px, calc(100vw - 30px));
  max-height: min(670px, calc(100vh - 36px));
  overflow: auto;
  padding: 25px;
  border: 1px solid #e0e2e9;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 70px rgba(26, 39, 55, .2);
}
.forward-modal header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.forward-modal h2 { margin: 0; color: #303c4a; font-size: 20px; }
.forward-modal header p:last-child { margin: 7px 0 0; color: #98a2ae; font-size: 11px; }
.forward-list { display: grid; gap: 3px; max-height: min(420px, calc(100vh - 220px)); overflow-y: auto; }
.forward-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 57px;
  gap: 11px;
  border: 0;
  border-radius: 9px;
  padding: 8px 9px;
  color: inherit;
  background: transparent;
  text-align: left;
}
.forward-item:hover { background: #f1f3f8; }
.forward-item .avatar { width: 38px; height: 38px; border-radius: 50%; font-size: 11px; }
.forward-item-copy { min-width: 0; flex: 1; }
.forward-item-copy strong,
.forward-item-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forward-item-copy strong { color: #383c4a; font-size: 13px; }
.forward-item-copy span { margin-top: 4px; color: #9a9ea9; font-size: 10px; }
.forward-list .modal-empty { padding: 24px 20px 14px; }

@media (max-width: 600px) {
  .forward-modal { padding: 20px; }
}

/* Inline application discovery for the app-conversation search field. The
   popover is positioned over the conversation list so results never increase
   the sidebar's layout height. */
.conversation-toolbar { position: relative; z-index: 4; }
.app-chat-search-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  display: grid;
  max-height: min(300px, 52vh);
  gap: 3px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #dfe4ec;
  border-radius: 10px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 13px 30px rgba(38, 50, 68, .18);
  scrollbar-width: thin;
}
.app-chat-search-popover.hidden { display: none; }
.app-chat-search-result {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 58px;
  gap: 9px;
  border: 0;
  border-radius: 7px;
  padding: 7px 8px;
  color: inherit;
  background: transparent;
  text-align: left;
  transition: background .15s ease;
}
.app-chat-search-result:hover,
.app-chat-search-result:focus-visible { background: #f0f3fa; }
.app-chat-search-result:disabled { cursor: wait; opacity: .62; }
.app-chat-search-result .avatar { width: 36px; height: 36px; border-radius: 50%; font-size: 12px; }
.app-chat-search-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.app-chat-search-copy strong,
.app-chat-search-copy span,
.app-chat-search-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-chat-search-copy strong { color: #354568; font-size: 12px; }
.app-chat-search-copy span { color: #8290af; font-size: 10px; }
.app-chat-search-copy small { color: #9aa6be; font-size: 10px; }
.app-chat-search-action {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid #cbd6ef;
  border-radius: 6px;
  color: #3e5ba8;
  background: #f8faff;
  font-size: 10px;
  white-space: nowrap;
}
.app-chat-search-result:hover .app-chat-search-action,
.app-chat-search-result:focus-visible .app-chat-search-action { border-color: #9eb1dd; color: #294993; background: #eef3ff; }
.app-chat-search-empty { padding: 17px 10px; color: #96a1ba; font-size: 11px; text-align: center; }
.app-chat-search-empty.is-error { color: #c2766e; }

@media (max-width: 600px) {
  .app-chat-search-popover { max-height: min(260px, 44vh); }
  .app-chat-search-result { min-height: 56px; }
}

/* Keep fallback and uploaded avatars circular with transparent corners. */
.avatar.default-avatar,
.app-card-mark.default-avatar,
.avatar.static-avatar,
.avatar.has-image,
.app-card-mark.has-image { background: transparent; border-radius: 50%; }
.avatar.default-avatar img,
.app-card-mark.default-avatar img,
.avatar.static-avatar img,
.avatar.has-image img { border-radius: 50%; }

@media (max-width: 600px) {
  .floating-app-window {
    min-width: 0;
    max-width: calc(100vw - 16px);
  }
  .floating-app-composer { padding: 8px 9px; }
}
