:root {
  color-scheme: light;
  --bg: #edf3f0;
  --surface: #ffffff;
  --surface-soft: #f5f8f6;
  --surface-hover: #e8f1ed;
  --text: #15221d;
  --muted: #61746b;
  --subtle: #8b9c94;
  --line: #d6e2dc;
  --green: #14775b;
  --green-dark: #0f5845;
  --green-soft: #dcefe7;
  --coral: #e46452;
  --coral-soft: #f9e8e4;
  --gold: #c58c35;
  --blue: #4f708e;
  --blue-soft: #e7eef4;
  --danger: #c74343;
  --shadow: 0 18px 48px rgba(18, 48, 37, 0.11);
  --shadow-soft: 0 5px 18px rgba(18, 48, 37, 0.065);
  --nav-width: 82px;
  --side-width: 340px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101613;
  --surface: #18201c;
  --surface-soft: #202924;
  --surface-hover: #283630;
  --text: #edf4f0;
  --muted: #a0afa7;
  --subtle: #7f8e86;
  --line: #303d37;
  --green: #49a984;
  --green-dark: #75c8a5;
  --green-soft: #263d34;
  --coral: #ef7968;
  --coral-soft: #3c2a27;
  --gold: #e6ae51;
  --blue: #7fa4c4;
  --blue-soft: #26343f;
  --danger: #ef6b6b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 7px 22px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; height: 100%; margin: 0; }
body { overflow: hidden; background: var(--bg); color: var(--text); font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.4; letter-spacing: 0; }
button, input, textarea, select { color: inherit; font: inherit; letter-spacing: 0; }
button { border: 0; cursor: pointer; transition: border-color .18s, background-color .18s, color .18s, box-shadow .18s, transform .18s; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid color-mix(in srgb, var(--green) 55%, white); outline-offset: 2px; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.lucide { width: 18px; height: 18px; stroke-width: 1.9; }

.auth-screen { display: grid; grid-template-columns: minmax(460px, 1.12fr) minmax(430px, .88fr); width: 100%; min-height: 100%; background: var(--surface); }
.auth-visual { position: relative; min-height: 100vh; overflow: hidden; background: #163f34; color: white; }
.auth-cover { width: 100%; height: 100%; object-fit: cover; opacity: .94; }
.auth-visual::after { position: absolute; inset: 0; background: rgba(8, 29, 23, .34); content: ""; }
.auth-brand { position: absolute; z-index: 1; top: 42px; left: 50px; display: flex; align-items: center; gap: 14px; }
.auth-mark { position: relative; display: inline-grid; width: 48px; height: 48px; flex: 0 0 48px; place-items: center; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; background: rgba(255,255,255,.13); backdrop-filter: blur(12px); }
.auth-mark img { width: 40px; height: 40px; border-radius: 8px; }
.auth-name { font-size: 22px; font-weight: 700; }
.auth-slogan { margin-top: 4px; color: rgba(255,255,255,.68); font-size: 12px; }
.auth-quote { position: absolute; z-index: 1; bottom: 54px; left: 50px; font-family: SimSun, serif; font-size: 48px; line-height: 1.3; }
.auth-panel { display: grid; place-items: center; padding: 48px; background: var(--surface); }
.auth-box { width: min(100%, 400px); }
.mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 34px; font-size: 20px; }
.mobile-brand .auth-mark { background: var(--green); }
.auth-tabs { display: flex; gap: 32px; margin-bottom: 38px; border-bottom: 1px solid var(--line); }
.auth-tab { position: relative; padding: 0 2px 14px; background: transparent; color: var(--muted); font-size: 15px; }
.auth-tab.active { color: var(--green-dark); font-weight: 700; }
.auth-tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--green); content: ""; }
.form-heading { margin-bottom: 28px; }
.form-heading h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.25; }
.form-heading p { margin: 0; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; }
.input-wrap { display: flex; height: 50px; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); transition: border-color .2s, background .2s, box-shadow .2s; }
.input-wrap:hover { border-color: color-mix(in srgb, var(--green) 34%, var(--line)); }
.input-wrap:focus-within { border-color: var(--green); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 11%, transparent); }
.input-wrap .lucide { width: 17px; color: var(--subtle); }
.input-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
.input-wrap input::placeholder { color: var(--subtle); }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--green); }
.primary, .secondary, .danger-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; border-radius: 6px; font-weight: 650; }
.primary { background: var(--green); color: white; box-shadow: 0 8px 18px rgba(23,107,82,.18); }
.primary:hover { background: var(--green-dark); box-shadow: 0 10px 24px rgba(23,107,82,.23); transform: translateY(-1px); }
.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.secondary:hover { background: var(--surface-hover); }
.danger-button { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.wide { width: 100%; height: 48px; }
.demo-block { padding-top: 9px; border-top: 1px solid var(--line); color: var(--subtle); font-size: 12px; }
.demo-users { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.demo-users button { display: flex; align-items: center; gap: 7px; padding: 6px 9px 6px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 12px; }
.demo-users button:hover { border-color: var(--green); color: var(--green-dark); }
.demo-users img { width: 24px; height: 24px; border-radius: 5px; object-fit: cover; }
.agreement { margin: 2px 0 0; color: var(--subtle); font-size: 12px; text-align: center; }

.app-shell { display: grid; grid-template-columns: var(--nav-width) var(--side-width) minmax(0, 1fr); width: 100%; height: 100vh; height: 100dvh; min-height: 0; }
.app-shell > * { min-height: 0; }
.desktop-titlebar, .desktop-new-chat { display: none; }
.main-nav { display: flex; z-index: 10; flex-direction: column; align-items: center; padding: 17px 10px 14px; background: #0f3d33; color: white; box-shadow: 5px 0 18px rgba(12, 39, 31, .12); }
[data-theme="dark"] .main-nav { background: #0c211a; }
.brand-button { position: relative; display: grid; width: 48px; height: 48px; flex: 0 0 48px; place-items: center; border: 1px solid rgba(255,255,255,.72); border-radius: 8px; background: #f7fbf9; box-shadow: 0 7px 18px rgba(4, 28, 20, .22); }
.brand-button img { width: 40px; height: 40px; border-radius: 8px; }
.nav-center { display: flex; flex: 1; flex-direction: column; gap: 8px; padding-top: 42px; }
.nav-bottom { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.nav-button { position: relative; display: flex; width: 56px; height: 54px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 7px; background: transparent; color: rgba(255,255,255,.62); font-size: 10px; }
.nav-button .lucide { width: 21px; height: 21px; }
.nav-button:hover, .nav-button.active { background: rgba(255,255,255,.12); color: white; }
.nav-button.active::before { position: absolute; top: 12px; bottom: 12px; left: -10px; width: 3px; border-radius: 0 3px 3px 0; background: #76d1ad; content: ""; }
.nav-badge { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid #153a30; border-radius: 9px; background: var(--coral); color: white; font-size: 10px; line-height: 13px; }
.avatar-button { position: relative; width: 42px; height: 42px; padding: 0; border-radius: 7px; background: transparent; }
.avatar-button img { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; }
.presence-dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border: 3px solid #153a30; border-radius: 50%; background: #55d89b; }

.side-panel { display: grid; min-width: 0; min-height: 0; grid-template-rows: 88px auto minmax(0, 1fr); overflow: hidden; border-right: 1px solid var(--line); background: var(--surface); }
.mobile-conversation-hero { display: none; }
.side-header { display: flex; height: 88px; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.eyebrow { color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: 1.3px; }
.side-header h2 { margin: 5px 0 0; font-size: 22px; }
.icon-button { display: inline-grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); }
.icon-button:hover { border-color: var(--line); background: var(--surface-hover); color: var(--text); box-shadow: var(--shadow-soft); }
.search-box { display: flex; height: 40px; align-items: center; gap: 8px; margin: 0 16px 12px; padding: 0 11px; border: 1px solid transparent; border-radius: 7px; background: var(--surface-soft); color: var(--subtle); }
.search-box:focus-within { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 9%, transparent); }
.search-box .lucide { width: 16px; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
.search-box kbd { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--subtle); font-family: inherit; font-size: 9px; }
.side-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 0 10px 18px; }
.list-section-label { padding: 12px 11px 7px; color: var(--subtle); font-size: 11px; font-weight: 650; }
.conversation-item, .contact-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; min-height: 70px; align-items: center; gap: 11px; width: 100%; padding: 10px 11px; border: 1px solid transparent; border-radius: 7px; background: transparent; text-align: left; }
.conversation-item:hover, .contact-row:hover { background: var(--surface-hover); }
.conversation-item.active { border-color: color-mix(in srgb, var(--green) 16%, var(--line)); background: var(--green-soft); box-shadow: inset 3px 0 var(--green); }
.list-avatar, .message-avatar { position: relative; }
.list-avatar img { width: 48px; height: 48px; border-radius: 7px; object-fit: cover; }
.online-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border: 2px solid var(--surface); border-radius: 50%; background: #45c98b; }
.conversation-item.active .online-dot { border-color: var(--green-soft); }
.item-copy { min-width: 0; }
.item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.item-title { overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.item-time { flex: 0 0 auto; color: var(--subtle); font-size: 10px; }
.item-preview { overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.unread-badge { display: grid; min-width: 20px; height: 20px; place-items: center; padding: 0 5px; border-radius: 10px; background: var(--coral); color: white; font-size: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.status-pill::before { width: 6px; height: 6px; border-radius: 50%; background: var(--subtle); content: ""; }
.status-pill.online::before { background: #45c98b; }
.empty-list { display: grid; min-height: 240px; place-items: center; padding: 30px; color: var(--muted); text-align: center; }
.empty-list .lucide { width: 34px; height: 34px; margin: 0 auto 12px; color: var(--subtle); }

.main-content { min-width: 0; min-height: 0; height: 100%; overflow: hidden; background: var(--surface); }
.welcome-pane { display: grid; height: 100%; place-items: center; padding: 28px; background: var(--surface); }
.welcome-inner { max-width: 460px; text-align: center; }
.welcome-art { position: relative; width: 190px; height: 190px; margin: 0 auto 24px; }
.welcome-art img { width: 100%; height: 100%; border-radius: 8px; object-fit: cover; box-shadow: var(--shadow); }
.welcome-art::after { position: absolute; right: -9px; bottom: -9px; width: 48px; height: 48px; border: 6px solid var(--surface); border-radius: 8px; background: var(--coral); content: "X"; color: white; font-size: 22px; font-weight: 750; line-height: 48px; }
.welcome-pane h1 { margin: 0 0 10px; font-size: 27px; }
.welcome-pane p { margin: 0; color: var(--muted); line-height: 1.8; }
.welcome-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }

.chat-pane { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 70px minmax(0, 1fr) auto; height: 100%; min-height: 0; background: var(--surface-soft); }
.chat-header { display: flex; z-index: 2; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--surface); box-shadow: 0 2px 12px rgba(28, 49, 40, .04); }
.chat-person { display: flex; min-width: 0; align-items: center; gap: 12px; }
.mobile-back { display: none; }
.chat-person img { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 7px; object-fit: cover; }
.chat-person h2 { overflow: hidden; margin: 0; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.chat-person p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.chat-tools { display: flex; gap: 4px; }
.mobile-menu-icon, .mobile-composer-tool { display: none; }
.mobile-back-count { display: none; }
.group-detail-panel { display: none; min-width: 0; }
.message-scroll { min-height: 0; overflow-y: auto; overflow-anchor: none; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 26px 36px; background: color-mix(in srgb, var(--surface-soft) 84%, var(--bg)); scroll-behavior: smooth; }
.history-loading { display: flex; min-height: 34px; align-items: center; justify-content: center; gap: 7px; color: var(--subtle); font-size: 11px; }
.history-loading .lucide { width: 14px; height: 14px; animation: history-spin .8s linear infinite; }
@keyframes history-spin { to { transform: rotate(360deg); } }
.message-day { margin: 18px 0; color: var(--subtle); font-size: 11px; text-align: center; }
.message { display: flex; align-items: flex-start; gap: 10px; max-width: min(74%, 680px); margin: 17px 0; }
.message-fragment { display: contents; }
.message.pending .bubble { opacity: .82; }
.message.pending .message-read-state { color: var(--subtle); }
.message-fragment.send-failed .bubble { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.message-fragment.send-failed .message-read-state { color: var(--danger); }
.message[data-mention-sender-id] { cursor: context-menu; -webkit-touch-callout: none; }
.message.mentioned .bubble { border-color: #d7b85f; box-shadow: 0 0 0 2px rgba(207, 152, 62, .1), var(--shadow-soft); }
.message.own { width: fit-content; margin-left: auto; flex-direction: row-reverse; }
.message.system { max-width: 100%; justify-content: center; }
.message.system .bubble { padding: 5px 10px; border-radius: 5px; background: var(--line); color: var(--muted); font-size: 11px; }
.message-avatar img { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; object-fit: cover; }
.message-body { min-width: 0; }
.message-name { display: flex; min-height: 18px; align-items: center; gap: 5px; margin: 0 0 5px 2px; color: var(--muted); font-size: 10px; }
.message.own .message-name { justify-content: flex-end; margin-right: 2px; text-align: right; }
.message-group-title { max-width: 140px; overflow: hidden; padding: 2px 5px; border-radius: 4px; background: var(--green-soft); color: var(--green-dark); font-size: 9px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.message-mention { color: #b27517; font-weight: 750; }
.message.own .message-mention { color: #fff0b5; }
.membership-badge { display: inline-flex; min-height: 22px; align-items: center; gap: 4px; padding: 0 7px; border: 1px solid #e4c875; border-radius: 4px; background: #fff5cf; color: #8b6719; font-size: 9px; font-weight: 800; line-height: 1; }
.membership-badge.svip { border-color: #ef9b8f; background: #fff0ed; color: #b7473c; }
.membership-badge.compact { min-height: 17px; padding: 0 5px; font-size: 8px; }
.membership-badge .lucide { width: 11px; height: 11px; }
.membership-badge.compact .lucide { width: 9px; height: 9px; }
.bubble { position: relative; padding: 10px 13px; border: 1px solid var(--line); border-radius: 3px 8px 8px 8px; background: var(--surface); box-shadow: var(--shadow-soft); line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap; }
.message.own .bubble { border-color: transparent; border-radius: 8px 3px 8px 8px; background: var(--green); color: white; box-shadow: 0 6px 18px rgba(23, 107, 82, .17); }
.bubble-image { position: relative; display: grid; width: min(330px, 55vw); aspect-ratio: 4 / 3; place-items: center; overflow: hidden; padding: 4px; }
.bubble-image img { width: 100%; height: 100%; max-height: 360px; border-radius: 4px; object-fit: contain; }
.chat-image-status { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 86%, transparent); color: var(--muted); pointer-events: none; transition: opacity .16s ease; }
.chat-image-status .lucide { grid-area: 1 / 1; width: 38px; height: 38px; padding: 8px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.chat-image-loading-icon, .chat-image-error-icon { display: none; }
.bubble-image[data-image-state="loading"] .chat-image-idle-icon { display: none; }
.bubble-image[data-image-state="loading"] .chat-image-loading-icon { display: block; animation: video-message-spin .78s linear infinite; }
.bubble-image[data-image-state="ready"] .chat-image-status { opacity: 0; }
.bubble-image[data-image-state="error"] .chat-image-idle-icon { display: none; }
.bubble-image[data-image-state="error"] .chat-image-error-icon { display: block; color: var(--danger); }
.message-audio { display: none; }
.voice-message-player { display: grid; width: min(var(--voice-width, 196px), 62vw); height: 44px; grid-template-columns: 32px minmax(96px, 1fr) 34px; align-items: center; gap: 5px; color: currentColor; transition: width .2s ease; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.voice-play-toggle, .voice-waveform-control { display: grid; min-width: 0; height: 40px; place-items: center; padding: 0; background: transparent; color: inherit; touch-action: manipulation; }
.voice-play-toggle { width: 32px; border-radius: 50%; }
.voice-play-toggle:hover { background: color-mix(in srgb, currentColor 9%, transparent); }
.voice-play-toggle .lucide { width: 21px; height: 21px; stroke-width: 2.2; }
.voice-waveform-control { width: 100%; cursor: pointer; }
.voice-waveform-canvas { display: block; width: 100%; height: 40px; pointer-events: none; }
.voice-duration { min-width: 30px; font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.voice-message-player.voice-error { color: var(--danger); }
.video-message-shell { position: relative; display: block; width: min(360px, 68vw); aspect-ratio: 16 / 9; max-height: 260px; overflow: hidden; border-radius: 10px; background: #080909; }
.message-video { display: block; width: 100%; height: 100%; max-height: 260px; background: #080909; object-fit: contain; }
.video-message-status { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 7, 8, .34); color: white; pointer-events: none; transition: opacity .16s ease; }
.video-message-status .lucide { grid-area: 1 / 1; width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: rgba(10, 12, 13, .62); }
.video-loading-icon, .video-error-icon { display: none; }
.video-message-shell[data-video-state="loading"] .video-play-icon { display: none; }
.video-message-shell[data-video-state="loading"] .video-loading-icon { display: block; animation: video-message-spin .78s linear infinite; }
.video-message-shell[data-video-state="ready"] .video-message-status { opacity: 0; }
.video-message-shell[data-video-state="error"] .video-play-icon { display: none; }
.video-message-shell[data-video-state="error"] .video-error-icon { display: block; color: #ff8c91; }
@keyframes video-message-spin { to { transform: rotate(360deg); } }
.message:has(.voice-message-player) .bubble { padding: 5px 9px; }
.message:has(.message-video) .bubble { padding: 9px; }
.file-message { display: flex; width: min(360px, 58vw); align-items: center; gap: 11px; color: inherit; text-decoration: none; white-space: normal; }
.file-message-icon { display: grid; width: 46px; height: 50px; flex: 0 0 auto; place-items: center; border-radius: 6px; background: color-mix(in srgb, var(--green) 12%, var(--surface)); color: var(--green); }
.file-message-icon .lucide { width: 21px; height: 21px; }
.file-message-icon b { max-width: 40px; margin-top: -8px; overflow: hidden; font-size: 8px; text-overflow: ellipsis; }
.file-message-copy { display: grid; min-width: 0; flex: 1; gap: 3px; }
.file-message-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.file-message-copy small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.file-message-open { width: 18px; height: 18px; flex: 0 0 auto; opacity: .68; }
.message.own .file-message-icon { background: rgba(255,255,255,.17); color: white; }
.message.own .file-message-copy small { color: rgba(255,255,255,.72); }
.media-caption { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.message-time { display: flex; margin-top: 5px; align-items: center; gap: 7px; color: var(--subtle); font-size: 10px; }
.message.own .message-time { justify-content: flex-end; text-align: right; }
.message-read-state { color: var(--muted); font-size: 10px; font-weight: 650; }
.message-read-state.read { color: var(--green); }
.composer { position: relative; padding: 9px 18px 15px; border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -4px 18px rgba(28, 49, 40, .035); }
.composer-tools { display: flex; gap: 3px; margin-bottom: 5px; }
.composer-main { display: flex; align-items: flex-end; gap: 9px; padding: 6px 7px 6px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); transition: border-color .18s, box-shadow .18s; }
.composer-main:focus-within { border-color: color-mix(in srgb, var(--green) 54%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 8%, transparent); }
.composer textarea { min-height: 34px; max-height: 120px; flex: 1; resize: none; border: 0; outline: 0; background: transparent; line-height: 1.6; }
.composer input, .composer textarea { user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
.send-button { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 7px; background: var(--green); color: white; }
.send-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.emoji-popover { position: absolute; z-index: 5; bottom: 106px; left: 18px; display: grid; width: 260px; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.emoji-popover button { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 5px; background: transparent; font-size: 19px; }
.emoji-popover button:hover { background: var(--surface-hover); }

.content-page { height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; background: var(--bg); }
.page-header { position: sticky; z-index: 3; top: 0; display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(20px, 4vw, 48px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); }
.page-header h1 { margin: 0; font-size: 21px; }
.page-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.settings-page-header h1 { margin-top: 2px; }
.header-icon { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--line)); border-radius: 7px; background: var(--blue-soft); color: var(--blue); }
.page-body { width: min(920px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 60px; }
.contact-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.contact-hero h2 { margin: 0 0 8px; font-size: 24px; }
.contact-hero p { margin: 0; color: var(--muted); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.friend-request-panel { margin-bottom: 18px; padding: 18px; border: 1px solid color-mix(in srgb, var(--green) 38%, var(--line)); border-radius: 7px; background: var(--surface); }
.request-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.request-heading h2 { margin: 0 0 4px; font-size: 17px; }
.request-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.request-list { display: grid; gap: 8px; }
.request-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 10px; border-radius: 6px; background: var(--surface-soft); }
.request-row img { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; }
.request-row h3 { margin: 0; font-size: 14px; }
.request-row p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.request-actions { display: flex; gap: 7px; }
.request-actions .primary, .request-actions .secondary { min-height: 34px; padding: 0 12px; }
.outgoing-requests { margin-bottom: 18px; padding: 12px 14px; border-left: 3px solid var(--gold); border-radius: 5px; background: color-mix(in srgb, var(--gold) 10%, var(--surface)); color: var(--text); font-size: 12px; }
.outgoing-requests span { color: var(--muted); }
.contact-card { display: grid; grid-template-columns: 58px minmax(0, 1fr) 36px; align-items: center; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-soft); transition: border-color .18s, transform .18s; }
.contact-card:hover { border-color: color-mix(in srgb, var(--green) 28%, var(--line)); transform: translateY(-1px); }
.contact-card img { width: 58px; height: 58px; border-radius: 7px; object-fit: cover; }
.contact-card h3 { overflow: hidden; margin: 0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.contact-card p { overflow: hidden; margin: 6px 0 0; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.moments-wrap { width: min(720px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 70px; }
.moment-composer { margin-bottom: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.moment-compose-row { display: flex; gap: 12px; }
.moment-compose-row > img { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; }
.moment-compose-content { min-width: 0; flex: 1; }
.moment-compose-content textarea { width: 100%; min-height: 62px; resize: vertical; border: 0; outline: 0; background: transparent; line-height: 1.6; }
.moment-compose-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.moment-image-preview { position: relative; width: 120px; margin-top: 8px; }
.moment-image-preview img { width: 120px; height: 80px; border-radius: 6px; object-fit: cover; }
.moment-card { margin-bottom: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-soft); }
.moment-author { display: flex; align-items: center; gap: 11px; }
.moment-author img { width: 44px; height: 44px; border-radius: 7px; object-fit: cover; }
.moment-author h3 { margin: 0; font-size: 14px; }
.moment-author time { display: block; margin-top: 4px; color: var(--subtle); font-size: 10px; }
.moment-text { margin: 16px 0; line-height: 1.75; white-space: pre-wrap; }
.moment-photo { width: 100%; max-height: 440px; border-radius: 7px; object-fit: cover; }
.moment-actions { display: flex; gap: 8px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.moment-actions button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; }
.moment-actions button:hover { background: var(--surface-hover); }
.moment-actions button.liked { color: var(--coral); }
.moment-social { border-radius: 6px; background: var(--surface-soft); }
.moment-likes { display: flex; align-items: flex-start; gap: 7px; padding: 10px 12px; color: var(--green-dark); font-size: 12px; line-height: 1.5; }
.moment-likes + .comment-list { border-top: 1px solid var(--line); }
.comment-list { padding: 7px 12px; }
.comment { padding: 4px 0; font-size: 12px; line-height: 1.5; }
.comment strong { color: var(--green-dark); }
.comment-form { display: flex; gap: 7px; padding: 8px 12px 12px; }
.comment-form input { min-width: 0; height: 34px; flex: 1; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); outline: 0; }
.comment-form button { padding: 0 12px; border-radius: 5px; background: var(--green); color: white; }

.profile-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; }
.profile-summary { align-self: start; padding: 28px 24px 22px; border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-soft); text-align: center; }
.profile-avatar-editor { position: relative; width: 112px; height: 112px; margin: 0 auto 16px; }
.profile-avatar-editor > img { width: 112px; height: 112px; border: 4px solid var(--surface); border-radius: 10px; object-fit: cover; box-shadow: 0 0 0 1px var(--line), 0 12px 26px rgba(21, 67, 51, .14); }
.avatar-edit-button { position: absolute; right: -8px; bottom: -8px; display: grid; width: 38px; height: 38px; place-items: center; border: 3px solid var(--surface); border-radius: 50%; background: var(--green); color: white; box-shadow: 0 7px 16px rgba(20, 119, 91, .24); }
.avatar-edit-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.avatar-edit-button .lucide { width: 17px; height: 17px; }
.profile-identity h2 { margin: 0; font-size: 20px; }
.profile-identity p { margin: 7px 0 11px; color: var(--muted); font-size: 12px; }
.profile-identity .status-pill { display: inline-flex; align-items: center; gap: 5px; }
.profile-identity .status-pill .lucide { width: 7px; height: 7px; fill: currentColor; stroke-width: 0; }
.avatar-reset-button { display: inline-flex; align-items: center; gap: 7px; margin-top: 20px; padding: 8px 10px; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; }
.avatar-reset-button:hover { background: var(--surface-hover); color: var(--green-dark); }
.avatar-reset-button .lucide { width: 14px; height: 14px; }
.settings-panel { padding: 26px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-soft); }
.settings-section-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.settings-section-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 7px; background: var(--coral-soft); color: var(--coral); }
.settings-section-heading h2 { margin: 0; font-size: 18px; }
.settings-section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-form .name-field { grid-column: 1 / -1; }
.settings-form .field input, .settings-form .field textarea, .settings-form .field select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); outline: 0; transition: border-color .18s, background-color .18s, box-shadow .18s; }
.settings-form .field input:focus, .settings-form .field textarea:focus, .settings-form .field select:focus { border-color: var(--green); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 9%, transparent); }
.settings-form .bio-field { grid-column: 1 / -1; position: relative; }
.settings-form .field textarea { min-height: 104px; padding-bottom: 28px; resize: vertical; }
.settings-form .field small { position: absolute; right: 11px; bottom: 9px; color: var(--subtle); font-size: 10px; }
.settings-form .field small b { font-weight: 600; }
.settings-actions { display: flex; grid-column: 1 / -1; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }

.profile-home { position: relative; padding-bottom: 70px; background: var(--bg); }
.profile-cover { position: relative; height: min(31vh, 310px); min-height: 230px; overflow: hidden; background: #173e34; color: white; }
.profile-cover > img { width: 100%; height: 100%; object-fit: cover; object-position: center 45%; }
.profile-cover-tint { position: absolute; inset: 0; background: rgba(9, 34, 27, .38); }
.profile-cover-copy { position: absolute; right: 42px; bottom: 28px; left: 42px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.profile-cover-copy span { font-size: 10px; font-weight: 800; letter-spacing: 0; opacity: .72; }
.profile-cover-copy strong { max-width: 430px; font-size: 22px; line-height: 1.4; text-align: right; }
.profile-cover-actions { position: absolute; z-index: 2; top: 20px; right: 24px; display: flex; gap: 8px; }
.profile-cover-actions button, .profile-mobile-back { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; background: rgba(13, 32, 27, .62); color: white; backdrop-filter: blur(10px); }
.profile-cover-actions button:hover, .profile-mobile-back:hover { background: rgba(13, 32, 27, .82); }
.profile-cover-actions .lucide, .profile-mobile-back .lucide { width: 19px; height: 19px; }
.profile-mobile-back { display: none; }

.profile-desktop-shell { position: relative; z-index: 2; display: grid; width: min(1120px, calc(100% - 48px)); min-height: 540px; grid-template-columns: 310px minmax(0, 1fr); margin: -38px auto 0; border: 1px solid var(--line); border-top: 4px solid var(--green); background: var(--surface); }
.profile-identity-panel { min-width: 0; padding: 0 28px 30px; border-right: 1px solid var(--line); }
.profile-avatar-wrap { position: relative; width: 132px; height: 132px; margin-top: -62px; }
.profile-avatar-wrap > img { width: 132px; height: 132px; border: 5px solid var(--surface); border-radius: 18px; object-fit: cover; box-shadow: 0 0 0 1px var(--line), 0 16px 36px rgba(11, 40, 30, .18); }
.profile-avatar-wrap .presence-dot { right: -3px; bottom: -3px; width: 17px; height: 17px; border-width: 4px; border-color: var(--surface); }
.profile-name-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 20px; }
.profile-name-heading { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 8px; }
.profile-name-row h1 { overflow-wrap: anywhere; margin: 0; font-size: 26px; line-height: 1.2; }
.profile-name-row p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.profile-name-row > button { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 50%; background: var(--surface-soft); color: var(--muted); }
.profile-name-row > button:hover { background: var(--surface-hover); color: var(--green-dark); }
.profile-name-row .lucide { width: 15px; height: 15px; }
.profile-status-line { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.profile-status-line span, .profile-status-line b { display: inline-flex; min-height: 25px; align-items: center; gap: 5px; padding: 0 9px; border-radius: 13px; font-size: 10px; }
.profile-status-line span { background: var(--green-soft); color: var(--green-dark); }
.profile-status-line b { background: var(--coral-soft); color: var(--coral); font-weight: 700; }
.profile-status-line .lucide { width: 11px; height: 11px; }
.profile-signature { min-height: 52px; margin: 20px 0 0; color: var(--text); font-size: 14px; line-height: 1.75; }
.profile-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 24px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile-stat-grid > * { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 4px; border-right: 1px solid var(--line); background: transparent; color: inherit; }
.profile-stat-grid > :last-child { border-right: 0; }
.profile-stat-grid strong { font-size: 19px; }
.profile-stat-grid span { color: var(--muted); font-size: 10px; }
.profile-desktop-actions { display: grid; gap: 9px; margin-top: 24px; }
.profile-desktop-actions button { width: 100%; }

.profile-content-column { min-width: 0; }
.profile-content-column > section { padding: 29px 32px; border-bottom: 1px solid var(--line); }
.profile-content-column > section:last-child { border-bottom: 0; }
.profile-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.profile-section-heading span { color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: 0; }
.profile-section-heading h2 { margin: 4px 0 0; font-size: 20px; }
.profile-section-heading > button { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; padding: 0 10px; border-radius: 6px; background: transparent; color: var(--green-dark); font-size: 11px; }
.profile-section-heading > button:hover { background: var(--surface-hover); }
.profile-section-heading .lucide { width: 15px; height: 15px; }
.profile-about-entry { display: grid; width: 100%; min-height: 72px; grid-template-columns: 48px minmax(0, 1fr) 20px; align-items: center; gap: 13px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--text); text-align: left; }
.profile-about-entry:hover { border-color: color-mix(in srgb, var(--green) 32%, var(--line)); background: var(--surface-hover); }
.profile-about-mark { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 7px; background: white; }
.profile-about-mark img { width: 38px; height: 38px; border-radius: 6px; }
.profile-about-entry > span:nth-child(2) { min-width: 0; }
.profile-about-entry b, .profile-about-entry small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-about-entry b { font-size: 13px; }
.profile-about-entry small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.profile-about-entry > .lucide { width: 17px; height: 17px; color: var(--subtle); }

.about-page { display: grid; grid-template-rows: 72px minmax(0, 1fr); overflow: hidden; background: #fff; color: #171a19; }
.about-page-header { display: flex; align-items: center; gap: 14px; padding: 0 24px; border-bottom: 1px solid #e4e8e6; background: #fff; }
.about-page-header .icon-button { color: #637068; }
.about-page-header .icon-button:hover { border-color: #d9e1dd; background: #f2f5f3; color: #17201c; }
.about-page-header span { display: block; color: #16785b; font-size: 8px; font-weight: 800; }
.about-page-header h1 { margin: 3px 0 0; font-size: 19px; }
.about-page-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #b8c1bd transparent; }
.about-page-inner { width: min(860px, calc(100% - 48px)); margin: 0 auto; padding: 38px 0 64px; }
.about-brand-visual { width: min(680px, 100%); aspect-ratio: 5 / 3; overflow: hidden; margin: 0 auto; border: 0; border-radius: 0; background: #fff; }
.about-brand-visual img { width: 100%; height: 100%; object-fit: cover; }
.about-story { width: min(720px, 100%); margin: 38px auto 0; }
.about-story p { margin: 0 0 22px; color: #4c5751; font-size: 14px; line-height: 2; text-align: justify; }
.about-story .about-story-lead { margin-bottom: 26px; color: #171a19; font-size: 19px; font-weight: 700; text-align: left; }
.about-story blockquote { margin: 34px 0 0; padding: 18px 0 18px 22px; border-left: 3px solid #238064; color: #1b2a24; font-family: SimSun, serif; font-size: 18px; line-height: 1.9; }
.about-story footer { display: flex; align-items: center; gap: 11px; margin-top: 42px; padding-top: 20px; border-top: 1px solid #e1e7e4; }
.about-story footer img { width: 38px; height: 38px; border-radius: 7px; }
.about-story footer strong, .about-story footer small { display: block; }
.about-story footer strong { font-size: 13px; }
.about-story footer small { margin-top: 3px; color: #718078; font-size: 9px; }
.profile-detail-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.profile-detail-list > div { display: grid; min-width: 0; min-height: 86px; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.profile-detail-list > div > .lucide { width: 18px; color: var(--green); }
.profile-detail-list span { min-width: 0; }
.profile-detail-list small, .profile-detail-list b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-detail-list small { color: var(--muted); font-size: 9px; }
.profile-detail-list b { margin-top: 5px; font-size: 11px; }
.profile-detail-list meter { grid-column: 1 / -1; width: 100%; height: 5px; accent-color: var(--green); }
.profile-badge-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.profile-badge-list > div { display: flex; min-width: 0; align-items: center; gap: 11px; padding: 13px; border-radius: 7px; background: var(--surface-soft); }
.profile-badge-list > div > .lucide { width: 25px; height: 25px; flex: 0 0 25px; color: var(--coral); }
.profile-badge-list > .membership-achievement.vip { background: #fff7dc; }
.profile-badge-list > .membership-achievement.vip > .lucide { color: #b68424; }
.profile-badge-list > .membership-achievement.svip { background: #fff0ed; }
.profile-badge-list > .membership-achievement.svip > .lucide { color: #d05447; }
.profile-badge-list b, .profile-badge-list small { display: block; }
.profile-badge-list b { font-size: 12px; }
.profile-badge-list small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.profile-moment-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.profile-moment-tile { position: relative; min-width: 0; aspect-ratio: 1; overflow: hidden; border-radius: 7px; background: var(--surface-soft); text-align: left; }
.profile-moment-tile > img { width: 100%; height: 100%; object-fit: cover; transition: transform .22s; }
.profile-moment-tile:hover > img { transform: scale(1.025); }
.profile-text-moment { display: flex; height: 100%; flex-direction: column; justify-content: space-between; padding: 15px; color: var(--text); }
.profile-text-moment .lucide { width: 18px; color: var(--coral); }
.profile-text-moment b { display: -webkit-box; overflow: hidden; font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.profile-moment-meta { position: absolute; right: 7px; bottom: 7px; display: inline-flex; height: 23px; align-items: center; gap: 4px; padding: 0 7px; border-radius: 12px; background: rgba(12, 28, 23, .68); color: white; font-size: 9px; }
.profile-moment-meta .lucide { width: 11px; height: 11px; fill: currentColor; }
.profile-moments-empty { display: grid; min-height: 104px; grid-column: 1 / -1; grid-template-columns: 40px minmax(0, 1fr) 18px; align-items: center; gap: 12px; padding: 17px; border: 1px dashed var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--muted); text-align: left; }
.profile-moments-empty > .lucide:first-child { width: 24px; color: var(--green); }
.profile-moments-empty b, .profile-moments-empty small { display: block; }
.profile-moments-empty b { color: var(--text); font-size: 13px; }
.profile-moments-empty small { margin-top: 5px; font-size: 10px; }
.profile-mobile-actions { display: none; }

.profile-editor-layer { position: fixed; z-index: 45; inset: 0; display: grid; place-items: center; overflow-y: auto; padding: 24px; background: rgba(8, 20, 16, .62); backdrop-filter: blur(5px); }
.profile-editor-sheet { width: min(610px, 100%); max-height: min(720px, calc(100dvh - 48px)); overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.profile-editor-sheet > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 23px 24px 18px; border-bottom: 1px solid var(--line); }
.profile-editor-sheet > header h2 { margin: 4px 0 0; font-size: 21px; }
.profile-editor-sheet > header p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.profile-editor-sheet .settings-form { padding: 22px 24px 24px; }
.profile-editor-avatar { display: flex; grid-column: 1 / -1; align-items: center; gap: 18px; margin-bottom: 2px; }
.profile-editor-avatar .profile-avatar-editor { margin: 0; }
.profile-editor-avatar .avatar-reset-button { margin: 0; }

.app-dialog { width: min(480px, calc(100% - 28px)); max-height: min(720px, calc(100% - 28px)); overflow: auto; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.app-dialog.wide-dialog { width: min(620px, calc(100% - 28px)); }
.app-dialog::backdrop { background: rgba(10, 23, 17, .48); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; z-index: 2; top: 14px; right: 14px; }
.dialog-body { padding: 25px; }
.dialog-body h2 { margin: 0 0 7px; font-size: 20px; }
.dialog-body > p { margin: 0 0 22px; color: var(--muted); }
.dialog-form { display: grid; gap: 16px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.member-checks { display: grid; max-height: 280px; gap: 6px; overflow-y: auto; padding: 4px; }
.member-option { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 6px; cursor: pointer; }
.member-option:hover { background: var(--surface-hover); }
.member-option img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; }
.member-option span { flex: 1; }
.member-option input { width: 17px; height: 17px; accent-color: var(--green); }
.member-option small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.member-picker-head, .group-members-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.member-picker-head { color: var(--muted); font-size: 12px; }
.member-picker-head b { display: inline-grid; min-width: 20px; height: 20px; place-items: center; margin-left: 4px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); }
.dialog-search { width: 100%; margin: -6px 0 0; }
.group-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px; }
.avatar-picker { display: flex; min-width: 116px; gap: 8px; margin: 0; padding: 0; border: 0; }
.avatar-picker legend { width: 100%; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.avatar-picker label { position: relative; cursor: pointer; }
.avatar-picker input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.avatar-picker img { width: 46px; height: 46px; border: 2px solid transparent; border-radius: 7px; object-fit: cover; }
.avatar-picker input:checked + img { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.avatar-upload-option img { border-style: dashed; opacity: .88; }
.avatar-upload-option > span { position: absolute; inset: 2px; display: grid; place-items: center; border-radius: 5px; background: rgba(15, 47, 37, .55); color: white; opacity: .72; transition: opacity .16s; }
.avatar-upload-option:hover > span { opacity: 1; }
.avatar-upload-option .lucide { width: 17px; height: 17px; }
.group-info-header { display: flex; align-items: center; gap: 13px; padding-right: 42px; }
.group-info-header > img { width: 56px; height: 56px; border-radius: 7px; object-fit: cover; }
.group-info-header h2 { margin-bottom: 4px; }
.group-info-header p { margin: 0; color: var(--muted); font-size: 12px; }
.group-settings { grid-template-columns: minmax(0, 1fr) auto; align-items: end; margin: 20px 0; padding: 16px; border-radius: 7px; background: var(--surface-soft); }
.group-settings .field:nth-child(2) { grid-column: 1 / -1; }
.group-settings textarea { min-height: 68px; padding: 10px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); outline: 0; }
.group-settings > button { grid-column: 1 / -1; justify-self: end; }
.group-notice { margin: 18px 0; padding: 13px; border-left: 3px solid var(--green); border-radius: 5px; background: var(--surface-soft); }
.group-notice span { color: var(--muted); font-size: 11px; }
.group-notice p { margin: 6px 0 0; line-height: 1.6; white-space: pre-wrap; }
.group-members-heading { margin: 18px 0 8px; }
.group-member-list { max-height: 250px; }
.member-option .member-identity { min-width: 0; }
.member-option .membership-badge { flex: 0 0 auto; }
.member-identity strong { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 5px; }
.member-identity small { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 6px; }
.group-title-chip { max-width: 150px; overflow: hidden; padding: 2px 5px; border-radius: 4px; background: var(--coral-soft); color: var(--coral); font-size: 9px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.member-option .group-member-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; }
.group-member-actions .icon-button { width: 31px; height: 31px; flex-basis: 31px; }
.owner-badge { padding: 3px 7px; border-radius: 4px; background: var(--green-soft); color: var(--green-dark); font-size: 10px; font-style: normal; }
.admin-badge { padding: 3px 7px; border-radius: 4px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-style: normal; }
.form-hint { margin-top: -8px; color: var(--muted); font-size: 10px; }
.group-danger-zone { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 16px; }
.conversation-pref-icon { width: 11px; height: 11px; flex: 0 0 11px; color: #777; }
button:disabled { cursor: not-allowed; opacity: .45; }

.toast-region { position: fixed; z-index: 50; top: 18px; right: 18px; display: grid; gap: 8px; width: min(360px, calc(100% - 36px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); animation: toast-in .22s ease-out; }
.toast.error { border-left-color: var(--danger); }
.toast strong { display: block; margin-bottom: 2px; font-size: 13px; }
.toast span { color: var(--muted); font-size: 11px; }
.toast .lucide { flex: 0 0 auto; color: var(--green); }
.toast.error .lucide { color: var(--danger); }
.message-notice { display: grid; width: 100%; min-height: 72px; grid-template-columns: 46px minmax(0, 1fr) 18px; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-left: 3px solid var(--coral); border-radius: 7px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); text-align: left; pointer-events: auto; animation: toast-in .22s ease-out; }
.message-notice:hover { border-color: color-mix(in srgb, var(--coral) 38%, var(--line)); transform: translateY(-1px); }
.message-notice-avatar { position: relative; }
.message-notice-avatar img { width: 44px; height: 44px; border-radius: 7px; object-fit: cover; }
.message-notice-avatar > .lucide { position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; padding: 3px; border: 2px solid var(--surface); border-radius: 50%; background: var(--green); color: white; }
.message-notice-copy { min-width: 0; }
.message-notice-copy strong, .message-notice-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-notice-copy strong { margin-bottom: 4px; font-size: 13px; }
.message-notice-copy span { color: var(--muted); font-size: 11px; }
.message-notice > .lucide { width: 16px; color: var(--subtle); }
[data-action="enable-web-notifications"].notification-enabled { color: var(--green); }
[data-action="enable-web-notifications"].notification-blocked { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes mobile-screen-in { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: translateX(0); } }
@keyframes mobile-screen-back { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: translateX(0); } }

.mobile-nav { display: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { border-radius: 4px; background: color-mix(in srgb, var(--muted) 35%, transparent); }
::-webkit-scrollbar-track { background: transparent; }

@media (min-width: 721px) {
  .app-shell.messages-view { grid-template-columns: 70px 310px minmax(0, 1fr); grid-template-rows: 50px minmax(0, 1fr); background: #202020; color: #ededed; }
  .messages-view .desktop-titlebar { z-index: 20; display: flex; grid-column: 1 / -1; grid-row: 1; min-width: 0; height: 50px; align-items: center; border-bottom: 1px solid #3a3a3a; background: #303030; color: #ededed; }
  .desktop-product { display: flex; width: 116px; min-width: 116px; flex: 0 0 116px; align-items: center; gap: 7px; overflow: hidden; padding: 0 11px; border-right: 1px solid #3a3a3a; color: #d6d6d6; }
  .desktop-product img { width: 23px; height: 23px; border-radius: 5px; }
  .desktop-product strong { overflow: hidden; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-account { display: flex; min-width: 0; flex: 1; align-items: center; gap: 10px; padding-left: 13px; }
  .desktop-account > img { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; object-fit: cover; }
  .desktop-account > div { display: flex; min-width: 0; align-items: baseline; gap: 10px; }
  .desktop-account strong { flex: 0 0 auto; font-size: 14px; }
  .desktop-account span { overflow: hidden; color: #a7a7a7; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-title-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; padding: 0 10px; }
  .desktop-title-actions > button { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 5px; background: transparent; color: #c9c9c9; }
  .desktop-title-actions > button:hover { background: #454545; color: white; }
  .desktop-title-actions > button.notification-enabled { color: #68d391; }
  .desktop-title-actions > button.notification-blocked { color: #ff8b8b; }
  .desktop-title-actions > button span { display: none; }
  .desktop-title-actions .lucide { width: 17px; height: 17px; }
  .desktop-presence { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; color: #bebebe; font-size: 12px; }
  .desktop-presence .lucide { width: 19px; height: 19px; }

  .messages-view .main-nav { z-index: 10; grid-column: 1; grid-row: 2; padding: 8px 7px 10px; background: #272727; box-shadow: none; }
  .messages-view .brand-button { display: none; }
  .messages-view .nav-center { width: 100%; padding-top: 2px; gap: 4px; }
  .messages-view .nav-bottom { width: 100%; gap: 10px; }
  .messages-view .nav-button { width: 48px; height: 48px; margin: 0 auto; border-radius: 6px; color: #bcbcbc; }
  .messages-view .nav-button span { display: none; }
  .messages-view .nav-button .lucide { width: 23px; height: 23px; }
  .messages-view .nav-button:hover, .messages-view .nav-button.active { background: #3a3a3a; color: #f2f2f2; }
  .messages-view .nav-button.active::before { top: 11px; bottom: 11px; left: -7px; width: 3px; background: #1683ff; }
  .messages-view .nav-badge { top: 1px; right: -2px; border-color: #272727; }
  .messages-view .avatar-button, .messages-view .avatar-button img { width: 40px; height: 40px; border-radius: 50%; }
  .messages-view .presence-dot { border-color: #272727; }

  .messages-view .side-panel { grid-column: 2; grid-row: 2; grid-template-rows: 64px minmax(0, 1fr); border-right: 1px solid #3b3b3b; background: #232323; color: #eeeeee; }
  .messages-view .side-header { display: none; }
  .messages-view .search-box { grid-row: 1; height: 36px; margin: 15px 14px 10px; padding: 0 7px 0 11px; border: 0; border-radius: 7px; background: #303030; color: #a9a9a9; }
  .messages-view .search-box:focus-within { border: 0; background: #363636; box-shadow: 0 0 0 1px #1683ff; }
  .messages-view .search-box input { color: #ededed; }
  .messages-view .search-box input::placeholder { color: #9d9d9d; }
  .messages-view .search-box kbd { display: none; }
  .messages-view .desktop-new-chat { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 5px; background: #3a3a3a; color: #bfbfbf; }
  .messages-view .desktop-new-chat:hover { background: #454545; color: white; }
  .messages-view .desktop-new-chat .lucide { width: 17px; height: 17px; }
  .messages-view .side-content { grid-row: 2; padding: 0 7px 18px; scrollbar-color: #555 transparent; }
  .messages-view .conversation-item { min-height: 74px; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 11px; padding: 9px 10px; border: 0; border-radius: 7px; color: #ededed; }
  .messages-view .conversation-item:hover { background: #2d2d2d; }
  .messages-view .conversation-item.active { border: 0; background: #3a3a3a; box-shadow: none; }
  .messages-view .list-avatar img { width: 50px; height: 50px; border-radius: 50%; }
  .messages-view .conversation-item.active .online-dot, .messages-view .online-dot { border-color: #232323; }
  .messages-view .conversation-item.active .online-dot { border-color: #3a3a3a; }
  .messages-view .item-title { color: #f2f2f2; font-size: 14px; font-weight: 600; }
  .messages-view .item-time { color: #8f8f8f; font-size: 10px; }
  .messages-view .item-preview { color: #989898; font-size: 11px; }
  .messages-view .unread-badge { min-width: 21px; height: 19px; border-radius: 10px; background: #666; font-size: 9px; transform: translateY(-6px); }

  .messages-view .main-content { grid-column: 3; grid-row: 2; background: #202020; color: #ededed; }
  .messages-view .welcome-pane { background: #202020; }
  .messages-view .welcome-art { width: 164px; height: 164px; }
  .messages-view .welcome-art::after { border-color: #202020; }
  .messages-view .welcome-pane p { color: #9f9f9f; }
  .messages-view .secondary { border-color: #4b4b4b; background: #2c2c2c; color: #ededed; }
  .messages-view .chat-pane { grid-template-rows: 64px minmax(0, 1fr) clamp(170px, 24dvh, 230px); background: #202020; }
  .messages-view .chat-header { padding: 0 20px; border-bottom: 1px solid #363636; background: #222; box-shadow: none; }
  .messages-view .chat-person { gap: 0; }
  .messages-view .chat-person > img { display: none; }
  .messages-view .chat-person h2 { color: #f0f0f0; font-size: 16px; font-weight: 700; }
  .messages-view .chat-person p { color: #929292; font-size: 10px; }
  .messages-view .chat-tools { gap: 3px; }
  .messages-view .chat-tools .icon-button { color: #bebebe; }
  .messages-view .chat-tools .icon-button:hover { border-color: transparent; background: #343434; color: white; box-shadow: none; }
  .messages-view .chat-tools .icon-button.active { border-color: transparent; background: #3a3a3a; color: #5fb2f5; box-shadow: none; }
  .messages-view .group-panel-open .group-detail-panel { position: absolute; z-index: 12; top: 64px; right: 0; bottom: 0; display: block; width: min(400px, calc(100% - 34px)); overflow: hidden; border-left: 1px solid #393939; background: #1b1b1b; color: #ededed; box-shadow: -18px 0 36px rgba(0, 0, 0, .22); }
  .group-panel-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 18px 24px 26px; scrollbar-color: #515151 transparent; }
  .group-panel-overview-scroll { padding-top: 24px; }
  .group-panel-heading { position: sticky; z-index: 3; top: -18px; display: grid; min-height: 58px; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: center; gap: 9px; margin: -18px -24px 16px; padding: 10px 18px; border-bottom: 1px solid #333; background: rgba(27, 27, 27, .97); backdrop-filter: blur(12px); }
  .group-panel-heading-compact { grid-template-columns: minmax(0, 1fr) 34px; }
  .group-panel-heading > div { min-width: 0; }
  .group-panel-heading span { display: block; margin-bottom: 2px; color: #777; font-size: 8px; font-weight: 700; }
  .group-panel-heading h3 { overflow: hidden; margin: 0; color: #f0f0f0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
  .group-panel-heading .icon-button { width: 32px; height: 32px; color: #aaa; }
  .group-panel-heading .icon-button:hover { border-color: transparent; background: #333; color: white; }
  .group-panel-profile { display: grid; min-height: 82px; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid #3a3a3a; border-radius: 8px; background: #292929; }
  .group-panel-profile > img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
  .group-panel-profile > div { min-width: 0; }
  .group-panel-profile strong, .group-panel-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .group-panel-profile strong { color: #f1f1f1; font-size: 14px; }
  .group-panel-profile small { width: max-content; max-width: 100%; margin-top: 6px; padding: 2px 5px; border-radius: 3px; background: #3c3c3c; color: #b9b9b9; font-size: 9px; }
  .group-panel-profile .secondary { min-height: 34px; padding: 0 12px; border-color: #555; background: transparent; font-size: 11px; }
  .group-panel-profile .secondary .lucide { width: 14px; height: 14px; }
  .group-panel-members-card { margin-top: 20px; padding: 13px 14px 15px; border: 1px solid #3a3a3a; border-radius: 8px; background: #292929; }
  .group-panel-section-head { display: flex; width: 100%; min-height: 30px; align-items: flex-start; justify-content: space-between; gap: 12px; background: transparent; color: #ededed; text-align: left; }
  .group-panel-section-head strong { font-size: 14px; }
  .group-panel-section-head > span { display: inline-flex; align-items: center; gap: 2px; color: #aaa; font-size: 10px; }
  .group-panel-section-head .lucide { width: 13px; height: 13px; }
  .group-member-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px 8px; margin-top: 14px; }
  .group-member-tile { display: grid; min-width: 0; justify-items: center; gap: 6px; padding: 0; background: transparent; color: #aaa; }
  .group-member-tile > span { position: relative; display: grid; width: 42px; height: 42px; place-items: center; }
  .group-member-tile img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
  .group-member-tile > span > .lucide { position: absolute; right: -3px; bottom: -2px; width: 15px; height: 15px; padding: 3px; border: 2px solid #292929; border-radius: 50%; background: #d3a63c; color: #222; }
  .group-member-tile small { width: 100%; overflow: hidden; color: #999; font-size: 9px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
  button.group-member-tile:hover small { color: white; }
  .group-member-tool > span { border-radius: 50%; background: #3b3b3b; }
  .group-member-tool > span > .lucide { position: static; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 0; background: transparent; color: #aaa; }
  .group-member-tool:hover > span { background: #454545; }
  .group-panel-section-title { margin: 24px 0 8px; padding-left: 2px; color: #999; font-size: 12px; }
  .group-panel-row-group { overflow: hidden; border: 1px solid #333; border-radius: 8px; background: #292929; }
  .group-panel-row, .group-panel-switch-row { display: flex; width: 100%; min-height: 54px; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 14px; border-bottom: 1px solid #383838; background: transparent; color: #ededed; text-align: left; }
  .group-panel-row:last-child, .group-panel-switch-row:last-child { border-bottom: 0; }
  button.group-panel-row:hover, .group-panel-switch-row:hover { background: #303030; }
  .group-panel-row > span, .group-panel-switch-row > span { min-width: 0; }
  .group-panel-row strong, .group-panel-row small, .group-panel-switch-row strong, .group-panel-switch-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .group-panel-row strong, .group-panel-switch-row strong { font-size: 13px; font-weight: 550; }
  .group-panel-row small, .group-panel-switch-row small { margin-top: 4px; color: #8f8f8f; font-size: 9px; }
  .group-panel-row > .lucide { width: 15px; height: 15px; flex: 0 0 15px; color: #888; }
  .switch-control { position: relative; display: block; width: 36px; height: 20px; flex: 0 0 36px; border-radius: 10px; background: #565656; transition: background .16s; }
  .switch-control b { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #e6e6e6; transition: transform .16s; }
  .switch-control.checked { background: #087ee5; }
  .switch-control.checked b { transform: translateX(16px); }
  .group-panel-danger, .group-panel-clear { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: center; gap: 8px; margin-top: 24px; border: 1px solid #333; border-radius: 8px; background: #292929; color: #f06056; font-size: 12px; }
  .group-panel-clear { margin-top: 14px; color: #d4d4d4; }
  .group-panel-danger:hover { border-color: #713d38; background: #382725; }
  .group-panel-clear:hover { background: #303030; color: white; }
  .group-panel-danger .lucide, .group-panel-clear .lucide { width: 15px; height: 15px; }
  .group-panel-members-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 12px; color: #999; font-size: 11px; }
  .group-panel-members-toolbar .secondary { min-height: 34px; padding: 0 11px; font-size: 10px; }
  .group-panel-member-list { overflow: hidden; border: 1px solid #333; border-radius: 8px; background: #292929; }
  .group-panel-member-row { display: grid; min-height: 62px; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 11px; border-bottom: 1px solid #383838; }
  .group-panel-member-row:last-child { border-bottom: 0; }
  .group-panel-member-avatar { position: relative; }
  .group-panel-member-avatar img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
  .group-panel-member-avatar > span { position: absolute; right: 0; bottom: 0; }
  .group-panel-member-copy { min-width: 0; }
  .group-panel-member-copy strong { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 11px; }
  .group-panel-member-copy small { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 4px; color: #8e8e8e; font-size: 9px; }
  .group-panel-member-actions { display: flex; align-items: center; gap: 3px; }
  .group-panel-member-actions .icon-button { width: 29px; height: 29px; color: #aaa; }
  .group-panel-member-actions .role-icon { color: #67a9df; }
  .group-panel-member-actions .danger-icon { color: #df6a61; }
  .group-panel-form { display: grid; gap: 16px; }
  .group-panel-form > label > span, .group-panel-avatar-picker legend { display: block; margin-bottom: 7px; color: #aaa; font-size: 11px; }
  .group-panel-form input[type="text"], .group-panel-form input:not([type]), .group-panel-form textarea { width: 100%; border: 1px solid #414141; border-radius: 7px; outline: 0; background: #292929; color: #ededed; }
  .group-panel-form input[type="text"], .group-panel-form input:not([type]) { height: 44px; padding: 0 12px; }
  .group-panel-form textarea { min-height: 88px; padding: 11px 12px; resize: vertical; line-height: 1.6; }
  .group-panel-form input:focus, .group-panel-form textarea:focus { border-color: #087ee5; box-shadow: 0 0 0 3px rgba(8, 126, 229, .12); }
  .group-panel-avatar-picker { flex-wrap: wrap; gap: 10px; }
  .group-panel-avatar-picker img { width: 52px; height: 52px; border-color: #414141; border-radius: 50%; }
  .group-panel-avatar-picker input:checked + img { border-color: #1688e9; box-shadow: 0 0 0 2px rgba(22, 136, 233, .16); }
  .group-panel-avatar-picker .avatar-upload-option > span { border-radius: 50%; }
  .group-panel-save { display: flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; border-radius: 7px; background: #087ee5; color: white; }
  .group-panel-save:hover { background: #1688e9; }
  .group-panel-save .lucide { width: 15px; height: 15px; }
  .group-panel-readonly { display: grid; gap: 7px; padding: 14px; border: 1px solid #333; border-radius: 8px; background: #292929; }
  .group-panel-readonly span { color: #888; font-size: 10px; }
  .group-panel-readonly strong, .group-panel-readonly p { margin: 0 0 8px; color: #ededed; font-size: 12px; line-height: 1.6; }
  .messages-view .message-scroll { padding: 22px 34px 30px; background: #202020; scrollbar-color: #555 transparent; }
  .messages-view .message-day { width: max-content; margin: 16px auto; padding: 4px 9px; border-radius: 11px; background: #181818; color: #898989; font-size: 10px; }
  .messages-view .message { max-width: min(72%, 680px); margin: 14px 0; }
  .messages-view .message.own { margin-left: auto; }
  .messages-view .message-avatar img { width: 38px; height: 38px; border: 0; border-radius: 50%; }
  .messages-view .message-name { color: #929292; }
  .messages-view .message-group-title { background: #313f3a; color: #84c9ae; }
  .messages-view .bubble { border-color: #3a3a3a; background: #2c2c2c; color: #ededed; box-shadow: none; }
  .messages-view .message.own .bubble { border-color: #176fbd; background: #176fbd; color: white; box-shadow: none; }
  .messages-view .message.system .bubble { background: #181818; color: #8f8f8f; }
  .messages-view .message-time { color: #7f7f7f; }
  .messages-view .message-read-state { color: #8e8e8e; }
  .messages-view .message-read-state.read { color: #5eaaeb; }
  .messages-view .message-mention { color: #72b7f5; }
  .messages-view .message.own .message-mention { color: #fff0a9; }
  .messages-view .composer { display: flex; min-height: 170px; flex-direction: column; padding: 10px 20px 14px; border-top: 1px solid #363636; background: #222; box-shadow: none; }
  .messages-view .composer-tools { flex: 0 0 auto; gap: 2px; margin: 0 0 4px; }
  .messages-view .composer-tools [data-action="search-messages"] { margin-left: auto; }
  .messages-view .composer-tools .icon-button { color: #c6c6c6; }
  .messages-view .composer-tools .icon-button:hover { border-color: transparent; background: #343434; color: white; box-shadow: none; }
  .messages-view .composer-main { position: relative; min-height: 0; flex: 1; align-items: stretch; padding: 0; border: 0; border-radius: 0; background: transparent; }
  .messages-view .composer-main:focus-within { border: 0; box-shadow: none; }
  .messages-view .composer textarea { width: 100%; min-height: 0; max-height: none; padding: 5px 0 48px; color: #ededed; font-size: 14px; line-height: 1.7; }
  .messages-view .composer textarea::placeholder { color: #777; }
  .messages-view .send-button { position: absolute; right: 10px; bottom: 4px; display: flex; width: 118px; height: 40px; align-items: center; justify-content: center; gap: 7px; border-radius: 7px; background: #087ee5; color: white; }
  .messages-view .send-button:hover { background: #148af0; transform: none; }
  .messages-view .send-button .lucide { width: 15px; height: 15px; }
  .messages-view .emoji-popover { bottom: calc(100% + 8px); left: 20px; border-color: #414141; background: #2a2a2a; box-shadow: 0 16px 40px rgba(0,0,0,.3); }
  .messages-view .emoji-popover button:hover { background: #3a3a3a; }

  [data-theme="light"] .app-shell.messages-view, [data-theme="light"] .messages-view .main-content, [data-theme="light"] .messages-view .welcome-pane, [data-theme="light"] .messages-view .chat-pane, [data-theme="light"] .messages-view .message-scroll { background: #f4f5f5; color: #202425; }
  [data-theme="light"] .messages-view .desktop-titlebar { border-color: #d9dddd; background: #f7f8f8; color: #202425; }
  [data-theme="light"] .desktop-product { border-color: #d9dddd; color: #303536; }
  [data-theme="light"] .desktop-account span, [data-theme="light"] .desktop-presence { color: #72797b; }
  [data-theme="light"] .desktop-title-actions > button { color: #555d5f; }
  [data-theme="light"] .desktop-title-actions > button:hover { background: #e6e9e9; color: #171a1b; }
  [data-theme="light"] .messages-view .main-nav { background: #eceeee; }
  [data-theme="light"] .messages-view .nav-button { color: #697173; }
  [data-theme="light"] .messages-view .nav-button:hover, [data-theme="light"] .messages-view .nav-button.active { background: #dce1e2; color: #1683e8; }
  [data-theme="light"] .messages-view .nav-badge, [data-theme="light"] .messages-view .presence-dot { border-color: #eceeee; }
  [data-theme="light"] .messages-view .side-panel { border-color: #d8dddd; background: #fafbfb; color: #222627; }
  [data-theme="light"] .messages-view .search-box { background: #e9eded; color: #72797b; }
  [data-theme="light"] .messages-view .search-box:focus-within { background: #fff; }
  [data-theme="light"] .messages-view .search-box input { color: #202425; }
  [data-theme="light"] .messages-view .search-box input::placeholder { color: #7d8486; }
  [data-theme="light"] .messages-view .desktop-new-chat { background: #dce1e2; color: #626a6c; }
  [data-theme="light"] .messages-view .conversation-item { color: #222627; }
  [data-theme="light"] .messages-view .conversation-item:hover { background: #eef1f1; }
  [data-theme="light"] .messages-view .conversation-item.active { background: #dfe5e6; }
  [data-theme="light"] .messages-view .conversation-item .online-dot { border-color: #fafbfb; }
  [data-theme="light"] .messages-view .conversation-item.active .online-dot { border-color: #dfe5e6; }
  [data-theme="light"] .messages-view .item-title, [data-theme="light"] .messages-view .chat-person h2 { color: #202425; }
  [data-theme="light"] .messages-view .item-preview, [data-theme="light"] .messages-view .chat-person p { color: #737b7d; }
  [data-theme="light"] .messages-view .chat-header, [data-theme="light"] .messages-view .composer { border-color: #d9dddd; background: #fff; }
  [data-theme="light"] .messages-view .chat-tools .icon-button, [data-theme="light"] .messages-view .composer-tools .icon-button { color: #596164; }
  [data-theme="light"] .messages-view .bubble { border-color: #dde2e3; background: #fff; color: #222627; }
  [data-theme="light"] .messages-view .message.system .bubble, [data-theme="light"] .messages-view .message-day { background: #e5e9e9; color: #747b7d; }
  [data-theme="light"] .messages-view .composer textarea { color: #202425; }
  [data-theme="light"] .messages-view .emoji-popover { border-color: #d3d8d9; background: #fff; }
}

@media (min-width: 1180px) {
  .messages-view .chat-pane.group-panel-open { grid-template-columns: minmax(320px, 1fr) 400px; }
  .messages-view .group-panel-open .chat-header { grid-column: 1 / -1; grid-row: 1; }
  .messages-view .group-panel-open .message-scroll { grid-column: 1; grid-row: 2; }
  .messages-view .group-panel-open .composer { grid-column: 1; grid-row: 3; }
  .messages-view .group-panel-open .group-detail-panel { position: static; z-index: auto; width: auto; grid-column: 2; grid-row: 2 / 4; box-shadow: none; }
}

@media (max-width: 980px) {
  :root { --side-width: 300px; }
  .auth-screen { grid-template-columns: minmax(350px, .8fr) minmax(420px, 1.2fr); }
  .auth-quote { font-size: 38px; }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-summary { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 20px; text-align: left; }
  .profile-avatar-editor { margin: 0; }
  .avatar-reset-button { margin: 0; }
  .profile-desktop-shell { grid-template-columns: 270px minmax(0, 1fr); }
  .profile-identity-panel { padding-right: 22px; padding-left: 22px; }
  .profile-detail-list { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body { overflow: hidden; }
  .auth-screen { display: block; overflow-y: auto; background: var(--surface); }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100%; padding: 30px 22px; }
  .mobile-brand { display: flex; }
  .auth-tabs { margin-bottom: 30px; }
  .app-shell { display: block; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .app-shell.chat-open { padding-bottom: 0; }
  .main-nav { display: none; }
  .side-panel { width: 100%; height: 100%; grid-template-rows: 78px auto minmax(0, 1fr); border: 0; }
  .side-header { height: 78px; padding: 13px 18px 8px; }
  .side-content { height: auto; }
  .messages-view .side-panel { grid-template-rows: clamp(94px, 12dvh, 104px) auto minmax(0, 1fr); background: #1d2021; color: #f1f2f2; }
  .messages-view .side-header { display: none; }
  .messages-view .mobile-conversation-hero { position: relative; display: block; min-height: 0; overflow: hidden; background: #173d33; color: white; }
  .mobile-conversation-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 42%; }
  .mobile-conversation-tint { position: absolute; inset: 0; background: rgba(7, 35, 27, .32); }
  .mobile-conversation-identity { position: absolute; z-index: 1; right: 54px; bottom: 18px; left: 14px; display: flex; min-width: 0; align-items: center; gap: 9px; }
  .mobile-conversation-identity > img { width: 40px; height: 40px; flex: 0 0 40px; border: 2px solid rgba(255,255,255,.78); border-radius: 50%; object-fit: cover; box-shadow: 0 6px 16px rgba(0,0,0,.22); }
  .mobile-conversation-identity > div { min-width: 0; }
  .mobile-conversation-identity h1 { overflow: hidden; margin: 0; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-conversation-identity p { display: flex; align-items: center; gap: 5px; margin: 2px 0 0; color: rgba(255,255,255,.8); font-size: 9px; }
  .mobile-conversation-identity p > span { width: 8px; height: 8px; border: 2px solid rgba(255,255,255,.38); border-radius: 50%; background: #55d89b; }
  .mobile-conversation-hero > strong { display: none; }
  .mobile-hero-action { position: absolute; z-index: 2; right: 14px; bottom: 29px; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; background: rgba(18, 49, 40, .34); color: white; backdrop-filter: blur(9px); }
  .mobile-hero-action .lucide { width: 19px; height: 19px; }
  .messages-view .search-box { height: 44px; margin: 10px 14px 7px; padding: 0 14px; border: 0; border-radius: 8px; background: #323536; color: #a7aaab; }
  .messages-view .search-box:focus-within { border: 0; background: #383b3c; box-shadow: 0 0 0 2px rgba(8,126,229,.35); }
  .messages-view .search-box .lucide { width: 19px; height: 19px; }
  .messages-view .search-box input { color: #f2f2f2; font-size: 14px; text-align: left; }
  .messages-view .search-box input::placeholder { color: #a0a3a4; }
  .messages-view .search-box kbd, .messages-view .desktop-new-chat { display: none; }
  .messages-view .side-content { padding: 0 10px calc(18px + env(safe-area-inset-bottom)); background: #1d2021; scrollbar-color: #454849 transparent; }
  .messages-view .conversation-item { position: relative; min-height: 80px; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; padding: 10px 9px; border: 0; border-radius: 8px; color: #f1f2f2; }
  .messages-view .conversation-item:hover, .messages-view .conversation-item.active { border: 0; background: #292c2d; box-shadow: none; }
  .messages-view .list-avatar img { width: 58px; height: 58px; border-radius: 50%; }
  .messages-view .conversation-item.active .online-dot, .messages-view .online-dot { border-color: #1d2021; }
  .messages-view .item-title { color: #f2f2f2; font-size: 15px; font-weight: 700; }
  .messages-view .item-time { color: #6f7374; font-size: 10px; }
  .messages-view .item-preview { margin-top: 6px; color: #999d9e; font-size: 12px; }
  .messages-view .unread-badge { position: absolute; top: 6px; left: 51px; min-width: 25px; height: 21px; border: 2px solid #1d2021; border-radius: 11px; background: #eb4f3d; font-size: 9px; transform: none; }
  .messages-view .conversation-pref-icon { color: #777b7c; }
  .side-panel.mobile-hidden { display: none; }
  .main-content { display: none; width: 100%; height: 100%; }
  .main-content.mobile-visible { display: block; }
  .mobile-nav { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: grid; height: calc(72px + env(safe-area-inset-bottom)); grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: 0 -6px 20px rgba(28, 49, 40, .06); backdrop-filter: blur(16px); }
  .mobile-nav.hidden-for-chat { display: none; }
  .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: transparent; color: var(--muted); font-size: 10px; }
  .mobile-nav button.active { color: var(--green); }
  .mobile-nav .lucide { width: 20px; height: 20px; }
  .messages-view .mobile-nav { border-color: #383b3c; background: rgba(39, 42, 43, .97); box-shadow: 0 -8px 22px rgba(0,0,0,.2); }
  .messages-view .mobile-nav button { color: #b9bcbc; }
  .messages-view .mobile-nav button.active { color: #2ca4f3; }
  .app-shell.profile-view { padding-bottom: 0; }
  .profile-view .mobile-nav { display: none; }
  .profile-home { padding-bottom: calc(78px + env(safe-area-inset-bottom)); background: #101613; color: #f1f5f3; }
  .profile-cover { height: 262px; min-height: 262px; }
  .profile-cover > img { object-position: center; }
  .profile-cover-tint { background: rgba(6, 21, 17, .34); }
  .profile-cover-copy { display: none; }
  .profile-cover-actions { top: calc(16px + env(safe-area-inset-top)); right: 15px; }
  .profile-cover-actions button { width: 38px; height: 38px; border-color: rgba(255,255,255,.18); }
  .profile-mobile-back { z-index: 2; top: calc(16px + env(safe-area-inset-top)); left: 15px; display: grid; position: absolute; }
  .profile-desktop-shell { display: block; width: 100%; min-height: 0; margin: -20px 0 0; border: 0; border-radius: 18px 18px 0 0; background: #151c19; }
  .profile-identity-panel { padding: 0 20px 22px; border: 0; }
  .profile-avatar-wrap { width: 104px; height: 104px; margin-top: -44px; }
  .profile-avatar-wrap > img { width: 104px; height: 104px; border: 4px solid #151c19; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.22), 0 12px 24px rgba(0,0,0,.24); }
  .profile-avatar-wrap .presence-dot { border-color: #151c19; }
  .profile-name-row { margin-top: 14px; }
  .profile-name-row h1 { color: #f6f8f7; font-size: 24px; }
  .profile-name-row p { color: #8fa099; }
  .profile-name-row > button { background: #222c28; color: #a9b7b1; }
  .profile-status-line { margin-top: 12px; }
  .profile-status-line span { background: #203c32; color: #70d2ab; }
  .profile-status-line b { background: #3a2926; color: #ff8b79; }
  .profile-signature { min-height: 0; margin-top: 17px; color: #e3e9e6; font-size: 15px; }
  .profile-stat-grid { margin-top: 19px; padding: 15px 0; border-color: #2a332f; }
  .profile-stat-grid > * { border-color: #2a332f; color: #f1f5f3; }
  .profile-stat-grid span { color: #889790; }
  .profile-desktop-actions { display: none; }
  .profile-content-column > section { padding: 22px 20px; border-top: 10px solid #0c110f; border-bottom: 0; }
  .profile-section-heading { margin-bottom: 17px; }
  .profile-section-heading span { color: #66bd9b; }
  .profile-section-heading h2 { color: #f3f6f4; font-size: 18px; }
  .profile-section-heading > button { color: #84bba4; }
  .profile-detail-list { grid-template-columns: 1fr; gap: 0; }
  .profile-detail-list > div { min-height: 68px; grid-template-columns: 32px minmax(0, 1fr) auto; padding: 10px 0; border: 0; border-bottom: 1px solid #29322e; border-radius: 0; background: transparent; }
  .profile-detail-list > div:last-child { border-bottom: 0; }
  .profile-detail-list small { color: #819088; }
  .profile-detail-list b { color: #e8eeeb; }
  .profile-detail-list meter { grid-column: 2 / -1; }
  .profile-about-entry { border-color: #35413b; background: #202824; color: #edf2ef; }
  .profile-about-entry:hover { border-color: #476055; background: #27322d; }
  .profile-about-entry small { color: #87968f; }
  .profile-about-entry > .lucide { color: #7e8d86; }
  .profile-badge-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
  .profile-badge-list::-webkit-scrollbar { display: none; }
  .profile-badge-list > div { min-width: 154px; background: #202824; }
  .profile-badge-list > div > .lucide { color: #ff765f; }
  .profile-badge-list b { color: #edf2ef; }
  .profile-badge-list small { color: #85938c; }
  .profile-moment-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .profile-moment-tile { border-radius: 4px; }
  .profile-text-moment { padding: 9px; color: #e8eeeb; }
  .profile-text-moment b { font-size: 9px; -webkit-line-clamp: 4; }
  .profile-moments-empty { min-height: 88px; border-color: #35413b; background: #1d2521; }
  .profile-moments-empty b { color: #edf2ef; }
  .profile-moments-empty small { color: #87968f; }
  .profile-mobile-actions { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; min-height: calc(72px + env(safe-area-inset-bottom)); grid-template-columns: .8fr 1fr 1.15fr; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #2a332f; background: rgba(18, 25, 22, .96); backdrop-filter: blur(16px); }
  .profile-mobile-actions button { display: flex; min-width: 0; min-height: 48px; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; border: 1px solid #3c4842; border-radius: 7px; background: transparent; color: #e6ece9; font-size: 12px; font-weight: 650; }
  .profile-mobile-actions button.primary { border-color: var(--green); background: var(--green); color: white; }
  .profile-mobile-actions .lucide { width: 17px; height: 17px; }
  .profile-editor-layer { align-items: end; padding: 0; }
  .profile-editor-sheet { width: 100%; max-height: 88dvh; border: 0; border-radius: 18px 18px 0 0; }
  .profile-editor-sheet > header { padding: 20px 20px 16px; }
  .profile-editor-sheet .settings-form { display: grid; grid-template-columns: 1fr; padding: 19px 20px calc(22px + env(safe-area-inset-bottom)); }
  .profile-editor-avatar, .profile-editor-sheet .name-field, .profile-editor-sheet .bio-field, .profile-editor-sheet .settings-actions { grid-column: 1; }
  .profile-editor-sheet .settings-actions { justify-content: stretch; }
  .profile-editor-sheet .settings-actions button { flex: 1; }
  .chat-pane { grid-template-rows: 72px minmax(0, 1fr) auto; height: 100dvh; background: #0b0c0d; color: #f2f2f2; }
  .chat-header { padding: 0 12px 0 7px; border-color: #292b2c; background: #171819; box-shadow: none; }
  .chat-person { gap: 9px; }
  .chat-person > img { display: none; }
  .chat-person h2 { color: #f4f4f4; font-size: 18px; font-weight: 750; }
  .chat-person p { margin-top: 2px; color: #50d594; font-size: 10px; }
  .mobile-back { display: flex; width: auto; min-width: 38px; height: 42px; flex: 0 0 auto; align-items: center; gap: 2px; padding: 0 5px 0 0; border: 0; color: #f1f1f1; }
  .mobile-back:hover { border: 0; background: transparent; box-shadow: none; }
  .mobile-back .lucide { width: 30px; height: 30px; stroke-width: 1.7; }
  .mobile-back-count { display: grid; min-width: 30px; height: 30px; place-items: center; padding: 0 7px; border-radius: 15px; background: #313234; color: #ddd; font-size: 11px; }
  .chat-tools [data-action="search-messages"] { display: none; }
  .chat-tools [data-action="conversation-info"] { width: 46px; height: 46px; color: #e9e9e9; }
  .chat-tools [data-action="conversation-info"] .lucide { width: 27px; height: 27px; stroke-width: 1.7; }
  .desktop-panel-icon { display: none; }
  .mobile-menu-icon { display: block; }
  .message-scroll { padding: 24px 14px 34px; background: #0b0c0d; scrollbar-color: #454748 transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .message-scroll *, .voice-recorder *, .message-action-layer * { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .chat-pane.chat-background-mist .message-scroll { background: #e8ecee; }
  .chat-pane.chat-background-night .message-scroll { background: #071a2b; }
  .message-day { margin: 22px auto; color: #707376; font-size: 10px; }
  .message { max-width: 91%; gap: 11px; margin: 22px 0; }
  .message-avatar img { width: 44px; height: 44px; border: 0; border-radius: 50%; }
  .direct-chat .message-name { display: none; }
  .message-name { margin-bottom: 5px; color: #808487; font-size: 9px; }
  .bubble, .message.own .bubble { padding: 11px 14px; border: 0; border-radius: 14px; background: #252728; color: #f5f5f5; box-shadow: none; font-size: 15px; line-height: 1.55; }
  .message.own .bubble { border-radius: 14px; }
  .bubble-image, .message.own .bubble-image { width: min(280px, 72vw); max-width: none; padding: 0; overflow: hidden; background: transparent; }
  .bubble-image img { width: 100%; max-height: 420px; border-radius: 14px; object-fit: contain; }
  .voice-message-player { width: min(var(--voice-width, 196px), 70vw); height: 46px; grid-template-columns: 32px minmax(92px, 1fr) 34px; }
  .voice-waveform-canvas, .voice-waveform-control { height: 42px; }
  .video-message-shell { width: min(300px, 74vw); border-radius: 12px; }
  .message-video { width: 100%; max-height: 260px; }
  .message:has(.voice-message-player) .bubble { padding: 4px 9px; }
  .message:has(.message-video) .bubble { padding: 9px; }
  .file-message { width: min(300px, 78vw); }
  .voice-recorder { position: absolute; z-index: 12; right: 0; bottom: 0; left: 0; display: flex; height: clamp(330px, 48dvh, 430px); max-height: calc(100dvh - 96px); flex-direction: column; overflow: hidden; border-top: 1px solid #303334; border-radius: 16px 16px 0 0; background: #181a1b; color: #f4f5f5; box-shadow: 0 -20px 44px rgba(0,0,0,.32); opacity: 0; pointer-events: none; transform: translateY(24px); transition: opacity .2s ease, transform .24s cubic-bezier(.2,.8,.2,1); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .voice-recorder[hidden] { display: none !important; }
  .voice-recorder:not([hidden]) { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .voice-recorder-close { position: absolute; z-index: 2; top: 10px; right: 10px; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; background: transparent; color: #8d9294; }
  .voice-recorder-close:hover { background: #242728; color: #f2f3f3; }
  .voice-recorder-close .lucide { width: 24px; height: 24px; }
  .voice-recorder-body { display: grid; min-height: 0; flex: 1; grid-template-rows: 40px auto 140px auto; align-content: center; justify-items: center; gap: 10px; padding: 20px 18px 12px; }
  .voice-recording-status { display: flex; width: min(272px, 72vw); height: 40px; align-items: center; justify-content: center; gap: 12px; opacity: 0; transition: opacity .18s ease; }
  .voice-recording-status canvas { width: min(218px, 56vw); height: 36px; }
  .voice-recording-status time { min-width: 42px; color: #92979a; font-size: 14px; font-variant-numeric: tabular-nums; }
  .voice-recorder.recording .voice-recording-status { opacity: 1; }
  .voice-recorder-body p { margin: 0; color: #aeb2b4; font-size: 17px; font-weight: 750; }
  .voice-recorder.recording .voice-recorder-body p { color: #d3d6d7; }
  .voice-recorder-body small { color: #727779; font-size: 11px; }
  .voice-record-controls { display: grid; grid-template-columns: 68px 136px 68px; align-items: center; justify-content: center; gap: clamp(12px, 6vw, 28px); }
  .voice-record-controls > span { width: 68px; height: 68px; }
  .voice-record-cancel { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 50%; background: #2b2d2e; color: #f0f1f1; opacity: 0; pointer-events: none; transform: scale(.88); transition: opacity .16s ease, transform .18s ease, background-color .16s ease; }
  .voice-record-cancel .lucide { width: 31px; height: 31px; stroke-width: 1.5; }
  .voice-recorder.recording .voice-record-cancel { opacity: 1; pointer-events: auto; transform: scale(1); }
  .voice-record-cancel:hover { background: #383b3c; }
  .voice-hold-button { display: grid; width: 136px; height: 136px; place-items: center; border: 6px solid #143f5b; border-radius: 50%; background: #159ff1; color: white; box-shadow: 0 11px 28px rgba(0,0,0,.34), 0 0 0 1px rgba(255,255,255,.08) inset; transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .voice-hold-button .lucide { width: 59px; height: 59px; stroke-width: 1.7; }
  .voice-hold-button:active, .voice-hold-button.recording { background: #078be0; box-shadow: 0 0 0 10px rgba(21,159,241,.15), 0 11px 30px rgba(0,0,0,.4); transform: scale(.96); }
  .voice-recorder-modes { display: grid; min-height: calc(54px + env(safe-area-inset-bottom)); grid-template-columns: repeat(3, 1fr); align-items: start; padding: 8px 58px env(safe-area-inset-bottom); border-top: 1px solid #292b2c; background: #171819; }
  .voice-recorder-modes span { display: grid; min-height: 40px; place-items: center; color: #777c7e; font-size: 13px; }
  .voice-recorder-modes span.active { color: #f2f3f3; font-weight: 750; }
  .message-time { margin-top: 6px; color: #6d7072; font-size: 9px; }
  .message-read-state { display: inline-flex; min-height: 16px; align-items: center; color: #8b8e90; font-size: 9px; font-weight: 650; }
  .message-read-state.read { color: #49aef0; }
  .composer { display: flex; min-height: calc(116px + env(safe-area-inset-bottom)); flex-direction: column; padding: 8px 14px calc(6px + env(safe-area-inset-bottom)); border-color: #292b2c; background: #181a1b; box-shadow: none; }
  .composer-main { order: 1; min-height: 42px; flex: 0 0 42px; align-items: center; padding: 3px 5px 3px 14px; border: 0; border-radius: 12px; background: #252728; }
  .composer-main:focus-within { border: 0; box-shadow: 0 0 0 2px rgba(255,255,255,.08); }
  .composer textarea { min-height: 32px; max-height: 68px; padding: 5px 0; color: #f2f2f2; font-size: 15px; }
  .composer textarea::placeholder { color: #65686a; }
  .composer .send-button { display: none; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; background: #1688e9; }
  .composer.has-text .send-button { display: grid; }
  .composer .send-button span { display: none; }
  .composer-tools { order: 2; display: grid; min-height: 48px; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: center; gap: 3px; margin: 4px 0 0; }
  .composer-tools .icon-button, .mobile-composer-tool { display: grid; width: 44px; height: 44px; justify-self: center; color: #eceeef; }
  .composer-tools .icon-button:hover { border-color: transparent; background: #292c2d; color: white; box-shadow: none; }
  .composer-tools .lucide { width: 25px; height: 25px; stroke-width: 1.7; }
  .composer-tools .desktop-composer-tool { display: none; }
  .emoji-popover { bottom: calc(100% + 8px); left: 10px; border-color: #393c3d; background: #242627; box-shadow: 0 16px 38px rgba(0,0,0,.38); }
  .chat-more-popover { position: absolute; z-index: 6; right: 12px; bottom: calc(100% + 8px); display: grid; grid-template-columns: repeat(3, 72px); gap: 8px; padding: 10px; border: 1px solid #393c3d; border-radius: 8px; background: #242627; box-shadow: 0 16px 38px rgba(0,0,0,.38); }
  .chat-more-popover button { display: grid; min-height: 66px; place-items: center; gap: 4px; border-radius: 7px; background: #2d3031; color: #e9e9e9; font-size: 10px; }
  .chat-more-popover button:hover { background: #383b3c; }
  .chat-more-popover .lucide { width: 22px; height: 22px; }
  .page-header { min-height: 66px; padding: 0 16px; }
  .page-body { width: calc(100% - 24px); padding-top: 18px; }
  .contact-hero { align-items: flex-start; }
  .contact-hero h2 { font-size: 20px; }
  .contact-grid { grid-template-columns: 1fr; }
  .request-row { grid-template-columns: 42px minmax(0, 1fr); }
  .request-row img { width: 42px; height: 42px; }
  .request-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .moments-wrap { width: calc(100% - 20px); padding-top: 10px; }
  .moment-card { padding: 15px; }
  .profile-layout { gap: 12px; }
  .profile-summary { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 15px; padding: 18px; text-align: left; }
  .profile-avatar-editor { width: 84px; height: 84px; margin: 0; }
  .profile-avatar-editor > img { width: 84px; height: 84px; border-width: 3px; }
  .avatar-edit-button { right: -6px; bottom: -6px; width: 34px; height: 34px; }
  .profile-identity h2 { font-size: 18px; }
  .profile-identity p { margin: 5px 0 8px; }
  .avatar-reset-button { grid-column: 1 / -1; justify-self: start; margin: 3px 0 0; }
  .settings-panel { padding: 18px; }
  .settings-form { grid-template-columns: 1fr; gap: 15px; }
  .settings-form .bio-field, .settings-actions { grid-column: 1; }
  .settings-form .name-field { grid-column: 1; }
  .settings-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-actions .primary { grid-column: 1 / -1; grid-row: 1; }
  .settings-actions .danger-button { grid-column: 1 / -1; }
  .about-page { grid-template-rows: 60px minmax(0, 1fr); height: 100dvh; }
  .about-page-header { gap: 10px; padding: 0 14px; }
  .about-page-header h1 { font-size: 17px; }
  .about-page-inner { width: calc(100% - 28px); padding: 18px 0 calc(46px + env(safe-area-inset-bottom)); }
  .about-brand-visual { border-radius: 7px; }
  .about-story { margin-top: 26px; }
  .about-story p { margin-bottom: 19px; font-size: 13px; line-height: 1.95; text-align: left; }
  .about-story .about-story-lead { margin-bottom: 21px; font-size: 17px; }
  .about-story blockquote { margin-top: 27px; padding: 14px 0 14px 16px; font-size: 16px; }
  .about-story footer { margin-top: 32px; }

  [data-theme="light"] .messages-view .side-panel, [data-theme="light"] .messages-view .side-content { background: #f6f8f8; color: #202425; }
  [data-theme="light"] .messages-view .search-box { background: #e7ebec; color: #70787a; }
  [data-theme="light"] .messages-view .search-box:focus-within { background: #fff; }
  [data-theme="light"] .messages-view .search-box input { color: #202425; }
  [data-theme="light"] .messages-view .search-box input::placeholder { color: #798083; }
  [data-theme="light"] .messages-view .conversation-item { color: #202425; }
  [data-theme="light"] .messages-view .conversation-item:hover, [data-theme="light"] .messages-view .conversation-item.active { background: #e5e9ea; }
  [data-theme="light"] .messages-view .conversation-item .online-dot { border-color: #f6f8f8; }
  [data-theme="light"] .messages-view .conversation-item.active .online-dot { border-color: #e5e9ea; }
  [data-theme="light"] .messages-view .item-title { color: #202425; }
  [data-theme="light"] .messages-view .item-time, [data-theme="light"] .messages-view .item-preview { color: #727a7c; }
  [data-theme="light"] .messages-view .unread-badge { border-color: #f6f8f8; }
  [data-theme="light"] .messages-view .mobile-nav { border-color: #d7dcdd; background: rgba(250, 251, 251, .97); box-shadow: 0 -8px 22px rgba(31, 42, 44, .08); }
  [data-theme="light"] .messages-view .mobile-nav button { color: #687174; }
  [data-theme="light"] .chat-pane, [data-theme="light"] .message-scroll { background: #f4f6f6; color: #202425; }
  [data-theme="light"] .chat-header, [data-theme="light"] .composer { border-color: #d8dddd; background: #fff; }
  [data-theme="light"] .chat-person h2 { color: #202425; }
  [data-theme="light"] .mobile-back, [data-theme="light"] .chat-tools [data-action="conversation-info"] { color: #303638; }
  [data-theme="light"] .mobile-back-count { background: #e1e5e6; color: #565e60; }
  [data-theme="light"] .bubble, [data-theme="light"] .message.own .bubble { background: #fff; color: #202425; box-shadow: 0 1px 3px rgba(25, 39, 42, .08); }
  [data-theme="light"] .message-name, [data-theme="light"] .message-time { color: #737b7d; }
  [data-theme="light"] .message-read-state { color: #7a8385; }
  [data-theme="light"] .message-read-state.read { color: #2789cf; }
  [data-theme="light"] .composer-main { background: #eef1f2; }
  [data-theme="light"] .composer textarea { color: #202425; }
  [data-theme="light"] .composer textarea::placeholder { color: #8a9294; }
  [data-theme="light"] .composer-tools .icon-button, [data-theme="light"] .mobile-composer-tool { color: #4f585b; }
  [data-theme="light"] .voice-recorder { border-color: #d6dbdc; background: #f7f9f9; color: #202425; box-shadow: 0 -20px 44px rgba(30, 43, 46, .16); }
  [data-theme="light"] .voice-recorder-close, [data-theme="light"] .voice-recorder-body p { color: #60696b; }
  [data-theme="light"] .voice-record-cancel { background: #e4e8e9; color: #313739; }
  [data-theme="light"] .voice-recorder-modes { border-color: #d8dddd; background: #fff; }
  [data-theme="light"] .voice-recorder-modes span.active { color: #202425; }
  [data-theme="light"] .emoji-popover, [data-theme="light"] .chat-more-popover { border-color: #d2d8d9; background: #fff; box-shadow: 0 16px 38px rgba(30,42,45,.16); }
  [data-theme="light"] .chat-more-popover button { background: #edf0f1; color: #303638; }
}

.bubble-image { cursor: zoom-in; line-height: 0; }
.image-viewer { position: fixed; z-index: 120; inset: 0; display: flex; flex-direction: column; background: rgba(5, 6, 7, .96); color: white; }
.image-viewer[hidden] { display: none; }
.image-viewer-toolbar { position: relative; z-index: 2; display: flex; min-height: 58px; flex: 0 0 58px; align-items: center; justify-content: flex-end; gap: 6px; padding: 8px 14px; background: rgba(18, 19, 20, .76); backdrop-filter: blur(12px); }
.image-viewer-action { display: inline-flex; min-width: 42px; height: 42px; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: #e9e9e9; font-size: 12px; text-decoration: none; }
.image-viewer-action:hover { background: #333; color: white; }
.image-viewer-action .lucide { width: 19px; height: 19px; }
.image-viewer-stage { display: grid; min-height: 0; flex: 1; place-items: center; overflow: auto; padding: 28px; }
.image-viewer-stage img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 20px 70px rgba(0,0,0,.44); }
.image-viewer-open { overflow: hidden; }
.message-action-layer { position: fixed; z-index: 150; inset: 0; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.message-action-backdrop { position: absolute; inset: 0; background: rgba(4, 7, 6, .08); backdrop-filter: blur(1px); }
.message-action-menu { --message-action-arrow-x: 50%; position: fixed; z-index: 1; display: grid; width: min(390px, calc(100vw - 24px)); grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding: 9px 8px 10px; border: 1px solid color-mix(in srgb, var(--line) 72%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--surface) 96%, #3d403f); color: var(--text); box-shadow: 0 22px 58px rgba(0,0,0,.34); animation: message-actions-in .16s ease-out; }
.message-action-menu::after { position: absolute; top: 100%; left: var(--message-action-arrow-x); width: 15px; height: 15px; background: inherit; content: ""; transform: translate(-50%, -8px) rotate(45deg); }
.message-action-menu.below-message::after { top: auto; bottom: 100%; transform: translate(-50%, 8px) rotate(45deg); }
.message-action-menu button { position: relative; z-index: 1; display: grid; min-width: 0; min-height: 62px; place-items: center; align-content: center; gap: 6px; padding: 5px 2px; border-radius: 8px; background: transparent; color: var(--text); font-size: 10px; font-weight: 600; line-height: 1.15; }
.message-action-menu button:hover, .message-action-menu button:active { background: color-mix(in srgb, var(--text) 9%, transparent); }
.message-action-menu button.danger { color: var(--text); }
.message-action-menu button.danger:hover { color: var(--danger); }
.message-action-menu button:disabled { opacity: .3; cursor: default; }
.message-action-menu .lucide { width: 23px; height: 23px; stroke-width: 2; }
.message-action-divider { z-index: 1; grid-column: 1 / -1; height: 1px; margin: 1px 8px; background: color-mix(in srgb, var(--line) 76%, transparent); }
[data-theme="dark"] .message-action-menu { border-color: #555a58; background: #444746; color: #fff; }
[data-theme="dark"] .message-action-divider { background: #5b5f5e; }
@keyframes message-actions-in { from { opacity: 0; transform: translateY(7px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.message-selection-mode .message { position: relative; }
.message-select-toggle { position: absolute; top: 20px; left: -34px; z-index: 2; display: grid; width: 28px; height: 28px; place-items: center; padding: 0; border-radius: 50%; background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--muted); box-shadow: 0 2px 9px rgba(0,0,0,.16); }
.message-select-toggle.selected { background: var(--green); color: white; }
.message-select-toggle .lucide { width: 20px; height: 20px; }
.message.multi-selected .bubble { box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 72%, white), var(--shadow-soft); }
.message-selection-toolbar { position: fixed; z-index: 145; right: 16px; bottom: 16px; left: 16px; display: grid; min-height: 68px; grid-template-columns: 60px minmax(80px, 1fr) 60px 60px; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: 0 18px 48px rgba(0,0,0,.3); backdrop-filter: blur(18px); }
.message-selection-toolbar button { display: grid; min-height: 50px; place-items: center; align-content: center; gap: 3px; border-radius: 8px; background: transparent; color: var(--text); font-size: 9px; }
.message-selection-toolbar button:hover { background: var(--surface-hover); }
.message-selection-toolbar button.danger { color: var(--danger); }
.message-selection-toolbar button:disabled { opacity: .35; }
.message-selection-toolbar .lucide { width: 20px; height: 20px; }
.message-selection-count { text-align: center; font-size: 12px; }
.forward-message-preview { overflow: hidden; margin: 0 0 12px; padding: 10px 12px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.forward-conversation-list { display: grid; max-height: min(420px, 58dvh); overflow-y: auto; }
.forward-conversation-row { display: grid; min-height: 64px; grid-template-columns: 44px minmax(0, 1fr) 18px; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; }
.forward-conversation-row:hover { background: var(--surface-hover); }
.forward-conversation-row img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.forward-conversation-row strong, .forward-conversation-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forward-conversation-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.direct-settings-profile-card { display: grid; width: 100%; min-height: 82px; grid-template-columns: 58px minmax(0, 1fr) 20px; align-items: center; gap: 12px; margin: 14px 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); text-align: left; }
.direct-settings-profile-card:hover { background: var(--surface-hover); }
.direct-settings-profile-card > img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; }
.direct-settings-profile-card strong { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.direct-settings-profile-card small { display: block; overflow: hidden; margin-top: 5px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.direct-settings-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.direct-profile-dialog { overflow: hidden; margin: 12px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.direct-profile-cover { position: relative; height: 104px; overflow: hidden; }
.direct-profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.direct-profile-cover > span { position: absolute; inset: 0; background: rgba(9, 30, 23, .22); }
.direct-profile-identity { display: flex; align-items: flex-end; gap: 12px; margin: -28px 18px 0; position: relative; }
.direct-profile-avatar { position: relative; flex: 0 0 auto; }
.direct-profile-avatar img { width: 76px; height: 76px; border: 4px solid var(--surface-soft); border-radius: 50%; object-fit: cover; }
.direct-profile-avatar i { position: absolute; right: 4px; bottom: 4px; width: 13px; height: 13px; border: 3px solid var(--surface-soft); border-radius: 50%; background: var(--subtle); }
.direct-profile-avatar i.online { background: #45c98b; }
.direct-profile-name { display: flex; align-items: center; gap: 6px; }
.direct-profile-name > strong { font-size: 19px; }
.direct-profile-identity small { display: block; margin: 4px 0 8px; color: var(--muted); }
.direct-profile-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 18px 0; padding: 11px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.direct-profile-status span { display: flex; align-items: center; gap: 6px; color: var(--green); }
.direct-profile-status .lucide { width: 14px; height: 14px; }
.direct-profile-status b { font-weight: 600; }
.direct-profile-dialog > p { margin: 0; padding: 14px 18px; color: var(--muted); line-height: 1.7; }
.direct-profile-dialog dl { display: grid; gap: 0; margin: 0; padding: 0 18px 14px; }
.direct-profile-dialog dl div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.direct-profile-dialog dt, .direct-profile-dialog dd { margin: 0; }
.direct-profile-dialog dt { color: var(--muted); }
.chat-background-options { display: grid; gap: 8px; margin-top: 14px; }
.chat-background-options button { display: grid; min-height: 62px; grid-template-columns: 38px minmax(0, 1fr) 22px; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); text-align: left; }
.chat-background-options button.selected { border-color: var(--green); background: var(--green-soft); }
.chat-background-options button > .lucide:first-child { color: var(--green); }
.chat-background-options button > .lucide:last-child { opacity: 0; }
.chat-background-options button.selected > .lucide:last-child { opacity: 1; color: var(--green); }
.chat-background-options small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

@media (max-width: 720px) {
  .message-action-menu { padding: 8px 7px 9px; border-radius: 14px; }
  .message-action-menu button { min-height: 60px; gap: 5px; font-size: 10px; }
  .message-action-menu .lucide { width: 22px; height: 22px; }
  .message-select-toggle { left: -29px; }
  .message-selection-toolbar { right: 10px; bottom: calc(118px + env(safe-area-inset-bottom)); left: 10px; }
}

.desktop-contact-index, .desktop-contact-canvas { display: none; }
.mobile-contact-list { display: block; }

@media (min-width: 721px) {
  .app-shell.contacts-view { grid-template-columns: 70px 310px minmax(0, 1fr); grid-template-rows: 50px minmax(0, 1fr); background: #202020; color: #ededed; }
  .contacts-view .desktop-titlebar { z-index: 20; display: flex; grid-column: 1 / -1; grid-row: 1; min-width: 0; height: 50px; align-items: center; border-bottom: 1px solid #3a3a3a; background: #303030; color: #ededed; }
  .contacts-view .main-nav { z-index: 10; grid-column: 1; grid-row: 2; padding: 8px 7px 10px; background: #272727; box-shadow: none; }
  .contacts-view .brand-button { display: none; }
  .contacts-view .nav-center { width: 100%; padding-top: 2px; gap: 4px; }
  .contacts-view .nav-bottom { width: 100%; gap: 10px; }
  .contacts-view .nav-button { width: 48px; height: 48px; margin: 0 auto; border-radius: 6px; color: #bcbcbc; }
  .contacts-view .nav-button span { display: none; }
  .contacts-view .nav-button .lucide { width: 23px; height: 23px; }
  .contacts-view .nav-button:hover, .contacts-view .nav-button.active { background: #3a3a3a; color: #f2f2f2; }
  .contacts-view .nav-button.active::before { top: 11px; bottom: 11px; left: -7px; width: 3px; background: #1683ff; }
  .contacts-view .nav-badge { top: 1px; right: -2px; border-color: #272727; }
  .contacts-view .avatar-button, .contacts-view .avatar-button img { width: 40px; height: 40px; border-radius: 50%; }
  .contacts-view .presence-dot { border-color: #272727; }
  .contacts-view .side-panel { grid-column: 2; grid-row: 2; grid-template-rows: 64px minmax(0, 1fr); border-right: 1px solid #3b3b3b; background: #232323; color: #eeeeee; }
  .contacts-view .side-header { display: none; }
  .contacts-view .search-box { grid-row: 1; height: 36px; margin: 15px 14px 10px; padding: 0 7px 0 11px; border: 0; border-radius: 7px; background: #303030; color: #a9a9a9; }
  .contacts-view .search-box:focus-within { border: 0; background: #363636; box-shadow: 0 0 0 1px #1683ff; }
  .contacts-view .search-box input { color: #ededed; }
  .contacts-view .search-box input::placeholder { color: #9d9d9d; }
  .contacts-view .search-box kbd { display: none; }
  .contacts-view .desktop-new-chat { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 5px; background: #3a3a3a; color: #bfbfbf; }
  .contacts-view .side-content { grid-row: 2; padding: 0 7px 18px; scrollbar-color: #555 transparent; }
  .contacts-view .main-content { grid-column: 3; grid-row: 2; background: #202020; color: #ededed; }
  .desktop-contact-index { display: block; }
  .mobile-contact-list, .mobile-contact-page { display: none; }
  .desktop-contact-canvas { display: block; width: 100%; height: 100%; overflow-y: auto; background: #202020; }
  .desktop-contact-manager { display: flex; width: calc(100% - 20px); min-height: 40px; align-items: center; justify-content: center; gap: 8px; margin: 8px 10px 9px; border: 1px solid #494949; border-radius: 6px; background: #262626; color: #ececec; font-size: 13px; }
  .desktop-contact-manager:hover { border-color: #666; background: #303030; }
  .desktop-contact-manager .lucide { width: 16px; height: 16px; }
  .desktop-contact-shortcut { display: flex; width: 100%; min-height: 46px; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px; border-bottom: 1px solid #303030; background: transparent; color: #e8e8e8; text-align: left; }
  .desktop-contact-shortcut:hover, .desktop-contact-shortcut.active { background: #333; }
  .desktop-contact-shortcut > span:last-child { display: inline-flex; align-items: center; gap: 7px; }
  .desktop-contact-shortcut b { display: grid; min-width: 18px; height: 18px; place-items: center; padding: 0 5px; border-radius: 9px; background: #e65042; color: white; font-size: 9px; }
  .desktop-contact-shortcut .lucide { width: 16px; height: 16px; color: #a6a6a6; }
  .desktop-contact-tabs { display: grid; height: 40px; grid-template-columns: 1fr 1fr; gap: 2px; margin: 20px 10px 7px; padding: 3px; border-radius: 5px; background: #303030; }
  .desktop-contact-tabs button { border-radius: 4px; background: transparent; color: #bcbcbc; font-size: 12px; }
  .desktop-contact-tabs button.active { background: #414141; color: #4aaff5; }
  .desktop-contact-section-title { display: flex; min-height: 38px; align-items: center; justify-content: space-between; padding: 0 13px; color: #d7d7d7; }
  .desktop-contact-section-title span { display: inline-flex; align-items: center; gap: 8px; }
  .desktop-contact-section-title small { color: #939393; }
  .desktop-contact-section-title .lucide { width: 14px; height: 14px; }
  .desktop-contact-row { display: grid; width: 100%; min-height: 62px; grid-template-columns: 44px minmax(0, 1fr) 18px; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 5px; background: transparent; color: #ededed; text-align: left; }
  .desktop-contact-row:hover { background: #303030; }
  .desktop-contact-row .list-avatar img { width: 44px; height: 44px; border-radius: 50%; }
  .desktop-contact-row .online-dot { border-color: #232323; }
  .desktop-contact-row > span:nth-child(2) { min-width: 0; }
  .desktop-contact-row strong, .desktop-contact-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-contact-row strong { font-size: 13px; }
  .desktop-contact-row small { margin-top: 5px; color: #929292; font-size: 10px; }
  .desktop-contact-row > .lucide { width: 15px; height: 15px; color: #777; }
  .desktop-contact-empty { padding: 24px 12px; color: #777; font-size: 11px; text-align: center; }
  .desktop-contact-home { display: grid; height: 100%; place-content: center; justify-items: center; color: #555; text-align: center; }
  .desktop-contact-home .lucide { width: 74px; height: 74px; margin-bottom: 16px; stroke-width: 1.1; }
  .desktop-contact-home strong { color: #757575; font-size: 14px; }
  .desktop-contact-home span { margin-top: 7px; color: #5f5f5f; font-size: 11px; }
  .desktop-contact-content { width: min(860px, calc(100% - 64px)); margin: 0 auto; padding: 46px 0 70px; }
  .desktop-contact-content > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid #353535; }
  .desktop-contact-content header span { color: #686868; font-size: 9px; font-weight: 700; }
  .desktop-contact-content h1 { margin: 5px 0 4px; color: #ededed; font-size: 22px; }
  .desktop-contact-content p { margin: 0; color: #8d8d8d; font-size: 11px; }
  .desktop-contact-primary { display: inline-flex; min-height: 38px; align-items: center; gap: 7px; padding: 0 14px; border-radius: 6px; background: #087ee5; color: white; }
  .desktop-contact-primary .lucide { width: 15px; height: 15px; }
  .desktop-contact-request-list, .desktop-contact-manager-grid { display: grid; gap: 1px; margin-top: 18px; overflow: hidden; border: 1px solid #353535; border-radius: 7px; background: #353535; }
  .desktop-contact-request-list article { display: grid; min-height: 72px; grid-template-columns: 48px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 13px; background: #282828; }
  .desktop-contact-request-list img, .desktop-contact-manager-grid img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
  .desktop-contact-request-list strong, .desktop-contact-request-list small { display: block; }
  .desktop-contact-request-list small { margin-top: 5px; color: #8f8f8f; font-size: 10px; }
  .desktop-contact-request-list article > button { min-height: 32px; padding: 0 12px; border-radius: 5px; background: #3a3a3a; color: #d2d2d2; }
  .desktop-contact-request-list article > button.accept { background: #087ee5; color: white; }
  .desktop-contact-manager-grid > button { display: grid; min-height: 72px; grid-template-columns: 48px minmax(0, 1fr) 22px; align-items: center; gap: 12px; padding: 10px 14px; background: #282828; color: #ededed; text-align: left; }
  .desktop-contact-manager-grid > button:hover { background: #303030; }
  .desktop-contact-manager-grid strong, .desktop-contact-manager-grid small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-contact-manager-grid small { margin-top: 5px; color: #8e8e8e; font-size: 10px; }
  .desktop-contact-manager-grid > button > .lucide { color: #838383; }
  .desktop-contact-content-empty { display: grid; min-height: 260px; place-content: center; justify-items: center; background: #242424; color: #777; text-align: center; }
  .desktop-contact-content-empty .lucide { width: 44px; height: 44px; margin-bottom: 12px; }
  .desktop-contact-content-empty strong { color: #aaa; }
  .desktop-contact-content-empty span { margin-top: 5px; font-size: 10px; }
}

@media (max-width: 720px) {
  .image-viewer-toolbar { min-height: calc(54px + env(safe-area-inset-top)); flex-basis: calc(54px + env(safe-area-inset-top)); padding: calc(7px + env(safe-area-inset-top)) 8px 7px; }
  .image-viewer-action { width: 42px; padding: 0; }
  .image-viewer-action span { display: none; }
  .image-viewer-stage { padding: 12px; }
  .mobile-group-info:not([hidden]) { position: fixed; z-index: 90; inset: 0; display: block; overflow: hidden; background: #0b0c0d; color: #f2f2f2; }
  .mobile-group-info-screen { display: flex; width: 100%; height: 100dvh; min-height: 0; flex-direction: column; background: #0b0c0d; transition: transform .18s cubic-bezier(.2,.8,.2,1); }
  .chat-pane { transition: transform .18s cubic-bezier(.2,.8,.2,1); }
  .app-shell.mobile-transition-forward .main-content.mobile-visible { animation: mobile-screen-in .24s cubic-bezier(.2,.8,.2,1) both; }
  .app-shell.mobile-transition-back .side-panel:not(.mobile-hidden) { animation: mobile-screen-back .24s cubic-bezier(.2,.8,.2,1) both; }
  .mobile-swipe-back-tracking { z-index: 2; transition: none !important; box-shadow: -18px 0 34px rgba(0,0,0,calc(.12 + var(--mobile-swipe-progress, 0) * .32)); will-change: transform; }
  .app-shell.mobile-swipe-back-preview .side-panel.mobile-hidden { position: fixed; z-index: 0; inset: 0; display: grid; }
  .app-shell.mobile-swipe-back-preview .main-content.mobile-visible { position: fixed; z-index: 1; inset: 0; }
  .mobile-group-info-header { position: relative; z-index: 3; display: grid; min-height: calc(62px + env(safe-area-inset-top)); flex: 0 0 calc(62px + env(safe-area-inset-top)); grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: end; padding: env(safe-area-inset-top) 7px 6px; border-bottom: 1px solid #252728; background: rgba(23, 24, 25, .97); backdrop-filter: blur(14px); }
  .mobile-group-info-header button, .mobile-group-info-header > span { display: grid; width: 48px; height: 48px; place-items: center; background: transparent; color: #f0f0f0; }
  .mobile-group-info-header button:hover { background: #252728; }
  .mobile-group-info-header .lucide { width: 29px; height: 29px; stroke-width: 1.7; }
  .mobile-group-info-header h2 { align-self: center; overflow: hidden; margin: 0; color: #f4f4f4; font-size: 18px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-group-info-scroll { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding: 14px 12px calc(34px + env(safe-area-inset-bottom)); scrollbar-color: #454748 transparent; }
  .mobile-group-overview-scroll { padding-top: 18px; }
  .mobile-group-profile { display: grid; width: 100%; min-height: 100px; grid-template-columns: 72px minmax(0, 1fr) 22px; align-items: center; gap: 14px; padding: 10px 13px; border-radius: 8px; background: transparent; color: #ededed; text-align: left; }
  .mobile-group-profile:hover { background: #191a1b; }
  .mobile-group-profile img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
  .mobile-group-profile strong, .mobile-group-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-group-profile strong { font-size: 20px; }
  .mobile-group-profile small { margin-top: 8px; color: #8e9193; font-size: 12px; }
  .mobile-group-profile > .lucide { width: 19px; height: 19px; color: #858789; }
  .mobile-group-card { overflow: hidden; margin-top: 14px; border-radius: 8px; background: #232526; }
  .mobile-group-members-card { padding: 0 14px 18px; }
  .mobile-group-card-heading { display: flex; width: 100%; min-height: 58px; align-items: center; justify-content: space-between; gap: 12px; background: transparent; color: #f1f1f1; }
  .mobile-group-card-heading strong { font-size: 16px; }
  .mobile-group-card-heading span { display: inline-flex; align-items: center; gap: 3px; color: #8d9092; font-size: 12px; }
  .mobile-group-card-heading .lucide { width: 17px; height: 17px; }
  .mobile-group-member-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px 8px; }
  .mobile-group-member { display: grid; min-width: 0; justify-items: center; gap: 6px; padding: 0; background: transparent; color: #a8aaac; }
  .mobile-group-member > span { position: relative; display: grid; width: 50px; height: 50px; place-items: center; }
  .mobile-group-member img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
  .mobile-group-member > span > .lucide { position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; padding: 3px; border: 2px solid #232526; border-radius: 50%; background: #d3a63c; color: #202020; }
  .mobile-group-member small { width: 100%; overflow: hidden; font-size: 10px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-group-member-tool > span { border-radius: 50%; background: #383a3b; }
  .mobile-group-member-tool > span > .lucide { position: static; width: 22px; height: 22px; padding: 0; border: 0; background: transparent; color: #a9abad; }
  .mobile-group-row, .mobile-group-switch { display: flex; width: 100%; min-height: 60px; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 16px; border-bottom: 1px solid #343637; background: transparent; color: #f0f0f0; text-align: left; }
  .mobile-group-row:last-child, .mobile-group-switch:last-child { border-bottom: 0; }
  button.mobile-group-row:hover, .mobile-group-switch:hover { background: #2b2d2e; }
  .mobile-group-row strong, .mobile-group-switch strong { flex: 0 0 auto; font-size: 15px; font-weight: 650; }
  .mobile-group-row > span { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 5px; overflow: hidden; color: #8f9193; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-group-row > span .lucide { width: 18px; height: 18px; flex: 0 0 18px; }
  .mobile-group-switch .switch-control { width: 48px; height: 28px; flex-basis: 48px; border-radius: 14px; background: #424445; }
  .mobile-group-switch .switch-control b { top: 3px; left: 3px; width: 22px; height: 22px; background: white; }
  .mobile-group-switch .switch-control.checked { background: #1688e9; }
  .mobile-group-switch .switch-control.checked b { transform: translateX(20px); }
  .mobile-group-action-card button { width: 100%; min-height: 62px; background: transparent; color: #83a9e9; font-size: 15px; font-weight: 650; text-align: left; padding: 0 16px; }
  .mobile-group-action-card.danger button { color: #ef5d43; }
  .mobile-group-member-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px 16px; }
  .mobile-group-member-list-head strong, .mobile-group-member-list-head span { display: block; }
  .mobile-group-member-list-head strong { font-size: 16px; }
  .mobile-group-member-list-head span { margin-top: 5px; color: #858789; font-size: 10px; }
  .mobile-group-member-list-head > button { display: inline-flex; min-height: 36px; align-items: center; gap: 6px; padding: 0 12px; border-radius: 6px; background: #1688e9; color: white; font-size: 11px; }
  .mobile-group-member-list-head .lucide { width: 15px; height: 15px; }
  .mobile-group-member-list { overflow: hidden; border-radius: 8px; background: #232526; }
  .mobile-group-member-list article { display: grid; min-height: 68px; grid-template-columns: 46px minmax(0, 1fr) repeat(4, auto); align-items: center; gap: 5px; padding: 9px 12px; border-bottom: 1px solid #343637; }
  .mobile-group-member-list article:last-child { border-bottom: 0; }
  .mobile-group-member-avatar { position: relative; }
  .mobile-group-member-avatar img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
  .mobile-group-member-avatar > i { position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border: 2px solid #232526; border-radius: 50%; background: #666; }
  .mobile-group-member-avatar > i.online { background: #45c98b; }
  .mobile-group-member-list article > span:nth-child(2) { min-width: 0; }
  .mobile-group-member-list article strong { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; }
  .mobile-group-member-list article small { display: block; overflow: hidden; margin-top: 4px; color: #8d8f91; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-group-member-list article > em { color: #d7aa45; font-size: 10px; font-style: normal; }
  .mobile-group-member-list article > .admin-badge { color: #75b7e8; }
  .mobile-group-member-list article > button { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 6px; background: #313334; color: #aaa; }
  .mobile-group-member-list article > button.role { color: #75b7e8; }
  .mobile-group-member-list article > button.danger { color: #ec6c61; }
  .mobile-group-member-list article > button .lucide { width: 16px; height: 16px; }
  .mobile-group-settings-form { display: grid; gap: 14px; }
  .mobile-group-avatar-card { padding: 16px; }
  .mobile-group-avatar-card > div strong, .mobile-group-avatar-card > div span { display: block; }
  .mobile-group-avatar-card > div span { margin-top: 5px; color: #898b8d; font-size: 10px; }
  .mobile-group-avatar-card .avatar-picker { margin-top: 15px; }
  .mobile-group-avatar-card .avatar-picker img { width: 64px; height: 64px; border-color: #444; border-radius: 50%; }
  .mobile-group-avatar-card .avatar-picker input:checked + img { border-color: #1688e9; box-shadow: 0 0 0 2px rgba(22,136,233,.22); }
  .mobile-group-avatar-card .avatar-upload-option > span { border-radius: 50%; }
  .mobile-group-form-card { padding: 3px 16px; }
  .mobile-group-form-card label { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid #343637; color: #d8d8d8; font-size: 12px; }
  .mobile-group-form-card label:last-child { border-bottom: 0; }
  .mobile-group-form-card input, .mobile-group-form-card textarea { width: 100%; border: 1px solid #414344; border-radius: 6px; outline: 0; background: #191b1c; color: #f0f0f0; }
  .mobile-group-form-card input { height: 44px; padding: 0 12px; }
  .mobile-group-form-card textarea { min-height: 108px; padding: 11px 12px; resize: vertical; line-height: 1.6; }
  .mobile-group-form-card input:focus, .mobile-group-form-card textarea:focus { border-color: #1688e9; box-shadow: 0 0 0 3px rgba(22,136,233,.13); }
  .mobile-group-save { display: flex; min-height: 48px; align-items: center; justify-content: center; gap: 7px; border-radius: 7px; background: #1688e9; color: white; font-weight: 650; }
  .mobile-group-save .lucide { width: 17px; height: 17px; }
  .mobile-group-readonly { display: grid; justify-items: center; gap: 7px; padding: 24px 18px; text-align: center; }
  .mobile-group-readonly > img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; }
  .mobile-group-readonly > strong { margin-top: 5px; font-size: 18px; }
  .mobile-group-readonly > span { color: #898b8d; font-size: 11px; }
  .mobile-group-readonly > p { width: 100%; margin: 12px 0 0; padding-top: 14px; border-top: 1px solid #343637; color: #aaa; line-height: 1.7; text-align: left; }
  .mobile-direct-settings-scroll { padding-top: 12px; }
  .mobile-direct-contact-card { margin-top: 0; }
  .mobile-direct-profile-card { display: grid; width: 100%; min-height: 94px; grid-template-columns: 62px minmax(0, 1fr) 20px; align-items: center; gap: 13px; padding: 13px 16px; border-bottom: 1px solid #343637; background: transparent; color: #f2f2f2; text-align: left; }
  .mobile-direct-profile-card > img { width: 62px; height: 62px; border-radius: 50%; object-fit: cover; }
  .mobile-direct-profile-card > span { min-width: 0; }
  .mobile-direct-profile-card > span > span { display: flex; min-width: 0; align-items: center; gap: 7px; }
  .mobile-direct-profile-card strong { overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-direct-profile-card small { display: block; overflow: hidden; margin-top: 7px; color: #8f9294; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-direct-profile-card > .lucide, .mobile-direct-start-group > .lucide { width: 19px; color: #858789; }
  .mobile-direct-start-group { display: grid; width: 100%; min-height: 74px; grid-template-columns: 50px minmax(0, 1fr) 20px; align-items: center; gap: 12px; padding: 11px 16px; background: transparent; color: #f1f1f1; text-align: left; }
  .mobile-direct-start-group > span { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 50%; background: #393b3c; color: #aaa; }
  .mobile-direct-start-group > span .lucide { width: 25px; height: 25px; }
  .mobile-direct-start-group strong { font-size: 16px; }
  .mobile-direct-profile-scroll { padding: 0 0 calc(30px + env(safe-area-inset-bottom)); }
  .mobile-direct-profile-page { min-height: 100%; background: #0b0c0d; }
  .mobile-direct-profile-page .direct-profile-cover { height: 190px; }
  .mobile-direct-profile-page .direct-profile-identity { margin: -42px 20px 0; }
  .mobile-direct-profile-page .direct-profile-avatar img { width: 94px; height: 94px; border-color: #0b0c0d; }
  .mobile-direct-profile-page .direct-profile-avatar i { border-color: #0b0c0d; }
  .mobile-direct-profile-page .direct-profile-name > strong { color: #f2f2f2; font-size: 23px; }
  .mobile-direct-profile-page .direct-profile-identity small { color: #8f9294; }
  .mobile-direct-profile-page .direct-profile-status { margin: 20px 20px 0; border-color: #2e3031; color: #a4a6a8; }
  .mobile-direct-profile-page > p { margin: 0; padding: 18px 20px; color: #b7b9ba; font-size: 14px; line-height: 1.75; }
  .mobile-direct-profile-page dl { margin: 0 12px; padding: 0 16px; border-radius: 8px; background: #232526; }
  .mobile-direct-profile-page dl div { display: flex; min-height: 54px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #343637; }
  .mobile-direct-profile-page dl div:last-child { border-bottom: 0; }
  .mobile-direct-profile-page dt, .mobile-direct-profile-page dd { margin: 0; }
  .mobile-direct-profile-page dt { color: #f0f0f0; }
  .mobile-direct-profile-page dd { color: #8e9193; text-align: right; }
  .mobile-direct-profile-message { display: flex; width: calc(100% - 24px); min-height: 48px; align-items: center; justify-content: center; gap: 8px; margin: 18px 12px 0; border-radius: 7px; background: #1688e9; color: white; font-weight: 700; }
  [data-theme="light"] .mobile-group-info:not([hidden]), [data-theme="light"] .mobile-group-info-screen, [data-theme="light"] .mobile-direct-profile-page { background: #f1f4f4; color: #202425; }
  [data-theme="light"] .mobile-group-info-header { border-color: #d6dbdc; background: rgba(255,255,255,.96); }
  [data-theme="light"] .mobile-group-info-header h2, [data-theme="light"] .mobile-group-info-header button, [data-theme="light"] .mobile-direct-profile-page .direct-profile-name > strong { color: #202425; }
  [data-theme="light"] .mobile-group-card, [data-theme="light"] .mobile-direct-profile-page dl { background: white; }
  [data-theme="light"] .mobile-group-row, [data-theme="light"] .mobile-group-switch, [data-theme="light"] .mobile-direct-profile-card, [data-theme="light"] .mobile-direct-start-group { border-color: #e0e4e5; color: #25292a; }
  [data-theme="light"] .mobile-direct-profile-page .direct-profile-avatar img, [data-theme="light"] .mobile-direct-profile-page .direct-profile-avatar i { border-color: #f1f4f4; }
  [data-theme="light"] .mobile-direct-profile-page dl div { border-color: #e0e4e5; }
  [data-theme="light"] .mobile-direct-profile-page dt { color: #25292a; }
  [data-theme="light"] .mobile-direct-profile-page > p { color: #5f6769; }
}

@media (max-width: 400px) {
  .auth-panel { padding: 24px 16px; }
  .form-heading h1 { font-size: 26px; }
  .demo-users button { font-size: 0; padding-right: 6px; }
  .contact-card { grid-template-columns: 52px minmax(0, 1fr) 36px; padding: 13px; }
  .contact-card img { width: 52px; height: 52px; }
  .settings-actions { grid-template-columns: 1fr; }
  .settings-actions > * { grid-column: 1 !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
