header.bar { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--line); min-height: 52px; }
header.bar h2 { font-size: 1.0625rem; font-weight: 600; }
header.bar h2.big { font-size: 1.75rem; font-weight: 700; padding: 6px 4px; }
header.bar .titles { display: grid; min-width: 0; }
header.bar .subtitle { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.back { font-size: 1.875rem; color: var(--accent); width: 40px; line-height: 1; }
.chat-list { display: grid; }
.chat-row .row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 14px; min-height: 64px; }
.chat-row .name { font-weight: 600; }
.icon-button { font-size: 1.375rem; color: var(--muted); width: 40px; }
.spacer { flex: 1; }
.chat-row .row { position: relative; }
.chat-row .avatar { position: relative; flex: 0 0 48px; width: 48px; height: 48px; font-size: 0.9375rem; }
.chat-row .avatar.off { filter: saturate(.5) brightness(.8); }
.online-dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg); }
.chat-row .text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.chat-row .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-row .when { font-size: 0.75rem; color: var(--subtle); flex: 0 0 auto; }
.chat-row .preview { font-size: 0.875rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row .subtitle { font-size: 0.75rem; color: var(--subtle); }
.chat-row .unread { flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: #0b0d12; font-size: 0.75rem; font-weight: 700; display: grid; place-items: center; }
/* Thread */
.messages { display: flex; flex-direction: column; gap: 2px; padding: 10px 10px 14px; }
.separator { align-self: center; font-size: 0.75rem; color: var(--subtle); margin: 10px 0 6px; }
.system { align-self: center; font-size: 0.75rem; color: var(--muted); text-align: center; padding: 4px 12px; margin: 6px 0; }
.msg { display: grid; grid-template-columns: 28px 1fr; column-gap: 6px; align-items: end; max-width: 86%; }
.msg.own { grid-template-columns: 1fr; align-self: flex-end; justify-items: end; }
.msg .who { grid-column: 2; font-size: 0.75rem; font-weight: 600; color: var(--muted); margin: 8px 0 2px 10px; }
.msg .avatar.small { grid-column: 1; grid-row: 2; width: 28px; height: 28px; font-size: 0.6875rem; }
.msg .bubble { grid-column: 2; position: relative; background: var(--surface-2); border-radius: var(--radius-bubble); padding: 8px 12px 8px; font-size: 1rem; line-height: 1.35; word-break: break-word; white-space: pre-line; border-bottom-left-radius: 6px; }
.msg.tail .bubble { border-bottom-left-radius: var(--radius-bubble); }
.msg.own .bubble { grid-column: 1; background: var(--mine); color: var(--mine-text); border-bottom-left-radius: var(--radius-bubble); border-bottom-right-radius: 6px; }
.msg.own.tail .bubble { border-bottom-right-radius: var(--radius-bubble); }
.msg:not(.own) .bubble[style*="--tone"] { background: color-mix(in srgb, var(--tone) 22%, var(--surface-2)); }
.msg .bubble time { display: block; font-size: 0.625rem; color: var(--subtle); text-align: right; margin-top: 2px; opacity: 0; height: 0; overflow: hidden; }
.msg.tail .bubble time, .msg .bubble:hover time { opacity: 1; height: auto; }
.msg.deleted .bubble { font-style: italic; color: var(--subtle); }
.msg .status { grid-column: 1 / -1; font-size: 0.6875rem; color: var(--subtle); margin: 2px 4px 6px; }
.msg .reaction { grid-column: 2; justify-self: start; font-size: 0.8125rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1px 6px; margin: -8px 0 4px 8px; }
.msg.own .reaction { grid-column: 1; justify-self: end; margin-right: 8px; }
.typing { display: grid; grid-template-columns: 28px auto; column-gap: 6px; align-items: end; margin-top: 4px; }
.typing .avatar.small { width: 28px; height: 28px; font-size: 0.6875rem; }
.dots { display: flex; gap: 4px; padding: 12px 14px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
html[data-motion="reduce"] .dots i { animation: none; opacity: .8; }
.pill { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(118px + var(--safe-bottom)); background: var(--accent); color: #0b0d12; border-radius: 999px; padding: 8px 14px; font-size: 0.8125rem; font-weight: 600; z-index: 4; }
.quoted, .forwarded { border-left: 3px solid var(--accent); background: #ffffff10; border-radius: 8px; padding: 6px 8px; margin: 0 0 6px; display: grid; gap: 1px; font-size: 0.875rem; }
.q-who, .f-label { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.q-text, .f-text { color: var(--text); white-space: pre-line; }
.attachment { display: grid; gap: 4px; margin-bottom: 6px; }
.attachment img { max-width: 100%; border-radius: 10px; display: block; }
.a-title { font-size: 0.8125rem; font-weight: 600; } .a-sub { font-size: 0.75rem; color: var(--muted); }
/* Composer */
.composer-slot { flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--surface); padding: 8px 10px calc(8px + 52px + var(--safe-bottom)); }
.composer .row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 10px 14px; max-height: 120px; line-height: 1.3; }
.composer .send { width: 40px; height: 40px; min-width: 40px; min-height: 40px; border-radius: 50%; background: var(--accent); color: #0b0d12; font-size: 1.25rem; font-weight: 700; }
.notice-line { font-size: 0.8125rem; color: var(--warn); padding: 6px 4px 0; }
.quote-strip { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.8125rem; color: var(--muted); padding: 2px 6px 8px; }
.quote-strip .x { font-size: 1.25rem; color: var(--muted); }
.ended { color: var(--muted); font-size: 0.875rem; padding: 10px 4px; }
.ended a { color: var(--accent); }
.picker-title { color: var(--muted); font-size: 0.8125rem; padding: 6px 14px 4px; }
#sheet .cancel, #picker .cancel { color: var(--muted); margin-top: 4px; }
li.flash .bubble { outline: 2px solid var(--accent); }
.msg .bubble { -webkit-touch-callout: none; user-select: none; }
.attachment { text-align: left; width: 100%; min-height: 44px; }
.attachment.inline { cursor: default; }
.attachment .a-sub { color: var(--muted); }
