:root {
  color-scheme: light;
  --ink: #172038;
  --muted: #5a667e;
  --paper: #fff;
  --canvas: #f3f6fc;
  --history: #fafbfe;
  --line: #dce4f0;
  --soft: #eaf0fa;
  --tint: #e6edff;
  --accent: #294cbb;
  --accent-hover: #203d99;
  --focus: #4266cf;
  --online: #24684f;
  --danger: #a42634;
  --radius: .75rem;
  --workspace-height: var(--visible-height, 100dvh);
  --workspace-top: var(--visible-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: max(0px, calc(env(safe-area-inset-bottom, 0px) - var(--viewport-bottom-gap, 0px)));
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, dl, dd { margin: 0; }
button, input, textarea { color: inherit; font: inherit; }
input, textarea { min-width: 0; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.button, .icon-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 650;
  text-decoration: none;
  background: transparent;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.button { padding: .62rem .92rem; }
.primary { color: #fff; background: var(--accent); }
.primary:hover:enabled { background: var(--accent-hover); }
.secondary { border-color: var(--line); background: var(--paper); }
.secondary:hover:enabled, .icon-button:hover:enabled, .text-button:hover:enabled { background: var(--soft); }
.icon-button { flex: none; width: 2.75rem; padding: 0; }
.text-button { padding: .18rem .45rem; }

.brand { display: inline-flex; align-items: center; gap: .6rem; font-size: 1.25rem; font-weight: 780; letter-spacing: .02em; text-decoration: none; }
.brand-icon { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; border-radius: .7rem; color: #fff; background: var(--accent); box-shadow: 0 2px 4px rgb(41 76 187 / .16); }
.brand-icon svg { width: 1.27rem; height: 1.27rem; }
.auth-page { min-height: var(--workspace-height); display: grid; place-items: center; padding: max(1.25rem, var(--safe-top)) max(1.25rem, var(--safe-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, var(--safe-left)); }
.auth-panel { width: min(100%, 28rem); padding: clamp(1.4rem, 5vw, 2.6rem); border: 1px solid var(--line); border-radius: 1.3rem; background: var(--paper); box-shadow: 0 12px 42px rgb(29 48 91 / .06); }
.auth-panel h1 { margin-top: 1.65rem; font-size: clamp(1.7rem, 4vw, 2.25rem); line-height: 1.2; letter-spacing: -.035em; }
.auth-panel > p { margin-top: .75rem; font-size: .94rem; }
.auth-panel .form { margin-top: 1.45rem; }
.auth-switch { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; color: var(--muted); }
.auth-switch button { color: var(--accent); }
.form { display: grid; gap: .8rem; }
.form label { display: grid; gap: .42rem; font-size: .9rem; font-weight: 650; }
.form input, .search {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.form input { padding: .6rem .75rem; font-size: 1rem; font-weight: 400; }
.feedback { color: var(--muted); font-size: .85rem; line-height: 1.45; overflow-wrap: anywhere; }
.feedback:empty { display: none; }

:root:has(.workspace:not([hidden])), body:has(.workspace:not([hidden])) { overflow: hidden; overscroll-behavior: none; }
.workspace { --header-height: 5rem; position: fixed; inset: var(--workspace-top) 0 auto; display: grid; grid-template-columns: minmax(0, clamp(12rem, 30vw, 21rem)) minmax(0, 1fr); height: var(--workspace-height); overflow: hidden; padding: var(--safe-top) var(--safe-right) 0 var(--safe-left); }
.sidebar { display: grid; grid-template-rows: var(--header-height) minmax(0, 1fr) auto; border-right: 1px solid var(--line); min-width: 0; min-height: 0; background: var(--canvas); }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem; gap: .7rem; border-bottom: 1px solid var(--line); }
.connection { display: inline-flex; align-items: center; gap: .4rem; flex: none; color: var(--muted); font-size: .75rem; }
.connection i { width: .44rem; height: .44rem; border-radius: 50%; background: #747e83; }
.connection.connected i { background: var(--online); }
.inbox { min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: .7rem; padding-top: 1.05rem; }
.inbox-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem; }
.inbox h1 { font-size: clamp(1.4rem, 3.5vw, 1.85rem); line-height: 1.2; letter-spacing: -.035em; }
.compose-button { color: var(--accent); background: var(--tint); }
.compose-button:hover:enabled { border-color: #c7d5fa; background: var(--tint); }
.search { display: flex; align-items: center; gap: .45rem; padding: 0 .7rem; color: var(--muted); }
.inbox .search { margin: 0 1.25rem; width: auto; }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.search input { width: 100%; min-height: 2.6rem; border: 0; background: transparent; outline: 0; font-size: 1rem; }
.search svg { width: 1.05rem; height: 1.05rem; }
.conversation-list { min-height: 0; overflow: auto; padding: .15rem .58rem .55rem; }
.list-empty { color: var(--muted); font-size: .87rem; padding: 1.1rem .68rem; }
.conversation-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .65rem; text-align: left; border: 1px solid transparent; border-radius: var(--radius); padding: .67rem .65rem; background: transparent; transition: background-color 140ms ease; }
.conversation-row:hover { background: var(--soft); }
.conversation-row[aria-current] { background: var(--tint); border-color: #d4dfff; box-shadow: inset 3px 0 var(--accent); }
.conversation-row:focus-visible { outline-offset: -2px; }
.avatar { display: grid; place-items: center; width: 2.55rem; height: 2.55rem; flex: none; border-radius: .85rem; color: #304786; background: #dee8fd; font-size: 1.02rem; font-weight: 760; }
.avatar[data-tone="1"], .avatar[data-tone="3"] { color: #385275; background: #e1e9f6; }
.conversation-copy, .account-copy, .peer-copy, .call-copy, .file-copy { min-width: 0; display: grid; gap: .15rem; }
.conversation-copy > *, .account-copy > *, .peer-copy > *, .call-copy > *, .file-copy > *, #upload-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snippet, .conversation-meta, .account-copy span { font-size: .79rem; color: var(--muted); }
.conversation-meta { display: grid; justify-items: end; gap: .24rem; align-self: start; padding-top: .12rem; }
.unread { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .2rem; border-radius: 1rem; background: var(--accent); color: #fff; font-size: .67rem; font-weight: 700; }
.account { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .64rem; padding: .75rem 1.25rem max(.75rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.account-copy strong { font-size: .88rem; }
.account > button { color: var(--muted); }

.conversation, .active-conversation { min-height: 0; min-width: 0; background: var(--history); }
.active-conversation { display: grid; grid-template-rows: min(var(--header-height), max(2.9rem, calc(var(--workspace-height) / 5))) minmax(0, 1fr) auto; height: 100%; }
.conversation-empty { height: 100%; display: grid; align-content: center; justify-items: center; gap: .72rem; text-align: center; padding: 1.2rem; }
.empty-icon { display: grid; place-items: center; width: 3.7rem; height: 3.7rem; border-radius: 1.15rem; color: var(--accent); background: var(--tint); }
.empty-icon svg { width: 1.75rem; height: 1.75rem; }
.conversation-empty h2 { font-size: 1.65rem; }
.conversation-empty p { color: var(--muted); font-size: .95rem; }
.conversation-empty button { margin-top: .45rem; }
.conversation-header { display: flex; align-items: center; gap: .8rem; padding: 0 clamp(1rem, 3vw, 2.25rem); border-bottom: 1px solid var(--line); background: var(--paper); }
.peer-copy { margin-right: auto; }
.peer-copy h2 { font-size: 1.1rem; }
.peer-copy p { color: var(--muted); font-size: .78rem; }
.peer-copy p.online { color: var(--online); }
.call-action { white-space: nowrap; flex: none; font-size: .86rem; color: var(--accent); }
.back-button { display: none; }
.history { overflow: auto; overscroll-behavior: contain; min-height: 0; padding: .95rem clamp(1rem, 4vw, 3.25rem); }
.messages { width: min(100%, 57rem); min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; justify-content: end; gap: .85rem; }
.history-empty { margin: auto; color: var(--muted); font-size: .9rem; text-align: center; }
.day-marker { display: flex; align-items: center; gap: .8rem; align-self: center; width: min(100%, 22rem); color: var(--muted); font-size: .79rem; }
.day-marker::before, .day-marker::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.message-row { display: flex; align-items: start; gap: .6rem; }
.message-row.own { justify-content: end; }
.message-avatar { width: 2rem; height: 2rem; font-size: .83rem; }
.message-content { display: grid; gap: .24rem; max-width: min(80%, 39rem); min-width: 0; }
.own .message-content { justify-items: end; }
.bubble {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: .28rem 1rem 1rem;
  padding: .63rem .82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--paper);
}
.own .bubble { border-color: var(--accent); border-radius: 1rem .28rem 1rem 1rem; background: var(--accent); color: #fff; }
.message-time { color: var(--muted); font-size: .72rem; }
.file-link { display: flex; align-items: center; gap: .65rem; max-width: 100%; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); text-decoration: none; }
.file-link:hover { background: var(--soft); }
.file-link svg { color: var(--accent); }
.file-copy small { color: var(--muted); font-size: .77rem; }
.file-copy strong { font-size: .91rem; }
.download-icon { margin-left: auto; }
.older { display: flex; margin: 0 auto .7rem; color: var(--muted); font-size: .83rem; }
.composer-wrap { padding: .82rem clamp(1rem, 4vw, 3.25rem) max(.68rem, var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
.composer-wrap > * { max-width: 57rem; margin-left: auto; margin-right: auto; }
.composer { display: flex; align-items: end; gap: .45rem; padding: .27rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--canvas); }
.composer:focus-within { border-color: var(--focus); }
.composer textarea { flex: 1; height: auto; min-height: 2.75rem; max-height: clamp(2.75rem, calc(var(--workspace-height) / 4), 8rem); field-sizing: content; box-sizing: border-box; resize: none; padding: .67rem .25rem; border: 0; outline: 0; background: transparent; font-size: max(1rem, 16px); line-height: 1.4; }
.send { font-size: .88rem; white-space: nowrap; }
.send svg { width: 1rem; height: 1rem; }
.composer-wrap .feedback:not(:empty) { padding-top: .4rem; }
.upload-selection { display: flex; align-items: center; justify-content: start; gap: .45rem; margin-bottom: .45rem; color: var(--muted); font-size: .87rem; }

.dialog { position: fixed; inset: var(--safe-top) var(--safe-right) auto var(--safe-left); margin: auto; top: max(1rem, calc(var(--workspace-height) / 2 - 9rem)); width: min(27rem, calc(100% - 2rem)); max-height: calc(var(--workspace-height) - 2rem); padding: 1.3rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); color: var(--ink); }
.dialog::backdrop { background: rgb(17 26 33 / .38); }
.dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: .55rem; }
.dialog h2 { font-size: 1.2rem; }
.dialog .form, .dialog p:not(:empty) { margin-top: .65rem; }
.dialog-actions { justify-content: end; margin-top: 1rem; }
.call-panel, .toast { position: fixed; z-index: 2; left: 50%; width: max-content; max-width: calc(100% - 1rem); transform: translateX(-50%); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 .3rem 1.4rem rgb(16 26 31 / .12); }
.call-panel { top: max(.55rem, env(safe-area-inset-top)); display: flex; align-items: center; gap: .6rem; padding: .55rem; animation: appear 150ms ease-out; }
.call-copy { min-width: 5rem; }
.call-copy p { color: var(--muted); font-size: .8rem; }
.call-buttons { display: flex; gap: .2rem; }
.call-panel .accept { background: var(--online); color: #fff; }
.call-panel .danger { background: var(--danger); color: #fff; }
.call-panel .accept:hover, .call-panel .danger:hover { filter: brightness(1.15); }
.call-panel .accept:hover { background: var(--online); }
.call-panel .danger:hover { background: var(--danger); }
.call-panel audio { display: none; }
.toast { bottom: calc(var(--viewport-bottom-gap, 0px) + max(5.6rem, calc(var(--safe-bottom) + 5rem))); padding: .8rem 1rem; font-size: .89rem; text-align: center; animation: appear 150ms ease-out; }

@keyframes appear {
  from { opacity: 0; translate: 0 .3rem; }
  to { opacity: 1; translate: 0 0; }
}

.admin-header { display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-height: 4.6rem; padding: .75rem clamp(1rem, 5vw, 3rem); background: var(--paper); border-bottom: 1px solid var(--line); }
.admin-label { margin-left: .35rem; padding-left: .72rem; border-left: 1px solid var(--line); color: var(--muted); font-size: .86rem; font-weight: 500; }
.admin-content { padding: 1.6rem clamp(1rem, 5vw, 3rem); max-width: 85rem; margin: 0 auto; }
.admin-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .65rem; }
.admin-heading h1 { font-size: 1.85rem; }
.admin-heading h2 { font-size: 1.32rem; }
.admin-heading .muted { margin-top: .25rem; font-size: .88rem; }
.admin-heading .search { max-width: 19rem; }
.admin-heading .search .text-button { min-height: 2rem; white-space: nowrap; }
.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1.1rem 0 1.85rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.metric { padding: .85rem 1rem; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric dt { color: var(--muted); font-size: .84rem; }
.metric dd { font-size: 1.65rem; font-weight: 700; }
.users { display: grid; gap: .8rem; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
table { width: 100%; min-width: 39rem; border-collapse: collapse; text-align: left; }
th, td { padding: .55rem .9rem; border-bottom: 1px solid var(--line); }
th { background: var(--soft); font-size: .87rem; }
td { font-size: .88rem; }
tr:last-child td { border-bottom: 0; }
.table-user strong, .table-user span { display: block; overflow-wrap: anywhere; }
.table-user strong { margin-bottom: .16rem; }
.table-empty { padding: 1.35rem; text-align: center; color: var(--muted); }
.pagination { display: flex; justify-content: end; align-items: center; gap: .65rem; font-size: .87rem; }

.chat-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); background: var(--paper); padding: .24rem .3rem max(.24rem, env(safe-area-inset-bottom)); }
.chat-nav button { display: grid; justify-items: center; align-content: center; gap: .23rem; min-width: 0; min-height: 3rem; background: transparent; border: 0; border-radius: .65rem; color: var(--muted); font-size: .7rem; white-space: nowrap; }
.chat-nav button:hover { background: var(--soft); }
.chat-nav button[aria-current] { color: var(--accent); font-weight: 700; background: var(--tint); }
.sidebar-section { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: .65rem; padding-top: 1.05rem; min-height: 0; }
.sidebar-section h1 { font-size: clamp(1.4rem, 3.5vw, 1.85rem); line-height: 1.2; letter-spacing: -.035em; }
.sidebar-section-body { padding: .15rem .58rem .55rem; overflow: auto; min-height: 0; }
.sidebar-section-body .account { padding: .65rem .55rem; border-top: 0; }
.contact-row { grid-template-columns: auto minmax(0, 1fr); }
.utility-row { display: flex; align-items: center; min-height: 2.9rem; width: 100%; gap: .62rem; border: 0; border-radius: .7rem; background: transparent; color: var(--ink); text-align: left; padding: .5rem .65rem; font-weight: 620; }
.utility-row:hover { background: var(--soft); }
.utility-row svg { color: var(--accent); }
.conversation-settings { color: var(--muted); }
.inbox-controls { display: flex; gap: .2rem; }
#preview-toggle { color: var(--accent); }
#preview-toggle[aria-pressed='true'] { background: var(--soft); }
.composer-wrap { padding-top: .65rem; }
.composer textarea { padding-inline: .7rem; }
.composer-actions { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); justify-items: center; gap: .16rem; width: min(100%, 29rem); margin-block: .2rem 0; }
.composer-actions .icon-button { color: var(--accent); width: min(100%, 2.75rem); position: relative; }
.composer-actions .composer-more[aria-expanded='true'], .private-toggle[aria-pressed='true'] { background: var(--tint); color: var(--accent); }
.composer-more svg { transition: transform 140ms ease; }
.composer-more[aria-expanded='true'] svg { transform: rotate(45deg); }
#private-duration { position: absolute; inset-block-end: 0; inset-inline-end: 0; font-size: .58rem; padding: .08rem .14rem; line-height: 1; white-space: nowrap; background: var(--tint); }
.tool-tray { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .37rem; padding: .63rem .3rem .22rem; border-top: 1px solid var(--line); max-height: min(12rem, 30dvh); overflow: auto; }
.tray-action { display: grid; justify-items: center; align-content: center; min-width: 0; min-height: 3.5rem; gap: .28rem; padding: .32rem .15rem; border: 0; border-radius: .7rem; color: var(--ink); background: var(--canvas); font-size: .75rem; text-align: center; }
.tray-action:hover { background: var(--tint); }
.tray-action svg { color: var(--accent); }
.tool-dialog-content { display: grid; gap: .65rem; margin-top: .55rem; }
.tool-dialog-content > .button { justify-content: start; text-align: start; }
.tool-summary, .revealed-message, .tool-record p { overflow-wrap: anywhere; white-space: pre-wrap; }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--soft); }
.utility-row { gap: .7rem; min-height: 3rem; }
.utility-row .unread { margin-left: auto; }
.chat-nav button[data-pane='contacts'] { position: relative; }
.nav-count { position: absolute; inset-block-start: .18rem; inset-inline-start: calc(50% + .47rem); pointer-events: none; }
.utility-group { margin-block: .45rem; padding-block: .3rem; border-block-start: 1px solid var(--line); }
.profile-shortcut { width: 100%; margin-top: .15rem; text-align: start; color: var(--ink); border: 0; border-radius: .9rem; background: var(--paper); }
.profile-shortcut:hover:enabled { background: var(--tint); }
.profile-shortcut .avatar { width: 3rem; height: 3rem; }
.utility-arrow { transform: rotate(180deg); color: var(--muted); }
.friends-search { margin-top: .6rem; }
.friend-index { position: sticky; z-index: 1; top: 0; display: flex; gap: .16rem; overflow-x: auto; padding: .18rem .1rem; background: var(--canvas); scrollbar-width: thin; }
.friend-index .text-button { flex: none; min-height: 1.85rem; min-width: 1.65rem; font-size: .72rem; color: var(--accent); }
.friends-list { margin-top: .25rem; }
.friend-letter { padding: .35rem .65rem; background: var(--soft); color: var(--muted); font-size: .73rem; font-weight: 750; scroll-margin-top: 2.45rem; }
.friend-letter-section .contact-row { border-bottom: 1px solid var(--line); }
.friend-letter-section .contact-row:last-child { border-bottom: 0; }
.community-dialog { width: min(36rem, calc(100% - 2rem)); overscroll-behavior: contain; }
.community-dialog .dialog-heading { position: sticky; top: -1.3rem; z-index: 1; padding-top: .25rem; background: var(--paper); }
.community-dialog.requests-dialog {
  inset-block: calc(var(--workspace-top) + max(.75rem, var(--safe-top))) calc(var(--viewport-bottom-gap, 0px) + max(.75rem, var(--safe-bottom)));
  max-height: calc(var(--workspace-height) - max(.75rem, var(--safe-top)) - max(.75rem, var(--safe-bottom)));
  padding-block: 0 .75rem;
}
.requests-dialog .dialog-heading { top: 0; padding-block: .6rem .4rem; border-bottom: 1px solid var(--line); }
.requests-dialog .tool-dialog-content { gap: 1rem; margin-top: .75rem; }
.request-section { container-type: inline-size; min-width: 0; }
.request-heading { margin: 0; font-size: .87rem; color: var(--muted); }
.request-list { margin: 0; padding: 0; list-style: none; }
.request-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .65rem; padding-block: .7rem; }
.request-row + .request-row { border-top: 1px solid var(--line); }
.request-row .account-copy { flex: 1; }
.request-row .account-copy strong { white-space: normal; overflow-wrap: anywhere; }
.request-date { color: var(--muted); font-size: .75rem; }
.request-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .45rem; min-width: 0; padding: 0; margin: 0; border: 0; }
.request-actions .button { padding: .45rem .75rem; white-space: nowrap; font-size: .88rem; }
.request-status { color: var(--muted); background: var(--canvas); border-radius: .45rem; padding: .28rem .5rem; font-size: .76rem; white-space: nowrap; }
@container (max-width: 21rem) {
  .request-actions { grid-column: 1 / -1; }
}
.community-form, .community-results, .community-feed { display: grid; gap: .6rem; min-width: 0; }
.community-actions { display: flex; flex-wrap: wrap; gap: .38rem; }
.community-actions .button { min-height: 2.45rem; font-size: .86rem; }
.community-person { display: flex; align-items: center; gap: .62rem; min-width: 0; }
.community-person .account-copy { min-width: 0; }
.community-person .account-copy strong { font-size: .98rem; }
.community-person .account-copy span { font-size: .87rem; }
.community-member-list { display: grid; gap: .28rem; }
.join-code { color: var(--accent); font-size: 2rem; font-variant-numeric: tabular-nums; font-weight: 750; letter-spacing: .2em; }
.community-qr { display: block; width: min(12rem, 100%); aspect-ratio: 1; background: #fff; border: 1px solid var(--line); border-radius: .75rem; }
.scan-panel { display: flex; flex-wrap: wrap; gap: .5rem; }
.scan-panel video { display: block; width: 100%; max-height: 40dvh; background: var(--ink); border-radius: .65rem; }
.share-value { padding: .6rem; min-height: 2.6rem; color: var(--accent); border: 1px solid var(--line); border-radius: .65rem; width: 100%; }
.moment { display: grid; gap: .45rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.moment-copy, .moment-comment { white-space: pre-wrap; overflow-wrap: anywhere; }
.moment-image { max-width: 100%; max-height: 18rem; object-fit: contain; border: 1px solid var(--line); border-radius: .65rem; justify-self: start; }
.moment-comment { display: flex; align-items: baseline; gap: .36rem; padding: .38rem .5rem; border-radius: .45rem; background: var(--canvas); font-size: .87rem; }
.moment-comment strong { flex: none; max-width: 34%; color: var(--accent); }
.tool-field select { width: 100%; min-height: 2.8rem; padding: .55rem; border: 1px solid var(--line); border-radius: .7rem; color: var(--ink); background: var(--canvas); font: inherit; font-size: 1.05rem; }
.message-sender { color: var(--muted); font-size: .74rem; }
.large-chat-text .bubble { font-size: 1.18rem; }
.active-conversation[data-group='true'] .tray-action[data-tool='phone'],
.active-conversation[data-group='true'] .tray-action[data-tool='lock'] { display: none; }
.admin-feedback { margin-block: 1.55rem; display: grid; gap: .6rem; }
.admin-feedback .tool-record { padding-inline: .75rem; }
.tool-summary, .revealed-message { background: var(--canvas); padding: .65rem .8rem; border-radius: .72rem; }
.tool-record { display: grid; gap: .3rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.tool-record p { color: var(--muted); font-size: .9rem; }
.tool-record .button { min-height: 2.25rem; padding: .3rem .55rem; width: max-content; max-width: 100%; font-size: .84rem; }
.tool-field { display: grid; gap: .3rem; font-size: .9rem; font-weight: 620; }
.tool-field textarea, .tool-field input { width: 100%; min-width: 0; padding: .55rem .6rem; border: 1px solid var(--line); border-radius: .64rem; background: var(--canvas); font-size: 1rem; }
.tool-field textarea { resize: vertical; }
.tool-options { display: flex; flex-wrap: wrap; gap: .45rem; }
.emoji-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(2.65rem, 1fr)); gap: .35rem; }
.emoji-picker .button { min-width: 0; padding: 0; font-size: 1.26rem; }
.record-timer { font-size: 1.8rem; color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 690; }
.message-meta { display: flex; align-items: center; gap: .4rem; }
.message-content { grid-template-columns: minmax(0, 1fr); }
.read-receipt { color: var(--accent); font-size: .72rem; }
.marked-icon { width: .8rem; height: .8rem; color: var(--accent); }
.message-options { color: var(--muted); width: 2.5rem; min-height: 2.5rem; order: 1; align-self: start; }
.own .message-options { order: -1; }
.message-options svg { width: .97rem; }
.message-system { align-self: center; color: var(--muted); background: var(--soft); padding: .36rem .65rem; border-radius: 1rem; font-size: .79rem; max-width: 100%; overflow-wrap: anywhere; }
.rich-message { display: flex; align-items: center; gap: .55rem; border: 1px solid var(--line); border-radius: .8rem; text-align: start; background: var(--paper); max-width: 100%; padding: .65rem .75rem; color: var(--ink); text-decoration: none; }
.rich-message:is(a,button):hover { background: var(--soft); }
.rich-message svg { color: var(--accent); }
.rich-message span { display: grid; gap: .16rem; min-width: 0; overflow-wrap: anywhere; }
.rich-message small { color: var(--muted); }
.photo-message { display: block; width: fit-content; max-width: 100%; border-radius: .85rem; border: 1px solid var(--line); overflow: hidden; }
.photo-message img { display: block; width: auto; max-width: 100%; max-height: 18rem; object-fit: contain; }
.audio-message { min-width: 0; width: 15rem; max-width: 100%; }
.audio-message audio { display: block; width: 100%; height: 2.6rem; }

@media (hover: hover) and (pointer: fine) {
  .message-options { opacity: .42; }
  .message-row:is(:hover,:focus-within) .message-options { opacity: 1; }
}

@media (max-width: 899px) {
  .workspace { --header-height: 4.25rem; }
  .sidebar-top, .inbox-heading, .account { padding-inline: .85rem; }
  .inbox .search { margin-inline: .85rem; }
  .conversation-header { gap: .55rem; padding: 0 .85rem; }
  .call-panel { top: calc(4.75rem + var(--safe-top)); }
  .tool-tray { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 599px) {
  .workspace { display: block; }
  .sidebar, .conversation { height: 100%; }
  .sidebar { border-right: 0; }
  .workspace:not(.has-peer) .conversation, .workspace.has-peer .sidebar { display: none; }
  .back-button { display: inline-flex; }
  .conversation-header { gap: .45rem; padding: 0 .65rem; }
  .call-action { width: 2.75rem; padding: .2rem; }
  .call-action span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .auth-panel { max-width: 26rem; }
  .composer-wrap { padding-inline: .68rem; }
  .composer-actions { width: 100%; }
  .message-row { gap: .28rem; }
  .message-content { max-width: calc(100% - 5rem); }
  .own .message-content { max-width: calc(100% - 3rem); }
  .chat-nav button { font-size: .75rem; }
}

@media (horizontal-viewport-segments: 2) {
  :root {
    --chat-start: env(viewport-segment-left 1 0);
    --chat-width: env(viewport-segment-width 1 0);
    --chat-center: calc(var(--chat-start) + var(--chat-width) / 2);
  }

  .workspace {
    --header-height: 4.25rem;
    display: grid;
    grid-template-columns: max(0px, calc(env(viewport-segment-width 0 0) - var(--safe-left)))
      max(0px, calc(var(--chat-start) - env(viewport-segment-right 0 0))) minmax(0, 1fr);
  }
  .sidebar, .workspace.has-peer .sidebar { display: grid; grid-column: 1; }
  .conversation, .workspace:not(.has-peer) .conversation { display: block; grid-column: 3; }
  .back-button { display: none; }
  .auth-page { margin-left: var(--chat-start); }
  .dialog { left: var(--chat-start); width: min(27rem, calc(var(--chat-width) - 1.5rem)); }
  .call-panel, .toast { left: var(--chat-center); max-width: calc(var(--chat-width) - 1rem); }
  .call-panel { top: calc(4.75rem + var(--safe-top)); }
  .tool-tray { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (vertical-viewport-segments: 2) {
  :root { --lower-segment: env(viewport-segment-top 0 1); }
  .workspace {
    --header-height: 4.25rem;
    --upper-height: max(var(--header-height), calc(env(viewport-segment-bottom 0 0) - var(--safe-top)));
  }
  .sidebar, .conversation-empty { height: var(--upper-height); min-height: 0; }
  .auth-page { height: env(viewport-segment-height 0 0); min-height: 0; overflow: auto; }
  .active-conversation {
    grid-template-rows: var(--header-height) minmax(0, calc(var(--upper-height) - var(--header-height))) auto auto minmax(0, 1fr);
  }
  .composer-wrap {
    grid-row: 4;
    margin-top: max(0px, calc(var(--lower-segment) - env(viewport-segment-bottom 0 0)));
  }
  .call-panel, .dialog { top: calc(var(--header-height, 4.25rem) + var(--safe-top) + .5rem); }
  .dialog { max-height: calc(env(viewport-segment-height 0 0) - 5.5rem); }
}

@media (max-width: 430px) {
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .call-panel { flex-wrap: wrap; justify-content: start; }
  .call-panel .avatar { display: none; }
}

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