
:root {
 color-scheme: light;
 --surface: #ffffff; --canvas: #fafafa; --foreground: #18181b; --text: #27272a;
 --secondary-text: #52525b; --muted-foreground: #71717a; --subtle: #a1a1aa;
 --muted: #f4f4f5; --soft: #f0f0f2; --avatar: #ededf0;
 --border: #e4e4e7; --line-strong: #d4d4d8; --line-soft: #eeeeef;
 --bubble-out: #e4e4e7; --bubble-in: #f4f4f5;
 --background: var(--surface); --primary: var(--foreground); --primary-foreground: var(--surface);
 --card: var(--surface); --card-foreground: var(--foreground); --popover: var(--surface); --popover-foreground: var(--foreground);
 --accent: var(--muted); --accent-foreground: var(--foreground); --ring: var(--subtle); --input: var(--border); --radius: .625rem;
}
:root[data-theme="dark"] {
 color-scheme: dark;
 --surface: #18181b; --canvas: #141416; --foreground: #f4f4f5; --text: #e4e4e7;
 --secondary-text: #c4c4cb; --muted-foreground: #a1a1aa; --subtle: #777780;
 --muted: #27272a; --soft: #242427; --avatar: #303034;
 --border: #36363b; --line-strong: #52525b; --line-soft: #2a2a2e;
 --bubble-out: #3b3b42; --bubble-in: #242427;
}
/* Shared neutral foundation; unlayered rules deliberately override utility defaults. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; font-family: 'Geist Sans', ui-sans-serif, system-ui, sans-serif; color: var(--foreground); background: var(--surface); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--subtle); outline-offset: 3px; }
::selection { background: var(--line-strong); color: var(--foreground); }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; }
.btn { min-height: 40px; border-radius: 7px; font-weight: 500; transition: background .15s; }
.btn[data-size="icon"] { width: 40px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 650; letter-spacing: -.6px; text-decoration: none; color: var(--foreground); margin: 0; }
.brand-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--foreground); color: var(--surface); font-size: 16px; letter-spacing: -1px; }
.eyebrow { display: block; font-size: 10px; font-weight: 600; letter-spacing: 1.6px; color: var(--muted-foreground); }
.auth-gate { height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; overflow-y: auto; }
.auth-story { padding: 42px 48px; background: var(--canvas); border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: space-between; }
.story-copy { max-width: 470px; margin: 70px auto; }
.story-copy h2 { font-size: clamp(32px, 3.5vw, 52px); line-height: 1.12; font-weight: 550; letter-spacing: -2px; margin: 20px 0; }
.story-copy > p { font-size: 16px; line-height: 1.8; max-width: 360px; color: var(--muted-foreground); }
.story-note { display: flex; align-items: center; gap: 14px; margin-top: 42px; font-size: 13px; line-height: 1.6; color: var(--secondary-text); }
.story-symbol { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); width: 50px; height: 50px; display: grid; place-items: center; font-size: 30px; color: var(--foreground); }
.story-footer { display: flex; align-items: center; gap: 14px; font-size: 13px; font-weight: 600; }
.story-footer span { font-weight: 400; color: var(--muted-foreground); }
.auth-content { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 370px; border: 0; box-shadow: none; padding: 0; background: var(--surface); gap: 28px; }
.auth-card > header { text-align: left; padding: 0; }
.auth-card h1 { font-size: 26px; letter-spacing: -.8px; font-weight: 600; margin: 10px 0; }
.auth-card > header p { color: var(--muted-foreground); line-height: 1.6; font-size: 14px; }
.auth-card > section { padding: 0; }
.auth-card [role="tablist"] { display: flex; padding: 4px; gap: 4px; background: var(--muted); border-radius: 8px; }
.auth-card [role="tab"] { flex: 1; border: none; border-radius: 5px; min-height: 34px; color: var(--muted-foreground); background: transparent; font-size: 13px; }
.auth-card [role="tab"][aria-selected="true"] { color: var(--foreground); background: var(--surface); box-shadow: 0 1px 3px #00000012; }
.auth-card .field { display: grid; gap: 7px; }
.auth-card input { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; background: var(--surface); font-size: 14px; box-shadow: 0 1px 2px #00000003; }
.auth-card label { font-size: 13px; font-weight: 500; }
.field-hint { color: var(--muted-foreground); font-size: 12px; }
.auth-footnote { color: var(--muted-foreground); font-size: 12px; text-align: center; margin-top: 28px; }
.messenger-shell { display: flex; height: 100dvh; width: 100%; overflow: hidden; }
[data-messenger-target="chatsPane"] { background: var(--canvas); min-height: 0; }
[data-messenger-target="chatsPane"] > header { min-height: 85px; padding: calc(18px + env(safe-area-inset-top, 0px)) 22px 18px; border-bottom: 0; }
[data-messenger-target="meLabel"] { font-size: 12px; margin-top: 8px; }
.list-tools { padding: 18px 20px 12px; }
.list-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.list-title h2 { font-size: 18px; font-weight: 600; letter-spacing: -.4px; }
.connection-status { color: var(--muted-foreground); font-size: 11px; display: flex; align-items: center; gap: 5px; }
.connection-status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--subtle); }
.connection-status[data-connected="true"]::before { background: #16a34a; }
.search-field { display: flex; align-items: center; gap: 8px; height: 39px; background: var(--surface); padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted-foreground); }
.search-field:focus-within { outline: 2px solid var(--line-strong); outline-offset: 2px; }
.search-field input { border: 0; outline: 0; min-width: 0; width: 100%; background: transparent; font-size: 13px; }
[data-messenger-target="chatList"] { min-height: 0; padding: 4px 10px; }
.chat-person { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 12px; margin: 2px 0; border: 1px solid transparent; border-radius: 8px; text-align: left; background: transparent; }
.chat-person:hover { background: var(--muted); }
.chat-person[aria-current="true"] { background: var(--surface); border-color: var(--border); box-shadow: 0 1px 3px #00000004; }
.avatar { width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center; background: var(--avatar); color: var(--secondary-text); border-radius: 50%; font-size: 14px; font-weight: 500; }
.avatar > span { background: transparent; color: inherit; font-size: inherit; font-weight: inherit; }
.chat-person[aria-current="true"] .avatar { background: var(--foreground); color: var(--canvas); }
.chat-person .font-medium { font-size: 13px; font-weight: 600; }
.chat-person .text-sm { font-size: 12px; margin-top: 4px; }
.chat-person .text-xs { font-size: 10px; white-space: nowrap; }
.chat-person .badge { background: var(--foreground); color: var(--surface); border-radius: 20px; min-width: 20px; height: 20px; font-size: 10px; }
.sidebar-footer { padding: 18px 22px calc(18px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); font-size: 11px; color: var(--muted-foreground); display: flex; align-items: center; gap: 8px; }
.footer-mark { font-size: 17px; }
[data-messenger-target="threadPane"] { background: var(--surface); }
[data-messenger-target="idlePane"] { background: var(--surface); }
[data-messenger-target="idlePane"] .empty { max-width: 430px; }
[data-messenger-target="idlePane"] figure { width: 60px; height: 60px; display: grid; place-items: center; background: var(--muted); border: 1px solid var(--border); border-radius: 16px; margin: 0 auto 24px; }
[data-messenger-target="idlePane"] h3 { margin-top: 12px; font-size: 23px; font-weight: 550; letter-spacing: -.7px; line-height: 1.3; }
[data-messenger-target="idlePane"] p { max-width: 290px; margin: 10px auto; line-height: 1.7; font-size: 13px; color: var(--muted-foreground); }
[data-messenger-target="conversationPane"] > header { min-height: 78px; padding: calc(16px + env(safe-area-inset-top, 0px)) 28px 16px; background: var(--surface); }
[data-messenger-target="threadName"] { font-size: 14px; font-weight: 600; }
[data-messenger-target="threadSub"] { font-size: 12px; margin-top: 3px; }
[data-messenger-target="messages"] { min-height: 0; padding: 24px max(24px, calc((100% - 780px) / 2)); overflow-x: hidden; overscroll-behavior-y: contain; }
.message-row { display: flex; margin: 8px 0; }
.message-row.out { justify-content: flex-end; }
.message-bubble { max-width: min(80%, 520px); min-width: 80px; border-radius: 12px 12px 12px 3px; background: var(--muted); color: var(--text); padding: 10px 14px 8px; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.message-row.out .message-bubble { background: var(--foreground); color: var(--canvas); border-radius: 12px 12px 3px 12px; }
.message-body { white-space: pre-wrap; }
.message-meta { display: block; text-align: right; font-size: 10px; opacity: .65; margin-top: 4px; }
.date-divider { text-align: center; font-size: 10px; font-weight: 500; color: var(--muted-foreground); margin: 24px 0 18px; }
.conversation-empty { display: grid; align-content: center; text-align: center; height: 100%; color: var(--muted-foreground); font-size: 13px; line-height: 1.8; padding: 24px; }
.conversation-empty h3 { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
[data-messenger-target="conversationPane"] > form { padding: 16px 24px calc(20px + env(safe-area-inset-bottom, 0px)); border-top: 0; }
.input-group { border: 1px solid var(--border); border-radius: 12px; padding: 6px; align-items: flex-end; box-shadow: 0 2px 6px #00000004; }
.input-group:focus-within { outline: 2px solid var(--border); outline-offset: 2px; }
.input-group textarea { resize: none; min-height: 40px; max-height: 140px; line-height: 22px; padding: 9px 8px; font-size: 14px; min-width: 0; outline: none; }
.input-group .btn { border-radius: 7px; }
.dialog { max-width: calc(100vw - 32px); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 20px 80px #00000020; }
.dialog::backdrop { background: #09090b66; backdrop-filter: blur(3px); }
.dialog > div { padding: 26px; max-height: 85dvh; overflow-y: auto; }
.dialog h2 { font-size: 18px; letter-spacing: -.4px; }
[data-messenger-target="inviteCodes"] > div { padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
[data-messenger-target="emojiGrid"] .btn { min-width: 0; width: 100%; font-size: 23px; }
@media (min-width: 1600px) { .messenger-shell { max-width: 1600px; margin: auto; border-inline: 1px solid var(--border); } }
@media (max-width: 900px) { .auth-story { padding: 32px; } .story-copy h2 { font-size: 36px; } }
@media (max-width: 767px) {
 .auth-gate { display: flex; flex-direction: column; }
 .auth-story { padding: calc(24px + env(safe-area-inset-top, 0px)) 24px 0; background: var(--surface); border: 0; }
 .story-copy, .story-footer { display: none; }
 .auth-content { flex: 1 0 auto; padding: 36px 24px calc(24px + env(safe-area-inset-bottom, 0px)); }
 .auth-card input, .search-field input, .input-group textarea { font-size: 16px; }
 [data-messenger-target="chatsPane"] > header { padding-inline: 20px; }
 [data-messenger-target="conversationPane"] > header { padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px 8px; min-height: 70px; }
 [data-messenger-target="messages"] { padding: 12px 16px; }
 [data-messenger-target="conversationPane"] > form { padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
 .btn[data-size="icon"] { min-width: 44px; min-height: 44px; }
 .message-bubble { max-width: 86%; }
 .chat-person { padding-block: 15px; }
 .dialog > div { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* Sidebar composition: navigation above, identity below the scrolling list. */
