: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; }

.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: 10px; font-weight: 650; }
.avatar.has-image { background: #e6e8f0; }
.avatar.has-image img { display: block; width: 100%; height: 100%; 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-wrap { display: flex; align-items: center; height: 38px; margin: 13px 13px 7px; padding: 0 10px; border-radius: 8px; color: #93a0af; background: #e8ebef; }
.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; }
.search-wrap input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 13px; }
.search-wrap input::placeholder { color: #9ba4af; }
.conversation-tabs { display: flex; gap: 3px; padding: 0 13px 8px; }
.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; }
.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; }
.version-pill { padding: 2px 5px; border-radius: 4px; color: #5768a3; background: #e2e6f2; font-size: 9px; }

.chat-panel { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: #f8f9fa; }
.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; }
.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: 8px; 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 { 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-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; margin-bottom: 3px; color: #4e5774; font-size: 10px; }
.message-quote-content { max-height: 72px; overflow: hidden; }
.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); }
.card { min-width: 210px; margin: 1px 0; padding: 10px; border: 1px solid #c0c8e1; border-radius: 9px; color: #34465a; background: #f4f7ff; }
.card strong { display: block; margin-bottom: 5px; color: #25346b; }
.card div { margin: 3px 0; }
.card hr { border-color: #cad1e6; }
.card[data-theme="dark"] { color: #e5e7eb; border-color: #374151; background: #1f2937; }
.card[data-theme="dark"] strong { color: #8fa0dd; }
.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; }
.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; }
.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: 8; 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; }
  .search-wrap { margin-left: 8px; margin-right: 8px; }
  .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-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: 10px; 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:hover { color: #2e3d4d; background: #fff; }
.nav-item.active { color: #2a5ce0; background: #fff; box-shadow: 0 4px 12px rgba(73,89,103,.1); }
.conversation-panel { background: #fff; border-right-color: #e5e9ec; }
.conversation-header { height: 68px; padding: 0 17px; background: #fff; }
.conversation-header .profile-chip { width: 100%; }
.search-row { display: flex; align-items: center; gap: 7px; margin: 12px 13px 8px; }
.search-row .search-wrap { flex: 1; min-width: 0; margin: 0; }
.search-row > .icon-button { flex: 0 0 34px; width: 34px; height: 34px; border: 1px solid #e1e7eb; border-radius: 7px; background: #fff; }
.search-row > .icon-button:hover { border-color: #b9c2dc; color: #0b2b98; background: #f0f3fa; }
.search-wrap { height: 34px; margin: 12px 13px 8px; border-radius: 5px; background: #f4f6f8; }
.conversation-tabs { padding-bottom: 7px; }
.conversation-tab:hover, .conversation-tab.active { color: #163498; background: #e4e8f6; }
.conversation-list { padding: 0 7px; }
.conversation-item { 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-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; }
.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: 7px; }
.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; }
.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; }
.message-row.compact .message-bubble { border-radius: 7px 11px 11px 11px; }
.message-row.outgoing.compact .message-bubble { border-radius: 11px 7px 11px 11px; }
.message-row { gap: 9px; }
.date-divider { width: 100%; }
.message-row > .avatar { flex: 0 0 34px; }

@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-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-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: 12px; color: #fff; background: linear-gradient(145deg, #4261cb, #2450cc); font-size: 15px; font-weight: 700; }
.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 { overflow: hidden; 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; }
.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; }
.settings-modal .eyebrow, .contact-modal .eyebrow { margin-bottom: 8px; }
.settings-modal label { margin: 12px 0; }
.settings-modal label input { height: 40px; }
.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); }
.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; }
.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-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-delete { width: 100%; }
  .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; }
}

/* 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%);
    box-shadow: 10px 0 28px rgba(31, 43, 57, .18);
  }
  .conversation-panel.mobile-open { transform: translateX(0); }
  .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-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 48px; }
}

/* 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;
  }
}

/* Card message composer and rich Card AST rendering. */
.card-editor-modal {
  width: min(700px, calc(100vw - 30px));
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  padding: 25px;
  border: 1px solid #dfe2e9;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 70px rgba(26, 39, 55, .2);
}
.card-editor-modal header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.card-editor-modal h2 { margin: 0; color: #303c4a; font-size: 20px; }
.card-editor-modal header p:last-child { margin: 7px 0 0; color: #98a2ae; font-size: 11px; }
.card-editor-modal form { display: grid; gap: 13px; }
.card-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, .46fr); gap: 12px; }
.card-editor-modal label { display: grid; gap: 7px; color: #687585; font-size: 11px; }
.card-editor-modal input,
.card-editor-modal select,
.card-editor-modal textarea { width: 100%; border: 1px solid #dcdee5; border-radius: 8px; padding: 0 10px; outline: 0; color: #363a48; background: #fbfcfd; font-size: 12px; }
.card-editor-modal input,
.card-editor-modal select { height: 40px; }
.card-editor-modal textarea { min-height: 92px; resize: vertical; padding-top: 10px; padding-bottom: 10px; line-height: 1.55; }
.card-editor-modal input:focus,
.card-editor-modal select:focus,
.card-editor-modal textarea:focus { border-color: #7d8ec5; box-shadow: 0 0 0 3px rgba(13, 49, 173, .07); }
.card-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.card-editor-actions .button-muted,
.card-editor-actions .send-button { height: 38px; }
.card-editor-hint { margin: 15px 0 0; color: #999ca8; font-size: 10px; line-height: 1.6; }
.card-editor-hint code { color: #3b4b7f; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.card-message {
  width: min(360px, 100%);
  min-width: 240px;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border-color: #b9d9f2;
  border-radius: 11px;
  background: #f5fbff;
  color: #33485d;
}
.card-message .card-heading { display: block; margin: 0; padding: 14px 14px 5px; color: #1f6698; font-size: 15px; line-height: 1.35; }
.card-message .card-text { margin: 0; padding: 3px 14px 12px; color: #5d7385; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.card-message .card-image { display: block; width: 100%; max-height: 180px; object-fit: cover; }
.card-message > .card-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 0 14px 12px; padding: 9px 0 0; border-top: 1px solid #d8eaf6; color: #8a9aa7; font-size: 11px; }
.card-message .card-kv strong { margin: 0; color: #4b718d; font-size: 11px; font-weight: 650; text-align: right; }
.card-message .card-separator { margin: 0 14px 10px; border: 0; border-top: 1px dashed #c9dfed; }
.card-message .card-action { display: block; width: 100%; margin: 0; padding: 10px 14px; border: 0; border-top: 1px solid #d5e8f4; color: #1676bd; background: rgba(255,255,255,.52); cursor: pointer; font-size: 12px; text-align: left; }
.card-message .card-action:hover { color: #0f5f98; background: #fff; }
.card-message .card-action:disabled { color: #a5b1b9; cursor: not-allowed; }
.card-message .card-inline-link { display: block; width: fit-content; margin: 0 14px 12px; padding: 2px 0; border: 0; color: #1676bd; background: transparent; cursor: pointer; font-size: 12px; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.card-message .card-inline-link:hover { color: #0f5f98; }
.card-message .card-inline-link:disabled { color: #a5b1b9; cursor: not-allowed; }
.card-message[data-theme="green"] { border-color: #bac3e1; background: #f4f7ff; }
.card-message[data-theme="green"] .card-heading { color: #263876; }
.card-message[data-theme="green"] .card-text { color: #5c647f; }
.card-message[data-theme="green"] > .card-kv { border-color: #d7ddee; }
.card-message[data-theme="green"] .card-kv strong { color: #3b4876; }
.card-message[data-theme="green"] .card-action { border-color: #d6dbec; color: #263a7f; }
.card-message[data-theme="green"] .card-inline-link { color: #263a7f; }
.card-message[data-theme="orange"] { border-color: #efd0a8; background: #fffaf3; }
.card-message[data-theme="orange"] .card-heading { color: #ad6b1f; }
.card-message[data-theme="orange"] .card-text { color: #866d52; }
.card-message[data-theme="orange"] > .card-kv { border-color: #f1dfc8; }
.card-message[data-theme="orange"] .card-kv strong { color: #9a6a35; }
.card-message[data-theme="orange"] .card-action { border-color: #f0dfc8; color: #b66b18; }
.card-message[data-theme="orange"] .card-inline-link { color: #b66b18; }
.card-message[data-theme="purple"] { border-color: #d5c9ec; background: #fbf9ff; }
.card-message[data-theme="purple"] .card-heading { color: #7656a8; }
.card-message[data-theme="purple"] .card-text { color: #746788; }
.card-message[data-theme="purple"] > .card-kv { border-color: #e4ddf2; }
.card-message[data-theme="purple"] .card-kv strong { color: #7656a8; }
.card-message[data-theme="purple"] .card-action { border-color: #e4ddf2; color: #7656a8; }
.card-message[data-theme="purple"] .card-inline-link { color: #7656a8; }
.card-message[data-theme="dark"] { border-color: #3d4a5d; background: #202b3a; color: #e7edf5; }
.card-message[data-theme="dark"] .card-heading { color: #aab6e1; }
.card-message[data-theme="dark"] .card-text { color: #c1cbd7; }
.card-message[data-theme="dark"] > .card-kv { border-color: #3d4a5d; color: #a4b0bd; }
.card-message[data-theme="dark"] .card-kv strong { color: #d6e4ef; }
.card-message[data-theme="dark"] .card-action { border-color: #3d4a5d; color: #a0afde; background: rgba(255,255,255,.04); }
.card-message[data-theme="dark"] .card-action:hover { background: rgba(255,255,255,.1); }
.card-message[data-theme="dark"] .card-inline-link { color: #a0afde; }

@media (max-width: 600px) {
  .card-editor-modal { padding: 20px; }
  .card-editor-grid { grid-template-columns: 1fr; }
}

/* 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-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: 9px; 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; }
}