[data-messenger-target="chatsPane"] > .sidebar-heading { min-height: 76px; padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sidebar-heading h1 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: -.4px; }
.sidebar-heading .brand-icon { width: 28px; height: 28px; font-size: 14px; }
.sidebar-heading .btn { min-height: 34px; gap: 6px; font-size: 12px; padding-inline: 10px; }
.list-tools { padding: 0 16px; }
.search-field { height: 38px; background: var(--surface); }
.search-field svg { flex-shrink: 0; }
.conversation-label { display: flex; justify-content: space-between; align-items: center; padding: 22px 6px 10px; font-size: 11px; font-weight: 500; color: var(--muted-foreground); }
.conversation-label > span { font-variant-numeric: tabular-nums; }
[data-messenger-target="chatList"] { padding: 0 10px 12px; }
.chat-person { padding: 12px 10px; }
.chat-person .avatar { width: 40px; height: 40px; }
.sidebar-account { display: flex; align-items: center; gap: 10px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); background: var(--canvas); }
.sidebar-account .account-avatar { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; }
.account-copy { min-width: 0; flex: 1; }
[data-messenger-target="meLabel"] { font-size: 12px; color: var(--text); font-weight: 500; margin: 0 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account .connection-status { font-size: 10px; }
.sidebar-account [data-popover] { bottom: calc(100% + 8px); top: auto; }
/* Textarea and actions form one input group with a dedicated toolbar. */
[data-messenger-target="conversationPane"] > .message-composer { padding: 12px 24px calc(20px + env(safe-area-inset-bottom, 0px)); }
.composer-card { max-width: 820px; margin-inline: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 1px 3px #00000006; transition: border-color .15s, box-shadow .15s; }
.composer-card:focus-within { border-color: var(--subtle); box-shadow: 0 0 0 3px #18181b0a; }
.composer-card textarea { display: block; width: 100%; min-width: 0; min-height: 56px; max-height: 140px; border: 0; outline: none; box-shadow: none; border-radius: 12px 12px 0 0; background: transparent; resize: none; padding: 14px 16px 8px; font-size: 14px; line-height: 22px; }
.composer-card textarea::placeholder { color: var(--subtle); }
.composer-toolbar { display: flex; align-items: center; gap: 10px; padding: 4px 8px 8px; }
.composer-toolbar .btn[data-size="icon"] { min-height: 32px; height: 32px; width: 32px; color: var(--muted-foreground); }
.composer-hint { color: var(--subtle); font-size: 10px; }
.composer-hint kbd { font: inherit; color: var(--muted-foreground); }
.composer-send { margin-left: auto; min-height: 32px; height: 32px; font-size: 12px; gap: 8px; padding-inline: 12px; background: var(--foreground); color: var(--surface); }
.composer-send:disabled { background: var(--muted); color: var(--subtle); opacity: 1; }
.message-bubble { font-size: 14px; font-weight: 400; letter-spacing: .05px; }
@media (max-width: 767px) {
 [data-messenger-target="conversationPane"] > .message-composer { padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
 .composer-card textarea { font-size: 16px; min-height: 50px; padding: 12px 14px 6px; }
 .composer-hint { display: none; }
 .composer-toolbar .btn[data-size="icon"], .composer-send { min-height: 40px; height: 40px; }
 .composer-toolbar { padding: 0 6px 6px; }
 .composer-toolbar .btn[data-size="icon"] { min-width: 40px; }
 .sidebar-heading .btn { min-height: 40px; }
}

.chat-filters { display: none; }
/* Phone navigation uses a dedicated layout, independent of the desktop sidebar. */
@media (max-width: 767px) {
 html, body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
 .messenger-shell { position: fixed; top: var(--viewport-top, 0px); left: 0; right: 0; height: var(--app-height, 100dvh); }
 .messenger-shell > section { height: 100%; }
 [data-messenger-target="chatsPane"] { position: relative; background: var(--surface); border-right: 0; }
 [data-messenger-target="chatsPane"] > .sidebar-heading { min-height: 94px; padding: calc(28px + env(safe-area-inset-top, 0px)) 124px 16px 20px; }
 .sidebar-heading h1 { font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 1.2; }
 .sidebar-heading .brand-icon { display: none; }
 .sidebar-heading .mobile-invite { position: absolute; top: calc(24px + env(safe-area-inset-top, 0px)); right: 20px; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--foreground); color: var(--surface); box-shadow: none; }
 .mobile-invite svg { width: 21px; height: 21px; }
 .invite-label { display: none; }
 .sidebar-account { position: absolute; top: calc(24px + env(safe-area-inset-top, 0px)); right: 74px; padding: 0; border: 0; background: transparent; z-index: 4; }
 .sidebar-account > .account-avatar, .sidebar-account > .account-copy { display: none; }
 .sidebar-account #account-menu-trigger { border-radius: 50%; background: var(--muted); width: 44px; height: 44px; color: var(--secondary-text); }
 .sidebar-account [data-popover] { top: calc(100% + 8px); bottom: auto; }
 .list-tools { padding: 0 20px 4px; }
 .search-field { height: 42px; border: 0; border-radius: 11px; background: var(--soft); padding-inline: 12px; gap: 9px; }
 .search-field input { font-size: 16px; letter-spacing: -.2px; }
 .search-field input::placeholder { color: var(--muted-foreground); }
 .conversation-label { display: none; }
 .chat-filters { display: flex; gap: 8px; padding: 16px 0 8px; }
 .chat-filters button { display: inline-flex; align-items: center; gap: 6px; border: 0; padding: 9px 16px; min-height: 40px; border-radius: 20px; background: var(--muted); color: var(--muted-foreground); font-size: 14px; font-weight: 500; }
 .chat-filters button[aria-pressed="true"] { color: var(--surface); background: var(--text); }
 .chat-filters span:empty { display: none; }
 [data-messenger-target="chatList"] { padding: 0 0 calc(16px + env(safe-area-inset-bottom, 0px)); overscroll-behavior-y: contain; }
 .chat-person { position: relative; min-height: 84px; padding: 15px 20px; margin: 0; gap: 13px; border: 0; border-radius: 0; }
 .chat-person::after { content: ''; position: absolute; bottom: 0; left: 85px; right: 20px; height: 1px; background: var(--soft); }
 .chat-person .avatar { width: 52px; height: 52px; font-size: 19px; background: var(--avatar); color: var(--secondary-text); font-weight: 500; }
 .chat-person .font-medium { font-size: 16px; font-weight: 600; letter-spacing: -.25px; }
 .chat-person .text-sm { font-size: 14px; margin-top: 5px; line-height: 1.4; color: var(--muted-foreground); }
 .chat-person .text-xs { font-size: 11px; font-weight: 400; color: var(--muted-foreground); }
 .chat-person[data-unread="true"] .text-sm { color: var(--text); font-weight: 500; }
 .chat-person[data-unread="true"] .text-xs { color: var(--foreground); font-weight: 600; }
 .chat-person .badge { height: 22px; min-width: 22px; font-size: 11px; }
 .chat-person[aria-current="true"] { background: var(--surface); border: 0; box-shadow: none; }
 .chat-person[aria-current="true"] .avatar { background: var(--avatar); color: var(--secondary-text); }
 .chat-person:active { background: var(--muted); }
 [data-messenger-target="conversationPane"] { animation: phone-thread-in 180ms ease-out; }
 [data-messenger-target="conversationPane"] > header { padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px 4px; min-height: 66px; gap: 4px; background: var(--surface); border-bottom-color: var(--line-soft); }
 [data-messenger-target="threadAvatar"] { width: 38px; height: 38px; font-size: 15px; }
 [data-messenger-target="threadName"] { font-size: 16px; font-weight: 600; letter-spacing: -.3px; }
 [data-messenger-target="threadSub"] { font-size: 12px; color: var(--muted-foreground); margin-top: 1px; }
 [data-messenger-target="messages"] { padding: 8px 14px 16px; }
 .message-row { margin: 5px 0; }
 .message-bubble { max-width: 84%; font-size: 16px; line-height: 1.4; padding: 10px 13px 7px; border-radius: 19px 19px 19px 5px; background: var(--soft); letter-spacing: -.2px; }
 .message-row.out .message-bubble { border-radius: 19px 19px 5px 19px; }
 .message-meta { font-size: 10px; margin-top: 4px; letter-spacing: 0; }
 .date-divider { margin: 18px 0; font-size: 11px; }
 [data-messenger-target="conversationPane"] > .message-composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line-soft); background: var(--canvas); }
 .composer-card { display: grid; grid-template-columns: 38px minmax(0, 1fr) 40px; align-items: end; gap: 2px; border: 1px solid var(--border); border-radius: 26px; padding: 3px; box-shadow: none; }
 .composer-card textarea { grid-column: 2; grid-row: 1; min-height: 42px; max-height: 140px; padding: 10px 0; border-radius: 0; line-height: 22px; font-size: 16px; }
 .composer-toolbar { display: contents; }
 .composer-toolbar .btn[data-size="icon"] { grid-column: 1; grid-row: 1; min-width: 38px; width: 38px; height: 42px; min-height: 42px; border-radius: 50%; color: var(--muted-foreground); }
 .composer-send { grid-column: 3; grid-row: 1; min-width: 40px; width: 40px; height: 42px; min-height: 42px; padding: 0; margin: 0; border-radius: 50%; }
 .composer-send svg { width: 19px; height: 19px; }
 .send-label, .composer-hint { display: none; }
 .composer-send:disabled { background: var(--muted); color: var(--subtle); }
 .dialog { top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%; max-height: 85dvh; margin: 0; border: 0; border-radius: 24px 24px 0 0; box-shadow: 0 -8px 50px #00000015; }
 .dialog > div { position: relative; inset: auto; translate: none; transform: none; width: 100%; max-width: none; margin: 0; max-height: 85dvh; border-radius: 24px 24px 0 0; padding: 30px 22px calc(22px + env(safe-area-inset-bottom, 0px)); }
 .dialog::before { content: ''; position: absolute; width: 34px; height: 4px; border-radius: 4px; top: 10px; left: calc(50% - 17px); background: var(--line-strong); }
 .dialog h2 { font-size: 20px; font-weight: 600; }
 .dialog footer .btn { min-height: 48px; border-radius: 12px; font-size: 15px; }
 .dialog::backdrop { backdrop-filter: blur(2px); }
 [data-messenger-target="emojiGrid"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
 [data-messenger-target="emojiGrid"] .btn { min-height: 44px; font-size: 26px; }
}
@keyframes phone-thread-in { from { transform: translateX(16px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { [data-messenger-target="conversationPane"] { animation: none; } }

/* Message surfaces stay neutral in both appearances. */
.message-row .message-bubble { background: var(--bubble-in); color: var(--foreground); }
.message-row.out .message-bubble { background: var(--bubble-out); color: var(--foreground); }
.messenger-shell { position: relative; }
.settings-pane { position: absolute; inset: 0; z-index: 12; background: var(--canvas); overflow-y: auto; overscroll-behavior-y: contain; }
.settings-header { display: flex; align-items: center; gap: 10px; padding: 20px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.settings-header h1 { font-size: 20px; font-weight: 600; letter-spacing: -.5px; }
.settings-content { max-width: 680px; padding: 40px 28px; margin: auto; }
.settings-profile { display: flex; align-items: center; gap: 14px; margin-bottom: 36px; }
.settings-profile .avatar { width: 52px; height: 52px; font-size: 20px; }
.settings-profile h2 { font-size: 17px; font-weight: 600; }
.settings-profile p { font-size: 13px; color: var(--muted-foreground); margin-top: 3px; }
.appearance-settings { border: 0; padding: 0; min-width: 0; }
.appearance-settings legend { font-size: 17px; font-weight: 600; letter-spacing: -.2px; }
.appearance-settings > p { font-size: 13px; color: var(--muted-foreground); margin: 8px 0 20px; }
.appearance-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.appearance-option { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px; gap: 8px; cursor: pointer; }
.appearance-option:has(input:checked) { border-color: var(--foreground); box-shadow: 0 0 0 1px var(--foreground); }
.appearance-option:focus-within { outline: 2px solid var(--ring); outline-offset: 4px; }
.appearance-option input { position: absolute; top: 16px; right: 16px; accent-color: var(--foreground); width: 16px; height: 16px; }
.appearance-preview { height: 100px; display: flex; flex-direction: column; justify-content: end; padding: 12px; gap: 5px; border-radius: 7px; border: 1px solid #d4d4d8; background: #fafafa; }
.appearance-preview i { display: block; height: 9px; width: 65%; border-radius: 4px; background: #d4d4d8; }
.appearance-preview i:nth-child(2) { margin-left: auto; width: 48%; background: #a1a1aa; }
.preview-dark { background: #18181b; border-color: #3f3f46; }
.preview-dark i { background: #3f3f46; }
.preview-dark i:nth-child(2) { background: #71717a; }
.preview-system { background: linear-gradient(135deg, #fafafa 50%, #18181b 50%); }
.appearance-label { font-size: 14px; font-weight: 500; }
.appearance-option small { font-size: 11px; color: var(--muted-foreground); }
.settings-note { font-size: 12px; color: var(--muted-foreground); margin-top: 20px; }
.settings-signout { margin-top: 36px; }
@media (max-width: 767px) {
 .messenger-shell { position: fixed; }
 .settings-header { padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; }
 .settings-header h1 { font-size: 18px; }
 .settings-content { padding: 28px 20px calc(28px + env(safe-area-inset-bottom, 0px)); }
 .appearance-options { gap: 10px; }
 .appearance-option { padding: 8px; border-radius: 10px; }
 .appearance-preview { height: 88px; padding: 8px; }
 .appearance-option input { top: 12px; right: 12px; }
 .appearance-option small { line-height: 1.5; }
 .settings-signout { width: 100%; min-height: 48px; }
}
